]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk1/combobox.cpp
Fixed yet another error in my wxCmdLineParser mdifications.
[wxWidgets.git] / src / gtk1 / combobox.cpp
index bd085bae0d39b7353b9e76c260aab124c3eeb1cb..55cbde698363aeec9f4c5ec70f13234b958376e5 100644 (file)
@@ -20,8 +20,7 @@
 
 #include "wx/textctrl.h"    // for wxEVT_COMMAND_TEXT_UPDATED
 
-#include <gdk/gdk.h>
-#include <gtk/gtk.h>
+#include "wx/gtk/private.h"
 
 //-----------------------------------------------------------------------------
 // idle system
@@ -186,7 +185,7 @@ bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value,
     }
 
 
-    SetBackgroundColour( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_WINDOW ) );
+    SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) );
     SetForegroundColour( parent->GetForegroundColour() );
 
     Show( TRUE );
@@ -492,11 +491,7 @@ void wxComboBox::Copy()
     wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") );
 
     GtkWidget *entry = GTK_COMBO(m_widget)->entry;
-#if defined(__WXGTK13__) || (GTK_MINOR_VERSION > 0)
-    gtk_editable_copy_clipboard( GTK_EDITABLE(entry) );
-#else
-    gtk_editable_copy_clipboard( GTK_EDITABLE(entry), 0 );
-#endif
+    gtk_editable_copy_clipboard( GTK_EDITABLE(entry) DUMMY_CLIPBOARD_ARG );
 }
 
 void wxComboBox::Cut()
@@ -504,11 +499,7 @@ void wxComboBox::Cut()
     wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") );
 
     GtkWidget *entry = GTK_COMBO(m_widget)->entry;
-#if defined(__WXGTK13__) || (GTK_MINOR_VERSION > 0)
-    gtk_editable_cut_clipboard( GTK_EDITABLE(entry) );
-#else
-    gtk_editable_cut_clipboard( GTK_EDITABLE(entry), 0 );
-#endif
+    gtk_editable_cut_clipboard( GTK_EDITABLE(entry) DUMMY_CLIPBOARD_ARG );
 }
 
 void wxComboBox::Paste()
@@ -516,11 +507,7 @@ void wxComboBox::Paste()
     wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") );
 
     GtkWidget *entry = GTK_COMBO(m_widget)->entry;
-#if defined(__WXGTK13__) || (GTK_MINOR_VERSION > 0)
-    gtk_editable_paste_clipboard( GTK_EDITABLE(entry) );
-#else
-    gtk_editable_paste_clipboard( GTK_EDITABLE(entry), 0 );
-#endif
+    gtk_editable_paste_clipboard( GTK_EDITABLE(entry) DUMMY_CLIPBOARD_ARG);
 }
 
 void wxComboBox::SetInsertionPoint( long pos )
@@ -540,8 +527,7 @@ void wxComboBox::SetInsertionPointEnd()
 
 long wxComboBox::GetInsertionPoint() const
 {
-    GtkWidget *entry = GTK_COMBO(m_widget)->entry;
-    return (long) GTK_EDITABLE(entry)->current_pos;
+    return (long) GET_EDITABLE_POS( GTK_COMBO(m_widget)->entry );
 }
 
 long wxComboBox::GetLastPosition() const
@@ -615,10 +601,29 @@ void wxComboBox::OnChar( wxKeyEvent &event )
                 event.SetEventObject( this );
                 GetEventHandler()->ProcessEvent( event );
             }
-            //else: do nothing, this will open the listbox
+
+            // This will invoke the dialog default action, such
+            // as the clicking the default button.
+
+            wxWindow *top_frame = m_parent;
+            while (top_frame->GetParent() && !(top_frame->IsTopLevel()))
+            top_frame = top_frame->GetParent();
+    
+            if (top_frame && GTK_IS_WINDOW(top_frame->m_widget))
+            {
+                GtkWindow *window = GTK_WINDOW(top_frame->m_widget);
+
+                if (window->default_widget)
+                {
+                    gtk_widget_activate (window->default_widget);
+                    return;
+                }
+            }
+            
+            return;
         }
     }
-
+    
     event.Skip();
 }