Move LabelWrapper, TextSizerWrapper classes out of function body to accommodate some older compilers.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@35301 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Michael Wetherell
2005-08-24 14:59:36 +00:00
parent 4f66d445e1
commit cfd1ac216d

View File

@@ -177,28 +177,10 @@ void wxTextWrapper::Wrap(wxWindow *win, const wxString& text, int widthMax)
} }
} }
wxSizer *wxDialogBase::CreateTextSizer(const wxString& message) class wxTextSizerWrapper : public wxTextWrapper
{
// I admit that this is complete bogus, but it makes
// message boxes work for pda screens temporarily..
int widthMax = -1;
const bool is_pda = wxSystemSettings::GetScreenType() <= wxSYS_SCREEN_PDA;
if (is_pda)
{
widthMax = wxSystemSettings::GetMetric( wxSYS_SCREEN_X ) - 25;
}
// '&' is used as accel mnemonic prefix in the wxWidgets controls but in
// the static messages created by CreateTextSizer() (used by wxMessageBox,
// for example), we don't want this special meaning, so we need to quote it
wxString text(message);
text.Replace(_T("&"), _T("&&"));
class TextSizerWrapper : public wxTextWrapper
{ {
public: public:
TextSizerWrapper(wxWindow *win) wxTextSizerWrapper(wxWindow *win)
{ {
m_win = win; m_win = win;
m_hLine = 0; m_hLine = 0;
@@ -233,20 +215,29 @@ wxSizer *wxDialogBase::CreateTextSizer(const wxString& message)
int m_hLine; int m_hLine;
}; };
TextSizerWrapper wrapper(this); wxSizer *wxDialogBase::CreateTextSizer(const wxString& message)
{
// I admit that this is complete bogus, but it makes
// message boxes work for pda screens temporarily..
int widthMax = -1;
const bool is_pda = wxSystemSettings::GetScreenType() <= wxSYS_SCREEN_PDA;
if (is_pda)
{
widthMax = wxSystemSettings::GetMetric( wxSYS_SCREEN_X ) - 25;
}
// '&' is used as accel mnemonic prefix in the wxWidgets controls but in
// the static messages created by CreateTextSizer() (used by wxMessageBox,
// for example), we don't want this special meaning, so we need to quote it
wxString text(message);
text.Replace(_T("&"), _T("&&"));
wxTextSizerWrapper wrapper(this);
return wrapper.CreateSizer(text, widthMax); return wrapper.CreateSizer(text, widthMax);
} }
void class wxLabelWrapper : public wxTextWrapper
#if defined(__WXGTK__) && !defined(__WXUNIVERSAL__)
wxStaticText
#else
wxStaticTextBase
#endif
::Wrap(int width)
{
class LabelWrapper : public wxTextWrapper
{ {
public: public:
void WrapLabel(wxWindow *text, int widthMax) void WrapLabel(wxWindow *text, int widthMax)
@@ -271,7 +262,15 @@ wxStaticTextBase
wxString m_text; wxString m_text;
}; };
LabelWrapper wrapper; void
#if defined(__WXGTK__) && !defined(__WXUNIVERSAL__)
wxStaticText
#else
wxStaticTextBase
#endif
::Wrap(int width)
{
wxLabelWrapper wrapper;
wrapper.WrapLabel(this, width); wrapper.WrapLabel(this, width);
} }