Example #1
0
// GetModel() is a wrapper around gtk_tree_view_get_model().
func (v *TreeView) GetModel() (*TreeModel, error) {
	c := C.gtk_tree_view_get_model(v.native())
	if c == nil {
		return nil, nilPtrErr
	}
	return wrapTreeModel(wrapObject(unsafe.Pointer(c))), nil
}
Example #2
0
func gListboxDelete(widget *C.GtkWidget, index int) {
	var iter C.GtkTreeIter

	tv := getTreeViewFrom(widget)
	ls := (*C.GtkListStore)(unsafe.Pointer(C.gtk_tree_view_get_model(tv)))
	if C.gtk_tree_model_iter_nth_child((*C.GtkTreeModel)(unsafe.Pointer(ls)), &iter, (*C.GtkTreeIter)(nil), C.gint(index)) == C.FALSE {
		panic(fmt.Errorf("error deleting row %d from GTK+ Listbox: no such index or some other error", index))
	}
	C.gtk_list_store_remove(ls, &iter)
}
Example #3
0
func gListboxInsert(widget *C.GtkWidget, index int, what string) {
	var iter C.GtkTreeIter

	tv := getTreeViewFrom(widget)
	ls := (*C.GtkListStore)(unsafe.Pointer(C.gtk_tree_view_get_model(tv)))
	C.gtk_list_store_insert(ls, &iter, C.gint(index))
	cwhat := C.CString(what)
	defer C.free(unsafe.Pointer(cwhat))
	C.gtkListStoreSet(ls, &iter, cwhat)
}
Example #4
0
func gListboxLen(widget *C.GtkWidget) int {
	tv := getTreeViewFrom(widget)
	model := C.gtk_tree_view_get_model(tv)
	return gtkTreeModelListLen(model)
}