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
This commit is contained in:
Vadim Zeitlin
2011-02-27 12:48:07 +00:00
parent b55bc1a2ca
commit f5bdfc69a5
21 changed files with 223 additions and 12 deletions

54
configure vendored
View File

@@ -1804,6 +1804,7 @@ Optional Features:
--enable-dnd use Drag'n'Drop classes --enable-dnd use Drag'n'Drop classes
--enable-metafile use win32 metafiles --enable-metafile use win32 metafiles
--disable-controls disable compilation of all standard controls --disable-controls disable compilation of all standard controls
--enable-markup support wxControl::SetLabelMarkup
--enable-accel use accelerators --enable-accel use accelerators
--enable-animatectrl use wxAnimationCtrl class --enable-animatectrl use wxAnimationCtrl class
--enable-artstd use standard XPM icons in wxArtProvider --enable-artstd use standard XPM icons in wxArtProvider
@@ -9784,6 +9785,7 @@ if test "$wxUSE_CONTROLS" = "no"; then
DEFAULT_wxUSE_LISTBOOK=no DEFAULT_wxUSE_LISTBOOK=no
DEFAULT_wxUSE_LISTBOX=no DEFAULT_wxUSE_LISTBOX=no
DEFAULT_wxUSE_LISTCTRL=no DEFAULT_wxUSE_LISTCTRL=no
DEFAULT_wxUSE_MARKUP=no
DEFAULT_wxUSE_NOTEBOOK=no DEFAULT_wxUSE_NOTEBOOK=no
DEFAULT_wxUSE_POPUPWIN=no DEFAULT_wxUSE_POPUPWIN=no
DEFAULT_wxUSE_RADIOBOX=no DEFAULT_wxUSE_RADIOBOX=no
@@ -9812,6 +9814,51 @@ if test "$wxUSE_CONTROLS" = "no"; then
fi 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= enablestring=
defaultval=$wxUSE_ALL_FEATURES defaultval=$wxUSE_ALL_FEATURES
if test -z "$defaultval"; then if test -z "$defaultval"; then
@@ -47013,6 +47060,13 @@ if test "$wxUSE_CONTROLS" = "yes"; then
USES_CONTROLS=1 USES_CONTROLS=1
fi fi
if test "$wxUSE_MARKUP" = "yes"; then
cat >>confdefs.h <<\_ACEOF
#define wxUSE_MARKUP 1
_ACEOF
fi
if test "$wxUSE_ACCEL" = "yes"; then if test "$wxUSE_ACCEL" = "yes"; then
cat >>confdefs.h <<\_ACEOF cat >>confdefs.h <<\_ACEOF
#define wxUSE_ACCEL 1 #define wxUSE_ACCEL 1

View File

@@ -898,6 +898,7 @@ if test "$wxUSE_CONTROLS" = "no"; then
DEFAULT_wxUSE_LISTBOOK=no DEFAULT_wxUSE_LISTBOOK=no
DEFAULT_wxUSE_LISTBOX=no DEFAULT_wxUSE_LISTBOX=no
DEFAULT_wxUSE_LISTCTRL=no DEFAULT_wxUSE_LISTCTRL=no
DEFAULT_wxUSE_MARKUP=no
DEFAULT_wxUSE_NOTEBOOK=no DEFAULT_wxUSE_NOTEBOOK=no
DEFAULT_wxUSE_POPUPWIN=no DEFAULT_wxUSE_POPUPWIN=no
DEFAULT_wxUSE_RADIOBOX=no DEFAULT_wxUSE_RADIOBOX=no
@@ -925,6 +926,9 @@ if test "$wxUSE_CONTROLS" = "no"; then
DEFAULT_wxUSE_TREECTRL=no DEFAULT_wxUSE_TREECTRL=no
fi 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 dnl please keep the settings below in alphabetical order
WX_ARG_FEATURE(accel, [ --enable-accel use accelerators], wxUSE_ACCEL) WX_ARG_FEATURE(accel, [ --enable-accel use accelerators], wxUSE_ACCEL)
WX_ARG_FEATURE(animatectrl, [ --enable-animatectrl use wxAnimationCtrl class], wxUSE_ANIMATIONCTRL) WX_ARG_FEATURE(animatectrl, [ --enable-animatectrl use wxAnimationCtrl class], wxUSE_ANIMATIONCTRL)
@@ -6751,6 +6755,10 @@ if test "$wxUSE_CONTROLS" = "yes"; then
USES_CONTROLS=1 USES_CONTROLS=1
fi fi
if test "$wxUSE_MARKUP" = "yes"; then
AC_DEFINE(wxUSE_MARKUP)
fi
if test "$wxUSE_ACCEL" = "yes"; then if test "$wxUSE_ACCEL" = "yes"; then
AC_DEFINE(wxUSE_ACCEL) AC_DEFINE(wxUSE_ACCEL)
USES_CONTROLS=1 USES_CONTROLS=1

View File

@@ -170,6 +170,7 @@ library:
@itemdef{wxUSE_LONGLONG, Use wxLongLong class.} @itemdef{wxUSE_LONGLONG, Use wxLongLong class.}
@itemdef{wxUSE_LONGLONG_NATIVE, Use native <tt>long long</tt> type in wxLongLong implementation.} @itemdef{wxUSE_LONGLONG_NATIVE, Use native <tt>long long</tt> type in wxLongLong implementation.}
@itemdef{wxUSE_LONGLONG_WX, Use generic 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, Use wxMDIParentFrame, and wxMDIChildFrame}
@itemdef{wxUSE_MDI_ARCHITECTURE, Use MDI-based document-view classes.} @itemdef{wxUSE_MDI_ARCHITECTURE, Use MDI-based document-view classes.}
@itemdef{wxUSE_MEDIACTRL, Use wxMediaCtrl.} @itemdef{wxUSE_MEDIACTRL, Use wxMediaCtrl.}

View File

@@ -829,6 +829,14 @@
# endif # endif
#endif /* !defined(wxUSE_LOG_DIALOG) */ #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 #ifndef wxUSE_MDI
# ifdef wxABORT_ON_CONFIG_ERROR # ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_MDI must be defined, please read comment near the top of this file." # error "wxUSE_MDI must be defined, please read comment near the top of this file."

View File

@@ -95,6 +95,7 @@ public:
virtual wxString GetLabelText() const { return GetLabelText(GetLabel()); } virtual wxString GetLabelText() const { return GetLabelText(GetLabel()); }
#if wxUSE_MARKUP
// Set the label with markup (and mnemonics). Markup is a simple subset of // Set the label with markup (and mnemonics). Markup is a simple subset of
// HTML with tags such as <b>, <i> and <span>. By default it is not // HTML with tags such as <b>, <i> and <span>. By default it is not
// supported i.e. all the markup is simply stripped and SetLabel() is // supported i.e. all the markup is simply stripped and SetLabel() is
@@ -113,6 +114,7 @@ public:
{ {
return DoSetLabelMarkup(markup); return DoSetLabelMarkup(markup);
} }
#endif // wxUSE_MARKUP
// controls by default inherit the colours of their parents, if a // controls by default inherit the colours of their parents, if a
@@ -183,10 +185,12 @@ protected:
const wxValidator& validator, const wxValidator& validator,
const wxString& name); const wxString& name);
#if wxUSE_MARKUP
// This function may be overridden in the derived classes to implement // This function may be overridden in the derived classes to implement
// support for labels with markup. The base class version simply strips the // support for labels with markup. The base class version simply strips the
// markup and calls SetLabel() with the remaining text. // markup and calls SetLabel() with the remaining text.
virtual bool DoSetLabelMarkup(const wxString& markup); virtual bool DoSetLabelMarkup(const wxString& markup);
#endif // wxUSE_MARKUP
// initialize the common fields of wxCommandEvent // initialize the common fields of wxCommandEvent
@@ -197,9 +201,11 @@ protected:
wxEllipsizeMode mode, int maxWidth, wxEllipsizeMode mode, int maxWidth,
int replacementWidth); int replacementWidth);
#if wxUSE_MARKUP
// Remove markup from the given string, returns empty string on error i.e. // Remove markup from the given string, returns empty string on error i.e.
// if markup was syntactically invalid. // if markup was syntactically invalid.
static wxString RemoveMarkup(const wxString& markup); static wxString RemoveMarkup(const wxString& markup);
#endif // wxUSE_MARKUP
// this field contains the label in wx format, i.e. with '&' mnemonics, // this field contains the label in wx format, i.e. with '&' mnemonics,

View File

@@ -52,7 +52,9 @@ protected:
// sets the label to the given string and also sets it for the given widget // sets the label to the given string and also sets it for the given widget
void GTKSetLabelForLabel(GtkLabel *w, const wxString& label); void GTKSetLabelForLabel(GtkLabel *w, const wxString& label);
#if wxUSE_MARKUP
void GTKSetLabelWithMarkupForLabel(GtkLabel *w, const wxString& label); void GTKSetLabelWithMarkupForLabel(GtkLabel *w, const wxString& label);
#endif // wxUSE_MARKUP
// GtkFrame helpers // GtkFrame helpers
GtkWidget* GTKCreateFrame(const wxString& label); GtkWidget* GTKCreateFrame(const wxString& label);

View File

@@ -56,7 +56,9 @@ protected:
virtual wxString DoGetLabel() const; virtual wxString DoGetLabel() const;
virtual void DoSetLabel(const wxString& str); virtual void DoSetLabel(const wxString& str);
#if wxUSE_MARKUP
virtual bool DoSetLabelMarkup(const wxString& markup); virtual bool DoSetLabelMarkup(const wxString& markup);
#endif // wxUSE_MARKUP
private: private:
// Common part of SetLabel() and DoSetLabelMarkup(). // Common part of SetLabel() and DoSetLabelMarkup().

View File

@@ -714,6 +714,15 @@
// Recommended setting: 1 (don't change except for very special programs) // Recommended setting: 1 (don't change except for very special programs)
#define wxUSE_CONTROLS 1 #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 // wxPopupWindow class is a top level transient window. It is currently used
// to implement wxTipWindow // to implement wxTipWindow
// //

View File

@@ -714,6 +714,15 @@
// Recommended setting: 1 (don't change except for very special programs) // Recommended setting: 1 (don't change except for very special programs)
#define wxUSE_CONTROLS 1 #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 // wxPopupWindow class is a top level transient window. It is currently used
// to implement wxTipWindow // to implement wxTipWindow
// //

View File

@@ -714,6 +714,15 @@
// Recommended setting: 1 (don't change except for very special programs) // Recommended setting: 1 (don't change except for very special programs)
#define wxUSE_CONTROLS 1 #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 // wxPopupWindow class is a top level transient window. It is currently used
// to implement wxTipWindow // to implement wxTipWindow
// //

View File

@@ -714,6 +714,15 @@
// Recommended setting: 1 (don't change except for very special programs) // Recommended setting: 1 (don't change except for very special programs)
#define wxUSE_CONTROLS 1 #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 // wxPopupWindow class is a top level transient window. It is currently used
// to implement wxTipWindow // to implement wxTipWindow
// //

View File

@@ -715,6 +715,15 @@
// Recommended setting: 1 (don't change except for very special programs) // Recommended setting: 1 (don't change except for very special programs)
#define wxUSE_CONTROLS 1 #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 // wxPopupWindow class is a top level transient window. It is currently used
// to implement wxTipWindow // to implement wxTipWindow
// //

View File

@@ -714,6 +714,15 @@
// Recommended setting: 1 (don't change except for very special programs) // Recommended setting: 1 (don't change except for very special programs)
#define wxUSE_CONTROLS 1 #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 // wxPopupWindow class is a top level transient window. It is currently used
// to implement wxTipWindow // to implement wxTipWindow
// //

View File

@@ -710,6 +710,15 @@
// Recommended setting: 1 (don't change except for very special programs) // Recommended setting: 1 (don't change except for very special programs)
#define wxUSE_CONTROLS 1 #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 // wxPopupWindow class is a top level transient window. It is currently used
// to implement wxTipWindow // to implement wxTipWindow
// //

View File

@@ -713,6 +713,15 @@
// Recommended setting: 1 (don't change except for very special programs) // Recommended setting: 1 (don't change except for very special programs)
#define wxUSE_CONTROLS 1 #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 // wxPopupWindow class is a top level transient window. It is currently used
// to implement wxTipWindow // to implement wxTipWindow
// //

View File

@@ -99,7 +99,9 @@ public:
Widgets widgets; Widgets widgets;
widgets.push_back(m_sizerStatBox->GetStaticBox()); widgets.push_back(m_sizerStatBox->GetStaticBox());
widgets.push_back(m_statText); widgets.push_back(m_statText);
#if wxUSE_MARKUP
widgets.push_back(m_statMarkup); widgets.push_back(m_statMarkup);
#endif // wxUSE_MARKUP
#if wxUSE_STATLINE #if wxUSE_STATLINE
widgets.push_back(m_statLine); widgets.push_back(m_statLine);
#endif // wxUSE_STATLINE #endif // wxUSE_STATLINE
@@ -118,7 +120,9 @@ protected:
void OnButtonReset(wxCommandEvent& event); void OnButtonReset(wxCommandEvent& event);
void OnButtonBoxText(wxCommandEvent& event); void OnButtonBoxText(wxCommandEvent& event);
void OnButtonLabelText(wxCommandEvent& event); void OnButtonLabelText(wxCommandEvent& event);
#if wxUSE_MARKUP
void OnButtonLabelWithMarkupText(wxCommandEvent& event); void OnButtonLabelWithMarkupText(wxCommandEvent& event);
#endif // wxUSE_MARKUP
void OnMouseEvent(wxMouseEvent& event); void OnMouseEvent(wxMouseEvent& event);
// reset all parameters // reset all parameters
@@ -134,9 +138,12 @@ protected:
wxCheckBox *m_chkVert, wxCheckBox *m_chkVert,
*m_chkGeneric, *m_chkGeneric,
*m_chkAutoResize, *m_chkAutoResize,
*m_chkEllipsize, *m_chkEllipsize;
*m_chkMarkup,
#if wxUSE_MARKUP
wxCheckBox *m_chkMarkup,
*m_chkGreen; *m_chkGreen;
#endif // wxUSE_MARKUP
wxRadioBox *m_radioHAlign, wxRadioBox *m_radioHAlign,
*m_radioVAlign, *m_radioVAlign,
@@ -144,8 +151,12 @@ protected:
// the controls and the sizer containing them // the controls and the sizer containing them
wxStaticBoxSizer *m_sizerStatBox; wxStaticBoxSizer *m_sizerStatBox;
wxStaticTextBase *m_statText, wxStaticTextBase *m_statText;
*m_statMarkup;
#if wxUSE_MARKUP
wxStaticTextBase *m_statMarkup;
#endif // wxUSE_MARKUP
#if wxUSE_STATLINE #if wxUSE_STATLINE
wxStaticLine *m_statLine; wxStaticLine *m_statLine;
#endif // wxUSE_STATLINE #endif // wxUSE_STATLINE
@@ -153,8 +164,11 @@ protected:
// the text entries for command parameters // the text entries for command parameters
wxTextCtrl *m_textBox, wxTextCtrl *m_textBox,
*m_textLabel, *m_textLabel;
*m_textLabelWithMarkup;
#if wxUSE_MARKUP
wxTextCtrl *m_textLabelWithMarkup;
#endif // wxUSE_MARKUP
private: private:
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
@@ -168,7 +182,9 @@ private:
BEGIN_EVENT_TABLE(StaticWidgetsPage, WidgetsPage) BEGIN_EVENT_TABLE(StaticWidgetsPage, WidgetsPage)
EVT_BUTTON(StaticPage_Reset, StaticWidgetsPage::OnButtonReset) EVT_BUTTON(StaticPage_Reset, StaticWidgetsPage::OnButtonReset)
EVT_BUTTON(StaticPage_LabelText, StaticWidgetsPage::OnButtonLabelText) EVT_BUTTON(StaticPage_LabelText, StaticWidgetsPage::OnButtonLabelText)
#if wxUSE_MARKUP
EVT_BUTTON(StaticPage_LabelTextWithMarkup, StaticWidgetsPage::OnButtonLabelWithMarkupText) EVT_BUTTON(StaticPage_LabelTextWithMarkup, StaticWidgetsPage::OnButtonLabelWithMarkupText)
#endif // wxUSE_MARKUP
EVT_BUTTON(StaticPage_BoxText, StaticWidgetsPage::OnButtonBoxText) EVT_BUTTON(StaticPage_BoxText, StaticWidgetsPage::OnButtonBoxText)
EVT_CHECKBOX(wxID_ANY, StaticWidgetsPage::OnCheckOrRadioBox) EVT_CHECKBOX(wxID_ANY, StaticWidgetsPage::OnCheckOrRadioBox)
@@ -189,9 +205,12 @@ StaticWidgetsPage::StaticWidgetsPage(WidgetsBookCtrl *book,
{ {
// init everything // init everything
m_chkVert = m_chkVert =
m_chkAutoResize = (wxCheckBox *)NULL; m_chkAutoResize =
m_chkGeneric = NULL; m_chkGeneric =
m_chkGreen = NULL; #if wxUSE_MARKUP
m_chkGreen =
#endif // wxUSE_MARKUP
NULL;
m_radioHAlign = m_radioHAlign =
m_radioVAlign = (wxRadioBox *)NULL; m_radioVAlign = (wxRadioBox *)NULL;
@@ -199,12 +218,19 @@ StaticWidgetsPage::StaticWidgetsPage(WidgetsBookCtrl *book,
#if wxUSE_STATLINE #if wxUSE_STATLINE
m_statLine = (wxStaticLine *)NULL; m_statLine = (wxStaticLine *)NULL;
#endif // wxUSE_STATLINE #endif // wxUSE_STATLINE
#if wxUSE_MARKUP
m_statText = m_statMarkup = NULL; m_statText = m_statMarkup = NULL;
#endif // wxUSE_MARKUP
m_sizerStatBox = (wxStaticBoxSizer *)NULL; m_sizerStatBox = (wxStaticBoxSizer *)NULL;
m_sizerStatic = (wxSizer *)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() void StaticWidgetsPage::CreateContent()
@@ -288,6 +314,7 @@ void StaticWidgetsPage::CreateContent()
sizerMiddle->Add(m_textLabel, 0, wxEXPAND|wxALL, 5); sizerMiddle->Add(m_textLabel, 0, wxEXPAND|wxALL, 5);
sizerMiddle->Add(b2, 0, wxLEFT|wxBOTTOM, 5); sizerMiddle->Add(b2, 0, wxLEFT|wxBOTTOM, 5);
#if wxUSE_MARKUP
m_textLabelWithMarkup = new wxTextCtrl(this, wxID_ANY, wxEmptyString, m_textLabelWithMarkup = new wxTextCtrl(this, wxID_ANY, wxEmptyString,
wxDefaultPosition, wxDefaultSize, wxDefaultPosition, wxDefaultSize,
wxTE_MULTILINE|wxHSCROLL); wxTE_MULTILINE|wxHSCROLL);
@@ -301,7 +328,9 @@ void StaticWidgetsPage::CreateContent()
m_chkGreen = CreateCheckBoxAndAddToSizer(sizerLeft, m_chkGreen = CreateCheckBoxAndAddToSizer(sizerLeft,
"Decorated label on g&reen"); "Decorated label on g&reen");
sizerMiddle->Add(m_chkGreen, 0, wxALL, 5); sizerMiddle->Add(m_chkGreen, 0, wxALL, 5);
#endif // wxUSE_MARKUP
// final initializations // final initializations
// NB: must be done _before_ calling CreateStatic() // NB: must be done _before_ calling CreateStatic()
@@ -310,10 +339,12 @@ void StaticWidgetsPage::CreateContent()
m_textBox->SetValue(wxT("This is a &box")); 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") 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.")); wxT("Only this text is affected by the ellipsize settings."));
#if wxUSE_MARKUP
m_textLabelWithMarkup->SetValue(wxT("Another label, this time <b>decorated</b> ") m_textLabelWithMarkup->SetValue(wxT("Another label, this time <b>decorated</b> ")
wxT("with <u>markup</u>; here you need entities ") wxT("with <u>markup</u>; here you need entities ")
wxT("for the symbols: &lt; &gt; &amp; &apos; &quot; ") wxT("for the symbols: &lt; &gt; &amp; &apos; &quot; ")
wxT(" but you can still place &mnemonics...")); wxT(" but you can still place &mnemonics..."));
#endif // wxUSE_MARKUP
// right pane // right pane
wxSizer *sizerRight = new wxBoxSizer(wxHORIZONTAL); wxSizer *sizerRight = new wxBoxSizer(wxHORIZONTAL);
@@ -354,7 +385,9 @@ void StaticWidgetsPage::CreateStatic()
// delete m_sizerStatBox; -- deleted by Remove() // delete m_sizerStatBox; -- deleted by Remove()
m_sizerStatic->Remove(m_sizerStatBox); m_sizerStatic->Remove(m_sizerStatBox);
delete m_statText; delete m_statText;
#if wxUSE_MARKUP
delete m_statMarkup; delete m_statMarkup;
#endif // wxUSE_MARKUP
#if wxUSE_STATLINE #if wxUSE_STATLINE
delete m_statLine; delete m_statLine;
#endif // wxUSE_STATLINE #endif // wxUSE_STATLINE
@@ -448,10 +481,12 @@ void StaticWidgetsPage::CreateStatic()
m_textLabel->GetValue(), m_textLabel->GetValue(),
wxDefaultPosition, wxDefaultSize, wxDefaultPosition, wxDefaultSize,
flagsDummyText); flagsDummyText);
#if wxUSE_MARKUP
m_statMarkup = new wxGenericStaticText(this, wxID_ANY, m_statMarkup = new wxGenericStaticText(this, wxID_ANY,
wxString(), wxString(),
wxDefaultPosition, wxDefaultSize, wxDefaultPosition, wxDefaultSize,
flagsText); flagsText);
#endif // wxUSE_MARKUP
} }
else // use native versions else // use native versions
{ {
@@ -459,16 +494,21 @@ void StaticWidgetsPage::CreateStatic()
m_textLabel->GetValue(), m_textLabel->GetValue(),
wxDefaultPosition, wxDefaultSize, wxDefaultPosition, wxDefaultSize,
flagsDummyText); flagsDummyText);
#if wxUSE_MARKUP
m_statMarkup = new wxStaticText(this, wxID_ANY, m_statMarkup = new wxStaticText(this, wxID_ANY,
wxString(), wxString(),
wxDefaultPosition, wxDefaultSize, wxDefaultPosition, wxDefaultSize,
flagsText); flagsText);
#endif // wxUSE_MARKUP
} }
#if wxUSE_MARKUP
m_statMarkup->SetLabelMarkup(m_textLabelWithMarkup->GetValue()); m_statMarkup->SetLabelMarkup(m_textLabelWithMarkup->GetValue());
if ( m_chkGreen->GetValue() ) if ( m_chkGreen->GetValue() )
m_statMarkup->SetBackgroundColour(*wxGREEN); m_statMarkup->SetBackgroundColour(*wxGREEN);
#endif // wxUSE_MARKUP
#if wxUSE_STATLINE #if wxUSE_STATLINE
m_statLine = new wxStaticLine(this, wxID_ANY, m_statLine = new wxStaticLine(this, wxID_ANY,
wxDefaultPosition, wxDefaultSize, wxDefaultPosition, wxDefaultSize,
@@ -479,7 +519,9 @@ void StaticWidgetsPage::CreateStatic()
#if wxUSE_STATLINE #if wxUSE_STATLINE
m_sizerStatBox->Add(m_statLine, 0, wxGROW | wxALL, 5); m_sizerStatBox->Add(m_statLine, 0, wxGROW | wxALL, 5);
#endif // wxUSE_STATLINE #endif // wxUSE_STATLINE
#if wxUSE_MARKUP
m_sizerStatBox->Add(m_statMarkup, 1, wxGROW | wxALL, 5); m_sizerStatBox->Add(m_statMarkup, 1, wxGROW | wxALL, 5);
#endif // wxUSE_MARKUP
m_sizerStatic->Add(m_sizerStatBox, 1, wxGROW); m_sizerStatic->Add(m_sizerStatBox, 1, wxGROW);
@@ -532,6 +574,7 @@ void StaticWidgetsPage::OnButtonLabelText(wxCommandEvent& WXUNUSED(event))
m_statText->GetLabelText()); m_statText->GetLabelText());
} }
#if wxUSE_MARKUP
void StaticWidgetsPage::OnButtonLabelWithMarkupText(wxCommandEvent& WXUNUSED(event)) void StaticWidgetsPage::OnButtonLabelWithMarkupText(wxCommandEvent& WXUNUSED(event))
{ {
m_statMarkup->SetLabelMarkup(m_textLabelWithMarkup->GetValue()); m_statMarkup->SetLabelMarkup(m_textLabelWithMarkup->GetValue());
@@ -544,6 +587,7 @@ void StaticWidgetsPage::OnButtonLabelWithMarkupText(wxCommandEvent& WXUNUSED(eve
wxLogMessage(wxT("The label text is '%s'"), wxLogMessage(wxT("The label text is '%s'"),
m_statMarkup->GetLabelText()); m_statMarkup->GetLabelText());
} }
#endif // wxUSE_MARKUP
void StaticWidgetsPage::OnMouseEvent(wxMouseEvent& event) void StaticWidgetsPage::OnMouseEvent(wxMouseEvent& event)
{ {

View File

@@ -349,6 +349,8 @@
#define wxUSE_CONTROLS 0 #define wxUSE_CONTROLS 0
#define wxUSE_MARKUP 0
#define wxUSE_POPUPWIN 0 #define wxUSE_POPUPWIN 0
#define wxUSE_TIPWINDOW 0 #define wxUSE_TIPWINDOW 0

View File

@@ -236,6 +236,8 @@ wxControlBase::GetCompositeControlsDefaultAttributes(wxWindowVariant WXUNUSED(va
// wxControl markup support // wxControl markup support
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
#if wxUSE_MARKUP
/* static */ /* static */
wxString wxControlBase::RemoveMarkup(const wxString& markup) wxString wxControlBase::RemoveMarkup(const wxString& markup)
{ {
@@ -253,6 +255,8 @@ bool wxControlBase::DoSetLabelMarkup(const wxString& markup)
return true; return true;
} }
#endif // wxUSE_MARKUP
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// wxControlBase - ellipsization code // wxControlBase - ellipsization code
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------

View File

@@ -23,8 +23,7 @@
#pragma hdrstop #pragma hdrstop
#endif #endif
#ifndef WX_PRECOMP #if wxUSE_MARKUP
#endif // WX_PRECOMP
#include "wx/private/markupparser.h" #include "wx/private/markupparser.h"
@@ -473,3 +472,5 @@ wxString wxMarkupParser::Strip(const wxString& text)
return output.GetText(); return output.GetText();
} }
#endif // wxUSE_MARKUP

View File

@@ -127,12 +127,15 @@ void wxControl::GTKSetLabelForLabel(GtkLabel *w, const wxString& label)
gtk_label_set_text_with_mnemonic(w, wxGTK_CONV(labelGTK)); gtk_label_set_text_with_mnemonic(w, wxGTK_CONV(labelGTK));
} }
#if wxUSE_MARKUP
void wxControl::GTKSetLabelWithMarkupForLabel(GtkLabel *w, const wxString& label) void wxControl::GTKSetLabelWithMarkupForLabel(GtkLabel *w, const wxString& label)
{ {
const wxString labelGTK = GTKConvertMnemonicsWithMarkup(label); const wxString labelGTK = GTKConvertMnemonicsWithMarkup(label);
gtk_label_set_markup_with_mnemonic(w, wxGTK_CONV(labelGTK)); gtk_label_set_markup_with_mnemonic(w, wxGTK_CONV(labelGTK));
} }
#endif // wxUSE_MARKUP
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// GtkFrame helpers // GtkFrame helpers

View File

@@ -133,6 +133,8 @@ void wxStaticText::SetLabel(const wxString& label)
GTKDoSetLabel(&wxStaticText::GTKSetLabelForLabel, label); GTKDoSetLabel(&wxStaticText::GTKSetLabelForLabel, label);
} }
#if wxUSE_MARKUP
bool wxStaticText::DoSetLabelMarkup(const wxString& markup) bool wxStaticText::DoSetLabelMarkup(const wxString& markup)
{ {
const wxString stripped = RemoveMarkup(markup); const wxString stripped = RemoveMarkup(markup);
@@ -146,6 +148,8 @@ bool wxStaticText::DoSetLabelMarkup(const wxString& markup)
return true; return true;
} }
#endif // wxUSE_MARKUP
bool wxStaticText::SetFont( const wxFont &font ) bool wxStaticText::SetFont( const wxFont &font )
{ {
const bool wasUnderlined = GetFont().GetUnderlined(); const bool wasUnderlined = GetFont().GetUnderlined();