- gtk_widget_realize( list_item );
- gtk_widget_realize( GTK_BIN(list_item)->child );
-
- if (m_widgetStyle) ApplyWidgetStyle();
- }
-
- gtk_widget_show( list_item );
-}
-
-void wxComboBox::Append( const wxString &item )
-{
- m_clientDataList.Append( (wxObject*) NULL );
- m_clientObjectList.Append( (wxObject*) NULL );
-
- AppendCommon( item );
-}
-
-void wxComboBox::Append( const wxString &item, void *clientData )
-{
- m_clientDataList.Append( (wxObject*) clientData );
- m_clientObjectList.Append( (wxObject*)NULL );
-
- AppendCommon( item );
-}
-
-void wxComboBox::Append( const wxString &item, wxClientData *clientData )
-{
- m_clientDataList.Append( (wxObject*) NULL );
- m_clientObjectList.Append( (wxObject*) clientData );
-
- AppendCommon( item );
-}
-
-void wxComboBox::SetClientData( int n, void* clientData )
-{
- wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") );
-
- wxNode *node = m_clientDataList.Nth( n );
- if (!node) return;
-
- node->SetData( (wxObject*) clientData );
-}
-
-void* wxComboBox::GetClientData( int n )
-{
- wxCHECK_MSG( m_widget != NULL, NULL, wxT("invalid combobox") );
-
- wxNode *node = m_clientDataList.Nth( n );
- if (!node) return NULL;
-
- return node->Data();
-}
-
-void wxComboBox::SetClientObject( int n, wxClientData* clientData )
-{
- wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") );
-
- wxNode *node = m_clientObjectList.Nth( n );
- if (!node) return;
-
- wxClientData *cd = (wxClientData*) node->Data();
- if (cd) delete cd;
-
- node->SetData( (wxObject*) clientData );
-}
-
-wxClientData* wxComboBox::GetClientObject( int n )
-{
- wxCHECK_MSG( m_widget != NULL, (wxClientData*)NULL, wxT("invalid combobox") );
-
- wxNode *node = m_clientDataList.Nth( n );
- if (!node) return (wxClientData*) NULL;
+ if (style & wxCB_READONLY)
+ {
+ // this will assert and do nothing if the value is not in our list
+ // of strings which is the desired behaviour (for consistency with
+ // wxMSW and also because it doesn't make sense to have a string
+ // which is not a possible choice in a read-only combobox)
+ SetStringSelection(value);
+ gtk_editable_set_editable(GTK_EDITABLE(entry), false);
+ }
+ else // editable combobox
+ {
+ // any value is accepted, even if it's not in our list
+ gtk_entry_set_text( entry, wxGTK_CONV(value) );
+ }