]> git.saurik.com Git - wxWidgets.git/commitdiff
Added wxComboCtrl::SetTextCtrlStyle()
authorJaakko Salli <jaakko.salli@dnainternet.net>
Sun, 13 Jun 2010 09:59:32 +0000 (09:59 +0000)
committerJaakko Salli <jaakko.salli@dnainternet.net>
Sun, 13 Jun 2010 09:59:32 +0000 (09:59 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64577 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

docs/changes.txt
include/wx/combo.h
interface/wx/combo.h
src/common/combocmn.cpp

index fee187ad4dc6175c48a84ef779b7dc4715e11305..12422a6ed621c07693ce9150633e48e61710137a 100644 (file)
@@ -523,6 +523,7 @@ All (GUI):
 - Added wxTreeCtrl::{Clear,Set}FocusedItem() (Nikolay Tiushkov).
 - Added "filter changed" event to wxFileCtrl (Bill Jones).
 - wxAUI: update floating window position and not only size on resize (MacGyver).
+- Added wxComboCtrl::SetTextCtrlStyle().
 
 GTK:
 
index cfb202be2bb8b874a2ef6a795b870e944d32c372..6a190e524aecdcd22590b285c8713f01f7db5653 100644 (file)
@@ -402,6 +402,10 @@ public:
     wxPoint GetMargins() const
         { 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
     wxUint32 GetInternalFlags() const { return m_iFlags; }
 
@@ -649,6 +653,9 @@ protected:
     // platform-dependant customization and other flags
     wxUint32                m_iFlags;
 
+    // custom style for m_text
+    int                     m_textCtrlStyle;
+
     // draw blank button background under bitmap?
     bool                    m_blankButtonBg;
 
index 82c63e4c42a3cfd3f225eac34ef39ece5938f427..9ed3db36cfae59e0523b800e7ecd57e5f1c4fe36 100644 (file)
@@ -734,6 +734,22 @@ public:
     */
     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
         the text, regardless whether control is read-only or not. Value -1 can
index a256b660c403c4feea64b344d275572d01589c12..b32ef217eda9d69a3644349b54e9cd9860d7efe3 100644 (file)
@@ -905,6 +905,7 @@ void wxComboCtrlBase::Init()
     m_extRight = 0;
     m_marginLeft = -1;
     m_iFlags = 0;
+    m_textCtrlStyle = 0;
     m_timeCanAcceptClick = 0;
 
     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
         // looking at ancestors to see if they have wxTAB_TRAVERSAL. The
         // navigation event is then sent to the wrong window.
-        style |= wxTE_PROCESS_TAB;
+        style |= wxTE_PROCESS_TAB | m_textCtrlStyle;
 
         if ( HasFlag(wxTE_PROCESS_ENTER) )
             style |= wxTE_PROCESS_ENTER;
@@ -2545,6 +2546,14 @@ wxCoord wxComboCtrlBase::GetNativeTextIndent() const
     return DEFAULT_TEXT_INDENT;
 }
 
+void wxComboCtrlBase::SetTextCtrlStyle( int style )
+{
+    m_textCtrlStyle = style;
+
+    if ( m_text )
+        m_text->SetWindowStyle(style);
+}
+
 // ----------------------------------------------------------------------------
 // methods forwarded to wxTextCtrl
 // ----------------------------------------------------------------------------