gtk3Import

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 26, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComboBoxTextAddSetEntry

func ComboBoxTextAddSetEntry(cbxEntry *gtk.ComboBoxText, newEntry string, prepend ...bool) (existAtPos int)

ComboBoxTextAddSetEntry: Add newEntry if not exist to ComboBoxText, Option: prepend:bool. Get index and set cbxText at it if already exist.

Types

type ComboBoXOpt

type ComboBoXOpt struct {
	Sort,
	Prepend,
	Descending bool // Sort direction
	ColActive int

	// concern only GtkComboBoxText
	Editable,
	PopupRemove,
	AddOnEnter bool

	// CurrentEntryPtr: Will be updated every time the 'combobox' or the entry 'control'
	// receives the 'modified' signal. Usefull for auto updating a caller variable as &ptr
	CurrentEntryPtr *string
	// callback function for 'enter' event
	AddOnEnterCallback func(item *string) bool
	// callback function for Combobox 'changed' event
	CallbackChanged func(obj interface{})
	// callback function for Entry 'changed' event
	CallbackEntryChanged func(obj interface{})

	PopupLabelAll,
	PopupLabelEntry string
	// contains filtered or unexported fields
}

ComboBoXOpt: Hold available options for 'ComboBoXStruct'

func ComboBoXOptNew

func ComboBoXOptNew() *ComboBoXOpt

type ComboBoXStruct

type ComboBoXStruct struct {
	Options   *ComboBoXOpt
	ListStore *gtk.ListStore
	TreeModel *gtk.TreeModel

	// Store the type of GtkComboBox/Text for further usages
	ComboBoxX interface{}

	CurrentEntry string
	// contains filtered or unexported fields
}

func ComboBoXFillWithOptionsNew

func ComboBoXFillWithOptionsNew(comboBoX interface{},
	inList []string,
	activeId string,
	options ...*ComboBoXOpt) (cbxs *ComboBoXStruct, err error)

ComboBoXFillWithOptionsNew: all in one function - Create the structure. - Initialization with the given options. - Fill comboBox / Text with entries.

func ComboBoXStructNew

func ComboBoXStructNew(comboBoX interface{}) (cbxs *ComboBoXStruct)

ComboBoXStructNew: Create a new structure that handle the methods to process GtkComboBox & GtkComboBoxText objects transparently, some options are not available for simple ComboBox like 'Editable', 'AddOnEnter', 'PopupRemove'. A realtime recorded modification is available. This method should be followed by 'Setup()' & 'Fill()' methods for a correct structure's initialization. 'Options' structure can be retrieved using 'GetOptions()' and filled as your wishes before passing it to 'Setup()' (optional).

func (*ComboBoXStruct) AddSetEntry

func (cbxs *ComboBoXStruct) AddSetEntry(item string, position ...int) int

AddSetEntry: Adds a new entry if it does not exist to ComboBox / Text. Returns -1 if 'item' does not exist or, set 'ActiveId' to it and return the position of the existing element. 'Sort' method is not used.

func (*ComboBoXStruct) Clear

func (cbxs *ComboBoXStruct) Clear()

Clear: Remove content of ComboBox/Text

func (*ComboBoXStruct) Fill

func (cbxs *ComboBoXStruct) Fill(inList []string, activeId string) (err error)

Fill: should only be used after calling the 'Setup' method. All previous entries will be deleted before the operation. The 'activeId' argument define current selected entry (ID).

func (*ComboBoXStruct) Find

func (cbxs *ComboBoXStruct) Find(item string) int

Find: find string value. Return -1 if nothing found handle both, GtkComboBox or GtkComboBoxText

func (*ComboBoXStruct) GetActive

func (cbxs *ComboBoXStruct) GetActive() (index int, id string)

GetActive: Return the active cell.

func (*ComboBoXStruct) GetAllEntries

func (cbxs *ComboBoXStruct) GetAllEntries() (out []string)

GetAllEntries: get all entries handle both, GtkComboBox or GtkComboBoxText

func (*ComboBoXStruct) GetOptions

func (cbxs *ComboBoXStruct) GetOptions() *ComboBoXOpt

GetOptions: get option structure to be completed (whether somthings need to be specified / modified), before using 'Init'

func (*ComboBoXStruct) ListStoreAdd

func (cbxs *ComboBoXStruct) ListStoreAdd(item string)

ListStoreAdd: Append or Prepend (via 'ComboBoXOpt') an 'item', then set ActiveId to it. Unlike 'AddSetEntry',this one, does not verify wether 'item' already exist or not. 'Sort' method is not used.

func (*ComboBoXStruct) RemoveEntry

func (cbxs *ComboBoXStruct) RemoveEntry(item string)

RemoveEntry:

func (*ComboBoXStruct) Setup

func (cbxs *ComboBoXStruct) Setup(options ...*ComboBoXOpt) (err error)

Setup: Applying options before setting up structure. NOTE: "has_entry" property if used, must be set at creation (glade)

func (*ComboBoXStruct) Sort

func (cbxs *ComboBoXStruct) Sort()

Sort: Order can be set in 'Options'

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL