Delete all Trailing spaces in code.
[reactos.git] / reactos / base / applications / games / solitaire / cardlib / cardwindow.h
1 #ifndef CARDBOARD_INCLUDED
2 #define CARDBOARD_INCLUDED
3
4 #define MAXBUTTONS 32
5 #define MAXCARDSTACKS 32
6 #define MAXDROPZONES 8
7
8 #include "dropzone.h"
9 #include "cardlib.h"
10
11 class CardRegion;
12 class CardButton;
13
14 LRESULT CALLBACK CardWndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam);
15
16 class CardWindow
17 {
18 friend class CardRegion;
19 friend class CardButton;
20
21 friend void RegisterCardWindow();
22
23 public:
24
25 CardWindow();
26 ~CardWindow();
27
28 //
29 // Basic windowing support
30 //
31 BOOL Create(HWND hwndParent, DWORD dwExStyle, DWORD dwStyle, int x, int y, int width, int height);
32 BOOL Destroy();
33
34 operator HWND() { return m_hWnd; }
35
36 CardButton *CreateButton (int id, TCHAR *szText, UINT uStyle, bool fVisible, int x, int y, int width, int height);
37 CardRegion *CreateRegion (int id, bool fVisible, int x, int y, int xoffset, int yoffset);
38
39 CardButton *CardButtonFromId(int id);
40 CardRegion *CardRegionFromId(int id);
41
42 bool DeleteButton(CardButton *pButton);
43 bool DeleteRegion(CardRegion *pRegion);
44 bool DeleteAll();
45
46 void SetBackColor(COLORREF cr);
47 COLORREF GetBackColor();
48 void SetBackCardIdx(UINT uBackIdx);
49 UINT GetBackCardIdx();
50 void SetBackImage(HBITMAP hBitmap);
51
52 void EmptyStacks(void);
53 void Redraw(void);
54 void Update(void);
55
56 bool DistributeStacks(int nIdFrom, int nNumStacks, UINT xJustify, int xSpacing, int nStartX);
57 void SetResizeProc(pResizeWndProc proc);
58 int GetWidth() { return nWidth; }
59 int GetHeight() { return nHeight; }
60
61 //
62 // Dropzone support
63 //
64 bool RegisterDropZone(int id, RECT *rect, pDropZoneProc proc);
65 bool DeleteDropZone(int id);
66
67 private:
68
69 int GetNumDropZones() { return nNumDropZones; }
70 DropZone* GetDropZoneFromRect(RECT *rect);
71
72 //
73 // Window procedure - don't call
74 //
75 LRESULT CALLBACK WndProc (HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam);
76 static LRESULT CALLBACK CardWndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam);
77
78 //
79 // Private functions
80 //
81 void Paint(HDC hdc);
82 void PaintCardRgn(HDC hdc, int dx, int dy, int width, int height, int sx, int sy);
83
84 HPALETTE CreateCardPalette();
85
86 CardButton *CardButtonFromPoint(int x, int y);
87 CardRegion *CardRegionFromPoint(int x, int y);
88 CardRegion *GetBestStack(int x, int y, int w, int h);
89
90 //
91 // Private members
92 //
93
94 HWND m_hWnd; //window handle!
95 int nWidth, nHeight;
96
97 UINT nBackCardIdx; //all stacks share this card index by default
98
99 HBITMAP hbmBackImage;
100 HDC hdcBackImage;
101
102
103 CardButton * Buttons[MAXBUTTONS];
104 int nNumButtons;
105
106 CardRegion * Regions[MAXCARDSTACKS];
107 int nNumCardRegions;
108
109 DropZone * dropzone[MAXDROPZONES];
110 int nNumDropZones;
111
112 COLORREF crBackgnd;
113
114 pResizeWndProc ResizeWndCallback;
115
116
117 };
118
119
120 #endif