25 #define VSCLASS_BUTTON L"BUTTON"
28#if ! defined(TMSCHEMA_H) && ! defined(__VSSTYLE_H__)
38enum PUSHBUTTONSTATES {
46enum RADIOBUTTONSTATES {
47 RBS_UNCHECKEDNORMAL = 1,
49 RBS_UNCHECKEDPRESSED = 3,
50 RBS_UNCHECKEDDISABLED = 4,
51 RBS_CHECKEDNORMAL = 5,
53 RBS_CHECKEDPRESSED = 7,
54 RBS_CHECKEDDISABLED = 8,
58 CBS_UNCHECKEDNORMAL = 1,
60 CBS_UNCHECKEDPRESSED = 3,
61 CBS_UNCHECKEDDISABLED = 4,
62 CBS_CHECKEDNORMAL = 5,
64 CBS_CHECKEDPRESSED = 7,
65 CBS_CHECKEDDISABLED = 8,
68 CBS_MIXEDPRESSED = 11,
69 CBS_MIXEDDISABLED = 12,
90 _SELECTANY
bool s_isCheckedThemeDll =
false;
112 #define _TnbTHEMEDLL_NAME "UxTheme.dll"
113 mutable HTHEME m_hTheme;
114 typedef HRESULT(WINAPI *P_DrawThemeBackground)(HTHEME, HDC, int, int,
const RECT *,
const RECT *);
117 bool m_CheckOpen(HDC hdc)
const
121 m_hTheme =
OpenThemeData(::WindowFromDC(hdc), VSCLASS_BUTTON);
123 return m_hTheme != NULL;
130 if ( ! s_isCheckedThemeDll )
134 s_isCheckedThemeDll =
true;
151 if ( m_hTheme != NULL )
170 if ( ! m_bkgd.HasFunc() || ! m_CheckOpen(hdc) )
172 #ifdef _TnbTHEME_ClassicOriginal
175 return _super::DrawButtonControl(hdc, _lprc, uState);
179 switch ( uState & 0x001F )
181 case DFCS_BUTTONPUSH:
182 iPartId = BP_PUSHBUTTON;
183 iStateId = PBS_NORMAL;
185 case DFCS_BUTTONCHECK:
186 iPartId = BP_CHECKBOX;
187 if ( (uState & DFCS_CHECKED) == 0 )
189 iStateId = CBS_UNCHECKEDNORMAL;
193 iStateId = CBS_CHECKEDNORMAL;
196 case DFCS_BUTTON3STATE:
197 iPartId = BP_CHECKBOX;
198 if ( (uState & DFCS_CHECKED) == 0 )
200 iStateId = CBS_UNCHECKEDNORMAL;
204 iStateId = CBS_MIXEDNORMAL;
207 case DFCS_BUTTONRADIO:
208 iPartId = BP_RADIOBUTTON;
209 if ( (uState & DFCS_CHECKED) == 0 )
211 iStateId = RBS_UNCHECKEDNORMAL;
215 iStateId = RBS_CHECKEDNORMAL;
219 if ( iPartId < 0 || iStateId < 0 )
223 if ( (uState & DFCS_HOT) != 0 )
227 else if ( (uState & DFCS_PUSHED) != 0 )
232 if ( (uState & DFCS_INACTIVE) != 0 )
237 switch ( uState & 0xFF )
239 case DFCS_BUTTON3STATE:
240 case DFCS_BUTTONCHECK:
241 case DFCS_BUTTONRADIO:
242 _lprc->right = _lprc->left + 13;
243 _lprc->bottom = _lprc->top + 13;
246 if ( hdc == NULL ) {
return true; }
247 HRESULT r = m_bkgd()(m_hTheme, hdc, iPartId, iStateId, _lprc, _lprc);
252 if ( ! m_CheckOpen(hdc) )
254 #ifdef _TnbTHEME_ClassicOriginal
257 return _super::DrawButtonControl(hdc, _lprc, uState);
259 r = m_bkgd()(m_hTheme, hdc, iPartId, iStateId, _lprc, _lprc);
261 if ( r == S_OK && m_hTheme != NULL && iPartId == BP_PUSHBUTTON )
266 _lprc->right -= po.x;
268 _lprc->bottom -= po.y;
284 if ( ! s_isCheckedThemeDll )
288 typedef BOOL(WINAPI *P)(void);
293 ASSERT0(
false,
"CThemeStylePartsDrawer",
"APIが見つかりません。");
295 s_isCheckedThemeDll =
true;
311 typedef HTHEME(WINAPI *P)(HWND, LPCWSTR);
318 ASSERT0(
false,
"CThemeStylePartsDrawer",
"APIが見つかりません。");
334 typedef HRESULT(WINAPI *P)(HTHEME);
339 ASSERT0(
false,
"CThemeStylePartsDrawer",
"APIが見つかりません。");
356 static HRESULT
DrawThemeBackground(HTHEME hTheme, HDC hdc,
int iPartId,
int iStateId,
const RECT *pRect, OPTIONAL
const RECT *pClipRect)
364 ASSERT0(
false,
"CThemeStylePartsDrawer",
"APIが見つかりません。");
#define _TnbTHEMEDLL_NAME
テーマDLL名宣言
void OnCatch(void) const
[表示] 内容表示
virtual void GetEdgeOffset(POINT &_po) const
[取得] エッジの幅、高さ.
~CThemeStylePartsDrawer(void)
デストラクタ
static HRESULT DrawThemeBackground(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pRect, OPTIONAL const RECT *pClipRect)
[描画] Draws the background image defined by the visual style for the specified control part.
virtual bool DrawButtonControl(HDC hdc, LPRECT _lprc, UINT uState) const
[描画] ボタンコントロール描画.
static HRESULT CloseThemeData(HTHEME hTheme)
[処理] Closes the theme data handle.
void ThemeChanged(void)
[設定] テーマ変更.
CThemeStylePartsDrawer(void)
コンストラクタ
static bool IsThemeActive(void)
[確認] Tests if a visual style for the current application is active.
static HTHEME OpenThemeData(HWND hWnd, LPCWSTR pszClassList)
[処理] Opens the theme data for a window and its associated class.