GtkWidget *list = GTK_COMBO(m_widget)->list;
- gtk_list_set_selection_mode( GTK_LIST(list), GTK_SELECTION_MULTIPLE );
+#ifndef __WXGTK20__
+ // gtk_list_set_selection_mode( GTK_LIST(list), GTK_SELECTION_MULTIPLE );
+#endif
for (int i = 0; i < n; i++)
{
inserting the first item */
m_alreadySent = TRUE;
- GtkWidget *list_item = gtk_list_item_new_with_label( choices[i].mbc_str() );
+ GtkWidget *list_item = gtk_list_item_new_with_label( wxGTK_CONV( choices[i] ) );
m_clientDataList.Append( (wxObject*)NULL );
m_clientObjectList.Append( (wxObject*)NULL );
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") );
GtkWidget *list = GTK_COMBO(m_widget)->list;
- GtkWidget *list_item = gtk_list_item_new_with_label( item.mbc_str() );
+ GtkWidget *list_item = gtk_list_item_new_with_label( wxGTK_CONV( item ) );
gtk_container_add( GTK_CONTAINER(list), list_item );
{
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 );
- str = wxString(label->label,*wxConvCurrent);
+#ifdef __WXGTK20__
+ str = wxGTK_CONV_BACK( gtk_label_get_text(label) );
+#else
+ str = wxString( label->label );
+#endif
}
else
{
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;
}
wxString wxComboBox::GetValue() const
{
- GtkWidget *entry = GTK_COMBO(m_widget)->entry;
- wxString tmp = wxString(gtk_entry_get_text( GTK_ENTRY(entry) ),*wxConvCurrent);
+ GtkEntry *entry = GTK_ENTRY( GTK_COMBO(m_widget)->entry );
+ wxString tmp( wxGTK_CONV_BACK( gtk_entry_get_text( entry ) ) );
+
+#if 0
+ for (int i = 0; i < wxStrlen(tmp.c_str()) +1; i++)
+ {
+ wxChar c = tmp[i];
+ printf( "%d ", (int) (c) );
+ }
+ printf( "\n" );
+#endif
+
return tmp;
}
GtkWidget *entry = GTK_COMBO(m_widget)->entry;
wxString tmp = wxT("");
if (!value.IsNull()) tmp = value;
- gtk_entry_set_text( GTK_ENTRY(entry), tmp.mbc_str() );
+ gtk_entry_set_text( GTK_ENTRY(entry), wxGTK_CONV( tmp ) );
}
void wxComboBox::Copy()
void wxComboBox::Replace( long from, long to, const wxString& value )
{
wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") );
- // FIXME: not quite sure how to do this method right in multibyte mode
GtkWidget *entry = GTK_COMBO(m_widget)->entry;
gtk_editable_delete_text( GTK_EDITABLE(entry), (gint)from, (gint)to );
if (value.IsNull()) return;
gint pos = (gint)to;
- gtk_editable_insert_text( GTK_EDITABLE(entry), value.mbc_str(), value.Length(), &pos );
+
+#if wxUSE_UNICODE
+ wxCharBuffer buffer = wxConvUTF8.cWX2MB( value );
+ gtk_editable_insert_text( GTK_EDITABLE(entry), (const char*) buffer, strlen( (const char*) buffer ), &pos );
+#else
+ gtk_editable_insert_text( GTK_EDITABLE(entry), value.c_str(), value.Length(), &pos );
+#endif
}
void wxComboBox::Remove(long from, long to)
event.SetEventObject( this );
GetEventHandler()->ProcessEvent( event );
}
- else
- {
- // This will invoke the dialog default action, such
- // as the clicking the default button.
+
+ // This will invoke the dialog default action, such
+ // as the clicking the default button.
+
+ wxWindow *top_frame = m_parent;
+ while (top_frame->GetParent() && !(top_frame->IsTopLevel()))
+ top_frame = top_frame->GetParent();
- wxWindow *top_frame = m_parent;
- while (top_frame->GetParent() && !(top_frame->IsTopLevel()))
- top_frame = top_frame->GetParent();
-
- if (top_frame && GTK_IS_WINDOW(top_frame->m_widget))
- {
- GtkWindow *window = GTK_WINDOW(top_frame->m_widget);
+ if (top_frame && GTK_IS_WINDOW(top_frame->m_widget))
+ {
+ GtkWindow *window = GTK_WINDOW(top_frame->m_widget);
- if (window->default_widget)
- {
- gtk_widget_activate (window->default_widget);
- return;
- }
+ if (window->default_widget)
+ {
+ gtk_widget_activate (window->default_widget);
+ return;
}
}
+
+ return;
}
}
-
+
event.Skip();
}
size_t count = Number();
for ( size_t n = 0; n < count; n++ )
{
- width = (wxCoord)gdk_string_width(font, GetString(n).mbc_str());
+ width = (wxCoord)gdk_string_width(font, wxGTK_CONV( GetString(n) ) );
if ( width > ret.x )
ret.x = width;
}