]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/combocmn.cpp
refresh tree item after changing its icon so that the change is visible
[wxWidgets.git] / src / common / combocmn.cpp
index 36a3bbe91acd90c38212717fee75c29be7e72501..e2a0fd70c37c05db04d7b3eb25af101bec82cebb 100644 (file)
@@ -743,24 +743,23 @@ void wxComboCtrlBase::InstallInputHandlers( bool alsoTextCtrl )
     m_extraEvtHandler = inputHandler;
 }
 
-void wxComboCtrlBase::CreateTextCtrl( int extraStyle, const wxValidator& validator )
+void
+wxComboCtrlBase::CreateTextCtrl(int style, const wxValidator& validator)
 {
     if ( !(m_windowStyle & wxCB_READONLY) )
     {
-        m_text = new wxTextCtrl(this,
-                                wxID_ANY,
-                                m_valueString,
-                                wxDefaultPosition,
-                                wxDefaultSize,
-                                // wxTE_PROCESS_TAB is needed because on Windows, wxTAB_TRAVERSAL is
-                                // 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.
-                                wxTE_PROCESS_TAB |
-                                wxTE_PROCESS_ENTER |
-                                extraStyle,
-                                validator);
+        // wxTE_PROCESS_TAB is needed because on Windows, wxTAB_TRAVERSAL is
+        // 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;
+
+        if ( HasFlag(wxTE_PROCESS_ENTER) )
+            style |= wxTE_PROCESS_ENTER;
+
+        m_text = new wxTextCtrl(this, wxID_ANY, m_valueString,
+                                wxDefaultPosition, wxDefaultSize,
+                                style, validator);
 
         // This is required for some platforms (GTK+ atleast)
         m_text->SetSizeHints(2,4);
@@ -1092,7 +1091,7 @@ void wxComboCtrlBase::DoSetToolTip(wxToolTip *tooltip)
 // ----------------------------------------------------------------------------
 
 // draw focus background on area in a way typical on platform
-void wxComboCtrlBase::DrawFocusBackground( wxDC& dc, const wxRect& rect, int flags )
+void wxComboCtrlBase::DrawFocusBackground( wxDC& dc, const wxRect& rect, int flags ) const
 {
     wxSize sz = GetClientSize();
     bool isEnabled;
@@ -1126,8 +1125,14 @@ void wxComboCtrlBase::DrawFocusBackground( wxDC& dc, const wxRect& rect, int fla
     wxRect selRect(rect);
     selRect.y += focusSpacingY;
     selRect.height -= (focusSpacingY*2);
-    selRect.x += m_widthCustomPaint + focusSpacingX;
-    selRect.width -= m_widthCustomPaint + (focusSpacingX*2);
+
+    int wcp = 0;
+
+    if ( !(flags & wxCONTROL_ISSUBMENU) )
+        wcp += m_widthCustomPaint;
+
+    selRect.x += wcp + focusSpacingX;
+    selRect.width -= wcp + (focusSpacingX*2);
 
     wxColour bgCol;
 
@@ -1285,8 +1290,11 @@ wxBitmap& wxComboCtrlBase::GetBufferBitmap( const wxSize& sz ) const
 
 void wxComboCtrlBase::OnTextCtrlEvent(wxCommandEvent& event)
 {
-    // Change event id and relay it forward
+    // Change event id, object and string before relaying it forward
     event.SetId(GetId());
+    wxString s = event.GetString();
+    event.SetEventObject(this);
+    event.SetString(s);
     event.Skip();
 }
 
@@ -1554,12 +1562,13 @@ void wxComboCtrlBase::DestroyPopup()
     if ( m_winPopup )
         m_winPopup->Destroy();
 
+    m_popupExtraHandler = (wxEvtHandler*) NULL;
     m_popupInterface = (wxComboPopup*) NULL;
     m_winPopup = (wxWindow*) NULL;
     m_popup = (wxWindow*) NULL;
 }
 
-void wxComboCtrlBase::SetPopupControl( wxComboPopup* iface )
+void wxComboCtrlBase::DoSetPopupControl(wxComboPopup* iface)
 {
     wxCHECK_RET( iface, wxT("no popup interface set for wxComboCtrl") );