wxComboBox::~wxComboBox()
{
- wxNode *node = m_clientObjectList.First();
+ wxNode *node = m_clientObjectList.GetFirst();
while (node)
{
- wxClientData *cd = (wxClientData*)node->Data();
+ wxClientData *cd = (wxClientData*)node->GetData();
if (cd) delete cd;
- node = node->Next();
+ node = node->GetNext();
}
m_clientObjectList.Clear();
m_clientDataList.Clear();
}
+void wxComboBox::SetFocus()
+{
+ if ( m_hasFocus )
+ {
+ // don't do anything if we already have focus
+ return;
+ }
+
+ gtk_widget_grab_focus( m_focusWidget );
+}
+
void wxComboBox::AppendCommon( const wxString &item )
{
wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") );
{
wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") );
- wxNode *node = m_clientDataList.Nth( n );
+ wxNode *node = m_clientDataList.Item( n );
if (!node) return;
node->SetData( (wxObject*) clientData );
{
wxCHECK_MSG( m_widget != NULL, NULL, wxT("invalid combobox") );
- wxNode *node = m_clientDataList.Nth( n );
+ wxNode *node = m_clientDataList.Item( n );
if (!node) return NULL;
- return node->Data();
+ return node->GetData();
}
void wxComboBox::SetClientObject( int n, wxClientData* clientData )
{
wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") );
- wxNode *node = m_clientObjectList.Nth( n );
+ wxNode *node = m_clientObjectList.Item( n );
if (!node) return;
- wxClientData *cd = (wxClientData*) node->Data();
+ wxClientData *cd = (wxClientData*) node->GetData();
if (cd) delete cd;
node->SetData( (wxObject*) clientData );
{
wxCHECK_MSG( m_widget != NULL, (wxClientData*)NULL, wxT("invalid combobox") );
- wxNode *node = m_clientObjectList.Nth( n );
+ wxNode *node = m_clientObjectList.Item( n );
if (!node) return (wxClientData*) NULL;
- return (wxClientData*) node->Data();
+ return (wxClientData*) node->GetData();
}
void wxComboBox::Clear()
GtkWidget *list = GTK_COMBO(m_widget)->list;
gtk_list_clear_items( GTK_LIST(list), 0, Number() );
- wxNode *node = m_clientObjectList.First();
+ wxNode *node = m_clientObjectList.GetFirst();
while (node)
{
- wxClientData *cd = (wxClientData*)node->Data();
+ wxClientData *cd = (wxClientData*)node->GetData();
if (cd) delete cd;
- node = node->Next();
+ node = node->GetNext();
}
m_clientObjectList.Clear();
gtk_list_remove_items( listbox, list );
g_list_free( list );
- wxNode *node = m_clientObjectList.Nth( n );
+ wxNode *node = m_clientObjectList.Item( n );
if (node)
{
- wxClientData *cd = (wxClientData*)node->Data();
+ wxClientData *cd = (wxClientData*)node->GetData();
if (cd) delete cd;
m_clientObjectList.DeleteNode( node );
}
- node = m_clientDataList.Nth( n );
+ node = m_clientDataList.Item( n );
if (node)
{
m_clientDataList.DeleteNode( node );
{
GtkBin *bin = GTK_BIN( child->data );
GtkLabel *label = GTK_LABEL( bin->child );
- if (item == wxString(label->label,*wxConvCurrent))
+#ifdef __WXGTK20__
+ wxString str( wxGTK_CONV_BACK( gtk_label_get_text(label) ) );
+#else
+ wxString str( label->label );
+#endif
+ if (item == str)
return count;
+
count++;
child = child->next;
}
GtkBin *bin = GTK_BIN( child->data );
GtkLabel *label = GTK_LABEL( bin->child );
#ifdef __WXGTK20__
- str = wxGTK_CONV_BACK( gtk_label_get_text( label) );
+ str = wxGTK_CONV_BACK( gtk_label_get_text(label) );
#else
str = wxString( label->label );
#endif
if (selection)
{
GtkBin *bin = GTK_BIN( selection->data );
- wxString tmp = wxString(GTK_LABEL( bin->child )->label,*wxConvCurrent);
+ GtkLabel *label = GTK_LABEL( bin->child );
+#ifdef __WXGTK20__
+ wxString tmp( wxGTK_CONV_BACK( gtk_label_get_text(label) ) );
+#else
+ wxString tmp( label->label );
+#endif
return tmp;
}
void wxComboBox::OnChar( wxKeyEvent &event )
{
- if ( event.KeyCode() == WXK_RETURN )
+ if ( event.GetKeyCode() == WXK_RETURN )
{
wxString value = GetValue();
ret.x = 0;
if ( m_widget )
{
- GdkFont *font = m_font.GetInternalFont();
-
- wxCoord width;
- size_t count = Number();
+ int width;
+ size_t count = GetCount();
for ( size_t n = 0; n < count; n++ )
{
- width = (wxCoord)gdk_string_width(font, wxGTK_CONV( GetString(n) ) );
+ GetTextExtent( GetString(n), &width, NULL, NULL, NULL, &m_font );
if ( width > ret.x )
ret.x = width;
}