|
/*
$Id: WtlEditBrowserCtrl.h 2069 2006-08-16 01:00:57Z phil $
*/
#if !defined EDITBROWSERCTRL_H
#define EDITBROWSERCTRL_H
#include <AtlCrack.h>
#include <atlmisc.h>
#include <atlctrls.h>
#define BTN_UP 0x01
#define BTN_DOWN 0x02
#define BTN_DISABLED 0x04
#define BTN_FLAT 0x08
// Brush sizes for drawing the button background
#define BRUSHWIDTH 8
#define BRUSHHEIGHT 8
#define FEC_BUTTONLEFT 0x00000010
#define WM_EB_PRESS WM_USER + 4444
class CWtlEditBrowserCtrl : public CWindowImpl< CWtlEditBrowserCtrl, CEdit, CControlWinTraits>
{
private:
int m_nButtonState; // current button state (up, down, or disabled)
int m_nButtonWidth; // the width of the button (-1 is default)
CRect m_rcButtonRect; // window coordinates of the button
BOOL m_bMouseCaptured; // button has captured the mouse?
public:
CWtlEditBrowserCtrl();
typedef CWtlEditBrowserCtrl thisClass;
BEGIN_MSG_MAP(CWtlEditBrowserCtrl)
MESSAGE_HANDLER( WM_CREATE, OnCreate )
MESSAGE_HANDLER( WM_NCLBUTTONDOWN, OnNcLButtonDown )
MESSAGE_HANDLER( WM_LBUTTONUP, OnLButtonUp )
MESSAGE_HANDLER( WM_NCCALCSIZE, OnNcCalcSize )
MESSAGE_HANDLER( WM_NCHITTEST, OnNcHitTest )
MESSAGE_HANDLER( WM_NCPAINT, OnNcPaint )
END_MSG_MAP()
virtual BOOL SubclassWindow( HWND hWnd );
virtual BOOL PreTranslateMessage(MSG* pMsg);
void ButtonClicked(); // handles a mouse click on the button
LRESULT OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnNcPaint(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnNcCalcSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnNcHitTest(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnLButtonUp(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnNcLButtonDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
private:
void DrawButton(int nButtonState);
void DrawDots(CDC& pDC, COLORREF CR, int nOffset = 0);
BOOL ScreenPointInButtonRect(CPoint point);
};
#endif
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.