~clint-fewbar/ubuntu/precise/squid3/ignore-sighup-early

« back to all changes in this revision

Viewing changes to lib/cppunit-1.10.0/src/msvc6/testrunner/DynamicWindow/cdxCSizeIconCtrl.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Luigi Gangitano
  • Date: 2006-11-11 10:32:06 UTC
  • Revision ID: james.westby@ubuntu.com-20061111103206-f3p0r9g0vq44rp3r
Tags: upstream-3.0.PRE5
ImportĀ upstreamĀ versionĀ 3.0.PRE5

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// cdxCSizeIconCtrl.cpp : implementation file
 
2
//
 
3
 
 
4
#include "stdafx.h"
 
5
#include "cdxCSizeIconCtrl.h"
 
6
 
 
7
#include        <winuser.h>
 
8
 
 
9
#ifndef OBM_SIZE
 
10
#define OBM_SIZE                32766
 
11
#pragma message("*** NOTE[cdxCSizeIconCtrl.cpp]: Please define OEMRESOURCE in your project settings !")
 
12
// taken from WinresRc.h
 
13
// if not used for any reason
 
14
#endif
 
15
 
 
16
#ifdef _DEBUG
 
17
#define new DEBUG_NEW
 
18
#undef THIS_FILE
 
19
static char THIS_FILE[] = __FILE__;
 
20
#endif
 
21
 
 
22
#pragma warning(disable: 4100)
 
23
 
 
24
/////////////////////////////////////////////////////////////////////////////
 
25
// cdxCSizeIconCtrl::AutoOEMImageList
 
26
/////////////////////////////////////////////////////////////////////////////
 
27
 
 
28
/////////////////////////////////////////////////////////////////////////////
 
29
// construction
 
30
/////////////////////////////////////////////////////////////////////////////
 
31
 
 
32
/*
 
33
 * one-step construction for my image list
 
34
 * (allows to use the AutoOEMImageList as static member)
 
35
 */
 
36
 
 
37
cdxCSizeIconCtrl::AutoOEMImageList::AutoOEMImageList(UINT nBitmapID, COLORREF crMask)
 
38
{
 
39
        CBitmap cbmp;
 
40
        BITMAP  bmp;
 
41
        VERIFY( cbmp.LoadOEMBitmap(nBitmapID) );
 
42
        VERIFY( cbmp.GetBitmap(&bmp) );
 
43
 
 
44
        m_szImage.cx    =       bmp.bmWidth;
 
45
        m_szImage.cy    =       bmp.bmHeight;
 
46
  
 
47
        InitCommonControls();
 
48
 
 
49
        VERIFY( Create(bmp.bmWidth,bmp.bmHeight,ILC_COLOR16|ILC_MASK,0,1) );
 
50
        int     i       =       Add(&cbmp,crMask);
 
51
        ASSERT(i == 0);
 
52
}
 
53
 
 
54
/////////////////////////////////////////////////////////////////////////////
 
55
// cdxCSizeIconCtrl
 
56
/////////////////////////////////////////////////////////////////////////////
 
57
 
 
58
IMPLEMENT_DYNAMIC(cdxCSizeIconCtrl,CScrollBar);
 
59
 
 
60
/////////////////////////////////////////////////////////////////////////////
 
61
 
 
62
cdxCSizeIconCtrl::AutoOEMImageList      cdxCSizeIconCtrl::M_ilImage(OBM_SIZE,::GetSysColor(COLOR_BTNFACE));
 
63
HCURSOR                                                                         cdxCSizeIconCtrl::M_hcSize      =       ::LoadCursor(NULL,IDC_SIZENWSE);
 
64
 
 
65
/////////////////////////////////////////////////////////////////////////////
 
66
// construction
 
67
/////////////////////////////////////////////////////////////////////////////
 
68
 
 
69
BEGIN_MESSAGE_MAP(cdxCSizeIconCtrl, CScrollBar)
 
70
        //{{AFX_MSG_MAP(cdxCSizeIconCtrl)
 
71
        ON_WM_PAINT()
 
72
        ON_WM_SETCURSOR()
 
73
        ON_WM_LBUTTONDBLCLK()
 
74
        //}}AFX_MSG_MAP
 
75
END_MESSAGE_MAP()
 
76
 
 
77
/////////////////////////////////////////////////////////////////////////////
 
78
// cdxCSizeIconCtrl inlines
 
79
/////////////////////////////////////////////////////////////////////////////
 
80
 
 
81
/*
 
82
 * create short-cut
 
83
 */
 
84
 
 
85
BOOL cdxCSizeIconCtrl::Create(CWnd *pParent, UINT id)
 
86
{
 
87
        ASSERT(pParent != NULL);
 
88
        CRect   rect;pParent->GetClientRect(&rect);
 
89
        if(!CScrollBar::Create(         SBS_SIZEBOX|SBS_SIZEBOXBOTTOMRIGHTALIGN|
 
90
                                                                                WS_CHILD,
 
91
                                                                                rect,
 
92
                                                                                pParent,id))
 
93
                return FALSE;
 
94
 
 
95
        VERIFY( ModifyStyleEx(0,WS_EX_TRANSPARENT) );
 
96
        return TRUE;
 
97
}
 
98
 
 
99
/////////////////////////////////////////////////////////////////////////////
 
100
// cdxCSizeIconCtrl message handlers
 
101
/////////////////////////////////////////////////////////////////////////////
 
102
 
 
103
/*
 
104
 * draw icon
 
105
 */
 
106
 
 
107
void cdxCSizeIconCtrl::OnPaint() 
 
108
{
 
109
        CPaintDC dc(this); // device context for painting
 
110
 
 
111
        if(GetParent() && (!GetParent()->IsZoomed() || !m_bReflectParentState))
 
112
        {
 
113
                CRect   rect;GetClientRect(&rect);
 
114
                CSize   sz      =       M_ilImage.Size();
 
115
 
 
116
                VERIFY( M_ilImage.Draw( &dc,
 
117
                                                                0,
 
118
                                                                CPoint(rect.right - sz.cx,rect.bottom - sz.cy),
 
119
                                                                ILD_NORMAL|ILD_TRANSPARENT) );
 
120
        }
 
121
}
 
122
 
 
123
/////////////////////////////////////////////////////////////////////////////
 
124
// cdxCSizeIconCtrl Cursor
 
125
/////////////////////////////////////////////////////////////////////////////
 
126
 
 
127
/*
 
128
 * set the cursor.
 
129
 */
 
130
 
 
131
BOOL cdxCSizeIconCtrl::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message) 
 
132
{
 
133
        if(GetParent() && (!GetParent()->IsZoomed() || !m_bReflectParentState))
 
134
                ::SetCursor((nHitTest == HTCLIENT) ? M_hcSize : NULL);
 
135
        return TRUE;
 
136
}
 
137
 
 
138
/*
 
139
 * catch Doubleclick - if you don't do that,
 
140
 * the window will be maximized if you double-blick
 
141
 * the control.
 
142
 * Don't know why, but it's annoying.
 
143
 */
 
144
 
 
145
void cdxCSizeIconCtrl::OnLButtonDblClk(UINT nFlags, CPoint point) 
 
146
{
 
147
//      CScrollBar::OnLButtonDblClk(nFlags, point);
 
148
}