Add wxControl::GetSizeFromTextSize() to size the control to its text.
This function can be used to size a, say, wxTextCtrl to be exactly of the size needed to enter the given amount of text in it. This patch adds wxGTK implementation for wxTextCtrl, wxChoice and wxCombobox; changes to the samples and the documentation. Closes #14812. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72935 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -134,6 +134,10 @@ public:
|
||||
// wxControl-specific processing after processing the update event
|
||||
virtual void DoUpdateWindowUI(wxUpdateUIEvent& event);
|
||||
|
||||
wxSize GetSizeFromTextSize(int xlen, int ylen = -1) const
|
||||
{ return DoGetSizeFromTextSize(xlen, ylen); }
|
||||
wxSize GetSizeFromTextSize(const wxSize& tsize) const
|
||||
{ return DoGetSizeFromTextSize(tsize.x, tsize.y); }
|
||||
|
||||
|
||||
// static utilities for mnemonics char (&) handling
|
||||
@@ -192,6 +196,8 @@ protected:
|
||||
virtual bool DoSetLabelMarkup(const wxString& markup);
|
||||
#endif // wxUSE_MARKUP
|
||||
|
||||
// override this to return the total control's size from a string size
|
||||
virtual wxSize DoGetSizeFromTextSize(int xlen, int ylen = -1) const;
|
||||
|
||||
// initialize the common fields of wxCommandEvent
|
||||
void InitCommandEvent(wxCommandEvent& event) const;
|
||||
|
Reference in New Issue
Block a user