ReactOS  0.4.13-dev-563-g0561610
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 }
#define ChooseColor
Definition: commdlg.h:661
#define GET_X_LPARAM(lp)
Definition: windowsx.h:274
void SetColor(int nIndex, int newColor)
COLORREF rgbResult
Definition: commdlg.h:242
void SetFgColor(int 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 }
#define GET_X_LPARAM(lp)
Definition: windowsx.h:274
int GetColor(int nIndex)
void SetFgColor(int newColor)
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  HDC hDC = GetDC();
19  HPEN oldPen;
20  HBRUSH oldBrush;
21  int i, a, b;
22 
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  ReleaseDC(hDC);
58  return 0;
59 }
#define COLOR_BTNHILIGHT
Definition: winuser.h:928
#define BF_MIDDLE
Definition: winuser.h:468
HPEN WINAPI CreatePen(_In_ int, _In_ int, _In_ COLORREF)
BOOL WINAPI Rectangle(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
HDC WINAPI GetDC(_In_opt_ HWND)
static HDC
Definition: imagelist.c:92
LONG top
Definition: windef.h:292
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
LONG left
Definition: windef.h:291
LONG right
Definition: windef.h:293
DWORD WINAPI GetSysColor(_In_ int)
WPARAM wParam
Definition: combotst.c:138
#define BF_TOPLEFT
Definition: winuser.h:458
#define BF_RECT
Definition: winuser.h:462
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
#define a
Definition: ke_i.h:78
BOOL WINAPI DrawEdge(_In_ HDC, _Inout_ LPRECT, _In_ UINT, _In_ UINT)
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define BF_BOTTOMRIGHT
Definition: winuser.h:461
#define b
Definition: ke_i.h:79
#define DefWindowProc
Definition: ros2win.h:31
FORCEINLINE VOID SetPixel(IN ULONG Left, IN ULONG Top, IN UCHAR Color)
Definition: vga.c:93
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
int GetColor(int nIndex)
#define WM_PAINT
Definition: winuser.h:1602
#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)
PaletteModel paletteModel
Definition: main.cpp:28
HBRUSH WINAPI CreateSolidBrush(_In_ COLORREF)
#define PS_NULL
Definition: wingdi.h:590
LONG bottom
Definition: windef.h:294
#define BDR_RAISEDINNER
Definition: winuser.h:444
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
LPARAM lParam
Definition: combotst.c:139

◆ 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 }
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)

◆ 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 }
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)

◆ 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
void SetColor(int nIndex, int newColor)
COLORREF rgbResult
Definition: commdlg.h:242
void SetBgColor(int 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(int newColor)
int GetColor(int nIndex)
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: