modified dll/win32/kernel32/kernel32.rbuild
[reactos.git] / reactos / base / applications / games / solitaire / cardlib / cardbutton.h
1 #ifndef CARDBUTTON_INCLUDED
2 #define CARDBUTTON_INCLUDED
3
4 #define MAXBUTTONTEXT 64
5
6 #include "cardlib.h"
7
8 class CardButton
9 {
10 friend class CardWindow;
11
12 //
13 // Constructor is PRIVATE - only a
14 // CardWindow can create buttons!
15 //
16 CardButton(CardWindow &parent, int id, TCHAR *szText, UINT style, bool visible,
17 int x, int y, int width, int height);
18
19 ~CardButton();
20
21 public:
22
23 void SetStyle(UINT uStyle);
24 UINT GetStyle();
25
26 void SetText(TCHAR *fmt, ...);
27 void SetFont(HFONT font);
28
29 void SetPlacement(UINT xJustify, UINT yJustify, int xAdjust, int yAdjust);
30
31 void SetForeColor(COLORREF cr);
32 void SetBackColor(COLORREF cr);
33
34 void Move(int x, int y, int width, int height);
35 void Show(bool fShow);
36 void Redraw();
37 int Id();
38
39 void SetIcon(HICON hicon, bool fRedraw);
40
41 void SetButtonProc(pButtonProc proc);
42
43 CardWindow &GetCardWindow() { return parentWnd; }
44
45 bool Lock();
46 bool UnLock();
47
48 static COLORREF GetHighlight(COLORREF crBase);
49 static COLORREF GetShadow(COLORREF crBase);
50 static COLORREF GetFace(COLORREF crBase);
51
52 private:
53
54 //
55 // Private member functions
56 //
57 void AdjustPosition(int winwidth, int winheight);
58
59 void DrawRect(HDC hdc, RECT *rect, bool fNormal);
60 void Draw(HDC hdc, bool fNormal);
61 void Clip(HDC hdc);
62
63 int OnLButtonDown(HWND hwnd, int x, int y);
64 int OnMouseMove(HWND hwnd, int x, int y);
65 int OnLButtonUp(HWND hwnd, int x, int y);
66
67 //
68 // Private members
69 //
70 CardWindow &parentWnd;
71
72 RECT rect;
73 int id;
74 UINT uStyle;
75 bool fVisible;
76
77 int xadjust;
78 int xjustify;
79 int yadjust;
80 int yjustify;
81
82 HICON hIcon;
83 HFONT hFont;
84
85 TCHAR szText[MAXBUTTONTEXT];
86
87 COLORREF crBack;
88 COLORREF crText;
89 COLORREF crHighlight;
90 COLORREF crShadow;
91 COLORREF crShadow2;
92
93 bool fMouseDown;
94 bool fButtonDown;
95
96 HANDLE mxlock;
97
98 pButtonProc ButtonCallback;
99 };
100
101 #endif