Fix wxMSW build with wxUSE_UXTHEME==0
Make wxUxThemeIsActive() available even in this case to fix compilation in some places and add the unavoidable preprocessor checks in other ones. Closes #18207.
This commit is contained in:
@@ -759,7 +759,7 @@ typedef void (wxEvtHandler::*wxAuiToolBarEventFunction)(wxAuiToolBarEvent&);
|
|||||||
#define wxEVT_COMMAND_AUITOOLBAR_MIDDLE_CLICK wxEVT_AUITOOLBAR_MIDDLE_CLICK
|
#define wxEVT_COMMAND_AUITOOLBAR_MIDDLE_CLICK wxEVT_AUITOOLBAR_MIDDLE_CLICK
|
||||||
#define wxEVT_COMMAND_AUITOOLBAR_BEGIN_DRAG wxEVT_AUITOOLBAR_BEGIN_DRAG
|
#define wxEVT_COMMAND_AUITOOLBAR_BEGIN_DRAG wxEVT_AUITOOLBAR_BEGIN_DRAG
|
||||||
|
|
||||||
#ifdef __WXMSW__
|
#if defined(__WXMSW__) && wxUSE_UXTHEME
|
||||||
#define wxHAS_NATIVE_TOOLBAR_ART
|
#define wxHAS_NATIVE_TOOLBAR_ART
|
||||||
#include "wx/aui/barartmsw.h"
|
#include "wx/aui/barartmsw.h"
|
||||||
#define wxAuiDefaultToolBarArt wxAuiMSWToolBarArt
|
#define wxAuiDefaultToolBarArt wxAuiMSWToolBarArt
|
||||||
|
@@ -318,7 +318,7 @@ protected:
|
|||||||
#define wxHAS_NATIVE_TABART
|
#define wxHAS_NATIVE_TABART
|
||||||
#include "wx/aui/tabartgtk.h"
|
#include "wx/aui/tabartgtk.h"
|
||||||
#define wxAuiDefaultTabArt wxAuiGtkTabArt
|
#define wxAuiDefaultTabArt wxAuiGtkTabArt
|
||||||
#elif defined(__WXMSW__)
|
#elif defined(__WXMSW__) && wxUSE_UXTHEME
|
||||||
#define wxHAS_NATIVE_TABART
|
#define wxHAS_NATIVE_TABART
|
||||||
#include "wx/aui/tabartmsw.h"
|
#include "wx/aui/tabartmsw.h"
|
||||||
#define wxAuiDefaultTabArt wxAuiMSWTabArt
|
#define wxAuiDefaultTabArt wxAuiMSWTabArt
|
||||||
|
@@ -13,6 +13,8 @@
|
|||||||
|
|
||||||
#include "wx/defs.h"
|
#include "wx/defs.h"
|
||||||
|
|
||||||
|
#if wxUSE_UXTHEME
|
||||||
|
|
||||||
#include "wx/msw/private.h" // we use GetHwndOf()
|
#include "wx/msw/private.h" // we use GetHwndOf()
|
||||||
#include <uxtheme.h>
|
#include <uxtheme.h>
|
||||||
|
|
||||||
@@ -253,5 +255,11 @@ private:
|
|||||||
wxDECLARE_NO_COPY_CLASS(wxUxThemeHandle);
|
wxDECLARE_NO_COPY_CLASS(wxUxThemeHandle);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#else // !wxUSE_UXTHEME
|
||||||
|
|
||||||
|
inline bool wxUxThemeIsActive() { return false; }
|
||||||
|
|
||||||
|
#endif // wxUSE_UXTHEME/!wxUSE_UXTHEME
|
||||||
|
|
||||||
#endif // _WX_UXTHEME_H_
|
#endif // _WX_UXTHEME_H_
|
||||||
|
|
||||||
|
@@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
#include "wx/defs.h"
|
#include "wx/defs.h"
|
||||||
|
|
||||||
#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__)
|
#if defined(__WXMSW__) && wxUSE_UXTHEME && !defined(__WXUNIVERSAL__)
|
||||||
#define wxHAS_SYSTEM_THEMED_CONTROL
|
#define wxHAS_SYSTEM_THEMED_CONTROL
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -13,6 +13,8 @@
|
|||||||
#pragma hdrstop
|
#pragma hdrstop
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if wxUSE_AUI && wxUSE_UXTHEME
|
||||||
|
|
||||||
#ifndef WX_PRECOMP
|
#ifndef WX_PRECOMP
|
||||||
#include "wx/bitmap.h"
|
#include "wx/bitmap.h"
|
||||||
#include "wx/dcclient.h"
|
#include "wx/dcclient.h"
|
||||||
@@ -25,8 +27,6 @@
|
|||||||
#include "wx/msw/uxtheme.h"
|
#include "wx/msw/uxtheme.h"
|
||||||
#include "wx/msw/private.h"
|
#include "wx/msw/private.h"
|
||||||
|
|
||||||
#if wxUSE_AUI
|
|
||||||
|
|
||||||
wxAuiMSWToolBarArt::wxAuiMSWToolBarArt()
|
wxAuiMSWToolBarArt::wxAuiMSWToolBarArt()
|
||||||
{
|
{
|
||||||
if ( wxUxThemeIsActive() )
|
if ( wxUxThemeIsActive() )
|
||||||
@@ -470,4 +470,4 @@ int wxAuiMSWToolBarArt::ShowDropDown(wxWindow* wnd,
|
|||||||
return wxAuiGenericToolBarArt::ShowDropDown(wnd, items);
|
return wxAuiGenericToolBarArt::ShowDropDown(wnd, items);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // wxUSE_AUI
|
#endif // wxUSE_AUI && wxUSE_UXTHEME
|
||||||
|
@@ -13,6 +13,8 @@
|
|||||||
#pragma hdrstop
|
#pragma hdrstop
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if wxUSE_AUI && wxUSE_UXTHEME && !defined(__WXUNIVERSAL__)
|
||||||
|
|
||||||
#ifndef WX_PRECOMP
|
#ifndef WX_PRECOMP
|
||||||
#include "wx/dc.h"
|
#include "wx/dc.h"
|
||||||
#endif
|
#endif
|
||||||
@@ -23,8 +25,6 @@
|
|||||||
#include "wx/msw/private.h"
|
#include "wx/msw/private.h"
|
||||||
#include "wx/renderer.h"
|
#include "wx/renderer.h"
|
||||||
|
|
||||||
#if wxUSE_AUI && !defined(__WXUNIVERSAL__)
|
|
||||||
|
|
||||||
wxAuiMSWTabArt::wxAuiMSWTabArt()
|
wxAuiMSWTabArt::wxAuiMSWTabArt()
|
||||||
{
|
{
|
||||||
m_closeBtnSize = wxDefaultSize;
|
m_closeBtnSize = wxDefaultSize;
|
||||||
@@ -469,4 +469,4 @@ bool wxAuiMSWTabArt::IsThemed() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif // wxUSE_AUI
|
#endif // wxUSE_AUI && wxUSE_UXTHEME && !defined(__WXUNIVERSAL__)
|
||||||
|
@@ -47,7 +47,10 @@
|
|||||||
#include "wx/textwrapper.h"
|
#include "wx/textwrapper.h"
|
||||||
|
|
||||||
#ifdef __WXMSW__
|
#ifdef __WXMSW__
|
||||||
#include "wx/msw/uxtheme.h"
|
#if wxUSE_UXTHEME
|
||||||
|
#include "wx/msw/uxtheme.h"
|
||||||
|
#define HAVE_MSW_THEME
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -86,7 +89,7 @@ public:
|
|||||||
// Determine the appropriate title font for the current platform.
|
// Determine the appropriate title font for the current platform.
|
||||||
titleFont = labelTitle->GetFont();
|
titleFont = labelTitle->GetFont();
|
||||||
|
|
||||||
#ifdef __WXMSW__
|
#ifdef HAVE_MSW_THEME
|
||||||
// When using themes MSW tooltips use larger bluish version of the
|
// When using themes MSW tooltips use larger bluish version of the
|
||||||
// normal font.
|
// normal font.
|
||||||
if ( UseTooltipTheme() )
|
if ( UseTooltipTheme() )
|
||||||
@@ -110,7 +113,7 @@ public:
|
|||||||
labelTitle->SetForegroundColour(wxRGBToColour(c));
|
labelTitle->SetForegroundColour(wxRGBToColour(c));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif // __WXMSW__
|
#endif // HAVE_MSW_THEME
|
||||||
{
|
{
|
||||||
// Everything else, including "classic" MSW look uses just the
|
// Everything else, including "classic" MSW look uses just the
|
||||||
// bold version of the base font.
|
// bold version of the base font.
|
||||||
@@ -132,7 +135,7 @@ public:
|
|||||||
wxTextSizerWrapper wrapper(this);
|
wxTextSizerWrapper wrapper(this);
|
||||||
wxSizer* sizerText = wrapper.CreateSizer(message, -1 /* No wrapping */);
|
wxSizer* sizerText = wrapper.CreateSizer(message, -1 /* No wrapping */);
|
||||||
|
|
||||||
#ifdef __WXMSW__
|
#ifdef HAVE_MSW_THEME
|
||||||
if ( icon.IsOk() && UseTooltipTheme() )
|
if ( icon.IsOk() && UseTooltipTheme() )
|
||||||
{
|
{
|
||||||
// Themed tooltips under MSW align the text with the title, not
|
// Themed tooltips under MSW align the text with the title, not
|
||||||
@@ -144,7 +147,7 @@ public:
|
|||||||
|
|
||||||
sizerText = sizerTextIndent;
|
sizerText = sizerTextIndent;
|
||||||
}
|
}
|
||||||
#endif // !__WXMSW__
|
#endif // HAVE_MSW_THEME
|
||||||
sizerTop->Add(sizerText,
|
sizerTop->Add(sizerText,
|
||||||
wxSizerFlags().DoubleBorder(wxLEFT|wxRIGHT|wxBOTTOM)
|
wxSizerFlags().DoubleBorder(wxLEFT|wxRIGHT|wxBOTTOM)
|
||||||
.Centre());
|
.Centre());
|
||||||
@@ -167,7 +170,7 @@ public:
|
|||||||
if ( !colStart.IsOk() )
|
if ( !colStart.IsOk() )
|
||||||
{
|
{
|
||||||
// Determine the best colour(s) to use on our own.
|
// Determine the best colour(s) to use on our own.
|
||||||
#ifdef __WXMSW__
|
#ifdef HAVE_MSW_THEME
|
||||||
if ( UseTooltipTheme() )
|
if ( UseTooltipTheme() )
|
||||||
{
|
{
|
||||||
wxUxThemeHandle hTheme(GetParent(), L"TOOLTIP");
|
wxUxThemeHandle hTheme(GetParent(), L"TOOLTIP");
|
||||||
@@ -198,7 +201,7 @@ public:
|
|||||||
colEnd = wxRGBToColour(c2);
|
colEnd = wxRGBToColour(c2);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif // __WXMSW__
|
#endif // HAVE_MSW_THEME
|
||||||
{
|
{
|
||||||
colStart = wxSystemSettings::GetColour(wxSYS_COLOUR_INFOBK);
|
colStart = wxSystemSettings::GetColour(wxSYS_COLOUR_INFOBK);
|
||||||
}
|
}
|
||||||
@@ -270,26 +273,26 @@ protected:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
#ifdef __WXMSW__
|
#ifdef HAVE_MSW_THEME
|
||||||
// Returns non-NULL theme only if we're using Win7-style tooltips.
|
// Returns non-NULL theme only if we're using Win7-style tooltips.
|
||||||
static bool UseTooltipTheme()
|
static bool UseTooltipTheme()
|
||||||
{
|
{
|
||||||
// Even themed applications under XP still use "classic" tooltips.
|
// Even themed applications under XP still use "classic" tooltips.
|
||||||
if ( wxGetWinVersion() <= wxWinVersion_XP )
|
if ( wxGetWinVersion() <= wxWinVersion_XP )
|
||||||
return false;
|
return false;
|
||||||
else
|
else
|
||||||
return wxUxThemeIsActive();
|
return wxUxThemeIsActive();
|
||||||
}
|
}
|
||||||
#endif // __WXMSW__
|
#endif // HAVE_MSW_THEME
|
||||||
|
|
||||||
// For now we just hard code the tip height, would be nice to do something
|
// For now we just hard code the tip height, would be nice to do something
|
||||||
// smarter in the future.
|
// smarter in the future.
|
||||||
static int GetTipHeight()
|
static int GetTipHeight()
|
||||||
{
|
{
|
||||||
#ifdef __WXMSW__
|
#ifdef HAVE_MSW_THEME
|
||||||
if ( UseTooltipTheme() )
|
if ( UseTooltipTheme() )
|
||||||
return 20;
|
return 20;
|
||||||
#endif // __WXMSW__
|
#endif // HAVE_MSW_THEME
|
||||||
|
|
||||||
return 15;
|
return 15;
|
||||||
}
|
}
|
||||||
|
@@ -37,9 +37,7 @@
|
|||||||
#include "wx/combo.h"
|
#include "wx/combo.h"
|
||||||
|
|
||||||
#include "wx/msw/registry.h"
|
#include "wx/msw/registry.h"
|
||||||
#if wxUSE_UXTHEME
|
|
||||||
#include "wx/msw/uxtheme.h"
|
#include "wx/msw/uxtheme.h"
|
||||||
#endif
|
|
||||||
#include "wx/msw/dc.h"
|
#include "wx/msw/dc.h"
|
||||||
|
|
||||||
#define NATIVE_TEXT_INDENT_XP 4
|
#define NATIVE_TEXT_INDENT_XP 4
|
||||||
@@ -87,7 +85,6 @@ bool wxComboCtrl::Create(wxWindow *parent,
|
|||||||
|
|
||||||
if ( !border )
|
if ( !border )
|
||||||
{
|
{
|
||||||
#if wxUSE_UXTHEME
|
|
||||||
if ( wxUxThemeIsActive() )
|
if ( wxUxThemeIsActive() )
|
||||||
{
|
{
|
||||||
// For XP, have 1-width custom border, for older version use sunken
|
// For XP, have 1-width custom border, for older version use sunken
|
||||||
@@ -95,7 +92,6 @@ bool wxComboCtrl::Create(wxWindow *parent,
|
|||||||
m_widthCustomBorder = 1;
|
m_widthCustomBorder = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
border = wxBORDER_SUNKEN;
|
border = wxBORDER_SUNKEN;
|
||||||
|
|
||||||
style = (style & ~(wxBORDER_MASK)) | border;
|
style = (style & ~(wxBORDER_MASK)) | border;
|
||||||
@@ -112,10 +108,8 @@ bool wxComboCtrl::Create(wxWindow *parent,
|
|||||||
name) )
|
name) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
#if wxUSE_UXTHEME
|
|
||||||
if ( wxUxThemeIsActive() && ::wxGetWinVersion() >= wxWinVersion_Vista )
|
if ( wxUxThemeIsActive() && ::wxGetWinVersion() >= wxWinVersion_Vista )
|
||||||
m_iFlags |= wxCC_BUTTON_STAYS_DOWN |wxCC_BUTTON_COVERS_BORDER;
|
m_iFlags |= wxCC_BUTTON_STAYS_DOWN |wxCC_BUTTON_COVERS_BORDER;
|
||||||
#endif
|
|
||||||
|
|
||||||
if ( style & wxCC_STD_BUTTON )
|
if ( style & wxCC_STD_BUTTON )
|
||||||
m_iFlags |= wxCC_POPUP_ON_MOUSE_UP;
|
m_iFlags |= wxCC_POPUP_ON_MOUSE_UP;
|
||||||
|
@@ -165,7 +165,10 @@ class MenuDrawData
|
|||||||
public:
|
public:
|
||||||
// Wrapper around standard MARGINS structure providing some helper
|
// Wrapper around standard MARGINS structure providing some helper
|
||||||
// functions and automatically initializing the margin fields to 0.
|
// functions and automatically initializing the margin fields to 0.
|
||||||
struct Margins : MARGINS
|
struct Margins
|
||||||
|
#if wxUSE_UXTHEME
|
||||||
|
: MARGINS
|
||||||
|
#endif // wxUSE_UXTHEME
|
||||||
{
|
{
|
||||||
Margins()
|
Margins()
|
||||||
{
|
{
|
||||||
@@ -193,6 +196,12 @@ public:
|
|||||||
rect.right += cyTopHeight;
|
rect.right += cyTopHeight;
|
||||||
rect.bottom += cyBottomHeight;
|
rect.bottom += cyBottomHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !wxUSE_UXTHEME
|
||||||
|
// When MARGINS struct is not available, we need to define the fields
|
||||||
|
// we use ourselves.
|
||||||
|
int cxLeftWidth, cxRightWidth, cyTopHeight, cyBottomHeight;
|
||||||
|
#endif // !wxUSE_UXTHEME
|
||||||
};
|
};
|
||||||
|
|
||||||
Margins ItemMargin; // popup item margins
|
Margins ItemMargin; // popup item margins
|
||||||
|
Reference in New Issue
Block a user