X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e2380ce1574c2c7290887f1eabc8cf2041a9e0ad..dad6a47e6d425673510b53e9a01114cdea2a5f2c:/src/gtk1/choice.cpp diff --git a/src/gtk1/choice.cpp b/src/gtk1/choice.cpp index 2eb0944efe..d4bcff0b9e 100644 --- a/src/gtk1/choice.cpp +++ b/src/gtk1/choice.cpp @@ -281,7 +281,7 @@ void wxChoice::Delete( int n ) if ( hasObjectData ) SetClientObject(i, (wxClientData *)itemsData[i]); else if ( hasClientData ) - SetClientDate(i, itemsData[i]); + SetClientData(i, itemsData[i]); } } @@ -346,11 +346,33 @@ int wxChoice::GetSelection() const #endif } -void wxChoice::SetString( int WXUNUSED(n), const wxString& WXUNUSED(string) ) +void wxChoice::SetString( int n, const wxString& str ) { wxCHECK_RET( m_widget != NULL, wxT("invalid choice") ); - wxFAIL_MSG(wxT("not implemented")); + GtkMenuShell *menu_shell = GTK_MENU_SHELL( gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) ) ); + int count = 0; + GList *child = menu_shell->children; + while (child) + { + GtkBin *bin = GTK_BIN( child->data ); + if (count == n) + { + GtkLabel *label = (GtkLabel *) NULL; + if (bin->child) + label = GTK_LABEL(bin->child); + if (!label) + label = GTK_LABEL( BUTTON_CHILD(m_widget) ); + + wxASSERT_MSG( label != NULL , wxT("wxChoice: invalid label") ); + + gtk_label_set_text( label, wxGTK_CONV( str ) ); + + return; + } + child = child->next; + count++; + } } wxString wxChoice::GetString( int n ) const