ReactOS  0.4.15-dev-4857-g47842d7
CPaletteWindow Class Reference

#include <palette.h>

Inheritance diagram for CPaletteWindow:
Collaboration diagram for CPaletteWindow:

Public Member Functions

LRESULT OnPaint (UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnLButtonDown (UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnRButtonDown (UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnLButtonDblClk (UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnRButtonDblClk (UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnPaletteModelColorChanged (UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnPaletteModelPaletteChanged (UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 

Detailed Description

Definition at line 11 of file palette.h.

Member Function Documentation

◆ OnLButtonDblClk()

LRESULT CPaletteWindow::OnLButtonDblClk ( UINT  nMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)

Definition at line 75 of file palette.cpp.

76 {
77  if (GET_X_LPARAM(lParam) >= 31)
79  {
80  paletteModel.SetColor((GET_X_LPARAM(lParam) - 31) / 16 + (GET_Y_LPARAM(lParam) / 16) * 14,
83  }
84  return 0;
85 }
void SetFgColor(COLORREF newColor)
#define ChooseColor
Definition: commdlg.h:661
#define GET_X_LPARAM(lp)
Definition: windowsx.h:274
COLORREF rgbResult
Definition: commdlg.h:242
void SetColor(UINT nIndex, COLORREF newColor)
PaletteModel paletteModel
Definition: main.cpp:28
#define GET_Y_LPARAM(lp)
Definition: windowsx.h:275
CHOOSECOLOR choosecolor
Definition: main.cpp:36
LPARAM lParam
Definition: combotst.c:139

◆ OnLButtonDown()

LRESULT CPaletteWindow::OnLButtonDown ( UINT  nMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)

Definition at line 61 of file palette.cpp.

62 {
63  if (GET_X_LPARAM(lParam) >= 31)
65  return 0;
66 }
void SetFgColor(COLORREF newColor)
#define GET_X_LPARAM(lp)
Definition: windowsx.h:274
COLORREF GetColor(UINT nIndex) const
PaletteModel paletteModel
Definition: main.cpp:28
#define GET_Y_LPARAM(lp)
Definition: windowsx.h:275
LPARAM lParam
Definition: combotst.c:139

◆ OnPaint()

LRESULT CPaletteWindow::OnPaint ( UINT  nMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)

Definition at line 15 of file palette.cpp.

16 {
17  RECT rc = { 0, 0, 31, 32 };
18  HPEN oldPen;
19  HBRUSH oldBrush;
20  int i, a, b;
21 
22  PAINTSTRUCT ps;
23  HDC hDC = BeginPaint(&ps);
24 
25  for(b = 2; b < 30; b++)
26  for(a = 2; a < 29; a++)
27  if ((a + b) % 2 == 1)
29 
32  SetRect(&rc, 11, 12, 26, 27);
34  oldPen = (HPEN) SelectObject(hDC, CreatePen(PS_NULL, 0, 0));
35  oldBrush = (HBRUSH) SelectObject(hDC, CreateSolidBrush(paletteModel.GetBgColor()));
36  Rectangle(hDC, rc.left, rc.top + 2, rc.right - 1, rc.bottom - 1);
37  DeleteObject(SelectObject(hDC, oldBrush));
38  SetRect(&rc, 4, 5, 19, 20);
40  oldBrush = (HBRUSH) SelectObject(hDC, CreateSolidBrush(paletteModel.GetFgColor()));
41  Rectangle(hDC, rc.left + 2, rc.top + 2, rc.right - 1, rc.bottom - 1);
42  DeleteObject(SelectObject(hDC, oldBrush));
43  DeleteObject(SelectObject(hDC, oldPen));
44 
45  for(i = 0; i < 28; i++)
46  {
47  SetRect(&rc, 31 + (i % 14) * 16,
48  0 + (i / 14) * 16, 16 + 31 + (i % 14) * 16, 16 + 0 + (i / 14) * 16);
51  oldPen = (HPEN) SelectObject(hDC, CreatePen(PS_NULL, 0, 0));
52  oldBrush = (HBRUSH) SelectObject(hDC, CreateSolidBrush(paletteModel.GetColor(i)));
53  Rectangle(hDC, rc.left + 2, rc.top + 2, rc.right - 1, rc.bottom - 1);
54  DeleteObject(SelectObject(hDC, oldBrush));
55  DeleteObject(SelectObject(hDC, oldPen));
56  }
57  EndPaint(&ps);
58  return 0;
59 }
#define COLOR_BTNHILIGHT
Definition: winuser.h:932
#define BF_MIDDLE
Definition: winuser.h:468
FORCEINLINE VOID SetPixel(_In_ ULONG Left, _In_ ULONG Top, _In_ UCHAR Color)
Definition: arm.h:50
HPEN WINAPI CreatePen(_In_ int, _In_ int, _In_ COLORREF)
BOOL WINAPI Rectangle(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
static HDC
Definition: imagelist.c:92
LONG top
Definition: windef.h:307
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1539
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
LONG left
Definition: windef.h:306
BOOL WINAPI EndPaint(_In_ HWND, _In_ const PAINTSTRUCT *)
LONG right
Definition: windef.h:308
DWORD WINAPI GetSysColor(_In_ int)
COLORREF GetBgColor() const
COLORREF GetFgColor() const
#define BF_TOPLEFT
Definition: winuser.h:458
#define BF_RECT
Definition: winuser.h:462
#define a
Definition: ke_i.h:78
HDC WINAPI BeginPaint(_In_ HWND, _Out_ LPPAINTSTRUCT)
BOOL WINAPI DrawEdge(_In_ HDC, _Inout_ LPRECT, _In_ UINT, _In_ UINT)
#define BF_BOTTOMRIGHT
Definition: winuser.h:461
COLORREF GetColor(UINT nIndex) const
#define b
Definition: ke_i.h:79
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
#define BDR_SUNKENOUTER
Definition: winuser.h:443
#define EDGE_RAISED
Definition: winuser.h:450
static HDC hDC
Definition: 3dtext.c:33
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
PaletteModel paletteModel
Definition: main.cpp:28
HBRUSH WINAPI CreateSolidBrush(_In_ COLORREF)
#define PS_NULL
Definition: wingdi.h:591
LONG bottom
Definition: windef.h:309
#define BDR_RAISEDINNER
Definition: winuser.h:444
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204

◆ OnPaletteModelColorChanged()

LRESULT CPaletteWindow::OnPaletteModelColorChanged ( UINT  nMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)

Definition at line 99 of file palette.cpp.

100 {
102  return 0;
103 }
#define FALSE
Definition: types.h:117
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
#define NULL
Definition: types.h:112

◆ OnPaletteModelPaletteChanged()

LRESULT CPaletteWindow::OnPaletteModelPaletteChanged ( UINT  nMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)

Definition at line 105 of file palette.cpp.

106 {
108  return 0;
109 }
#define FALSE
Definition: types.h:117
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
#define NULL
Definition: types.h:112

◆ OnRButtonDblClk()

LRESULT CPaletteWindow::OnRButtonDblClk ( UINT  nMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)

Definition at line 87 of file palette.cpp.

88 {
89  if (GET_X_LPARAM(lParam) >= 31)
91  {
92  paletteModel.SetColor((GET_X_LPARAM(lParam) - 31) / 16 + (GET_Y_LPARAM(lParam) / 16) * 14,
95  }
96  return 0;
97 }
#define ChooseColor
Definition: commdlg.h:661
#define GET_X_LPARAM(lp)
Definition: windowsx.h:274
COLORREF rgbResult
Definition: commdlg.h:242
void SetBgColor(COLORREF newColor)
void SetColor(UINT nIndex, COLORREF newColor)
PaletteModel paletteModel
Definition: main.cpp:28
#define GET_Y_LPARAM(lp)
Definition: windowsx.h:275
CHOOSECOLOR choosecolor
Definition: main.cpp:36
LPARAM lParam
Definition: combotst.c:139

◆ OnRButtonDown()

LRESULT CPaletteWindow::OnRButtonDown ( UINT  nMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)

Definition at line 68 of file palette.cpp.

69 {
70  if (GET_X_LPARAM(lParam) >= 31)
72  return 0;
73 }
#define GET_X_LPARAM(lp)
Definition: windowsx.h:274
void SetBgColor(COLORREF newColor)
COLORREF GetColor(UINT nIndex) const
PaletteModel paletteModel
Definition: main.cpp:28
#define GET_Y_LPARAM(lp)
Definition: windowsx.h:275
LPARAM lParam
Definition: combotst.c:139

The documentation for this class was generated from the following files: