20 #include "../../../idlib/precompiled.h"
24 #include "../../../sys/win32/rc/proptree_Resource.h"
30 static char THIS_FILE[] = __FILE__;
43 {RGB(0x00, 0x00, 0x00)},
44 {RGB(0xA5, 0x2A, 0x00)},
45 {RGB(0x00, 0x40, 0x40)},
46 {RGB(0x00, 0x55, 0x00)},
47 {RGB(0x00, 0x00, 0x5E)},
48 {RGB(0x00, 0x00, 0x8B)},
49 {RGB(0x4B, 0x00, 0x82)},
50 {RGB(0x28, 0x28, 0x28)},
52 {RGB(0x8B, 0x00, 0x00)},
53 {RGB(0xFF, 0x68, 0x20)},
54 {RGB(0x8B, 0x8B, 0x00)},
55 {RGB(0x00, 0x93, 0x00)},
56 {RGB(0x38, 0x8E, 0x8E)},
57 {RGB(0x00, 0x00, 0xFF)},
58 {RGB(0x7B, 0x7B, 0xC0)},
59 {RGB(0x66, 0x66, 0x66)},
61 {RGB(0xFF, 0x00, 0x00)},
62 {RGB(0xFF, 0xAD, 0x5B)},
63 {RGB(0x32, 0xCD, 0x32)},
64 {RGB(0x3C, 0xB3, 0x71)},
65 {RGB(0x7F, 0xFF, 0xD4)},
66 {RGB(0x7D, 0x9E, 0xC0)},
67 {RGB(0x80, 0x00, 0x80)},
68 {RGB(0x7F, 0x7F, 0x7F)},
70 {RGB(0xFF, 0xC0, 0xCB)},
71 {RGB(0xFF, 0xD7, 0x00)},
72 {RGB(0xFF, 0xFF, 0x00)},
73 {RGB(0x00, 0xFF, 0x00)},
74 {RGB(0x40, 0xE0, 0xD0)},
75 {RGB(0xC0, 0xFF, 0xFF)},
76 {RGB(0x48, 0x00, 0x48)},
77 {RGB(0xC0, 0xC0, 0xC0)},
79 {RGB(0xFF, 0xE4, 0xE1)},
80 {RGB(0xD2, 0xB4, 0x8C)},
81 {RGB(0xFF, 0xFF, 0xE0)},
82 {RGB(0x98, 0xFB, 0x98)},
83 {RGB(0xAF, 0xEE, 0xEE)},
84 {RGB(0x68, 0x83, 0x8B)},
85 {RGB(0xE6, 0xE6, 0xFA)},
86 {RGB(0xFF, 0xFF, 0xFF)}
89 static void ColorBox(CDC* pDC, CPoint pt, COLORREF clr,
BOOL bHover)
93 CBrush* obr = pDC->SelectObject(&br);
95 pDC->PatBlt(pt.x, pt.y, 13, 13, PATCOPY);
96 pDC->SelectObject(obr);
99 rc.SetRect(pt.x - 2, pt.y - 2, pt.x + 15, pt.y + 15);
101 pDC->DrawEdge(&rc, (bHover) ? BDR_SUNKENOUTER : BDR_RAISEDINNER, BF_RECT);
106 static LONG FindSpot(CPoint point)
110 if (PtInRect(&_crColors[
i].rcSpot, point))
166 if (!
m_pProp->IsWindowEnabled())
167 pDC->SetTextColor(GetSysColor(COLOR_GRAYTEXT));
169 pDC->SetTextColor(RGB(0,0,0));
172 r.right = r.left + r.Height() - 1;
175 CBrush* pold = pDC->SelectObject(&br);
176 pDC->PatBlt(r.left, r.top, r.Width(), r.Height(), PATCOPY);
177 pDC->SelectObject(pold);
179 pDC->DrawEdge(&r, EDGE_SUNKEN, BF_RECT);
184 r.left += r.Height();
186 pDC->DrawText(s, r, DT_SINGLELINE|DT_VCENTER);
225 r.right = r.left + 150;
226 r.bottom = r.top + 120;
231 if (!IsWindow(m_hWnd))
233 LPCTSTR pszClassName;
235 pszClassName = AfxRegisterWndClass(CS_VREDRAW|CS_HREDRAW, LoadCursor(
NULL, IDC_ARROW), (HBRUSH)(COLOR_BTNFACE + 1));
237 DWORD dwStyle = WS_POPUP|WS_DLGFRAME;
243 SetWindowPos(
NULL, r.left, r.top, r.Width() + 1, r.Height(), SWP_NOZORDER|SWP_SHOWWINDOW);
250 CWnd::OnKillFocus(pNewWnd);
264 pt.x = (
i & 7) * 18 + 3;
265 pt.y = (
i >> 3) * 18 + 3;
267 SetRect(&_crColors[
i].rcSpot, pt.x, pt.y, pt.x + 13, pt.y + 13);
274 CString
s(_T(
"More Colors"));
276 dc.SetBkMode(TRANSPARENT);
277 dc.SetTextColor(GetSysColor(COLOR_BTNTEXT));
278 dc.DrawText(s, &
m_rcButton, DT_SINGLELINE|DT_VCENTER|DT_CENTER);
295 nSpot = FindSpot(point);
314 if (nHitTest==HTCLIENT)
318 GetCursorPos(&point);
319 ScreenToClient(&point);
321 if (FindSpot(point)!=-1 ||
m_rcButton.PtInRect(point))
329 return CWnd::OnSetCursor(pWnd, nHitTest, message);
346 ZeroMemory(&cc,
sizeof(CHOOSECOLOR));
347 cc.Flags = CC_FULLOPEN|CC_ANYCOLOR|CC_RGBINIT;
348 cc.lStructSize =
sizeof(CHOOSECOLOR);
349 cc.hwndOwner = m_hWnd;
353 memset(clr, 0xff,
sizeof(COLORREF) * 16);
363 if (ChooseColor(&cc))
static CFont * GetNormalFont()
static COLORREF * s_pColors
CONST PIXELFORMATDESCRIPTOR UINT
struct _ColorTableEntry ColorTableEntry
afx_msg void OnLButtonDown(UINT nFlags, CPoint point)
afx_msg BOOL OnSetCursor(CWnd *pWnd, UINT nHitTest, UINT message)
static CFont * GetBoldFont()
virtual LPARAM GetItemValue()
virtual void OnActivate(int activateType, CPoint point)
GLdouble GLdouble GLdouble r
afx_msg void OnKillFocus(CWnd *pNewWnd)
virtual void SetItemValue(LPARAM lParam)
virtual ~CPropTreeItemColor()
void DisableInput(BOOL bDisable=TRUE)
virtual void DrawAttribute(CDC *pDC, const RECT &rc)
afx_msg void OnMouseMove(UINT nFlags, CPoint point)