示例#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
}
示例#2
0
文件: listbox_unix.go 项目: UIKit0/ui
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)
}
示例#3
0
文件: listbox_unix.go 项目: UIKit0/ui
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)
}
示例#4
0
文件: listbox_unix.go 项目: UIKit0/ui
func gListboxLen(widget *C.GtkWidget) int {
	tv := getTreeViewFrom(widget)
	model := C.gtk_tree_view_get_model(tv)
	return gtkTreeModelListLen(model)
}