Small fixes to wxChoice, wxComboBox and wxListBox
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@644 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -103,6 +103,11 @@ void wxChoice::Clear(void)
|
||||
gtk_option_menu_set_menu( GTK_OPTION_MENU(m_widget), menu );
|
||||
}
|
||||
|
||||
void wxChoice::Delete( int WXUNUSED(n) )
|
||||
{
|
||||
wxFAIL_MSG( "wxChoice:Delete not implemented" );
|
||||
}
|
||||
|
||||
int wxChoice::FindString( const wxString &string ) const
|
||||
{
|
||||
// If you read this code once and you think you understand
|
||||
|
@@ -143,22 +143,33 @@ void wxComboBox::Append( const wxString &item, char *clientData )
|
||||
gtk_signal_connect( GTK_OBJECT(list_item), "select",
|
||||
GTK_SIGNAL_FUNC(gtk_combo_clicked_callback), (gpointer)this );
|
||||
|
||||
m_clientData.Append( (wxObject*)clientData );
|
||||
|
||||
gtk_container_add( GTK_CONTAINER(list), list_item );
|
||||
|
||||
gtk_widget_show( list_item );
|
||||
|
||||
m_clientData.Append( (wxObject*)clientData );
|
||||
}
|
||||
|
||||
void wxComboBox::Delete( int n )
|
||||
{
|
||||
GtkWidget *list = GTK_COMBO(m_widget)->list;
|
||||
gtk_list_clear_items( GTK_LIST(list), n, n );
|
||||
GtkList *listbox = GTK_LIST( GTK_COMBO(m_widget)->list );
|
||||
|
||||
GList *child = g_list_nth( listbox->children, n );
|
||||
|
||||
if (!child)
|
||||
{
|
||||
wxFAIL_MSG("wrong index");
|
||||
return;
|
||||
}
|
||||
|
||||
GList *list = g_list_append( NULL, child->data );
|
||||
gtk_list_remove_items( listbox, list );
|
||||
g_list_free( list );
|
||||
|
||||
wxNode *node = m_clientData.Nth( n );
|
||||
if (!node)
|
||||
{
|
||||
wxFAIL_MSG( "wxComboBox: wrong index" );
|
||||
wxFAIL_MSG( "wrong index" );
|
||||
}
|
||||
else
|
||||
m_clientData.DeleteNode( node );
|
||||
|
@@ -140,10 +140,10 @@ void wxListBox::Append( const wxString &item, char *clientData )
|
||||
gtk_signal_connect( GTK_OBJECT(list_item), "deselect",
|
||||
GTK_SIGNAL_FUNC(gtk_listitem_select_callback), (gpointer)this );
|
||||
|
||||
gtk_container_add( GTK_CONTAINER(m_list), list_item );
|
||||
|
||||
m_clientData.Append( (wxObject*)clientData );
|
||||
|
||||
gtk_container_add( GTK_CONTAINER(m_list), list_item );
|
||||
|
||||
gtk_widget_show( list_item );
|
||||
}
|
||||
|
||||
|
@@ -103,6 +103,11 @@ void wxChoice::Clear(void)
|
||||
gtk_option_menu_set_menu( GTK_OPTION_MENU(m_widget), menu );
|
||||
}
|
||||
|
||||
void wxChoice::Delete( int WXUNUSED(n) )
|
||||
{
|
||||
wxFAIL_MSG( "wxChoice:Delete not implemented" );
|
||||
}
|
||||
|
||||
int wxChoice::FindString( const wxString &string ) const
|
||||
{
|
||||
// If you read this code once and you think you understand
|
||||
|
@@ -143,22 +143,33 @@ void wxComboBox::Append( const wxString &item, char *clientData )
|
||||
gtk_signal_connect( GTK_OBJECT(list_item), "select",
|
||||
GTK_SIGNAL_FUNC(gtk_combo_clicked_callback), (gpointer)this );
|
||||
|
||||
m_clientData.Append( (wxObject*)clientData );
|
||||
|
||||
gtk_container_add( GTK_CONTAINER(list), list_item );
|
||||
|
||||
gtk_widget_show( list_item );
|
||||
|
||||
m_clientData.Append( (wxObject*)clientData );
|
||||
}
|
||||
|
||||
void wxComboBox::Delete( int n )
|
||||
{
|
||||
GtkWidget *list = GTK_COMBO(m_widget)->list;
|
||||
gtk_list_clear_items( GTK_LIST(list), n, n );
|
||||
GtkList *listbox = GTK_LIST( GTK_COMBO(m_widget)->list );
|
||||
|
||||
GList *child = g_list_nth( listbox->children, n );
|
||||
|
||||
if (!child)
|
||||
{
|
||||
wxFAIL_MSG("wrong index");
|
||||
return;
|
||||
}
|
||||
|
||||
GList *list = g_list_append( NULL, child->data );
|
||||
gtk_list_remove_items( listbox, list );
|
||||
g_list_free( list );
|
||||
|
||||
wxNode *node = m_clientData.Nth( n );
|
||||
if (!node)
|
||||
{
|
||||
wxFAIL_MSG( "wxComboBox: wrong index" );
|
||||
wxFAIL_MSG( "wrong index" );
|
||||
}
|
||||
else
|
||||
m_clientData.DeleteNode( node );
|
||||
|
@@ -140,10 +140,10 @@ void wxListBox::Append( const wxString &item, char *clientData )
|
||||
gtk_signal_connect( GTK_OBJECT(list_item), "deselect",
|
||||
GTK_SIGNAL_FUNC(gtk_listitem_select_callback), (gpointer)this );
|
||||
|
||||
gtk_container_add( GTK_CONTAINER(m_list), list_item );
|
||||
|
||||
m_clientData.Append( (wxObject*)clientData );
|
||||
|
||||
gtk_container_add( GTK_CONTAINER(m_list), list_item );
|
||||
|
||||
gtk_widget_show( list_item );
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user