skinnedbutton.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. #ifndef NULLOSFT_MEDIALIBRARY_SKINNED_BUTTON_HEADER
  2. #define NULLOSFT_MEDIALIBRARY_SKINNED_BUTTON_HEADER
  3. #if defined(_MSC_VER) && (_MSC_VER >= 1020)
  4. #pragma once
  5. #endif
  6. #include "./skinnedwnd.h"
  7. #define BUTTON_TEXT_MAX 512
  8. typedef struct _BUTTONPAINTSTRUCT
  9. {
  10. HDC hdc;
  11. RECT rcClient;
  12. RECT rcPaint;
  13. UINT buttonState;
  14. UINT windowStyle;
  15. UINT skinnedStyle;
  16. HBITMAP hImage;
  17. INT imageIndex;
  18. UINT textFormat;
  19. HFONT hFont;
  20. COLORREF rgbText;
  21. COLORREF rgbTextBk;
  22. INT cchText;
  23. wchar_t szText[BUTTON_TEXT_MAX];
  24. } BUTTONPAINTSTRUCT;
  25. class SkinnedButton : public SkinnedWnd
  26. {
  27. protected:
  28. SkinnedButton(void);
  29. virtual ~SkinnedButton(void);
  30. protected:
  31. virtual BOOL Attach(HWND hwndButton);
  32. virtual LRESULT WindowProc(UINT uMsg, WPARAM wParam, LPARAM lParam); // treat this as dialog proc
  33. virtual void OnPaint(void);
  34. virtual void OnPrintClient(HDC hdc, UINT options);
  35. virtual void OnSkinChanged(BOOL bNotifyChildren, BOOL bRedraw);
  36. virtual BOOL OnMediaLibraryIPC(INT msg, INT_PTR param, LRESULT *pResult);
  37. virtual void OnLButtonDown(UINT flags, POINTS pts);
  38. virtual void OnLButtonUp(UINT flags, POINTS pts);
  39. virtual void OnMouseMove(UINT flags, POINTS pts);
  40. virtual LRESULT GetIdealSize(LPCWSTR pszText);
  41. protected:
  42. void Emulate_LeftButtonDown(UINT flags, POINTS pts, BOOL forwardMessage);
  43. void Emulate_LeftButtonUp(UINT flags, POINTS pts, BOOL forwardMessage);
  44. public:
  45. static COLORREF GetButtonBkColor(BOOL bPressed, BOOL *pbUnified);
  46. static void PrePaint(HWND hwnd, BUTTONPAINTSTRUCT *pbps, UINT skinStyle, UINT uiStat);
  47. static void DrawButton(BUTTONPAINTSTRUCT *pbps);
  48. static void DrawPushButton(BUTTONPAINTSTRUCT *pbps);
  49. static void DrawGroupBox(BUTTONPAINTSTRUCT *pbps);
  50. static void DrawCheckBox(BUTTONPAINTSTRUCT *pbps);
  51. static void DrawRadioButton(BUTTONPAINTSTRUCT *pbps);
  52. static BOOL RegisterImageFilter(HANDLE filterMananger);
  53. protected:
  54. MLBUTTONIMAGELIST imagelist;
  55. private:
  56. friend BOOL SkinWindowEx(HWND hwndToSkin, INT type, UINT style);
  57. };
  58. #endif // NULLOSFT_MEDIALIBRARY_SKINNED_BUTTON_HEADER