projects
/
wxWidgets.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
compilation fix
[wxWidgets.git]
/
src
/
gtk1
/
choice.cpp
diff --git
a/src/gtk1/choice.cpp
b/src/gtk1/choice.cpp
index f62387d9b5832a748c85cb5a5a07e8a94b88273f..c9e3cceac2b568532a13cfae7e7692ce6cc88aa7 100644
(file)
--- a/
src/gtk1/choice.cpp
+++ b/
src/gtk1/choice.cpp
@@
-166,8
+166,7
@@
void wxChoice::DoSetItemClientObject( int n, wxClientData* clientData )
wxNode *node = m_clientList.Nth( n );
wxCHECK_RET( node, wxT("invalid index in wxChoice::DoSetItemClientObject") );
wxNode *node = m_clientList.Nth( n );
wxCHECK_RET( node, wxT("invalid index in wxChoice::DoSetItemClientObject") );
- wxClientData *cd = (wxClientData*) node->Data();
- delete cd;
+ // wxItemContainer already deletes data for us
node->SetData( (wxObject*) clientData );
}
node->SetData( (wxObject*) clientData );
}
@@
-256,8
+255,13
@@
int wxChoice::FindString( const wxString &string ) const
label = GTK_LABEL( BUTTON_CHILD(m_widget) );
wxASSERT_MSG( label != NULL , wxT("wxChoice: invalid label") );
label = GTK_LABEL( BUTTON_CHILD(m_widget) );
wxASSERT_MSG( label != NULL , wxT("wxChoice: invalid label") );
-
- if (string == wxString(label->label,*wxConvCurrent))
+
+#ifdef __WXGTK20__
+ wxString tmp( wxGTK_CONV_BACK( gtk_label_get_text( label) ) );
+#else
+ wxString tmp( label->label );
+#endif
+ if (string == tmp)
return count;
child = child->next;
return count;
child = child->next;
@@
-270,9
+274,15
@@
int wxChoice::FindString( const wxString &string ) const
int wxChoice::GetSelection() const
{
wxCHECK_MSG( m_widget != NULL, -1, wxT("invalid choice") );
int wxChoice::GetSelection() const
{
wxCHECK_MSG( m_widget != NULL, -1, wxT("invalid choice") );
+
+#ifdef __WXGTK20__
+ return gtk_option_menu_get_history( GTK_OPTION_MENU(m_widget) );
+
+#else
GtkMenuShell *menu_shell = GTK_MENU_SHELL( gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) ) );
int count = 0;
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)
{
GList *child = menu_shell->children;
while (child)
{
@@
-283,6
+293,7
@@
int wxChoice::GetSelection() const
}
return -1;
}
return -1;
+#endif
}
void wxChoice::SetString( int WXUNUSED(n), const wxString& WXUNUSED(string) )
}
void wxChoice::SetString( int WXUNUSED(n), const wxString& WXUNUSED(string) )
@@
-312,7
+323,11
@@
wxString wxChoice::GetString( int n ) const
wxASSERT_MSG( label != NULL , wxT("wxChoice: invalid label") );
wxASSERT_MSG( label != NULL , wxT("wxChoice: invalid label") );
- return wxString(label->label,*wxConvCurrent);
+#ifdef __WXGTK20__
+ return wxString( wxGTK_CONV_BACK( gtk_label_get_text( label) ) );
+#else
+ return wxString( label->label );
+#endif
}
child = child->next;
count++;
}
child = child->next;
count++;
@@
-375,7
+390,7
@@
void wxChoice::ApplyWidgetStyle()
size_t wxChoice::GtkAppendHelper(GtkWidget *menu, const wxString& item)
{
size_t wxChoice::GtkAppendHelper(GtkWidget *menu, const wxString& item)
{
- GtkWidget *menu_item = gtk_menu_item_new_with_label(
item.mbc_str(
) );
+ GtkWidget *menu_item = gtk_menu_item_new_with_label(
wxGTK_CONV( item
) );
size_t index;
if ( m_strings )
size_t index;
if ( m_strings )
@@
-439,7
+454,8
@@
wxSize wxChoice::DoGetBestSize() const
size_t count = GetCount();
for ( size_t n = 0; n < count; n++ )
{
size_t count = GetCount();
for ( size_t n = 0; n < count; n++ )
{
- width = (wxCoord)gdk_string_width(font, GetString(n).mbc_str());
+ // FIXME GTK 2.0
+ width = (wxCoord)gdk_string_width(font, wxGTK_CONV( GetString(n) ) );
if ( width > ret.x )
ret.x = width;
}
if ( width > ret.x )
ret.x = width;
}
@@
-461,7
+477,7
@@
wxSize wxChoice::DoGetBestSize() const
if ( ret.x < 80 )
ret.x = 80;
if ( ret.x < 80 )
ret.x = 80;
- ret.y = 16 + gdk_char_height(GET_STYLE_FONT( m_widget->style ), 'H');
+ ret.y = 16 + gdk_char_height(GET_STYLE_FONT( m_widget->style ), 'H'
);
return ret;
}
return ret;
}