ReactOS 0.4.15-dev-7942-gd23573b
PaletteModel Class Reference

#include <palettemodel.h>

Public Member Functions

 PaletteModel ()
 
PAL_TYPE SelectedPalette ()
 
void SelectPalette (PAL_TYPE nPalette)
 
COLORREF GetColor (UINT nIndex) const
 
void SetColor (UINT nIndex, COLORREF newColor)
 
COLORREF GetFgColor () const
 
void SetFgColor (COLORREF newColor)
 
COLORREF GetBgColor () const
 
void SetBgColor (COLORREF newColor)
 

Private Member Functions

void NotifyColorChanged ()
 
void NotifyPaletteChanged ()
 

Private Attributes

COLORREF m_colors [NUM_COLORS]
 
PAL_TYPE m_nSelectedPalette
 
COLORREF m_fgColor
 
COLORREF m_bgColor
 

Detailed Description

Definition at line 20 of file palettemodel.h.

Constructor & Destructor Documentation

◆ PaletteModel()

PaletteModel::PaletteModel ( )

Definition at line 15 of file palettemodel.cpp.

16{
17 m_fgColor = 0x00000000;
18 m_bgColor = 0x00ffffff;
20}
void SelectPalette(PAL_TYPE nPalette)
COLORREF m_fgColor
Definition: palettemodel.h:25
COLORREF m_bgColor
Definition: palettemodel.h:26
@ PAL_MODERN
Definition: palettemodel.h:14

Member Function Documentation

◆ GetBgColor()

◆ GetColor()

COLORREF PaletteModel::GetColor ( UINT  nIndex) const

Definition at line 56 of file palettemodel.cpp.

57{
58 if (nIndex < NUM_COLORS)
59 return m_colors[nIndex];
60 else
61 return 0;
62}
COLORREF m_colors[NUM_COLORS]
Definition: palettemodel.h:23
#define NUM_COLORS
Definition: palettemodel.h:10

Referenced by CPaletteWindow::OnLButtonDown(), CPaletteWindow::OnPaint(), and CPaletteWindow::OnRButtonDown().

◆ GetFgColor()

◆ NotifyColorChanged()

void PaletteModel::NotifyColorChanged ( )
private

Definition at line 95 of file palettemodel.cpp.

96{
97 if (paletteWindow.IsWindow())
99 if (canvasWindow.IsWindow())
101 if (textEditWindow.IsWindow())
103}
#define WM_PALETTEMODELCOLORCHANGED
Definition: precomp.h:52
CTextEditWindow textEditWindow
Definition: textedit.cpp:12
CCanvasWindow canvasWindow
Definition: canvas.cpp:10
CPaletteWindow paletteWindow
Definition: palette.cpp:19

Referenced by SetBgColor(), and SetFgColor().

◆ NotifyPaletteChanged()

void PaletteModel::NotifyPaletteChanged ( )
private

Definition at line 105 of file palettemodel.cpp.

106{
107 if (paletteWindow.IsWindow())
108 paletteWindow.Invalidate(FALSE);
109}
#define FALSE
Definition: types.h:117

Referenced by SelectPalette(), and SetColor().

◆ SelectedPalette()

PAL_TYPE PaletteModel::SelectedPalette ( )

Definition at line 22 of file palettemodel.cpp.

23{
24 return m_nSelectedPalette;
25}
PAL_TYPE m_nSelectedPalette
Definition: palettemodel.h:24

Referenced by CMainWindow::OnInitMenuPopup().

◆ SelectPalette()

void PaletteModel::SelectPalette ( PAL_TYPE  nPalette)

Definition at line 27 of file palettemodel.cpp.

28{
29 static const COLORREF modernColors[NUM_COLORS] =
30 {
31 0x000000, 0x464646, 0x787878, 0x300099, 0x241ced, 0x0078ff, 0x0ec2ff,
32 0x00f2ff, 0x1de6a8, 0x4cb122, 0xefb700, 0xf36d4d, 0x99362f, 0x98316f,
33 0xffffff, 0xdcdcdc, 0xb4b4b4, 0x3c5a9c, 0xb1a3ff, 0x7aaae5, 0x9ce4f5,
34 0xbdf9ff, 0xbcf9d3, 0x61bb9d, 0xead999, 0xd19a70, 0x8e6d54, 0xd5a5b5
35 };
36 static const COLORREF oldColors[NUM_COLORS] =
37 {
38 0x000000, 0x808080, 0x000080, 0x008080, 0x008000, 0x808000, 0x800000,
39 0x800080, 0x408080, 0x404000, 0xff8000, 0x804000, 0xff0040, 0x004080,
40 0xffffff, 0xc0c0c0, 0x0000ff, 0x00ffff, 0x00ff00, 0xffff00, 0xff0000,
41 0xff00ff, 0x80ffff, 0x80ff00, 0xffff80, 0xff8080, 0x8000ff, 0x4080ff
42 };
43 switch (nPalette)
44 {
45 case PAL_MODERN:
46 CopyMemory(m_colors, modernColors, sizeof(m_colors));
47 break;
48 case PAL_OLDTYPE:
49 CopyMemory(m_colors, oldColors, sizeof(m_colors));
50 break;
51 }
52 m_nSelectedPalette = nPalette;
54}
void NotifyPaletteChanged()
@ PAL_OLDTYPE
Definition: palettemodel.h:15
#define CopyMemory
Definition: winbase.h:1710
DWORD COLORREF
Definition: windef.h:300

Referenced by CMainWindow::OnCommand(), and PaletteModel().

◆ SetBgColor()

void PaletteModel::SetBgColor ( COLORREF  newColor)

Definition at line 89 of file palettemodel.cpp.

90{
91 m_bgColor = newColor;
93}
void NotifyColorChanged()

Referenced by ColorTool::fetchColor(), CPaletteWindow::OnRButtonDblClk(), and CPaletteWindow::OnRButtonDown().

◆ SetColor()

void PaletteModel::SetColor ( UINT  nIndex,
COLORREF  newColor 
)

Definition at line 64 of file palettemodel.cpp.

65{
66 if (nIndex < NUM_COLORS)
67 {
68 m_colors[nIndex] = newColor;
70 }
71}

Referenced by CPaletteWindow::OnLButtonDblClk(), and CPaletteWindow::OnRButtonDblClk().

◆ SetFgColor()

void PaletteModel::SetFgColor ( COLORREF  newColor)

Member Data Documentation

◆ m_bgColor

COLORREF PaletteModel::m_bgColor
private

Definition at line 26 of file palettemodel.h.

Referenced by GetBgColor(), PaletteModel(), and SetBgColor().

◆ m_colors

COLORREF PaletteModel::m_colors[NUM_COLORS]
private

Definition at line 23 of file palettemodel.h.

Referenced by GetColor(), SelectPalette(), and SetColor().

◆ m_fgColor

COLORREF PaletteModel::m_fgColor
private

Definition at line 25 of file palettemodel.h.

Referenced by GetFgColor(), PaletteModel(), and SetFgColor().

◆ m_nSelectedPalette

PAL_TYPE PaletteModel::m_nSelectedPalette
private

Definition at line 24 of file palettemodel.h.

Referenced by SelectedPalette(), and SelectPalette().


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