]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk1/choice.cpp
Applied patch [ 1427626 ] Fix wxFileConfig so that it still works after DeleteAll()
[wxWidgets.git] / src / gtk1 / choice.cpp
index 6dbc4a9cd1485d1d02db186d00de0a2325f0cb41..8b61e05950a50df61d80da7cf28b4a400cb9dc05 100644 (file)
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        choice.cpp
+// Name:        src/gtk1/choice.cpp
 // Purpose:
 // Author:      Robert Roebling
 // Id:          $Id$
@@ -7,11 +7,6 @@
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
-
-#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
-#pragma implementation "choice.h"
-#endif
-
 #include "wx/defs.h"
 
 #if wxUSE_CHOICE
@@ -19,7 +14,7 @@
 #include "wx/choice.h"
 #include "wx/arrstr.h"
 
-#include "wx/gtk/private.h"
+#include "wx/gtk1/private.h"
 
 //-----------------------------------------------------------------------------
 // idle system
@@ -50,9 +45,6 @@ static void gtk_choice_clicked_callback( GtkWidget *WXUNUSED(widget), wxChoice *
 
     int selection = wxNOT_FOUND;
 
-#ifdef __WXGTK20__
-    selection = gtk_option_menu_get_history( GTK_OPTION_MENU(choice->GetHandle()) );
-#else
     GtkMenuShell *menu_shell = GTK_MENU_SHELL( gtk_option_menu_get_menu( GTK_OPTION_MENU(choice->GetHandle()) ) );
     int count = 0;
 
@@ -68,7 +60,7 @@ static void gtk_choice_clicked_callback( GtkWidget *WXUNUSED(widget), wxChoice *
         child = child->next;
         count++;
     }
-#endif
+
     choice->m_selection_hack = selection;
 
     wxCommandEvent event(wxEVT_COMMAND_CHOICE_SELECTED, choice->GetId() );
@@ -339,9 +331,9 @@ void wxChoice::Delete( int n )
     }
 }
 
-int wxChoice::FindString( const wxString &string ) const
+int wxChoice::FindString( const wxString &string, bool bCase ) const
 {
-    wxCHECK_MSG( m_widget != NULL, -1, wxT("invalid choice") );
+    wxCHECK_MSG( m_widget != NULL, wxNOT_FOUND, wxT("invalid choice") );
 
     // If you read this code once and you think you understand
     // it, then you are very wrong. Robert Roebling.
@@ -360,12 +352,9 @@ int wxChoice::FindString( const wxString &string ) const
 
         wxASSERT_MSG( label != NULL , wxT("wxChoice: invalid label") );
 
-#ifdef __WXGTK20__
-         wxString tmp( wxGTK_CONV_BACK( gtk_label_get_text( label) ) );
-#else
          wxString tmp( label->label );
-#endif
-        if (string == tmp)
+
+         if (string.IsSameAs( tmp, bCase ))
             return count;
 
         child = child->next;
@@ -377,7 +366,7 @@ int wxChoice::FindString( const wxString &string ) const
 
 int wxChoice::GetSelection() const
 {
-    wxCHECK_MSG( m_widget != NULL, -1, wxT("invalid choice") );
+    wxCHECK_MSG( m_widget != NULL, wxNOT_FOUND, wxT("invalid choice") );
 
     return m_selection_hack;
 
@@ -432,11 +421,7 @@ wxString wxChoice::GetString( int n ) const
 
             wxASSERT_MSG( label != NULL , wxT("wxChoice: invalid label") );
 
-#ifdef __WXGTK20__
-            return wxString( wxGTK_CONV_BACK( gtk_label_get_text( label) ) );
-#else
             return wxString( label->label );
-#endif
         }
         child = child->next;
         count++;
@@ -627,11 +612,7 @@ wxSize wxChoice::DoGetBestSize() const
 
 bool wxChoice::IsOwnGtkWindow( GdkWindow *window )
 {
-#ifdef __WXGTK20__
-    return GTK_BUTTON(m_widget)->event_window;
-#else
     return (window == m_widget->window);
-#endif
 }
 
 // static