]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/combobox.cpp
show error message if exec() failed: not pretty but better than nothing
[wxWidgets.git] / src / mac / combobox.cpp
index 8ea92291e2cfd4a9f524fafc3af4310c0c285464..2e68206c4275886cf4353248c8084154fa49167c 100644 (file)
@@ -14,6 +14,7 @@
 #endif
 
 #include "wx/combobox.h"
+#include "wx/button.h"
 #include "wx/menu.h"
 #include "wx/mac/uma.h"
 
@@ -59,7 +60,7 @@ public:
 protected:
     void OnChar( wxKeyEvent& event )
     {
-        if ( event.KeyCode() == WXK_RETURN )
+        if ( event.GetKeyCode() == WXK_RETURN )
         {
             wxString value = GetValue();
 
@@ -204,7 +205,7 @@ void wxComboBox::DoMoveWindow(int x, int y, int width, int height) {
     }
     else
     {
-        wxCoord wText = width - POPUPWIDTH;
+        wxCoord wText = width - POPUPWIDTH - MARGIN;
         m_text->SetSize(0, 0, wText, height);
         m_choice->SetSize(0 + wText + MARGIN, 0, POPUPWIDTH, -1);
     }    
@@ -261,10 +262,6 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id,
            const wxValidator& validator,
            const wxString& name)
 {
-
-    Rect bounds ;
-    Str255 title ;
-
     if ( !wxControl::Create(parent, id, wxDefaultPosition, wxDefaultSize, style ,
                             wxDefaultValidator, name) )
     {
@@ -314,7 +311,12 @@ wxString wxComboBox::GetValue() const
 
 void wxComboBox::SetValue(const wxString& value)
 {
-    SetStringSelection( value ) ;
+    int s = FindString (value);
+    if (s == wxNOT_FOUND && !HasFlag(wxCB_READONLY) )
+    {
+       m_choice->Append(value) ;
+    }
+       SetStringSelection( value ) ;
 }
 
 // Clipboard operations
@@ -411,6 +413,10 @@ void wxComboBox::Append(const wxString& item)
 
 void wxComboBox::Delete(int n)
 {
+    if ( HasClientObjectData() )
+    {
+        SetClientObject(n, NULL);
+    }
     m_choice->Delete( n );
 }
 
@@ -465,7 +471,7 @@ bool wxComboBox::SetStringSelection(const wxString& sel)
         return FALSE;
 }
 
-void wxComboBox::MacHandleControlClick( WXWidget control , wxInt16 controlpart ) 
+void wxComboBox::MacHandleControlClick( WXWidget WXUNUSED(control) , wxInt16 WXUNUSED(controlpart) ) 
 {
     wxCommandEvent event(wxEVT_COMMAND_COMBOBOX_SELECTED, m_windowId );
     event.SetInt(GetSelection());