The Winamp Remote Control suite
a remote control client and plugin for Winamp 2.x, 5.x
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
GlassExtender.h
Go to the documentation of this file.
1 /*
2  * GlassExtender.h
3  *
4  * Created on: 10 Mar 2012
5  * Author: Patrick
6  */
7 
8 #ifndef GLASSEXTENDER_H_
9 #define GLASSEXTENDER_H_
10 
11 #include <classes.hpp>
12 #include <forms.hpp>
13 #include <windows.h>
14 #include <messages.hpp>
15 #pragma hdrstop
16 
17 
18 const int WM_DWMCOMPOSITIONCHANGED = 0x031E;
19 
20 
24 class GlassExtender: public Classes::TComponent
25 {
26 
27 private:
28 
29  typedef struct _MARGINS
30  {
31  int cxLeftWidth;
32  int cxRightWidth;
33  int cyTopHeight;
34  int cyBottomHeight;
35  } MARGINS, *PMARGINS;
36 
37 
38  typedef struct _DTTOPTS {
39  DWORD dwSize;
40  DWORD dwFlags;
41  COLORREF crText;
42  COLORREF crBorder;
43  COLORREF crShadow;
44  int iTextShadowType;
45  POINT ptShadowOffset;
46  int iBorderSize;
47  int iFontPropId;
48  int iColorPropId;
49  int iStateId;
50  BOOL fApplyOverlay;
51  int iGlowSize;
52  void * pfnDrawTextCallback; // AACK to avoid pulling in the world
53  LPARAM lParam;
54  } DTTOPTS, *PDTTOPTS;
55 
56 /* DrawThemeText() flags */
57 #define DTT_TEXTCOLOR 0x00000001L
58 #define DTT_BORDERCOLOR 0x00000002L
59 #define DTT_SHADOWCOLOR 0x00000004L
60 #define DTT_SHADOWTYPE 0x00000008L
61 #define DTT_SHADOWOFFSET 0x00000010L
62 #define DTT_BORDERSIZE 0x00000020L
63 #define DTT_FONTPROP 0x00000040L
64 #define DTT_COLORPROP 0x00000080L
65 #define DTT_STATEID 0x00000100L
66 #define DTT_CALCRECT 0x00000200L
67 #define DTT_APPLYOVERLAY 0x00000400L
68 #define DTT_GLOWSIZE 0x00000800L
69 #define DTT_CALLBACK 0x00001000L
70 #define DTT_COMPOSITED 0x00002000L
71 
72 
73 
74  typedef HRESULT (__stdcall *DWMEnabledProc)(BOOL * enabled);
75  typedef HRESULT (__stdcall *ExtendFrameProc)(HANDLE hWnd, const MARGINS *pMarInset);
76  typedef HRESULT (__stdcall *DrawThemeTextExProc)(HANDLE hTheme,
77  HDC hdc,
78  int iPartId,
79  int iStateId,
80  LPCWSTR pszText,
81  int iCharCount,
82  DWORD dwFlags,
83  LPRECT pRect,
84  const DTTOPTS *pOptions);
85 
86  typedef HANDLE (__stdcall *OpenThemeDataProc)(HWND hwnd, LPCWSTR pszClassList);
87  typedef HRESULT (__stdcall *CloseThemeDataProc)(HANDLE hTheme);
88 
89 
90  HINST m_dwmapi;
91  HINST m_uxtheme;
92  ExtendFrameProc m_ExtendFrameProc;
93  DWMEnabledProc m_DWMEnabledProc;
94  DrawThemeTextExProc m_DrawThemeTextExProc;
95  OpenThemeDataProc m_OpenThemeDataProc;
96  CloseThemeDataProc m_CloseThemeDataProc;
97  TForm * m_Form;
98  bool glassWindow(TWinControl * winControl);
99  bool extendIntoClientAll();
100  void DWMCompositionChanged(TMessage& Msg);
101 
102 public:
108  __fastcall virtual GlassExtender(TForm* AOwner);
112  __fastcall virtual ~GlassExtender(void);
113  bool isCompositionActive();
114  bool drawGlowText(HDC dc, const AnsiString& item,const TRect &itemRect,
115  bool current);
116 
117 // BEGIN_MESSAGE_MAP
118 // // handling DWM composition changes
119 // MESSAGE_HANDLER(WM_DWMCOMPOSITIONCHANGED, TMessage, DWMCompositionChanged)
120 // END_MESSAGE_MAP(GlassExtender)
121 
122 
123 };
124 
125 #endif /* GLASSEXTENDER_H_ */