wxTextEntry::SetMargins(), GetMargins() - implemented on wxMSW and wxGTK (GTK+ 2.10+); also added similar functions into wxComboCtrl, deprecated old indent-functions; wxPropertyGrid modified to use the new functionality
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61834 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -86,8 +86,8 @@ enum
|
||||
wxCC_IFLAG_CREATED = 0x0100,
|
||||
// Internal use: really put button outside
|
||||
wxCC_IFLAG_BUTTON_OUTSIDE = 0x0200,
|
||||
// Internal use: SetTextIndent has been called
|
||||
wxCC_IFLAG_INDENT_SET = 0x0400,
|
||||
// Internal use: SetMargins has been succesfully called
|
||||
wxCC_IFLAG_LEFT_MARGIN_SET = 0x0400,
|
||||
// Internal use: Set wxTAB_TRAVERSAL to parent when popup is dismissed
|
||||
wxCC_IFLAG_PARENT_TAB_TRAVERSAL = 0x0800,
|
||||
// Internal use: Secondary popup window type should be used (if available).
|
||||
@@ -118,7 +118,8 @@ struct wxComboCtrlFeatures
|
||||
BitmapButton = 0x0002, // Button may be replaced with bitmap
|
||||
ButtonSpacing = 0x0004, // Button can have spacing from the edge
|
||||
// of the control
|
||||
TextIndent = 0x0008, // SetTextIndent can be used
|
||||
TextIndent = 0x0008, // SetMargins can be used to control
|
||||
// left margin.
|
||||
PaintControl = 0x0010, // Combo control itself can be custom painted
|
||||
PaintWritable = 0x0020, // A variable-width area in front of writable
|
||||
// combo control's textctrl can be custom
|
||||
@@ -302,19 +303,18 @@ public:
|
||||
const wxBitmap& bmpHover = wxNullBitmap,
|
||||
const wxBitmap& bmpDisabled = wxNullBitmap );
|
||||
|
||||
#if WXWIN_COMPATIBILITY_2_6
|
||||
//
|
||||
// This will set the space in pixels between left edge of the control and the
|
||||
// text, regardless whether control is read-only (ie. no wxTextCtrl) or not.
|
||||
// Platform-specific default can be set with value-1.
|
||||
// Remarks
|
||||
// * This method may do nothing on some native implementations.
|
||||
void SetTextIndent( int indent );
|
||||
wxDEPRECTED( void SetTextIndent( int indent ) );
|
||||
|
||||
// Returns actual indentation in pixels.
|
||||
wxCoord GetTextIndent() const
|
||||
{
|
||||
return m_absIndent;
|
||||
}
|
||||
wxDEPRECTED( wxCoord GetTextIndent() const );
|
||||
#endif
|
||||
|
||||
// Returns area covered by the text field.
|
||||
const wxRect& GetTextRect() const
|
||||
@@ -385,6 +385,17 @@ public:
|
||||
const wxBitmap& GetBitmapHover() const { return m_bmpHover; }
|
||||
const wxBitmap& GetBitmapDisabled() const { return m_bmpDisabled; }
|
||||
|
||||
// Margins functions mirrored from TextEntryBase
|
||||
// (wxComboCtrl does not inherit from wxTextEntry, but may embed a
|
||||
// wxTextCtrl, so we need these). Also note that these functions
|
||||
// have replaced SetTextIndent() in wxWidgets 2.9.1 and later.
|
||||
bool SetMargins(const wxPoint& pt)
|
||||
{ return DoSetMargins(pt); }
|
||||
bool SetMargins(wxCoord left, wxCoord top = -1)
|
||||
{ return DoSetMargins(wxPoint(left, top)); }
|
||||
wxPoint GetMargins() const
|
||||
{ return DoGetMargins(); }
|
||||
|
||||
// Return internal flags
|
||||
wxUint32 GetInternalFlags() const { return m_iFlags; }
|
||||
|
||||
@@ -423,7 +434,8 @@ protected:
|
||||
// called from wxSizeEvent handler
|
||||
virtual void OnResize() = 0;
|
||||
|
||||
// Return native text identation (for pure text, not textctrl)
|
||||
// Return native text identation
|
||||
// (i.e. text margin, for pure text, not textctrl)
|
||||
virtual wxCoord GetNativeTextIndent() const;
|
||||
|
||||
// Called in syscolourchanged handler and base create
|
||||
@@ -521,6 +533,10 @@ protected:
|
||||
virtual void DoSetToolTip( wxToolTip *tip );
|
||||
#endif
|
||||
|
||||
// margins functions
|
||||
virtual bool DoSetMargins(const wxPoint& pt);
|
||||
virtual wxPoint DoGetMargins() const;
|
||||
|
||||
// This is used when m_text is hidden (readonly).
|
||||
wxString m_valueString;
|
||||
|
||||
@@ -572,8 +588,8 @@ protected:
|
||||
// selection indicator.
|
||||
wxCoord m_widthCustomPaint;
|
||||
|
||||
// absolute text indentation, in pixels
|
||||
wxCoord m_absIndent;
|
||||
// left margin, in pixels
|
||||
wxCoord m_marginLeft;
|
||||
|
||||
// side on which the popup is aligned
|
||||
int m_anchorSide;
|
||||
|
@@ -135,8 +135,8 @@ protected:
|
||||
// custom list stores.
|
||||
virtual void GTKCreateComboBoxWidget();
|
||||
|
||||
// return the GtkEntry part of the combobox
|
||||
GtkEntry *GetEntry() const { return m_entry; }
|
||||
virtual GtkEntry *GetEntry() const
|
||||
{ return m_entry; }
|
||||
|
||||
GtkEntry* m_entry;
|
||||
|
||||
|
@@ -178,6 +178,7 @@ protected:
|
||||
private:
|
||||
// overridden wxTextEntry virtual methods
|
||||
virtual GtkEditable *GetEditable() const;
|
||||
virtual GtkEntry *GetEntry() const;
|
||||
virtual void EnableTextChangedEvents(bool enable);
|
||||
|
||||
// change the font for everything in this control
|
||||
|
@@ -12,6 +12,7 @@
|
||||
#define _WX_GTK_TEXTENTRY_H_
|
||||
|
||||
typedef struct _GtkEditable GtkEditable;
|
||||
typedef struct _GtkEntry GtkEntry;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxTextEntry: roughly corresponds to GtkEditable
|
||||
@@ -55,10 +56,17 @@ public:
|
||||
protected:
|
||||
virtual wxString DoGetValue() const;
|
||||
|
||||
// margins functions
|
||||
virtual bool DoSetMargins(const wxPoint& pt);
|
||||
virtual wxPoint DoGetMargins() const;
|
||||
|
||||
private:
|
||||
// implement this to return the associated GtkEntry or another widget
|
||||
// implementing GtkEditable
|
||||
virtual GtkEditable *GetEditable() const = 0;
|
||||
|
||||
// implement this to return the associated GtkEntry
|
||||
virtual GtkEntry *GetEntry() const = 0;
|
||||
};
|
||||
|
||||
#endif // _WX_GTK_TEXTENTRY_H_
|
||||
|
@@ -76,6 +76,10 @@ protected:
|
||||
};
|
||||
virtual void DoSetSelection(long from, long to, int flags = SetSel_Scroll);
|
||||
|
||||
// margins functions
|
||||
virtual bool DoSetMargins(const wxPoint& pt);
|
||||
virtual wxPoint DoGetMargins() const;
|
||||
|
||||
private:
|
||||
// implement this to return the HWND of the EDIT control
|
||||
virtual WXHWND GetEditHWND() const = 0;
|
||||
|
@@ -37,9 +37,6 @@
|
||||
// space between vertical line and value editor control
|
||||
#define wxPG_XBEFOREWIDGET 1
|
||||
|
||||
// x position adjustment for wxTextCtrl (and like)
|
||||
#define wxPG_TEXTCTRLXADJUST 3
|
||||
|
||||
// comment to use bitmap buttons
|
||||
#define wxPG_ICON_WIDTH 9
|
||||
// 1 if wxRendererNative should be employed
|
||||
@@ -75,7 +72,9 @@
|
||||
#define wxPG_XBEFOREWIDGET 1
|
||||
|
||||
// x position adjustment for wxTextCtrl (and like)
|
||||
#define wxPG_TEXTCTRLXADJUST 3
|
||||
// NB: Only define wxPG_TEXTCTRLXADJUST for platforms that do not
|
||||
// (yet) support wxTextEntry::SetMargins() for the left margin.
|
||||
//#define wxPG_TEXTCTRLXADJUST 3
|
||||
|
||||
// comment to use bitmap buttons
|
||||
#define wxPG_ICON_WIDTH 9
|
||||
|
@@ -783,6 +783,7 @@ protected:
|
||||
#ifdef __WXGTK20__
|
||||
virtual wxWindow *GetEditableWindow() { return this; }
|
||||
virtual GtkEditable *GetEditable() const { return NULL; }
|
||||
virtual GtkEntry *GetEntry() const { return NULL; }
|
||||
#endif
|
||||
|
||||
// Overrides
|
||||
|
@@ -142,6 +142,20 @@ public:
|
||||
virtual wxString GetHint() const;
|
||||
|
||||
|
||||
// margins
|
||||
// -------
|
||||
|
||||
// margins are the empty space between borders of control and the text
|
||||
// itself. When setting margin, use value -1 to indicate that specific
|
||||
// margin should not be changed.
|
||||
|
||||
bool SetMargins(const wxPoint& pt)
|
||||
{ return DoSetMargins(pt); }
|
||||
bool SetMargins(wxCoord left, wxCoord top = -1)
|
||||
{ return DoSetMargins(wxPoint(left, top)); }
|
||||
wxPoint GetMargins() const
|
||||
{ return DoGetMargins(); }
|
||||
|
||||
protected:
|
||||
// flags for DoSetValue(): common part of SetValue() and ChangeValue() and
|
||||
// also used to implement WriteText() in wxMSW
|
||||
@@ -159,6 +173,10 @@ protected:
|
||||
// generation and also by generic hints implementation
|
||||
virtual wxWindow *GetEditableWindow() = 0;
|
||||
|
||||
// margins functions
|
||||
virtual bool DoSetMargins(const wxPoint& pt);
|
||||
virtual wxPoint DoGetMargins() const;
|
||||
|
||||
|
||||
// class which should be used to temporarily disable text change events
|
||||
//
|
||||
|
Reference in New Issue
Block a user