1
// cdxCSizeIconCtrl.cpp : implementation file
5
#include "cdxCSizeIconCtrl.h"
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
19
static char THIS_FILE[] = __FILE__;
22
#pragma warning(disable: 4100)
24
/////////////////////////////////////////////////////////////////////////////
25
// cdxCSizeIconCtrl::AutoOEMImageList
26
/////////////////////////////////////////////////////////////////////////////
28
/////////////////////////////////////////////////////////////////////////////
30
/////////////////////////////////////////////////////////////////////////////
33
* one-step construction for my image list
34
* (allows to use the AutoOEMImageList as static member)
37
cdxCSizeIconCtrl::AutoOEMImageList::AutoOEMImageList(UINT nBitmapID, COLORREF crMask)
41
VERIFY( cbmp.LoadOEMBitmap(nBitmapID) );
42
VERIFY( cbmp.GetBitmap(&bmp) );
44
m_szImage.cx = bmp.bmWidth;
45
m_szImage.cy = bmp.bmHeight;
49
VERIFY( Create(bmp.bmWidth,bmp.bmHeight,ILC_COLOR16|ILC_MASK,0,1) );
50
int i = Add(&cbmp,crMask);
54
/////////////////////////////////////////////////////////////////////////////
56
/////////////////////////////////////////////////////////////////////////////
58
IMPLEMENT_DYNAMIC(cdxCSizeIconCtrl,CScrollBar);
60
/////////////////////////////////////////////////////////////////////////////
62
cdxCSizeIconCtrl::AutoOEMImageList cdxCSizeIconCtrl::M_ilImage(OBM_SIZE,::GetSysColor(COLOR_BTNFACE));
63
HCURSOR cdxCSizeIconCtrl::M_hcSize = ::LoadCursor(NULL,IDC_SIZENWSE);
65
/////////////////////////////////////////////////////////////////////////////
67
/////////////////////////////////////////////////////////////////////////////
69
BEGIN_MESSAGE_MAP(cdxCSizeIconCtrl, CScrollBar)
70
//{{AFX_MSG_MAP(cdxCSizeIconCtrl)
77
/////////////////////////////////////////////////////////////////////////////
78
// cdxCSizeIconCtrl inlines
79
/////////////////////////////////////////////////////////////////////////////
85
BOOL cdxCSizeIconCtrl::Create(CWnd *pParent, UINT id)
87
ASSERT(pParent != NULL);
88
CRect rect;pParent->GetClientRect(&rect);
89
if(!CScrollBar::Create( SBS_SIZEBOX|SBS_SIZEBOXBOTTOMRIGHTALIGN|
95
VERIFY( ModifyStyleEx(0,WS_EX_TRANSPARENT) );
99
/////////////////////////////////////////////////////////////////////////////
100
// cdxCSizeIconCtrl message handlers
101
/////////////////////////////////////////////////////////////////////////////
107
void cdxCSizeIconCtrl::OnPaint()
109
CPaintDC dc(this); // device context for painting
111
if(GetParent() && (!GetParent()->IsZoomed() || !m_bReflectParentState))
113
CRect rect;GetClientRect(&rect);
114
CSize sz = M_ilImage.Size();
116
VERIFY( M_ilImage.Draw( &dc,
118
CPoint(rect.right - sz.cx,rect.bottom - sz.cy),
119
ILD_NORMAL|ILD_TRANSPARENT) );
123
/////////////////////////////////////////////////////////////////////////////
124
// cdxCSizeIconCtrl Cursor
125
/////////////////////////////////////////////////////////////////////////////
131
BOOL cdxCSizeIconCtrl::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
133
if(GetParent() && (!GetParent()->IsZoomed() || !m_bReflectParentState))
134
::SetCursor((nHitTest == HTCLIENT) ? M_hcSize : NULL);
139
* catch Doubleclick - if you don't do that,
140
* the window will be maximized if you double-blick
142
* Don't know why, but it's annoying.
145
void cdxCSizeIconCtrl::OnLButtonDblClk(UINT nFlags, CPoint point)
147
// CScrollBar::OnLButtonDblClk(nFlags, point);