Rename wxStaticText::Do[SG]etLabel() to WX[SG]etVisibleLabel()
The names of these methods were confusing because they implied that they were the actual implementations of the public [SG]etLabel(), while this wasn't at all the case. Give them then ames describing what they really do and also update the comments to hopefully be more clear. No real changes.
This commit is contained in:
@@ -54,8 +54,8 @@ public:
|
||||
protected:
|
||||
virtual wxSize DoGetBestClientSize() const wxOVERRIDE;
|
||||
|
||||
virtual wxString DoGetLabel() const wxOVERRIDE { return m_label; }
|
||||
virtual void DoSetLabel(const wxString& label) wxOVERRIDE;
|
||||
virtual wxString WXGetVisibleLabel() const wxOVERRIDE { return m_label; }
|
||||
virtual void WXSetVisibleLabel(const wxString& label) wxOVERRIDE;
|
||||
|
||||
void DoSetSize(int x, int y, int width, int height, int sizeFlags) wxOVERRIDE;
|
||||
|
||||
|
@@ -49,8 +49,8 @@ protected:
|
||||
|
||||
virtual wxSize DoGetBestSize() const wxOVERRIDE;
|
||||
|
||||
virtual wxString DoGetLabel() const wxOVERRIDE;
|
||||
virtual void DoSetLabel(const wxString& str) wxOVERRIDE;
|
||||
virtual wxString WXGetVisibleLabel() const wxOVERRIDE;
|
||||
virtual void WXSetVisibleLabel(const wxString& str) wxOVERRIDE;
|
||||
#if wxUSE_MARKUP
|
||||
virtual bool DoSetLabelMarkup(const wxString& markup) wxOVERRIDE;
|
||||
#endif // wxUSE_MARKUP
|
||||
|
@@ -51,8 +51,8 @@ public:
|
||||
virtual WXWidget GetLabelWidget() const
|
||||
{ return m_labelWidget; }
|
||||
|
||||
virtual void DoSetLabel(const wxString& str);
|
||||
virtual wxString DoGetLabel() const;
|
||||
virtual void WXSetVisibleLabel(const wxString& str);
|
||||
virtual wxString WXGetVisibleLabel() const;
|
||||
|
||||
virtual wxSize DoGetBestSize() const;
|
||||
protected:
|
||||
|
@@ -47,8 +47,8 @@ protected:
|
||||
int sizeFlags = wxSIZE_AUTO) wxOVERRIDE;
|
||||
virtual wxSize DoGetBestClientSize() const wxOVERRIDE;
|
||||
|
||||
virtual wxString DoGetLabel() const wxOVERRIDE;
|
||||
virtual void DoSetLabel(const wxString& str) wxOVERRIDE;
|
||||
virtual wxString WXGetVisibleLabel() const wxOVERRIDE;
|
||||
virtual void WXSetVisibleLabel(const wxString& str) wxOVERRIDE;
|
||||
|
||||
wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxStaticText);
|
||||
};
|
||||
|
@@ -41,8 +41,8 @@ public:
|
||||
|
||||
protected :
|
||||
|
||||
virtual wxString DoGetLabel() const wxOVERRIDE;
|
||||
virtual void DoSetLabel(const wxString& str) wxOVERRIDE;
|
||||
virtual wxString WXGetVisibleLabel() const wxOVERRIDE;
|
||||
virtual void WXSetVisibleLabel(const wxString& str) wxOVERRIDE;
|
||||
|
||||
virtual wxSize DoGetBestSize() const wxOVERRIDE;
|
||||
|
||||
|
@@ -63,21 +63,27 @@ protected: // functions required for wxST_ELLIPSIZE_* support
|
||||
// style. Shouldn't be called if we don't have any.
|
||||
wxString Ellipsize(const wxString& label) const;
|
||||
|
||||
// to be called when updating the size of the static text:
|
||||
// updates the label redoing ellipsization calculations
|
||||
|
||||
// Note that even though ports with native support for ellipsization
|
||||
// (currently only wxGTK) don't need this stuff, we still need to define it
|
||||
// as it's used by wxGenericStaticText.
|
||||
|
||||
// Must be called when the size or font changes to redo the ellipsization
|
||||
// for the new size. Calls WXSetVisibleLabel() to actually update the
|
||||
// display.
|
||||
void UpdateLabel();
|
||||
|
||||
// These functions are platform-specific and must be overridden in ports
|
||||
// which do not natively support ellipsization and they must be implemented
|
||||
// in a way so that the m_labelOrig member of wxControl is not touched:
|
||||
// These functions are platform-specific and must be implemented in the
|
||||
// platform-specific code. They must not use or update m_labelOrig.
|
||||
|
||||
// returns the real label currently displayed inside the control.
|
||||
virtual wxString DoGetLabel() const { return wxEmptyString; }
|
||||
// Returns the label currently displayed inside the control, with mnemonics
|
||||
// if any.
|
||||
virtual wxString WXGetVisibleLabel() const = 0;
|
||||
|
||||
// sets the real label currently displayed inside the control,
|
||||
// _without_ invalidating the size. The text passed is always markup-free
|
||||
// but may contain the mnemonic characters.
|
||||
virtual void DoSetLabel(const wxString& WXUNUSED(str)) { }
|
||||
// Sets the real label currently displayed inside the control, _without_
|
||||
// invalidating the size. The text passed is always markup-free but may
|
||||
// contain the mnemonic characters.
|
||||
virtual void WXSetVisibleLabel(const wxString& str) = 0;
|
||||
|
||||
// Update the current size to match the best size unless wxST_NO_AUTORESIZE
|
||||
// style is explicitly used.
|
||||
|
@@ -58,8 +58,8 @@ protected:
|
||||
// draw the control
|
||||
virtual void DoDraw(wxControlRenderer *renderer) wxOVERRIDE;
|
||||
|
||||
virtual void DoSetLabel(const wxString& str) wxOVERRIDE;
|
||||
virtual wxString DoGetLabel() const wxOVERRIDE;
|
||||
virtual void WXSetVisibleLabel(const wxString& str) wxOVERRIDE;
|
||||
virtual wxString WXGetVisibleLabel() const wxOVERRIDE;
|
||||
|
||||
wxDECLARE_DYNAMIC_CLASS(wxStaticText);
|
||||
};
|
||||
|
@@ -240,9 +240,9 @@ void wxStaticTextBase::UpdateLabel()
|
||||
// In fact, we must be careful not to touch the original label passed to
|
||||
// SetLabel() otherwise GetLabel() will behave in a strange way to the user
|
||||
// (e.g. returning a "Ver...ing" instead of "Very long string") !
|
||||
if (newlabel == DoGetLabel())
|
||||
if (newlabel == WXGetVisibleLabel())
|
||||
return;
|
||||
DoSetLabel(newlabel);
|
||||
WXSetVisibleLabel(newlabel);
|
||||
}
|
||||
|
||||
wxString wxStaticTextBase::GetEllipsizedLabel() const
|
||||
|
@@ -100,7 +100,7 @@ wxSize wxGenericStaticText::DoGetBestClientSize() const
|
||||
void wxGenericStaticText::SetLabel(const wxString& label)
|
||||
{
|
||||
wxControl::SetLabel(label);
|
||||
DoSetLabel(GetEllipsizedLabel());
|
||||
WXSetVisibleLabel(GetEllipsizedLabel());
|
||||
|
||||
AutoResizeIfNecessary();
|
||||
|
||||
@@ -115,7 +115,7 @@ void wxGenericStaticText::SetLabel(const wxString& label)
|
||||
Refresh();
|
||||
}
|
||||
|
||||
void wxGenericStaticText::DoSetLabel(const wxString& label)
|
||||
void wxGenericStaticText::WXSetVisibleLabel(const wxString& label)
|
||||
{
|
||||
m_mnemonic = FindAccelIndex(label, &m_label);
|
||||
}
|
||||
|
@@ -272,13 +272,13 @@ void wxStaticText::GTKWidgetDoSetMnemonic(GtkWidget* w)
|
||||
|
||||
// These functions should be used only when GTK+ < 2.6 by wxStaticTextBase::UpdateLabel()
|
||||
|
||||
wxString wxStaticText::DoGetLabel() const
|
||||
wxString wxStaticText::WXGetVisibleLabel() const
|
||||
{
|
||||
GtkLabel *label = GTK_LABEL(m_widget);
|
||||
return wxGTK_CONV_BACK( gtk_label_get_text( label ) );
|
||||
}
|
||||
|
||||
void wxStaticText::DoSetLabel(const wxString& str)
|
||||
void wxStaticText::WXSetVisibleLabel(const wxString& str)
|
||||
{
|
||||
GTKSetLabelForLabel(GTK_LABEL(m_widget), str);
|
||||
}
|
||||
|
@@ -77,12 +77,12 @@ void wxStaticText::SetLabel(const wxString& label)
|
||||
m_labelOrig = label; // save original label
|
||||
|
||||
// Motif does not support ellipsized labels natively
|
||||
DoSetLabel(GetEllipsizedLabel());
|
||||
WXSetVisibleLabel(GetEllipsizedLabel());
|
||||
}
|
||||
|
||||
// for wxST_ELLIPSIZE_* support:
|
||||
|
||||
wxString wxStaticText::DoGetLabel() const
|
||||
wxString wxStaticText::WXGetVisibleLabel() const
|
||||
{
|
||||
XmString label = NULL;
|
||||
XtVaGetValues((Widget)m_labelWidget, XmNlabelString, &label, NULL);
|
||||
@@ -90,7 +90,7 @@ wxString wxStaticText::DoGetLabel() const
|
||||
return wxXmStringToString(label);
|
||||
}
|
||||
|
||||
void wxStaticText::DoSetLabel(const wxString& str)
|
||||
void wxStaticText::WXSetVisibleLabel(const wxString& str)
|
||||
{
|
||||
// build our own cleaned label
|
||||
wxXmString label_str(RemoveMnemonics(str));
|
||||
|
@@ -179,10 +179,10 @@ void wxStaticText::SetLabel(const wxString& label)
|
||||
|
||||
#ifdef SS_ENDELLIPSIS
|
||||
if ( updateStyle.IsOn(SS_ENDELLIPSIS) )
|
||||
DoSetLabel(GetLabel());
|
||||
WXSetVisibleLabel(GetLabel());
|
||||
else
|
||||
#endif // SS_ENDELLIPSIS
|
||||
DoSetLabel(GetEllipsizedLabel());
|
||||
WXSetVisibleLabel(GetEllipsizedLabel());
|
||||
|
||||
AutoResizeIfNecessary();
|
||||
}
|
||||
@@ -197,16 +197,18 @@ bool wxStaticText::SetFont(const wxFont& font)
|
||||
return true;
|
||||
}
|
||||
|
||||
// for wxST_ELLIPSIZE_* support:
|
||||
// These functions are used by wxST_ELLIPSIZE_* supporting code in
|
||||
// wxStaticTextBase which requires us to implement them, but actually the base
|
||||
// wxWindow methods already do exactly what we need under this platform.
|
||||
|
||||
wxString wxStaticText::DoGetLabel() const
|
||||
wxString wxStaticText::WXGetVisibleLabel() const
|
||||
{
|
||||
return wxGetWindowText(GetHwnd());
|
||||
return wxWindow::GetLabel();
|
||||
}
|
||||
|
||||
void wxStaticText::DoSetLabel(const wxString& str)
|
||||
void wxStaticText::WXSetVisibleLabel(const wxString& str)
|
||||
{
|
||||
SetWindowText(GetHwnd(), str.c_str());
|
||||
wxWindow::SetLabel(str);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -71,11 +71,11 @@ void wxStaticText::SetLabel(const wxString& label)
|
||||
)
|
||||
{
|
||||
// leave ellipsization to the OS
|
||||
DoSetLabel(GetLabel());
|
||||
WXSetVisibleLabel(GetLabel());
|
||||
}
|
||||
else // not supported natively
|
||||
{
|
||||
DoSetLabel(GetEllipsizedLabel());
|
||||
WXSetVisibleLabel(GetEllipsizedLabel());
|
||||
}
|
||||
|
||||
AutoResizeIfNecessary();
|
||||
@@ -98,7 +98,7 @@ bool wxStaticText::SetFont(const wxFont& font)
|
||||
return ret;
|
||||
}
|
||||
|
||||
void wxStaticText::DoSetLabel(const wxString& label)
|
||||
void wxStaticText::WXSetVisibleLabel(const wxString& label)
|
||||
{
|
||||
m_label = RemoveMnemonics(label);
|
||||
GetPeer()->SetLabel(m_label , GetFont().GetEncoding() );
|
||||
@@ -118,7 +118,7 @@ bool wxStaticText::DoSetLabelMarkup(const wxString& markup)
|
||||
|
||||
#endif // wxUSE_MARKUP && wxOSX_USE_COCOA
|
||||
|
||||
wxString wxStaticText::DoGetLabel() const
|
||||
wxString wxStaticText::WXGetVisibleLabel() const
|
||||
{
|
||||
return m_label;
|
||||
}
|
||||
|
@@ -77,15 +77,15 @@ void wxStaticText::SetLabel(const wxString& str)
|
||||
m_labelOrig = str;
|
||||
|
||||
// draw as real label the abbreviated version of it
|
||||
DoSetLabel(GetEllipsizedLabel());
|
||||
WXSetVisibleLabel(GetEllipsizedLabel());
|
||||
}
|
||||
|
||||
void wxStaticText::DoSetLabel(const wxString& str)
|
||||
void wxStaticText::WXSetVisibleLabel(const wxString& str)
|
||||
{
|
||||
UnivDoSetLabel(str);
|
||||
}
|
||||
|
||||
wxString wxStaticText::DoGetLabel() const
|
||||
wxString wxStaticText::WXGetVisibleLabel() const
|
||||
{
|
||||
return wxControl::GetLabel();
|
||||
}
|
||||
|
Reference in New Issue
Block a user