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