From f5bdfc69a576eb32f680f962feec04935f6e71eb Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 27 Feb 2011 12:48:07 +0000 Subject: [PATCH] Add wxUSE_MARKUP and wrap SetLabelMarkup() in it. Make it possible to disable all the new markup-related code by setting wxUSE_MARKUP to 0 in setup.h or using configure --disable-markup option. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67062 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- configure | 54 +++++++++++++++++++++ configure.in | 8 ++++ docs/doxygen/mainpages/const_wxusedef.h | 1 + include/wx/chkconf.h | 8 ++++ include/wx/control.h | 6 +++ include/wx/gtk/control.h | 2 + include/wx/gtk/stattext.h | 2 + include/wx/motif/setup0.h | 9 ++++ include/wx/msw/setup0.h | 9 ++++ include/wx/msw/wince/setup.h | 9 ++++ include/wx/os2/setup0.h | 9 ++++ include/wx/osx/setup0.h | 9 ++++ include/wx/palmos/setup0.h | 9 ++++ include/wx/setup_inc.h | 9 ++++ include/wx/univ/setup0.h | 9 ++++ samples/widgets/static.cpp | 64 +++++++++++++++++++++---- setup.h.in | 2 + src/common/ctrlcmn.cpp | 4 ++ src/common/markupparser.cpp | 5 +- src/gtk/control.cpp | 3 ++ src/gtk/stattext.cpp | 4 ++ 21 files changed, 223 insertions(+), 12 deletions(-) diff --git a/configure b/configure index 07d613ab1b..3ccf8165e4 100755 --- a/configure +++ b/configure @@ -1804,6 +1804,7 @@ Optional Features: --enable-dnd use Drag'n'Drop classes --enable-metafile use win32 metafiles --disable-controls disable compilation of all standard controls + --enable-markup support wxControl::SetLabelMarkup --enable-accel use accelerators --enable-animatectrl use wxAnimationCtrl class --enable-artstd use standard XPM icons in wxArtProvider @@ -9784,6 +9785,7 @@ if test "$wxUSE_CONTROLS" = "no"; then DEFAULT_wxUSE_LISTBOOK=no DEFAULT_wxUSE_LISTBOX=no DEFAULT_wxUSE_LISTCTRL=no + DEFAULT_wxUSE_MARKUP=no DEFAULT_wxUSE_NOTEBOOK=no DEFAULT_wxUSE_POPUPWIN=no DEFAULT_wxUSE_RADIOBOX=no @@ -9812,6 +9814,51 @@ if test "$wxUSE_CONTROLS" = "no"; then fi + enablestring= + defaultval=$wxUSE_ALL_FEATURES + if test -z "$defaultval"; then + if test x"$enablestring" = xdisable; then + defaultval=yes + else + defaultval=no + fi + fi + + { echo "$as_me:$LINENO: checking for --${enablestring:-enable}-markup" >&5 +echo $ECHO_N "checking for --${enablestring:-enable}-markup... $ECHO_C" >&6; } + # Check whether --enable-markup was given. +if test "${enable_markup+set}" = set; then + enableval=$enable_markup; + if test "$enableval" = yes; then + wx_cv_use_markup='wxUSE_MARKUP=yes' + else + wx_cv_use_markup='wxUSE_MARKUP=no' + fi + +else + + wx_cv_use_markup='wxUSE_MARKUP=${'DEFAULT_wxUSE_MARKUP":-$defaultval}" + +fi + + + eval "$wx_cv_use_markup" + + if test x"$enablestring" = xdisable; then + if test $wxUSE_MARKUP = no; then + result=yes + else + result=no + fi + else + result=$wxUSE_MARKUP + fi + + { echo "$as_me:$LINENO: result: $result" >&5 +echo "${ECHO_T}$result" >&6; } + + + enablestring= defaultval=$wxUSE_ALL_FEATURES if test -z "$defaultval"; then @@ -47013,6 +47060,13 @@ if test "$wxUSE_CONTROLS" = "yes"; then USES_CONTROLS=1 fi +if test "$wxUSE_MARKUP" = "yes"; then + cat >>confdefs.h <<\_ACEOF +#define wxUSE_MARKUP 1 +_ACEOF + +fi + if test "$wxUSE_ACCEL" = "yes"; then cat >>confdefs.h <<\_ACEOF #define wxUSE_ACCEL 1 diff --git a/configure.in b/configure.in index 279ff1a03d..8fd0b7a0e1 100644 --- a/configure.in +++ b/configure.in @@ -898,6 +898,7 @@ if test "$wxUSE_CONTROLS" = "no"; then DEFAULT_wxUSE_LISTBOOK=no DEFAULT_wxUSE_LISTBOX=no DEFAULT_wxUSE_LISTCTRL=no + DEFAULT_wxUSE_MARKUP=no DEFAULT_wxUSE_NOTEBOOK=no DEFAULT_wxUSE_POPUPWIN=no DEFAULT_wxUSE_RADIOBOX=no @@ -925,6 +926,9 @@ if test "$wxUSE_CONTROLS" = "no"; then DEFAULT_wxUSE_TREECTRL=no fi +dnl features affecting multiple controls +WX_ARG_FEATURE(markup, [ --enable-markup support wxControl::SetLabelMarkup], wxUSE_MARKUP) + dnl please keep the settings below in alphabetical order WX_ARG_FEATURE(accel, [ --enable-accel use accelerators], wxUSE_ACCEL) WX_ARG_FEATURE(animatectrl, [ --enable-animatectrl use wxAnimationCtrl class], wxUSE_ANIMATIONCTRL) @@ -6751,6 +6755,10 @@ if test "$wxUSE_CONTROLS" = "yes"; then USES_CONTROLS=1 fi +if test "$wxUSE_MARKUP" = "yes"; then + AC_DEFINE(wxUSE_MARKUP) +fi + if test "$wxUSE_ACCEL" = "yes"; then AC_DEFINE(wxUSE_ACCEL) USES_CONTROLS=1 diff --git a/docs/doxygen/mainpages/const_wxusedef.h b/docs/doxygen/mainpages/const_wxusedef.h index 693bce4a13..2367dfcde9 100644 --- a/docs/doxygen/mainpages/const_wxusedef.h +++ b/docs/doxygen/mainpages/const_wxusedef.h @@ -170,6 +170,7 @@ library: @itemdef{wxUSE_LONGLONG, Use wxLongLong class.} @itemdef{wxUSE_LONGLONG_NATIVE, Use native long long type in wxLongLong implementation.} @itemdef{wxUSE_LONGLONG_WX, Use generic wxLongLong implementation.} +@itemdef{wxUSE_MARKUP, Provide wxControl::SetLabelMarkup() method.} @itemdef{wxUSE_MDI, Use wxMDIParentFrame, and wxMDIChildFrame} @itemdef{wxUSE_MDI_ARCHITECTURE, Use MDI-based document-view classes.} @itemdef{wxUSE_MEDIACTRL, Use wxMediaCtrl.} diff --git a/include/wx/chkconf.h b/include/wx/chkconf.h index 10c79baad6..2e6a95cb38 100644 --- a/include/wx/chkconf.h +++ b/include/wx/chkconf.h @@ -829,6 +829,14 @@ # endif #endif /* !defined(wxUSE_LOG_DIALOG) */ +#ifndef wxUSE_MARKUP +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_MARKUP must be defined, please read comment near the top of this file." +# else +# define wxUSE_MARKUP 0 +# endif +#endif /* !defined(wxUSE_MARKUP) */ + #ifndef wxUSE_MDI # ifdef wxABORT_ON_CONFIG_ERROR # error "wxUSE_MDI must be defined, please read comment near the top of this file." diff --git a/include/wx/control.h b/include/wx/control.h index bfb0cf5fdd..b597937ef2 100644 --- a/include/wx/control.h +++ b/include/wx/control.h @@ -95,6 +95,7 @@ public: virtual wxString GetLabelText() const { return GetLabelText(GetLabel()); } +#if wxUSE_MARKUP // Set the label with markup (and mnemonics). Markup is a simple subset of // HTML with tags such as , and . By default it is not // supported i.e. all the markup is simply stripped and SetLabel() is @@ -113,6 +114,7 @@ public: { return DoSetLabelMarkup(markup); } +#endif // wxUSE_MARKUP // controls by default inherit the colours of their parents, if a @@ -183,10 +185,12 @@ protected: const wxValidator& validator, const wxString& name); +#if wxUSE_MARKUP // This function may be overridden in the derived classes to implement // support for labels with markup. The base class version simply strips the // markup and calls SetLabel() with the remaining text. virtual bool DoSetLabelMarkup(const wxString& markup); +#endif // wxUSE_MARKUP // initialize the common fields of wxCommandEvent @@ -197,9 +201,11 @@ protected: wxEllipsizeMode mode, int maxWidth, int replacementWidth); +#if wxUSE_MARKUP // Remove markup from the given string, returns empty string on error i.e. // if markup was syntactically invalid. static wxString RemoveMarkup(const wxString& markup); +#endif // wxUSE_MARKUP // this field contains the label in wx format, i.e. with '&' mnemonics, diff --git a/include/wx/gtk/control.h b/include/wx/gtk/control.h index 164337796c..fdce88e008 100644 --- a/include/wx/gtk/control.h +++ b/include/wx/gtk/control.h @@ -52,7 +52,9 @@ protected: // sets the label to the given string and also sets it for the given widget void GTKSetLabelForLabel(GtkLabel *w, const wxString& label); +#if wxUSE_MARKUP void GTKSetLabelWithMarkupForLabel(GtkLabel *w, const wxString& label); +#endif // wxUSE_MARKUP // GtkFrame helpers GtkWidget* GTKCreateFrame(const wxString& label); diff --git a/include/wx/gtk/stattext.h b/include/wx/gtk/stattext.h index d3a4bc1576..78241efe29 100644 --- a/include/wx/gtk/stattext.h +++ b/include/wx/gtk/stattext.h @@ -56,7 +56,9 @@ protected: virtual wxString DoGetLabel() const; virtual void DoSetLabel(const wxString& str); +#if wxUSE_MARKUP virtual bool DoSetLabelMarkup(const wxString& markup); +#endif // wxUSE_MARKUP private: // Common part of SetLabel() and DoSetLabelMarkup(). diff --git a/include/wx/motif/setup0.h b/include/wx/motif/setup0.h index 4fc403229b..720fea7abc 100644 --- a/include/wx/motif/setup0.h +++ b/include/wx/motif/setup0.h @@ -714,6 +714,15 @@ // Recommended setting: 1 (don't change except for very special programs) #define wxUSE_CONTROLS 1 +// Support markup in control labels, i.e. provide wxControl::SetLabelMarkup(). +// Currently markup is supported only by a few controls and only some ports but +// their number will increase with time. +// +// Default is 1 +// +// Recommended setting: 1 (may be set to 0 if you want to save on code size) +#define wxUSE_MARKUP 1 + // wxPopupWindow class is a top level transient window. It is currently used // to implement wxTipWindow // diff --git a/include/wx/msw/setup0.h b/include/wx/msw/setup0.h index 703e872ad9..95fb470bd8 100644 --- a/include/wx/msw/setup0.h +++ b/include/wx/msw/setup0.h @@ -714,6 +714,15 @@ // Recommended setting: 1 (don't change except for very special programs) #define wxUSE_CONTROLS 1 +// Support markup in control labels, i.e. provide wxControl::SetLabelMarkup(). +// Currently markup is supported only by a few controls and only some ports but +// their number will increase with time. +// +// Default is 1 +// +// Recommended setting: 1 (may be set to 0 if you want to save on code size) +#define wxUSE_MARKUP 1 + // wxPopupWindow class is a top level transient window. It is currently used // to implement wxTipWindow // diff --git a/include/wx/msw/wince/setup.h b/include/wx/msw/wince/setup.h index d01ee02635..649c8b845d 100644 --- a/include/wx/msw/wince/setup.h +++ b/include/wx/msw/wince/setup.h @@ -714,6 +714,15 @@ // Recommended setting: 1 (don't change except for very special programs) #define wxUSE_CONTROLS 1 +// Support markup in control labels, i.e. provide wxControl::SetLabelMarkup(). +// Currently markup is supported only by a few controls and only some ports but +// their number will increase with time. +// +// Default is 1 +// +// Recommended setting: 1 (may be set to 0 if you want to save on code size) +#define wxUSE_MARKUP 1 + // wxPopupWindow class is a top level transient window. It is currently used // to implement wxTipWindow // diff --git a/include/wx/os2/setup0.h b/include/wx/os2/setup0.h index cf5b66fbaa..be2ce532ce 100644 --- a/include/wx/os2/setup0.h +++ b/include/wx/os2/setup0.h @@ -714,6 +714,15 @@ // Recommended setting: 1 (don't change except for very special programs) #define wxUSE_CONTROLS 1 +// Support markup in control labels, i.e. provide wxControl::SetLabelMarkup(). +// Currently markup is supported only by a few controls and only some ports but +// their number will increase with time. +// +// Default is 1 +// +// Recommended setting: 1 (may be set to 0 if you want to save on code size) +#define wxUSE_MARKUP 1 + // wxPopupWindow class is a top level transient window. It is currently used // to implement wxTipWindow // diff --git a/include/wx/osx/setup0.h b/include/wx/osx/setup0.h index 812597c67e..5ed9112a04 100644 --- a/include/wx/osx/setup0.h +++ b/include/wx/osx/setup0.h @@ -715,6 +715,15 @@ // Recommended setting: 1 (don't change except for very special programs) #define wxUSE_CONTROLS 1 +// Support markup in control labels, i.e. provide wxControl::SetLabelMarkup(). +// Currently markup is supported only by a few controls and only some ports but +// their number will increase with time. +// +// Default is 1 +// +// Recommended setting: 1 (may be set to 0 if you want to save on code size) +#define wxUSE_MARKUP 1 + // wxPopupWindow class is a top level transient window. It is currently used // to implement wxTipWindow // diff --git a/include/wx/palmos/setup0.h b/include/wx/palmos/setup0.h index 9b7f64783d..f1c772f57f 100644 --- a/include/wx/palmos/setup0.h +++ b/include/wx/palmos/setup0.h @@ -714,6 +714,15 @@ // Recommended setting: 1 (don't change except for very special programs) #define wxUSE_CONTROLS 1 +// Support markup in control labels, i.e. provide wxControl::SetLabelMarkup(). +// Currently markup is supported only by a few controls and only some ports but +// their number will increase with time. +// +// Default is 1 +// +// Recommended setting: 1 (may be set to 0 if you want to save on code size) +#define wxUSE_MARKUP 1 + // wxPopupWindow class is a top level transient window. It is currently used // to implement wxTipWindow // diff --git a/include/wx/setup_inc.h b/include/wx/setup_inc.h index 8b917569bc..59565e19a0 100644 --- a/include/wx/setup_inc.h +++ b/include/wx/setup_inc.h @@ -710,6 +710,15 @@ // Recommended setting: 1 (don't change except for very special programs) #define wxUSE_CONTROLS 1 +// Support markup in control labels, i.e. provide wxControl::SetLabelMarkup(). +// Currently markup is supported only by a few controls and only some ports but +// their number will increase with time. +// +// Default is 1 +// +// Recommended setting: 1 (may be set to 0 if you want to save on code size) +#define wxUSE_MARKUP 1 + // wxPopupWindow class is a top level transient window. It is currently used // to implement wxTipWindow // diff --git a/include/wx/univ/setup0.h b/include/wx/univ/setup0.h index d07c861209..be0bc2edbe 100644 --- a/include/wx/univ/setup0.h +++ b/include/wx/univ/setup0.h @@ -713,6 +713,15 @@ // Recommended setting: 1 (don't change except for very special programs) #define wxUSE_CONTROLS 1 +// Support markup in control labels, i.e. provide wxControl::SetLabelMarkup(). +// Currently markup is supported only by a few controls and only some ports but +// their number will increase with time. +// +// Default is 1 +// +// Recommended setting: 1 (may be set to 0 if you want to save on code size) +#define wxUSE_MARKUP 1 + // wxPopupWindow class is a top level transient window. It is currently used // to implement wxTipWindow // diff --git a/samples/widgets/static.cpp b/samples/widgets/static.cpp index faa9756e53..a2a363c6d5 100644 --- a/samples/widgets/static.cpp +++ b/samples/widgets/static.cpp @@ -99,7 +99,9 @@ public: Widgets widgets; widgets.push_back(m_sizerStatBox->GetStaticBox()); widgets.push_back(m_statText); +#if wxUSE_MARKUP widgets.push_back(m_statMarkup); +#endif // wxUSE_MARKUP #if wxUSE_STATLINE widgets.push_back(m_statLine); #endif // wxUSE_STATLINE @@ -118,7 +120,9 @@ protected: void OnButtonReset(wxCommandEvent& event); void OnButtonBoxText(wxCommandEvent& event); void OnButtonLabelText(wxCommandEvent& event); +#if wxUSE_MARKUP void OnButtonLabelWithMarkupText(wxCommandEvent& event); +#endif // wxUSE_MARKUP void OnMouseEvent(wxMouseEvent& event); // reset all parameters @@ -134,9 +138,12 @@ protected: wxCheckBox *m_chkVert, *m_chkGeneric, *m_chkAutoResize, - *m_chkEllipsize, - *m_chkMarkup, + *m_chkEllipsize; + +#if wxUSE_MARKUP + wxCheckBox *m_chkMarkup, *m_chkGreen; +#endif // wxUSE_MARKUP wxRadioBox *m_radioHAlign, *m_radioVAlign, @@ -144,8 +151,12 @@ protected: // the controls and the sizer containing them wxStaticBoxSizer *m_sizerStatBox; - wxStaticTextBase *m_statText, - *m_statMarkup; + wxStaticTextBase *m_statText; + +#if wxUSE_MARKUP + wxStaticTextBase *m_statMarkup; +#endif // wxUSE_MARKUP + #if wxUSE_STATLINE wxStaticLine *m_statLine; #endif // wxUSE_STATLINE @@ -153,8 +164,11 @@ protected: // the text entries for command parameters wxTextCtrl *m_textBox, - *m_textLabel, - *m_textLabelWithMarkup; + *m_textLabel; + +#if wxUSE_MARKUP + wxTextCtrl *m_textLabelWithMarkup; +#endif // wxUSE_MARKUP private: DECLARE_EVENT_TABLE() @@ -168,7 +182,9 @@ private: BEGIN_EVENT_TABLE(StaticWidgetsPage, WidgetsPage) EVT_BUTTON(StaticPage_Reset, StaticWidgetsPage::OnButtonReset) EVT_BUTTON(StaticPage_LabelText, StaticWidgetsPage::OnButtonLabelText) +#if wxUSE_MARKUP EVT_BUTTON(StaticPage_LabelTextWithMarkup, StaticWidgetsPage::OnButtonLabelWithMarkupText) +#endif // wxUSE_MARKUP EVT_BUTTON(StaticPage_BoxText, StaticWidgetsPage::OnButtonBoxText) EVT_CHECKBOX(wxID_ANY, StaticWidgetsPage::OnCheckOrRadioBox) @@ -189,9 +205,12 @@ StaticWidgetsPage::StaticWidgetsPage(WidgetsBookCtrl *book, { // init everything m_chkVert = - m_chkAutoResize = (wxCheckBox *)NULL; - m_chkGeneric = NULL; - m_chkGreen = NULL; + m_chkAutoResize = + m_chkGeneric = +#if wxUSE_MARKUP + m_chkGreen = +#endif // wxUSE_MARKUP + NULL; m_radioHAlign = m_radioVAlign = (wxRadioBox *)NULL; @@ -199,12 +218,19 @@ StaticWidgetsPage::StaticWidgetsPage(WidgetsBookCtrl *book, #if wxUSE_STATLINE m_statLine = (wxStaticLine *)NULL; #endif // wxUSE_STATLINE +#if wxUSE_MARKUP m_statText = m_statMarkup = NULL; +#endif // wxUSE_MARKUP m_sizerStatBox = (wxStaticBoxSizer *)NULL; m_sizerStatic = (wxSizer *)NULL; - m_textBox = m_textLabel = m_textLabelWithMarkup = NULL; + m_textBox = + m_textLabel = +#if wxUSE_MARKUP + m_textLabelWithMarkup = +#endif // wxUSE_MARKUP + NULL; } void StaticWidgetsPage::CreateContent() @@ -288,6 +314,7 @@ void StaticWidgetsPage::CreateContent() sizerMiddle->Add(m_textLabel, 0, wxEXPAND|wxALL, 5); sizerMiddle->Add(b2, 0, wxLEFT|wxBOTTOM, 5); +#if wxUSE_MARKUP m_textLabelWithMarkup = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxHSCROLL); @@ -301,7 +328,9 @@ void StaticWidgetsPage::CreateContent() m_chkGreen = CreateCheckBoxAndAddToSizer(sizerLeft, "Decorated label on g&reen"); + sizerMiddle->Add(m_chkGreen, 0, wxALL, 5); +#endif // wxUSE_MARKUP // final initializations // NB: must be done _before_ calling CreateStatic() @@ -310,10 +339,12 @@ void StaticWidgetsPage::CreateContent() m_textBox->SetValue(wxT("This is a &box")); m_textLabel->SetValue(wxT("And this is a\n\tlabel inside the box with a &mnemonic.\n") wxT("Only this text is affected by the ellipsize settings.")); +#if wxUSE_MARKUP m_textLabelWithMarkup->SetValue(wxT("Another label, this time decorated ") wxT("with markup; here you need entities ") wxT("for the symbols: < > & ' " ") wxT(" but you can still place &mnemonics...")); +#endif // wxUSE_MARKUP // right pane wxSizer *sizerRight = new wxBoxSizer(wxHORIZONTAL); @@ -354,7 +385,9 @@ void StaticWidgetsPage::CreateStatic() // delete m_sizerStatBox; -- deleted by Remove() m_sizerStatic->Remove(m_sizerStatBox); delete m_statText; +#if wxUSE_MARKUP delete m_statMarkup; +#endif // wxUSE_MARKUP #if wxUSE_STATLINE delete m_statLine; #endif // wxUSE_STATLINE @@ -448,10 +481,12 @@ void StaticWidgetsPage::CreateStatic() m_textLabel->GetValue(), wxDefaultPosition, wxDefaultSize, flagsDummyText); +#if wxUSE_MARKUP m_statMarkup = new wxGenericStaticText(this, wxID_ANY, wxString(), wxDefaultPosition, wxDefaultSize, flagsText); +#endif // wxUSE_MARKUP } else // use native versions { @@ -459,16 +494,21 @@ void StaticWidgetsPage::CreateStatic() m_textLabel->GetValue(), wxDefaultPosition, wxDefaultSize, flagsDummyText); +#if wxUSE_MARKUP m_statMarkup = new wxStaticText(this, wxID_ANY, wxString(), wxDefaultPosition, wxDefaultSize, flagsText); +#endif // wxUSE_MARKUP } +#if wxUSE_MARKUP m_statMarkup->SetLabelMarkup(m_textLabelWithMarkup->GetValue()); if ( m_chkGreen->GetValue() ) m_statMarkup->SetBackgroundColour(*wxGREEN); +#endif // wxUSE_MARKUP + #if wxUSE_STATLINE m_statLine = new wxStaticLine(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, @@ -479,7 +519,9 @@ void StaticWidgetsPage::CreateStatic() #if wxUSE_STATLINE m_sizerStatBox->Add(m_statLine, 0, wxGROW | wxALL, 5); #endif // wxUSE_STATLINE +#if wxUSE_MARKUP m_sizerStatBox->Add(m_statMarkup, 1, wxGROW | wxALL, 5); +#endif // wxUSE_MARKUP m_sizerStatic->Add(m_sizerStatBox, 1, wxGROW); @@ -532,6 +574,7 @@ void StaticWidgetsPage::OnButtonLabelText(wxCommandEvent& WXUNUSED(event)) m_statText->GetLabelText()); } +#if wxUSE_MARKUP void StaticWidgetsPage::OnButtonLabelWithMarkupText(wxCommandEvent& WXUNUSED(event)) { m_statMarkup->SetLabelMarkup(m_textLabelWithMarkup->GetValue()); @@ -544,6 +587,7 @@ void StaticWidgetsPage::OnButtonLabelWithMarkupText(wxCommandEvent& WXUNUSED(eve wxLogMessage(wxT("The label text is '%s'"), m_statMarkup->GetLabelText()); } +#endif // wxUSE_MARKUP void StaticWidgetsPage::OnMouseEvent(wxMouseEvent& event) { diff --git a/setup.h.in b/setup.h.in index b1f8916a9f..6ac7576dbc 100644 --- a/setup.h.in +++ b/setup.h.in @@ -349,6 +349,8 @@ #define wxUSE_CONTROLS 0 +#define wxUSE_MARKUP 0 + #define wxUSE_POPUPWIN 0 #define wxUSE_TIPWINDOW 0 diff --git a/src/common/ctrlcmn.cpp b/src/common/ctrlcmn.cpp index 72e1d342b8..82bcefd814 100644 --- a/src/common/ctrlcmn.cpp +++ b/src/common/ctrlcmn.cpp @@ -236,6 +236,8 @@ wxControlBase::GetCompositeControlsDefaultAttributes(wxWindowVariant WXUNUSED(va // wxControl markup support // ---------------------------------------------------------------------------- +#if wxUSE_MARKUP + /* static */ wxString wxControlBase::RemoveMarkup(const wxString& markup) { @@ -253,6 +255,8 @@ bool wxControlBase::DoSetLabelMarkup(const wxString& markup) return true; } +#endif // wxUSE_MARKUP + // ---------------------------------------------------------------------------- // wxControlBase - ellipsization code // ---------------------------------------------------------------------------- diff --git a/src/common/markupparser.cpp b/src/common/markupparser.cpp index 8320e35eca..5701ee64fa 100644 --- a/src/common/markupparser.cpp +++ b/src/common/markupparser.cpp @@ -23,8 +23,7 @@ #pragma hdrstop #endif -#ifndef WX_PRECOMP -#endif // WX_PRECOMP +#if wxUSE_MARKUP #include "wx/private/markupparser.h" @@ -473,3 +472,5 @@ wxString wxMarkupParser::Strip(const wxString& text) return output.GetText(); } + +#endif // wxUSE_MARKUP diff --git a/src/gtk/control.cpp b/src/gtk/control.cpp index 7fcdb2192e..5a06a3910f 100644 --- a/src/gtk/control.cpp +++ b/src/gtk/control.cpp @@ -127,12 +127,15 @@ void wxControl::GTKSetLabelForLabel(GtkLabel *w, const wxString& label) gtk_label_set_text_with_mnemonic(w, wxGTK_CONV(labelGTK)); } +#if wxUSE_MARKUP + void wxControl::GTKSetLabelWithMarkupForLabel(GtkLabel *w, const wxString& label) { const wxString labelGTK = GTKConvertMnemonicsWithMarkup(label); gtk_label_set_markup_with_mnemonic(w, wxGTK_CONV(labelGTK)); } +#endif // wxUSE_MARKUP // ---------------------------------------------------------------------------- // GtkFrame helpers diff --git a/src/gtk/stattext.cpp b/src/gtk/stattext.cpp index e7139db0a3..7fd12e10ab 100644 --- a/src/gtk/stattext.cpp +++ b/src/gtk/stattext.cpp @@ -133,6 +133,8 @@ void wxStaticText::SetLabel(const wxString& label) GTKDoSetLabel(&wxStaticText::GTKSetLabelForLabel, label); } +#if wxUSE_MARKUP + bool wxStaticText::DoSetLabelMarkup(const wxString& markup) { const wxString stripped = RemoveMarkup(markup); @@ -146,6 +148,8 @@ bool wxStaticText::DoSetLabelMarkup(const wxString& markup) return true; } +#endif // wxUSE_MARKUP + bool wxStaticText::SetFont( const wxFont &font ) { const bool wasUnderlined = GetFont().GetUnderlined(); -- 2.47.2