#pragma once namespace Ooganizer { ////////////////////////////////////////////////////////////////////// // Itce: ButtonStrategy // Desc: This interface allows us to abstract out specific implementations // for different caption buttons with different Themes. // // Note: following functions will be called from the windows messages to // be implemented directly here independently and draw only the button. // // Note2: Each Button Strategy is directly tied to a C ////////////////////////////////////////////////////////////////////// class ButtonStrategy { public: // generic draw function - called for all default messages virtual void draw(HWND hWnd, const HDC &hdc, const RECT &rpos) const = 0; // draw the button in an up state virtual void drawButtonUp(HWND hWnd, const HDC &hDc, const RECT &rPos) const = 0; // draw the button in a down state virtual void drawButtonDown(HWND hWnd, const HDC &hDc, const RECT &rPos) const = 0; // returns the RECT position of the the CaptionButton virtual void CalcCaptionButtonRect(HWND hWnd, RECT& RectButtonPos) const = 0; //// // returns the dimension / size of the caption / title bar (impl. in base) //// void CalcCaptionRect(HWND hWnd, RECT& RectCaption, SIZE &heightNwidth) const; ButtonStrategy(void); virtual ~ButtonStrategy(void); }; ////////////////////////////////////////////////////////////////////// // Clss: ClassicButtonStrategy // Desc: Implementation for our Windows Classic Theme Strategy ////////////////////////////////////////////////////////////////////// class ClassicButtonStrategy : public ButtonStrategy { public: void draw(HWND hWnd, const HDC &hdc, const RECT &rpos) const; void drawButtonUp(HWND hWnd, const HDC &hDc, const RECT &rPos) const; void drawButtonDown(HWND hWnd, const HDC &hDc, const RECT &rPos) const; void CalcCaptionButtonRect(HWND hWnd, RECT& RectButtonPos) const {}; ClassicButtonStrategy(); virtual ~ClassicButtonStrategy(); }; ////////////////////////////////////////////////////////////////////// // Clss: AeroButtonStrategy // Desc: Implementation for our Windows Aero (Glass) Strategy ////////////////////////////////////////////////////////////////////// class AeroButtonStrategy : public ButtonStrategy { public: virtual void draw(HWND hWnd, const HDC &hdc, const RECT &rpos) const; void drawButtonUp(HWND hWnd, const HDC &hDc, const RECT &rPos) const; void drawButtonDown(HWND hWnd, const HDC &hDc, const RECT &rPos) const; void CalcCaptionButtonRect(HWND hWnd, RECT& RectButtonPos) const; AeroButtonStrategy(); virtual ~AeroButtonStrategy(); }; ////////////////////////////////////////////////////////////////////// // Clss: VistaNoAeroStrategy // Desc: Implementation for Vista when Aero (Glass) is not running ////////////////////////////////////////////////////////////////////// class VistaNoAeroStrategy : public ButtonStrategy { public: virtual void draw(HWND hWnd, const HDC &hdc, const RECT &rpos) const; void drawButtonUp(HWND hWnd, const HDC &hDc, const RECT &rPos) const; void drawButtonDown(HWND hWnd, const HDC &hDc, const RECT &rPos) const; void CalcCaptionButtonRect(HWND hWnd, RECT& RectButtonPos) const; // Uses Hidden Window Strategy VistaNoAeroStrategy(); virtual ~VistaNoAeroStrategy(); }; ////////////////////////////////////////////////////////////////////// // Clss: XPButtonStrategy // Desc: Implementation for Windows XP Themed Strategy ////////////////////////////////////////////////////////////////////// class XPButtonStrategy : public ButtonStrategy { public: virtual void draw(HWND hWnd, const HDC &hdc, const RECT &rpos) const; void drawButtonUp(HWND hWnd, const HDC &hDc, const RECT &rPos) const; void drawButtonDown(HWND hWnd, const HDC &hDc, const RECT &rPos) const; void CalcCaptionButtonRect(HWND hWnd, RECT& RectButtonPos) const{}; XPButtonStrategy(); virtual ~XPButtonStrategy(); }; }