Esempio n. 1
0
func gListboxNew(multisel bool) *C.GtkWidget {
	store := C.gtkListStoreNew()
	widget := C.gtk_tree_view_new_with_model((*C.GtkTreeModel)(unsafe.Pointer(store)))
	tv := (*C.GtkTreeView)(unsafe.Pointer(widget))
	column := C.gtkTreeViewColumnNewWithAttributes(C.gtk_cell_renderer_text_new())
	C.gtk_tree_view_column_set_sizing(column, C.GTK_TREE_VIEW_COLUMN_AUTOSIZE)
	C.gtk_tree_view_column_set_resizable(column, C.FALSE) // not resizeable by the user; just autoresize
	C.gtk_tree_view_append_column(tv, column)
	C.gtk_tree_view_set_headers_visible(tv, C.FALSE)
	sel := C.GTK_SELECTION_SINGLE
	if multisel {
		sel = C.GTK_SELECTION_MULTIPLE
	}
	C.gtk_tree_selection_set_mode(C.gtk_tree_view_get_selection(tv), C.GtkSelectionMode(sel))
	scrollarea := C.gtk_scrolled_window_new((*C.GtkAdjustment)(nil), (*C.GtkAdjustment)(nil))
	// thanks to jlindgren in irc.gimp.net/#gtk+
	C.gtk_scrolled_window_set_shadow_type((*C.GtkScrolledWindow)(unsafe.Pointer(scrollarea)), C.GTK_SHADOW_IN)
	C.gtk_container_add((*C.GtkContainer)(unsafe.Pointer(scrollarea)), widget)
	return scrollarea
}
Esempio n. 2
0
// SetSelectionMode is a wrapper around gtk_list_box_set_selection_mode().
func (v *ListBox) SetSelectionMode(mode SelectionMode) {
	C.gtk_list_box_set_selection_mode(v.native(), C.GtkSelectionMode(mode))
}
Esempio n. 3
0
	SCROLL_STEP_DOWN     = C.GtkScrollType(C.GTK_SCROLL_STEP_DOWN)
	SCROLL_PAGE_UP       = C.GtkScrollType(C.GTK_SCROLL_PAGE_UP)
	SCROLL_PAGE_DOWN     = C.GtkScrollType(C.GTK_SCROLL_PAGE_DOWN)
	SCROLL_STEP_LEFT     = C.GtkScrollType(C.GTK_SCROLL_STEP_LEFT)
	SCROLL_STEP_RIGHT    = C.GtkScrollType(C.GTK_SCROLL_STEP_RIGHT)
	SCROLL_PAGE_LEFT     = C.GtkScrollType(C.GTK_SCROLL_PAGE_LEFT)
	SCROLL_PAGE_RIGHT    = C.GtkScrollType(C.GTK_SCROLL_PAGE_RIGHT)
	SCROLL_START         = C.GtkScrollType(C.GTK_SCROLL_START)
	SCROLL_END           = C.GtkScrollType(C.GTK_SCROLL_END)

	// ScrollablePolicy
	SCROLL_MINIMUM = C.GtkScrollablePolicy(C.GTK_SCROLL_MINIMUM)
	SCROLL_NATURAL = C.GtkScrollablePolicy(C.GTK_SCROLL_NATURAL)

	// SelectionMode
	SELECTION_NONE     = C.GtkSelectionMode(C.GTK_SELECTION_NONE)
	SELECTION_SINGLE   = C.GtkSelectionMode(C.GTK_SELECTION_SINGLE)
	SELECTION_BROWSE   = C.GtkSelectionMode(C.GTK_SELECTION_BROWSE)
	SELECTION_MULTIPLE = C.GtkSelectionMode(C.GTK_SELECTION_MULTIPLE)

	// SensitivityType
	SENSITIVITY_AUTO = C.GtkSensitivityType(C.GTK_SENSITIVITY_AUTO)
	SENSITIVITY_ON   = C.GtkSensitivityType(C.GTK_SENSITIVITY_ON)
	SENSITIVITY_OFF  = C.GtkSensitivityType(C.GTK_SENSITIVITY_OFF)

	// ShadowType
	SHADOW_NONE       = C.GtkShadowType(C.GTK_SHADOW_NONE)
	SHADOW_IN         = C.GtkShadowType(C.GTK_SHADOW_IN)
	SHADOW_OUT        = C.GtkShadowType(C.GTK_SHADOW_OUT)
	SHADOW_ETCHED_IN  = C.GtkShadowType(C.GTK_SHADOW_ETCHED_IN)
	SHADOW_ETCHED_OUT = C.GtkShadowType(C.GTK_SHADOW_ETCHED_OUT)