Merge branch 'statictext-setlabel'
wxControl label-related fixes and improvements. See https://github.com/wxWidgets/wxWidgets/pull/1364
This commit is contained in:
@@ -178,11 +178,6 @@ protected:
|
||||
// initialize the common fields of wxCommandEvent
|
||||
void InitCommandEvent(wxCommandEvent& event) const;
|
||||
|
||||
// Ellipsize() helper:
|
||||
static wxString DoEllipsizeSingleLine(const wxString& label, const wxDC& dc,
|
||||
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.
|
||||
|
@@ -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;
|
||||
|
||||
|
@@ -31,10 +31,13 @@ public:
|
||||
const wxString &name = wxStaticTextNameStr );
|
||||
|
||||
virtual void SetLabel(const wxString& label) wxOVERRIDE;
|
||||
virtual wxString GetLabel() const wxOVERRIDE;
|
||||
|
||||
virtual QWidget *GetHandle() const wxOVERRIDE;
|
||||
|
||||
protected:
|
||||
virtual wxString WXGetVisibleLabel() const wxOVERRIDE;
|
||||
virtual void WXSetVisibleLabel(const wxString& str) wxOVERRIDE;
|
||||
|
||||
private:
|
||||
QLabel *m_qtLabel;
|
||||
|
||||
|
@@ -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);
|
||||
};
|
||||
|
Reference in New Issue
Block a user