- wxCHECK_RET( m_list != NULL, "invalid checklistbox" );
-
- GList *child = g_list_nth( m_list->children, index );
- if (child)
- {
- GtkBin *bin = GTK_BIN( child->data );
- GtkLabel *label = GTK_LABEL( bin->child );
-
- wxString str = label->label;
-
- if (check == (str[1] == 'X')) return;
-
- if (check)
- str.SetChar( 1, 'X' );
- else
- str.SetChar( 1, '-' );
-
- gtk_label_set( label, str );
-
- wxCommandEvent event( wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, GetId() );
- event.SetEventObject( this );
- event.SetInt( index );
- GetEventHandler()->ProcessEvent( event );
-
- return;
- }
-
- wxFAIL_MSG("wrong checklistbox index");
+ 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;
+
+ GValue value = {0, };
+ gtk_tree_model_get_value(GTK_TREE_MODEL(m_liststore),
+ &iter,
+ 0, //column
+ &value);
+
+ return g_value_get_boolean(&value) != 0;
+}
+
+void wxCheckListBox::Check(unsigned int index, bool check)
+{
+ wxCHECK_RET( m_treeview != NULL, 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;
+
+ gtk_list_store_set(m_liststore,
+ &iter,
+ 0, //column
+ check ? TRUE : FALSE, -1);
+}
+
+int wxCheckListBox::GetItemHeight() const
+{
+ wxCHECK_MSG( m_treeview != NULL, 0, wxT("invalid listbox"));
+
+ gint height;
+ gtk_tree_view_column_cell_get_size(
+ gtk_tree_view_get_column(m_treeview, 0),
+ NULL, NULL, NULL, NULL,
+ &height);
+ return height;