Added wxComboCtrl::SetTextCtrlStyle()

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64577 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Jaakko Salli
2010-06-13 09:59:32 +00:00
parent 863d1ce7c2
commit 1ac5cfc7c9
4 changed files with 34 additions and 1 deletions

View File

@@ -523,6 +523,7 @@ All (GUI):
- Added wxTreeCtrl::{Clear,Set}FocusedItem() (Nikolay Tiushkov). - Added wxTreeCtrl::{Clear,Set}FocusedItem() (Nikolay Tiushkov).
- Added "filter changed" event to wxFileCtrl (Bill Jones). - Added "filter changed" event to wxFileCtrl (Bill Jones).
- wxAUI: update floating window position and not only size on resize (MacGyver). - wxAUI: update floating window position and not only size on resize (MacGyver).
- Added wxComboCtrl::SetTextCtrlStyle().
GTK: GTK:

View File

@@ -402,6 +402,10 @@ public:
wxPoint GetMargins() const wxPoint GetMargins() const
{ return DoGetMargins(); } { return DoGetMargins(); }
// Set custom style flags for embedded wxTextCtrl. Usually must be used
// with two-step creation, before Create() call.
void SetTextCtrlStyle( int style );
// Return internal flags // Return internal flags
wxUint32 GetInternalFlags() const { return m_iFlags; } wxUint32 GetInternalFlags() const { return m_iFlags; }
@@ -649,6 +653,9 @@ protected:
// platform-dependant customization and other flags // platform-dependant customization and other flags
wxUint32 m_iFlags; wxUint32 m_iFlags;
// custom style for m_text
int m_textCtrlStyle;
// draw blank button background under bitmap? // draw blank button background under bitmap?
bool m_blankButtonBg; bool m_blankButtonBg;

View File

@@ -734,6 +734,22 @@ public:
*/ */
void SetText(const wxString& value); void SetText(const wxString& value);
/**
Set a custom window style for the embedded wxTextCtrl. Usually you
will need to use this during two-step creation, just before Create().
For example:
@code
wxComboCtrl* comboCtrl = new wxComboCtrl();
// Let's make the text right-aligned
comboCtrl->SetTextCtrlStyle(wxTE_RIGHT);
comboCtrl->Create(parent, wxID_ANY, wxEmptyString);
@endcode
*/
void SetTextCtrlStyle( int style );
/** /**
This will set the space in pixels between left edge of the control and This will set the space in pixels between left edge of the control and
the text, regardless whether control is read-only or not. Value -1 can the text, regardless whether control is read-only or not. Value -1 can

View File

@@ -905,6 +905,7 @@ void wxComboCtrlBase::Init()
m_extRight = 0; m_extRight = 0;
m_marginLeft = -1; m_marginLeft = -1;
m_iFlags = 0; m_iFlags = 0;
m_textCtrlStyle = 0;
m_timeCanAcceptClick = 0; m_timeCanAcceptClick = 0;
m_resetFocus = false; m_resetFocus = false;
@@ -968,7 +969,7 @@ wxComboCtrlBase::CreateTextCtrl(int style, const wxValidator& validator)
// not used by the wxPropertyGrid and therefore the tab is processed by // not used by the wxPropertyGrid and therefore the tab is processed by
// looking at ancestors to see if they have wxTAB_TRAVERSAL. The // looking at ancestors to see if they have wxTAB_TRAVERSAL. The
// navigation event is then sent to the wrong window. // navigation event is then sent to the wrong window.
style |= wxTE_PROCESS_TAB; style |= wxTE_PROCESS_TAB | m_textCtrlStyle;
if ( HasFlag(wxTE_PROCESS_ENTER) ) if ( HasFlag(wxTE_PROCESS_ENTER) )
style |= wxTE_PROCESS_ENTER; style |= wxTE_PROCESS_ENTER;
@@ -2545,6 +2546,14 @@ wxCoord wxComboCtrlBase::GetNativeTextIndent() const
return DEFAULT_TEXT_INDENT; return DEFAULT_TEXT_INDENT;
} }
void wxComboCtrlBase::SetTextCtrlStyle( int style )
{
m_textCtrlStyle = style;
if ( m_text )
m_text->SetWindowStyle(style);
}
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// methods forwarded to wxTextCtrl // methods forwarded to wxTextCtrl
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------