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:
@@ -95,6 +95,7 @@ protected:
|
||||
int m_stringCellIndex;
|
||||
|
||||
virtual wxSize DoGetBestSize() const;
|
||||
virtual wxSize DoGetSizeFromTextSize(int xlen, int ylen = -1) const;
|
||||
virtual int DoInsertItems(const wxArrayStringsAdapter& items,
|
||||
unsigned int pos,
|
||||
void **clientData, wxClientDataType type);
|
||||
|
@@ -145,6 +145,8 @@ protected:
|
||||
// custom list stores.
|
||||
virtual void GTKCreateComboBoxWidget();
|
||||
|
||||
virtual wxSize DoGetSizeFromTextSize(int xlen, int ylen = -1) const;
|
||||
|
||||
virtual GtkEntry *GetEntry() const
|
||||
{ return m_entry; }
|
||||
|
||||
|
@@ -12,6 +12,7 @@
|
||||
|
||||
typedef struct _GtkLabel GtkLabel;
|
||||
typedef struct _GtkFrame GtkFrame;
|
||||
typedef struct _GtkEntry GtkEntry;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxControl
|
||||
@@ -100,6 +101,12 @@ protected:
|
||||
// Fix sensitivity due to bug in GTK+ < 2.14
|
||||
void GTKFixSensitivity(bool onlyIfUnderMouse = true);
|
||||
|
||||
// Ask GTK+ for preferred size. Use it after setting the font.
|
||||
wxSize GTKGetPreferredSize(GtkWidget* widget) const;
|
||||
|
||||
// Inner margins in a GtkEntry
|
||||
wxPoint GTKGetEntryMargins(GtkEntry* entry) const;
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxControl)
|
||||
};
|
||||
|
@@ -155,6 +155,8 @@ protected:
|
||||
virtual void DoApplyWidgetStyle(GtkRcStyle *style);
|
||||
virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const;
|
||||
|
||||
virtual wxSize DoGetSizeFromTextSize(int xlen, int ylen = -1) const;
|
||||
|
||||
virtual void DoFreeze();
|
||||
virtual void DoThaw();
|
||||
|
||||
|
Reference in New Issue
Block a user