1
0

skinnedmenuwnd.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. #ifndef NULLOSFT_MEDIALIBRARY_SKINNED_MENU_WINDOW_HEADER
  2. #define NULLOSFT_MEDIALIBRARY_SKINNED_MENU_WINDOW_HEADER
  3. #if defined(_MSC_VER) && (_MSC_VER >= 1020)
  4. #pragma once
  5. #endif
  6. #include "./skinnedwnd.h"
  7. #include "./skinnedmenuthreadinfo.h"
  8. #define MENU_BUTTON_SCROLLUP 0x0001
  9. #define MENU_BUTTON_SCROLLDOWN 0x0002
  10. #define MENU_BUTTON_STATE_DISABLED 0x0001
  11. #define MENU_BUTTON_STATE_PRESSED 0x0002
  12. class SkinnedMenuWnd : public SkinnedWnd
  13. {
  14. protected:
  15. SkinnedMenuWnd(UINT menuExStyle, HMLIMGLST hmlil, INT forcedWidth, MENUCUSTOMIZEPROC customProc, ULONG_PTR customParam);
  16. virtual ~SkinnedMenuWnd(void);
  17. public:
  18. HMENU GetMenuHandle();
  19. HWND GetOwnerWindow();
  20. HWND SetOwnerWindow(HWND hwndOwner);
  21. protected:
  22. virtual BOOL Attach(HWND hwndMenu, HWND hwndOwner);
  23. virtual BOOL AttachMenu(HMENU hMenuToAttach);
  24. virtual LRESULT WindowProc(UINT uMsg, WPARAM wParam, LPARAM lParam); // treat this as dialog proc
  25. virtual HPEN GetBorderPen(void);
  26. BOOL OnReflectedDrawItem(DRAWITEMSTRUCT *pdis);
  27. BOOL OnReflectedMeasureItem(MEASUREITEMSTRUCT *pmis);
  28. HFONT GetMenuFont(BOOL fBold);
  29. INT GetLineHeight();
  30. virtual LRESULT OnEraseBackground(HDC hdc);
  31. virtual void OnPrint(HDC hdc, UINT options);
  32. virtual void OnNcPaint(HRGN rgnUpdate);
  33. virtual INT OnNcCalcSize(BOOL bCalcValidRects, NCCALCSIZE_PARAMS *pncsp);
  34. virtual void DrawBorder(HDC hdc);
  35. BOOL IsSkinnedItem(UINT itemId);
  36. BOOL DrawScrollButton(HDC hdc, UINT scrollButton);
  37. void PaintScrollButton(HDC hdc, const RECT *prc, UINT scrollButton, BOOL buttonState);
  38. LRESULT OnMenuSelect(UINT selectedItem);
  39. LRESULT CallHookedWindowProc(UINT uItem, BOOL fByPosition, UINT uMsg, WPARAM wParam, LPARAM lParam);
  40. INT FindHiliteItem(HMENU hMenu);
  41. private:
  42. friend BOOL SkinWindowEx(HWND hwndToSkin, INT type, UINT style);
  43. friend class SkinnedMenu;
  44. protected:
  45. typedef struct SkinnedItemRecord
  46. {
  47. unsigned int itemId;
  48. unsigned int originalId;
  49. BOOL skinned;
  50. BOOL failed;
  51. }SkinnedItemRecord;
  52. protected:
  53. SkinnedMenuThreadInfo *threadInfo;
  54. HWND hOwner;
  55. HMENU hMenu;
  56. UINT menuExStyle;
  57. HMLIMGLST hmlil;
  58. INT lineWidth = 0;
  59. INT lineHeight = 0;
  60. INT imageWidth = 0;
  61. INT imageHeight = 0;
  62. INT shortcutCX = 0;
  63. INT textCX = 0;
  64. BOOL bRestoreShadow;
  65. HFONT hBoldFont;
  66. HBRUSH backBrush;
  67. HPEN borderPen;
  68. HBRUSH menuOrigBrush;
  69. SkinnedItemRecord *skinnedItems;
  70. INT skinnedItemCount;
  71. INT skinnedItemCursor;
  72. INT prevSelectedItem;
  73. HBITMAP scrollBitmap;
  74. HBITMAP disabledScrollBitmap;
  75. UINT menuFlags;
  76. MENUCUSTOMIZEPROC customProc;
  77. ULONG_PTR customParam;
  78. };
  79. #endif // NULLOSFT_MEDIALIBRARY_SKINNED_MENU_WINDOW_HEADER