ThemePageControl.h 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. //---------------------------------------------------------------------------
  2. #ifndef ThemePageControlH
  3. #define ThemePageControlH
  4. //---------------------------------------------------------------------------
  5. #include <ComCtrls.hpp>
  6. //---------------------------------------------------------------------------
  7. class TThemeTabSheet : public TTabSheet
  8. {
  9. public:
  10. __fastcall TThemeTabSheet(TComponent * Owner);
  11. __property bool Shadowed = { read = FShadowed, write = SetShadowed };
  12. __property bool ShowCloseButton = { read = FShowCloseButton, write = SetShowCloseButton };
  13. private:
  14. void __fastcall SetShadowed(bool Value);
  15. void __fastcall SetShowCloseButton(bool Value);
  16. void __fastcall Invalidate();
  17. bool FShadowed;
  18. bool FShowCloseButton;
  19. };
  20. //---------------------------------------------------------------------------
  21. typedef void __fastcall (__closure *TPageControlCloseButtonClick)(TPageControl * Sender, int Index);
  22. //---------------------------------------------------------------------------
  23. class TThemePageControl : public TPageControl
  24. {
  25. friend class TThemeTabSheet;
  26. __published:
  27. __property TPageControlCloseButtonClick OnCloseButtonClick = { read = FOnCloseButtonClick, write = FOnCloseButtonClick };
  28. public:
  29. __fastcall TThemePageControl(TComponent * Owner);
  30. int __fastcall GetTabsHeight();
  31. UnicodeString __fastcall FormatCaptionWithCloseButton(const UnicodeString & Caption);
  32. protected:
  33. virtual void __fastcall PaintWindow(HDC DC);
  34. DYNAMIC bool __fastcall CanChange();
  35. DYNAMIC void __fastcall Change();
  36. DYNAMIC void __fastcall MouseMove(TShiftState Shift, int X, int Y);
  37. virtual void __fastcall Dispatch(void * Message);
  38. #ifdef _DEBUG
  39. virtual void __fastcall RequestAlign();
  40. #endif
  41. private:
  42. void __fastcall DrawThemesXpTab(HDC DC, int Tab);
  43. void __fastcall DrawThemesXpTabItem(HDC DC, int Item, const TRect & Rect, bool Body, int State);
  44. void __fastcall DrawTabItem(HDC DC, int Item, TRect TabRect, TRect Rect, bool Selected, bool Shadowed);
  45. void __fastcall DrawThemesPart(HDC DC, int PartId, int StateId, LPCWSTR PartNameID, LPRECT Rect);
  46. void __fastcall InvalidateTab(int Index);
  47. int __fastcall CloseButtonSize();
  48. int __fastcall GetCrossPadding();
  49. TRect __fastcall CloseButtonRect(int Index);
  50. int __fastcall IndexOfCloseButtonAt(int X, int Y);
  51. void __fastcall ItemContentsRect(int Item, TRect & Rect);
  52. bool __fastcall HasItemImage(int Item);
  53. void __fastcall ItemTextRect(int Item, TRect & Rect);
  54. void __fastcall ItemTabRect(int Item, TRect & Rect);
  55. bool __fastcall HasTabCloseButton(int Index);
  56. void __fastcall SetHotCloseButton(int Index);
  57. void __fastcall DrawCross(HDC DC, int Width, COLORREF Color, const TRect & Rect);
  58. void __fastcall WMLButtonDown(TWMLButtonDown & Message);
  59. int FOldTabIndex;
  60. int FHotCloseButton;
  61. TPageControlCloseButtonClick FOnCloseButtonClick;
  62. };
  63. //---------------------------------------------------------------------------
  64. #endif