]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/msw/uxtheme.h
Removed non-theme related defs
[wxWidgets.git] / include / wx / msw / uxtheme.h
index c3c70ce0f08ac9a29e0d7d05c35db85d6b60e7ff..f462ec9a0afec1543270d9409a83154d35468dbd 100644 (file)
@@ -1,11 +1,11 @@
 ///////////////////////////////////////////////////////////////////////////////
 // Name:        include/wx/msw/uxtheme.h
 // Purpose:     wxUxThemeEngine class: support for XP themes
-// Author:      
+// Author:      John Platts, Vadim Zeitlin
 // Modified by:
 // Created:     2003
 // RCS-ID:      $Id$
-// Copyright:   (c) 2003 wxWidgets Dev-Team
+// Copyright:   (c) 2003 John Platts, Vadim Zeitlin
 // License:     wxWindows licence
 ///////////////////////////////////////////////////////////////////////////////
 
 
 #include "wx/msw/wrapwin.h"
 
-#if wxUSE_UNICODE
-typedef struct _WXUOSVERSIONINFOEXW {
-    WXDWORD        dwOSVersionInfoSize;
-    WXDWORD        dwMajorVersion;
-    WXDWORD        dwMinorVersion;
-    WXDWORD        dwBuildNumber;
-    WXDWORD        dwPlatformId;
-    wchar_t        szCSDVersion[ 128 ];     // Maintenance string for PSS usage
-    unsigned short wServicePackMajor;
-    unsigned short wServicePackMinor;
-    unsigned short wSuiteMask;
-    unsigned char  wProductType;
-    unsigned char  wReserved;
-} WXUOSVERSIONINFOEXW, *PWXUOSVERSIONINFOEXW, *LPWXUOSVERSIONINFOEXW;
-#define WXUOSVERSIONINFOEX WXUOSVERSIONINFOEXW
-#define PWXUOSVERSIONINFOEX PWXUOSVERSIONINFOEXW
-#define LPWXUOSVERSIONINFOEX LPWXUOSVERSIONINFOEXW
-#else
-typedef struct _WXUOSVERSIONINFOEXA {
-    WXDWORD        dwOSVersionInfoSize;
-    WXDWORD        dwMajorVersion;
-    WXDWORD        dwMinorVersion;
-    WXDWORD        dwBuildNumber;
-    WXDWORD        dwPlatformId;
-    char           szCSDVersion [128];     // Maintenance string for PSS usage
-    unsigned short wServicePackMajor;
-    unsigned short wServicePackMinor;
-    unsigned short wSuiteMask;
-    unsigned char  wProductType;
-    unsigned char  wReserved;
-} WXUOSVERSIONINFOEXA, *PWXUOSVERSIONINFOEXA, *LPWXUOSVERSIONINFOEXA;
-#define WXUOSVERSIONINFOEX WXUOSVERSIONINFOEXA
-#define PWXUOSVERSIONINFOEX PWXUOSVERSIONINFOEXA
-#define LPWXUOSVERSIONINFOEX LPWXUOSVERSIONINFOEXA
-#endif
-
 typedef void* WXHTHEME;
 typedef long WXUHRESULT;
-typedef WXHTHEME (__stdcall *PFNWXUOPENTHEMEDATA)(WXHWND, const wchar_t *); 
+typedef WXHTHEME (__stdcall *PFNWXUOPENTHEMEDATA)(WXHWND, const wchar_t *);
 typedef WXUHRESULT (__stdcall *PFNWXUCLOSETHEMEDATA)(WXHTHEME);
-typedef WXUHRESULT (__stdcall *PFNWXUDRAWTHEMEBACKGROUND)(WXHTHEME, WXHDC, 
+typedef WXUHRESULT (__stdcall *PFNWXUDRAWTHEMEBACKGROUND)(WXHTHEME, WXHDC,
     int, int, const RECT *, const RECT *);
 #define WXU_DTT_GRAYED 0x1
-typedef WXUHRESULT (__stdcall *PFNWXUDRAWTHEMETEXT)(WXHTHEME, WXHDC, int, 
-    int, const wchar_t *, int, DWORD, 
+typedef WXUHRESULT (__stdcall *PFNWXUDRAWTHEMETEXT)(WXHTHEME, WXHDC, int,
+    int, const wchar_t *, int, DWORD,
     DWORD, const RECT *);
-typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMEBACKGROUNDCONTENTRECT)(WXHTHEME, WXHDC, 
+typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMEBACKGROUNDCONTENTRECT)(WXHTHEME, WXHDC,
     int, int, const RECT *, RECT *);
-typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMEBACKGROUNDEXTENT)(WXHTHEME, WXHDC, int, int, 
+typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMEBACKGROUNDEXTENT)(WXHTHEME, WXHDC, int, int,
     const RECT *, RECT *);
 
 enum WXUTHEMESIZE
 {
-    WXU_TS_MIN,             // minimum size
-    WXU_TS_TRUE,            // size without stretching
-    WXU_TS_DRAW             // size that theme mgr will use to draw part
+    WXU_TS_MIN,
+    WXU_TS_TRUE,
+    WXU_TS_DRAW
 };
 
-typedef struct tagWXUSIZE
-{
-    long        cx;
-    long        cy;
-} WXUSIZE;
-
-typedef struct tagWXUTEXTMETRIC
-{
-    long          tmHeight;
-    long          tmAscent;
-    long          tmDescent;
-    long          tmInternalLeading;
-    long          tmExternalLeading;
-    long          tmAveCharWidth;
-    long          tmMaxCharWidth;
-    long          tmWeight;
-    long          tmOverhang;
-    long          tmDigitizedAspectX;
-    long          tmDigitizedAspectY;
-    wchar_t       tmFirstChar;
-    wchar_t       tmLastChar;
-    wchar_t       tmDefaultChar;
-    wchar_t       tmBreakChar;
-    unsigned char tmItalic;
-    unsigned char tmUnderlined;
-    unsigned char tmStruckOut;
-    unsigned char tmPitchAndFamily;
-    unsigned char tmCharSet;
-} WXUTEXTMETRIC;
-
-typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMEPARTSIZE)(WXHTHEME, WXHDC, int, int, const RECT *, 
-    enum WXUTHEMESIZE, WXUSIZE *);
-typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMETEXTEXTENT)(WXHTHEME, WXHDC, int, int, const wchar_t *, 
+typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMEPARTSIZE)(WXHTHEME, WXHDC, int, int, const RECT *,
+    enum WXUTHEMESIZE, SIZE *);
+typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMETEXTEXTENT)(WXHTHEME, WXHDC, int, int, const wchar_t *,
     int, WXDWORD, const RECT *, RECT *);
 typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMETEXTMETRICS)(WXHTHEME, WXHDC,
-    int, int, WXUTEXTMETRIC*);
+    int, int, TEXTMETRIC*);
 typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMEBACKGROUNDREGION)(WXHTHEME, WXHDC,
     int, int, const RECT *, WXHRGN *);
 
@@ -128,15 +62,9 @@ typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMEBACKGROUNDREGION)(WXHTHEME, WXHDC,
 #define WXU_HTTB_SIZINGTEMPLATE         0x0100
 #define WXU_HTTB_SYSTEMSIZINGMARGINS    0x0200
 
-typedef struct tagWXUPOINT
-{
-    long x;
-    long y;
-} WXUPOINT;
-
 typedef WXUHRESULT (__stdcall *PFNWXUHITTESTTHEMEBACKGROUND)(WXHTHEME, WXHDC, int,
     int, WXDWORD, const RECT *, WXHRGN,
-    WXUPOINT, unsigned short *);
+    POINT, unsigned short *);
 typedef WXUHRESULT (__stdcall *PFNWXUDRAWTHEMEEDGE)(WXHTHEME, WXHDC, int, int,
     const RECT *, unsigned int, unsigned int, RECT *);
 typedef WXUHRESULT (__stdcall *PFNWXUDRAWTHEMEICON)(WXHTHEME, WXHDC, int, int,
@@ -151,32 +79,15 @@ typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMESTRING)(WXHTHEME, int,
 typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMEBOOL)(WXHTHEME, int, int, int, BOOL *);
 typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMEINT)(WXHTHEME, int, int, int, int *);
 typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMEENUMVALUE)(WXHTHEME, int, int, int, int *);
-typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMEPOSITION)(WXHTHEME, int, int, int, WXUPOINT *);
-typedef struct tagWXULOGFONT
-{
-    long          lfHeight;
-    long          lfWidth;
-    long          lfEscapement;
-    long          lfOrientation;
-    long          lfWeight;
-    unsigned char lfItalic;
-    unsigned char lfUnderline;
-    unsigned char lfStrikeOut;
-    unsigned char lfCharSet;
-    unsigned char lfOutPrecision;
-    unsigned char lfClipPrecision;
-    unsigned char lfQuality;
-    unsigned char lfPitchAndFamily;
-    wchar_t       lfFaceName[32];
-} WXULOGFONT;
-typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMEFONT)(WXHTHEME, WXHDC, int, int, int, WXULOGFONT *);
+typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMEPOSITION)(WXHTHEME, int, int, int, POINT *);
+typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMEFONT)(WXHTHEME, WXHDC, int, int, int, LOGFONT *);
 typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMERECT)(WXHTHEME, int, int, int, RECT *);
 typedef struct _WXUMARGINS
 {
-    int cxLeftWidth;      // width of left border that retains its size
-    int cxRightWidth;     // width of right border that retains its size
-    int cyTopHeight;      // height of top border that retains its size
-    int cyBottomHeight;   // height of bottom border that retains its size
+    int cxLeftWidth;
+    int cxRightWidth;
+    int cyTopHeight;
+    int cyBottomHeight;
 } WXUMARGINS, *PWXUMARGINS;
 typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMEMARGINS)(WXHTHEME, WXHDC, int,
     int, int, RECT *, WXUMARGINS *);
@@ -184,19 +95,19 @@ typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMEMARGINS)(WXHTHEME, WXHDC, int,
 #define WXU_MAX_INTLIST_COUNT 10
 typedef struct _WXUINTLIST
 {
-    int iValueCount;      // number of values in iValues
+    int iValueCount;
     int iValues[WXU_MAX_INTLIST_COUNT];
 } WXUINTLIST, *PWXUINTLIST;
 typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMEINTLIST)(WXHTHEME, int,
-       int, int, WXUINTLIST*);
+    int, int, WXUINTLIST*);
 
 enum WXUPROPERTYORIGIN
 {
-    WXU_PO_STATE,           // property was found in the state section
-    WXU_PO_PART,            // property was found in the part section
-    WXU_PO_CLASS,           // property was found in the class section
-    WXU_PO_GLOBAL,          // property was found in [globals] section
-    WXU_PO_NOTFOUND         // property was not found
+    WXU_PO_STATE,
+    WXU_PO_PART,
+    WXU_PO_CLASS,
+    WXU_PO_GLOBAL,
+    WXU_PO_NOTFOUND
 };
 
 typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMEPROPERTYORIGIN)(WXHTHEME, int,
@@ -207,7 +118,7 @@ typedef WXCOLORREF (__stdcall *PFNWXUGETTHEMESYSCOLOR)(WXHTHEME, int);
 typedef WXHBRUSH (__stdcall *PFNWXUGETTHEMESYSCOLORBRUSH)(WXHTHEME, int);
 typedef BOOL (__stdcall *PFNWXUGETTHEMESYSBOOL)(WXHTHEME, int);
 typedef int (__stdcall *PFNWXUGETTHEMESYSSIZE)(WXHTHEME, int);
-typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMESYSFONT)(WXHTHEME, int, WXULOGFONT *);
+typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMESYSFONT)(WXHTHEME, int, LOGFONT *);
 typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMESYSSTRING)(WXHTHEME, int, wchar_t *, int);
 typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMESYSINT)(WXHTHEME, int, int *);
 typedef BOOL (__stdcall *PFNWXUISTHEMEACTIVE)();
@@ -228,7 +139,7 @@ typedef BOOL (__stdcall *PFNWXUISTHEMEDIALOGTEXTUREENABLED)(WXHWND);
 
 typedef WXDWORD (__stdcall *PFNWXUGETTHEMEAPPPROPERTIES)();
 typedef void (__stdcall *PFNWXUSETTHEMEAPPPROPERTIES)(WXDWORD);
-typedef WXUHRESULT (__stdcall *PFNWXUGETCURRENTTHEMENAME)(wchar_t *, int, 
+typedef WXUHRESULT (__stdcall *PFNWXUGETCURRENTTHEMENAME)(wchar_t *, int,
     wchar_t *, int, wchar_t *, int);
 
 #define WXU_SZ_THDOCPROP_DISPLAYNAME                L"DisplayName"
@@ -261,6 +172,10 @@ public:
     // get the theme engine or NULL if themes are not available
     static wxUxThemeEngine *Get();
 
+    // get the theme enging or NULL if themes are not available or not used for
+    // this application
+    static wxUxThemeEngine *GetIfActive();
+
     // all uxtheme.dll functions
     wxUX_THEME_DECLARE(PFNWXUOPENTHEMEDATA, OpenThemeData)
     wxUX_THEME_DECLARE(PFNWXUCLOSETHEMEDATA, CloseThemeData)
@@ -329,7 +244,7 @@ private:
     // uxtheme.dll
     wxDynamicLibrary m_dllUxTheme;
 
-    
+
     // the one and only theme engine, initially NULL
     static wxUxThemeEngine *ms_themeEngine;
 
@@ -343,14 +258,29 @@ private:
     DECLARE_NO_COPY_CLASS(wxUxThemeEngine)
 };
 
-#if !wxUSE_UXTHEME
+#if wxUSE_UXTHEME
+
+/* static */ inline wxUxThemeEngine *wxUxThemeEngine::GetIfActive()
+{
+    wxUxThemeEngine *engine = Get();
+    return engine && engine->IsAppThemed() && engine->IsThemeActive()
+                ? engine
+                : NULL;
+}
+
+#else // !wxUSE_UXTHEME
 
 /* static */ inline wxUxThemeEngine *wxUxThemeEngine::Get()
 {
     return NULL;
 }
 
-#endif // !wxUSE_UXTHEME
+/* static */ inline wxUxThemeEngine *wxUxThemeEngine::GetIfActive()
+{
+    return NULL;
+}
+
+#endif // wxUSE_UXTHEME/!wxUSE_UXTHEME
 
 // ----------------------------------------------------------------------------
 // wxUxThemeHandle: encapsulates ::Open/CloseThemeData()
@@ -363,7 +293,7 @@ public:
     {
         wxUxThemeEngine *engine = wxUxThemeEngine::Get();
 
-        m_hTheme = 
+        m_hTheme =
             engine ? (WXHTHEME)engine->OpenThemeData(win->GetHWND(), classes)
                    : NULL;
     }