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