leocad/win/clrpopup.h

90 lines
2.1 KiB
C
Raw Normal View History

#ifndef _CLRPOPUP_H_
#define _CLRPOPUP_H_
2011-09-07 23:06:51 +02:00
// CColorPopup messages
#define CPN_SELENDOK WM_USER + 1001 // Color Picker end OK
#define CPN_SELENDCANCEL WM_USER + 1002 // Color Picker end (cancelled)
// forward declaration
class CColorPicker;
/////////////////////////////////////////////////////////////////////////////
// CColorPopup window
struct CColorPopupCell
{
CRect Rect;
COLORREF Color;
int ColorIndex;
};
2011-09-07 23:06:51 +02:00
class CColorPopup : public CWnd
{
// Construction
public:
CColorPopup();
CColorPopup(CPoint p, int nColor, CWnd* pParentWnd);
void Initialise();
2011-09-07 23:06:51 +02:00
// Attributes
public:
// Operations
public:
BOOL Create(CPoint p, int nColor, CWnd* pParentWnd);
2011-09-07 23:06:51 +02:00
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CColorPopup)
public:
virtual BOOL PreTranslateMessage(MSG* pMsg);
//}}AFX_VIRTUAL
2011-09-07 23:06:51 +02:00
// Implementation
public:
virtual ~CColorPopup();
2011-09-07 23:06:51 +02:00
protected:
void SetWindowSize();
void CalculateLayout();
void CreateToolTips();
void ChangeSelection(int nIndex);
void EndSelection(int nMessage);
void DrawCell(CDC* pDC, int nIndex);
2011-09-07 23:06:51 +02:00
// protected attributes
protected:
int m_nNumColumns, m_nNumRows;
int m_nBoxSize, m_nMargin;
int m_nCurrentSel;
int m_nChosenColorSel;
BOOL m_bDefaultText;
BOOL m_bCustomText;
CRect m_CustomTextRect, m_DefaultTextRect, m_WindowRect;
CFont m_Font;
CPalette m_Palette;
int m_nInitialColor, m_nColor;
CToolTipCtrl m_ToolTip;
CWnd* m_pParent;
CArray<CRect, const CRect&> mGroups;
CArray<CColorPopupCell, const CColorPopupCell&> mCells;
// Generated message map functions
2011-09-07 23:06:51 +02:00
protected:
//{{AFX_MSG(CColorPopup)
afx_msg void OnNcDestroy();
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
afx_msg void OnPaint();
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
afx_msg BOOL OnQueryNewPalette();
afx_msg void OnPaletteChanged(CWnd* pFocusWnd);
2011-09-07 23:06:51 +02:00
afx_msg void OnKillFocus(CWnd* pNewWnd);
afx_msg void OnActivateApp(BOOL bActive, DWORD hTask);
2011-09-07 23:06:51 +02:00
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
2011-09-07 23:06:51 +02:00
};
#endif // _CLRPOPUP_H_