]> git.saurik.com Git - wxWidgets.git/blobdiff - src/stc/PlatWX.cpp
Added wxUSE_TOOLTIPS guard for previous patch
[wxWidgets.git] / src / stc / PlatWX.cpp
index db2960ad5bf7690057e5b1b3937e0c1bb75298e8..ceb50296a67a96d97b99a727be1a8e92ae5ff6b9 100644 (file)
@@ -698,7 +698,7 @@ void Window::SetTitle(const char *s) {
 // Helper classes for ListBox
 
 
-// This is a simple subclass of wxLIstView that just resets focus to the
+// This is a simple subclass of wxListView that just resets focus to the
 // parent when it gets it.
 class wxSTCListBox : public wxListView {
 public:
@@ -713,12 +713,17 @@ public:
         event.Skip();
     }
 
+    void OnKillFocus(wxFocusEvent& event) {
+        // Do nothing.  Prevents base class from resetting the colors...
+    }
+
 private:
     DECLARE_EVENT_TABLE()
 };
 
 BEGIN_EVENT_TABLE(wxSTCListBox, wxListView)
     EVT_SET_FOCUS( wxSTCListBox::OnFocus)
+    EVT_KILL_FOCUS(wxSTCListBox::OnKillFocus)
 END_EVENT_TABLE()
 
 
@@ -741,9 +746,26 @@ public:
         lv->SetCursor(wxCursor(wxCURSOR_ARROW));
         lv->InsertColumn(0, wxEmptyString);
         lv->InsertColumn(1, wxEmptyString);
+
+        // Eventhough we immediately reset the focus to the parent, this helps
+        // things to look right...
+        lv->SetFocus();
+
         Hide();
     }
 
+        
+    // On OSX and (possibly others) there can still be pending
+    // messages/events for the list control when Scintilla wants to
+    // close it, so do a pending delete of it instead of destroying
+    // immediately.
+    bool Destroy() {
+        if ( !wxPendingDelete.Member(this) )
+            wxPendingDelete.Append(this);
+        return TRUE;
+    }
+
+    
     int IconWidth() {
         wxImageList* il = lv->GetImageList(wxIMAGE_LIST_SMALL);
         if (il != NULL) {