-#ifndef CARDBOARD_INCLUDED\r
-#define CARDBOARD_INCLUDED\r
-\r
-#define MAXBUTTONS 32\r
-#define MAXCARDSTACKS 32\r
-#define MAXDROPZONES 8\r
-\r
-#include "dropzone.h"\r
-#include "cardlib.h"\r
-\r
-class CardRegion;\r
-class CardButton;\r
-\r
-LRESULT CALLBACK CardWndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam);\r
-\r
-class CardWindow\r
-{\r
- friend class CardRegion;\r
- friend class CardButton;\r
- \r
- friend void RegisterCardWindow();\r
-\r
-public:\r
-\r
- CardWindow();\r
- ~CardWindow();\r
-\r
- //\r
- // Basic windowing support\r
- //\r
- BOOL Create(HWND hwndParent, DWORD dwExStyle, DWORD dwStyle, int x, int y, int width, int height);\r
- BOOL Destroy();\r
-\r
- operator HWND() { return m_hWnd; }\r
-\r
- CardButton *CreateButton (int id, TCHAR *szText, UINT uStyle, bool fVisible, int x, int y, int width, int height);\r
- CardRegion *CreateRegion (int id, bool fVisible, int x, int y, int xoffset, int yoffset);\r
-\r
- CardButton *CardButtonFromId(int id);\r
- CardRegion *CardRegionFromId(int id);\r
-\r
- bool DeleteButton(CardButton *pButton);\r
- bool DeleteRegion(CardRegion *pRegion);\r
- bool DeleteAll();\r
-\r
- void SetBackColor(COLORREF cr);\r
- COLORREF GetBackColor();\r
- void SetBackCardIdx(UINT uBackIdx);\r
- void SetBackImage(HBITMAP hBitmap);\r
-\r
- void EmptyStacks(void);\r
- void Redraw(void);\r
- void Update(void);\r
-\r
- bool DistributeStacks(int nIdFrom, int nNumStacks, UINT xJustify, int xSpacing, int nStartX);\r
- void SetResizeProc(pResizeWndProc proc);\r
- int GetWidth() { return nWidth; }\r
- int GetHeight() { return nHeight; }\r
- \r
- //\r
- // Dropzone support\r
- //\r
- bool RegisterDropZone(int id, RECT *rect, pDropZoneProc proc);\r
- bool DeleteDropZone(int id);\r
-\r
-private:\r
-\r
- int GetNumDropZones() { return nNumDropZones; }\r
- DropZone* GetDropZoneFromRect(RECT *rect);\r
-\r
- //\r
- // Window procedure - don't call\r
- //\r
- LRESULT CALLBACK WndProc (HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam);\r
-static LRESULT CALLBACK CardWndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam);\r
-\r
- //\r
- // Private functions\r
- //\r
- void Paint(HDC hdc);\r
- void PaintCardRgn(HDC hdc, int dx, int dy, int width, int height, int sx, int sy);\r
-\r
- HPALETTE CreateCardPalette();\r
-\r
- CardButton *CardButtonFromPoint(int x, int y);\r
- CardRegion *CardRegionFromPoint(int x, int y);\r
- CardRegion *GetBestStack(int x, int y, int w, int h);\r
-\r
- //\r
- // Private members\r
- //\r
-\r
- HWND m_hWnd; //window handle!\r
- int nWidth, nHeight;\r
- \r
- UINT nBackCardIdx; //all stacks share this card index by default\r
-\r
- HBITMAP hbmBackImage;\r
- HDC hdcBackImage;\r
-\r
-\r
- CardButton * Buttons[MAXBUTTONS];\r
- int nNumButtons;\r
-\r
- CardRegion * Regions[MAXCARDSTACKS];\r
- int nNumCardRegions;\r
-\r
- DropZone * dropzone[MAXDROPZONES];\r
- int nNumDropZones;\r
-\r
- COLORREF crBackgnd;\r
-\r
- pResizeWndProc ResizeWndCallback;\r
-\r
-\r
-};\r
-\r
-\r
-#endif\r
+#ifndef CARDBOARD_INCLUDED
+#define CARDBOARD_INCLUDED
+
+#define MAXBUTTONS 32
+#define MAXCARDSTACKS 32
+#define MAXDROPZONES 8
+
+#include "dropzone.h"
+#include "cardlib.h"
+
+class CardRegion;
+class CardButton;
+
+LRESULT CALLBACK CardWndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam);
+
+class CardWindow
+{
+ friend class CardRegion;
+ friend class CardButton;
+
+ friend void RegisterCardWindow();
+
+public:
+
+ CardWindow();
+ ~CardWindow();
+
+ //
+ // Basic windowing support
+ //
+ BOOL Create(HWND hwndParent, DWORD dwExStyle, DWORD dwStyle, int x, int y, int width, int height);
+ BOOL Destroy();
+
+ operator HWND() { return m_hWnd; }
+
+ CardButton *CreateButton (int id, TCHAR *szText, UINT uStyle, bool fVisible, int x, int y, int width, int height);
+ CardRegion *CreateRegion (int id, bool fVisible, int x, int y, int xoffset, int yoffset);
+
+ CardButton *CardButtonFromId(int id);
+ CardRegion *CardRegionFromId(int id);
+
+ bool DeleteButton(CardButton *pButton);
+ bool DeleteRegion(CardRegion *pRegion);
+ bool DeleteAll();
+
+ void SetBackColor(COLORREF cr);
+ COLORREF GetBackColor();
+ void SetBackCardIdx(UINT uBackIdx);
+ void SetBackImage(HBITMAP hBitmap);
+
+ void EmptyStacks(void);
+ void Redraw(void);
+ void Update(void);
+
+ bool DistributeStacks(int nIdFrom, int nNumStacks, UINT xJustify, int xSpacing, int nStartX);
+ void SetResizeProc(pResizeWndProc proc);
+ int GetWidth() { return nWidth; }
+ int GetHeight() { return nHeight; }
+
+ //
+ // Dropzone support
+ //
+ bool RegisterDropZone(int id, RECT *rect, pDropZoneProc proc);
+ bool DeleteDropZone(int id);
+
+private:
+
+ int GetNumDropZones() { return nNumDropZones; }
+ DropZone* GetDropZoneFromRect(RECT *rect);
+
+ //
+ // Window procedure - don't call
+ //
+ LRESULT CALLBACK WndProc (HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam);
+static LRESULT CALLBACK CardWndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam);
+
+ //
+ // Private functions
+ //
+ void Paint(HDC hdc);
+ void PaintCardRgn(HDC hdc, int dx, int dy, int width, int height, int sx, int sy);
+
+ HPALETTE CreateCardPalette();
+
+ CardButton *CardButtonFromPoint(int x, int y);
+ CardRegion *CardRegionFromPoint(int x, int y);
+ CardRegion *GetBestStack(int x, int y, int w, int h);
+
+ //
+ // Private members
+ //
+
+ HWND m_hWnd; //window handle!
+ int nWidth, nHeight;
+
+ UINT nBackCardIdx; //all stacks share this card index by default
+
+ HBITMAP hbmBackImage;
+ HDC hdcBackImage;
+
+
+ CardButton * Buttons[MAXBUTTONS];
+ int nNumButtons;
+
+ CardRegion * Regions[MAXCARDSTACKS];
+ int nNumCardRegions;
+
+ DropZone * dropzone[MAXDROPZONES];
+ int nNumDropZones;
+
+ COLORREF crBackgnd;
+
+ pResizeWndProc ResizeWndCallback;
+
+
+};
+
+
+#endif