X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/caf6e6dee8d177844bb633786ec8c05eba6972bc..03a126c68c940c13a7a6c9ee183fa88e9b575a21:/src/gtk/checklst.cpp diff --git a/src/gtk/checklst.cpp b/src/gtk/checklst.cpp index 169e56785b..1bfd53c2d9 100644 --- a/src/gtk/checklst.cpp +++ b/src/gtk/checklst.cpp @@ -23,7 +23,6 @@ //----------------------------------------------------------------------------- // "toggled" //----------------------------------------------------------------------------- -#if wxUSE_NATIVEGTKCHECKLIST extern "C" { static void gtk_checklist_toggled(GtkCellRendererToggle *renderer, gchar *stringpath, @@ -41,7 +40,6 @@ static void gtk_checklist_toggled(GtkCellRendererToggle *renderer, listbox->GetEventHandler()->ProcessEvent( new_event ); } } -#endif //----------------------------------------------------------------------------- // wxCheckListBox @@ -80,7 +78,6 @@ wxCheckListBox::wxCheckListBox(wxWindow *parent, wxWindowID id, style, validator, name ); } -#if wxUSE_NATIVEGTKCHECKLIST void wxCheckListBox::DoCreateCheckList() { //Create the checklist in our treeview and set up events for it @@ -101,16 +98,16 @@ void wxCheckListBox::DoCreateCheckList() gtk_tree_view_append_column(m_treeview, column); } -bool wxCheckListBox::IsChecked( int index ) const +bool wxCheckListBox::IsChecked(unsigned int index) const { - wxCHECK_MSG( m_treeview != NULL, FALSE, wxT("invalid checklistbox") ); + wxCHECK_MSG( m_treeview != NULL, false, wxT("invalid checklistbox") ); GtkTreeIter iter; gboolean res = gtk_tree_model_iter_nth_child( GTK_TREE_MODEL(m_liststore), &iter, NULL, //NULL = parent = get first index - ); + ); if(!res) return false; @@ -123,7 +120,7 @@ bool wxCheckListBox::IsChecked( int index ) const return g_value_get_boolean(&value) == TRUE ? true : false; } -void wxCheckListBox::Check( int index, bool check ) +void wxCheckListBox::Check(unsigned int index, bool check) { wxCHECK_RET( m_treeview != NULL, wxT("invalid checklistbox") ); @@ -132,7 +129,7 @@ void wxCheckListBox::Check( int index, bool check ) GTK_TREE_MODEL(m_liststore), &iter, NULL, //NULL = parent = get first index - ); + ); if(!res) return; @@ -154,52 +151,4 @@ int wxCheckListBox::GetItemHeight() const return height; } -#else //NON-NATIVE - -bool wxCheckListBox::IsChecked( int index ) const -{ - wxCHECK_MSG( m_treeview != NULL, false, wxT("invalid checklistbox") ); - - GtkTreeEntry* entry = GtkGetEntry(index); - if (entry) - { - wxString str( wxGTK_CONV_BACK( gtk_tree_entry_get_label(entry) ) ); - - return str.GetChar(1) == wxCHECKLBOX_CHECKED; - } - - wxFAIL_MSG(wxT("wrong checklistbox index")); - return false; -} - -void wxCheckListBox::Check( int index, bool check ) -{ - wxCHECK_RET( m_treeview != NULL, wxT("invalid checklistbox") ); - - GtkTreeEntry* entry = GtkGetEntry(index); - if (entry) - { - wxString str( wxGTK_CONV_BACK( gtk_tree_entry_get_label(entry) ) ); - - if (check == (str.GetChar(1) == wxCHECKLBOX_CHECKED)) - return; - - str.SetChar( 1, check ? wxCHECKLBOX_CHECKED : wxCHECKLBOX_UNCHECKED ); - - gtk_tree_entry_set_label( entry, wxGTK_CONV( str ) ); - - return; - } - - wxFAIL_MSG(wxT("wrong checklistbox index")); -} - -int wxCheckListBox::GetItemHeight() const -{ - // FIXME - return 22; -} - -#endif //wxUSE_NATIVEGTKCHECKLIST - #endif //wxUSE_CHECKLISTBOX