X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ce4169a4d129fc6cd165b2e9ccc5cf5d48356020..18027d49b9daea9f8808052d927246b4489b0ef9:/src/gtk1/choice.cpp?ds=sidebyside diff --git a/src/gtk1/choice.cpp b/src/gtk1/choice.cpp index bd63c5e3f8..c78d0a2e8f 100644 --- a/src/gtk1/choice.cpp +++ b/src/gtk1/choice.cpp @@ -38,7 +38,8 @@ extern bool g_blockEventsOnDrag; static void gtk_choice_clicked_callback( GtkWidget *WXUNUSED(widget), wxChoice *choice ) { - if (g_isIdle) wxapp_install_idle_handler(); + if (g_isIdle) + wxapp_install_idle_handler(); if (!choice->m_hasVMT) return; @@ -71,11 +72,12 @@ bool wxChoice::Create( wxWindow *parent, wxWindowID id, m_acceptsFocus = TRUE; #endif - PreCreation( parent, id, pos, size, style, name ); - -#if wxUSE_VALIDATORS - SetValidator( validator ); -#endif + if (!PreCreation( parent, pos, size ) || + !CreateBase( parent, id, pos, size, style, validator, name )) + { + wxFAIL_MSG( _T("wxChoice creation failed") ); + return FALSE; + } m_widget = gtk_option_menu_new(); @@ -285,8 +287,6 @@ int wxChoice::GetSelection() count++; } - wxFAIL_MSG( _T("wxChoice: no selection") ); - return -1; } @@ -355,8 +355,6 @@ void wxChoice::SetSelection( int n ) int tmp = n; gtk_option_menu_set_history( GTK_OPTION_MENU(m_widget), (gint)tmp ); - - gtk_choice_clicked_callback( (GtkWidget *) NULL, this ); } void wxChoice::SetStringSelection( const wxString &string ) @@ -367,6 +365,36 @@ void wxChoice::SetStringSelection( const wxString &string ) if (n != -1) SetSelection( n ); } +void wxChoice::DisableEvents() +{ +/* + GtkMenuShell *menu_shell = GTK_MENU_SHELL( gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) ) ); + GList *child = menu_shell->children; + while (child) + { + gtk_signal_disconnect_by_func( GTK_OBJECT( child->data ), + GTK_SIGNAL_FUNC(gtk_choice_clicked_callback), (gpointer*)this ); + + child = child->next; + } +*/ +} + +void wxChoice::EnableEvents() +{ +/* + GtkMenuShell *menu_shell = GTK_MENU_SHELL( gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) ) ); + GList *child = menu_shell->children; + while (child) + { + gtk_signal_connect( GTK_OBJECT( child->data ), "activate", + GTK_SIGNAL_FUNC(gtk_choice_clicked_callback), (gpointer*)this ); + + child = child->next; + } +*/ +} + void wxChoice::ApplyWidgetStyle() { SetWidgetStyle();