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: 13 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	HexToBytes = gipf.HexToBytes
	GetPixBuf  = gipf.GetPixBuf
)

Functions

func CssWdgScnBytes

func CssWdgScnBytes(data []byte, wdgt ...*gtk.Widget) (err error)

func CssWdgScnLoad

func CssWdgScnLoad(filename string, wdgt ...*gtk.Widget) (err error)

CssWidgetLoad: Load or read from data and apply css to widget if it's provided. Apply to screen otherwise.

func Notify

func Notify(title, text string)

Notify: Display a notify message at the top right of screen.

Types

type Clipboard

type Clipboard struct {
	Entity *gtk.Clipboard
}

func ClipboardNew

func ClipboardNew() (c *Clipboard, err error)

ClipboardNew: Create new clipboard structure

func (*Clipboard) GetText

func (c *Clipboard) GetText() (clipboardContent string, err error)

GetText: Get text from clipboard

func (*Clipboard) Init

func (c *Clipboard) Init() (err error)

Init: Initialise clipboard

func (*Clipboard) SetText

func (c *Clipboard) SetText(clipboardContent string)

SetText: Set text to clipboard

func (*Clipboard) Store

func (c *Clipboard) Store()

Store: the current clipboard data somewhere so that it will stay around after the application has quit.

type DragNDropStruct

type DragNDropStruct struct {
	// gtkObject that receive DND
	Object interface{}
	// Contain the files list received
	FilesList *[]string
	// contains filtered or unexported fields
}

func DragNDropNew

func DragNDropNew(objects interface{}, filesList *[]string,
	callBackRecieveDone func(),
	callBackOnRecieve ...func(item interface{}, context *gdk.DragContext) bool) *DragNDropStruct

DragNDropNew: configure controls to receive dndcontent. "filesList" can be "nil"

type ItemOptionsType

type ItemOptionsType int
const (
	// Like GtkMenuItem
	ITEM_OPT_NORMAL ItemOptionsType = 1 << 0
	// Like GtkCheckMenuItem
	ITEM_OPT_CHECK ItemOptionsType = 1 << 1
	// Like GtkRadioMenuItem
	ITEM_OPT_RADIO ItemOptionsType = 1 << 2
	// Like GtkSeparatorMenuItem
	ITEM_OPT_SEPARATOR ItemOptionsType = 1 << 3
	// Add icon before GtkMenuItem
	ITEM_OPT_ICON ItemOptionsType = 1 << 4
	// Disable the use of mnemonic
	ITEM_OPT_NO_MNEMONIC ItemOptionsType = 1 << 5
	// Start a new group for GtkRadioButton(s)
	ITEM_OPT_RADIO_NEW_GRP ItemOptionsType = 1 << 6
	// align label to other (adding blank icon)
	ITEM_OPT_ALGN_LBL ItemOptionsType = 1 << 7
	// Box container alignement centered
	ITEM_OPT_ALGN_BOX_CNTR ItemOptionsType = 1 << 8
)

type PopupMenuIconStruct

type PopupMenuIconStruct struct {
	Menu *gtk.Menu
	// Indicate what type of function the window has.
	WindowTypeHint gdk.WindowTypeHint // default (WINDOW_TYPE_HINT_POPUP_MENU)
	// left mouse button instead of right
	LMB,

	ReserveToggleSize bool
	// Define icons size
	IconsSize,

	BoxSpacing,

	TreeViewMinSelectedRows int

	// Options that can be used with designed function
	OPT_NORMAL,
	OPT_CHECK,
	OPT_RADIO,
	OPT_SEPARATOR,
	OPT_ICON,
	OPT_NO_MNEMONIC,
	OPT_RADIO_NEW_GRP,
	OPT_ALGN_LBL,
	OPT_ALGN_BOX_CNTR ItemOptionsType
	// contains filtered or unexported fields
}
  • Icon version, this structure hold a home-made version of GtkMenu with Icon
  • handling. Since Gtk3 does not include icon possibility anymore, i've made
  • this implementation to continue using icons in my menu.
  • - GtkMenuItem is replaced by a GtkBox which embeds a GtkLabel, everything will be embedded in a GtkMenuItem.
  • - GtkCheckMenuItem is replaced by a GtkBox which embeds a GtkCheckButton, everything will be embedded in a GtkMenuItem.
  • - GtkRadioMenuItem is replaced by a GtkBox which embeds a GtkRadioButton, everything will be embedded in a GtkMenuItem.
  • - GtkSeparatorMenuItem still untouched.
  • Note: for Icon, each GtkBox may embed/or not a GtkImage at first.
  • The "signal" emitted by the objects is processed transparently.
  • All objects are accessible using they own method just after

* creation or later, using they indexes and respective methods.

PopupMenuIconStruct: Structure that hold popup menu options and methods. A simple builder for popup menu that may handle icons. Instead of classics GtkMenuItem, this structure use: - GtkLabel as GtkMenuItem, it will be embedded in a GtkMenuItem - GtkCheckButton as GtkCheckMenuItem, it will be embedded in a GtkMenuItem - GtkRadioButton as GtkRadioMenuItem, it will be embedded in a GtkMenuItem To get the active widget, you can use 'GetXXXCurrent' or 'GetXXXIdx' method Note: the "toggled" signal is handled as transparent as possible.

func PopupMenuIconStructNew

func PopupMenuIconStructNew() (pop *PopupMenuIconStruct)

PopupMenuNew: return a new PopupMenuIconStruct structure

func (*PopupMenuIconStruct) AddItem

func (pop *PopupMenuIconStruct) AddItem(
	lbl string, activateFunction interface{}, options ...interface{}) (widgetIdx int, err error)

AddItem: Add item to menu. This version handle checkbutton/radiobutton with groups and classic labels with or without icon and more options ...

func (*PopupMenuIconStruct) AppendToExistingMenu

func (pop *PopupMenuIconStruct) AppendToExistingMenu(menu *gtk.Menu) *gtk.Menu

func (*PopupMenuIconStruct) CheckRMB

func (pop *PopupMenuIconStruct) CheckRMB(obj interface{}, event *gdk.Event) bool

CheckRMB: Check whether an event comes from the right button of the mouse and display the popup if it is the case at the mouse position.

func (*PopupMenuIconStruct) CheckRMBFromTreeView

func (pop *PopupMenuIconStruct) CheckRMBFromTreeView(tv *gtk.TreeView, event *gdk.Event) bool

CheckRMBFromTreeView: May be directly used as callback function for TreeView' "button-press-event" signal, considere to initialize the popup menu before setting this function as callback. Otherwise, the call will generate error "nil pointer ..."

func (*PopupMenuIconStruct) GetCheckButtonCurrent

func (pop *PopupMenuIconStruct) GetCheckButtonCurrent() *gtk.CheckButton

Retrieve current undferlayed GtkCheckButton

func (*PopupMenuIconStruct) GetIWidgetIdx

func (pop *PopupMenuIconStruct) GetIWidgetIdx(idx int) gtk.IWidget

Retrieve the underlayed IWidget at 'idx'

func (*PopupMenuIconStruct) GetLabelCurrent

func (pop *PopupMenuIconStruct) GetLabelCurrent() *gtk.Label

Retrieve current undferlayed GtkLabel

func (*PopupMenuIconStruct) GetMenuItemCurrent

func (pop *PopupMenuIconStruct) GetMenuItemCurrent() *gtk.MenuItem

Retrieve current GtkMenuItem

func (*PopupMenuIconStruct) GetMenuItemIdx

func (pop *PopupMenuIconStruct) GetMenuItemIdx(idx int) *gtk.MenuItem

Get the MenuItem at 'idx', which contains underlying widgets

func (*PopupMenuIconStruct) GetRadioButtonCurrent

func (pop *PopupMenuIconStruct) GetRadioButtonCurrent() *gtk.RadioButton

Retrieve current undferlayed GtkRadioButton

func (*PopupMenuIconStruct) GetSeparatorMenuItemCurrent

func (pop *PopupMenuIconStruct) GetSeparatorMenuItemCurrent() *gtk.SeparatorMenuItem

Retrieve current GtkSeparatorMenuItem

func (*PopupMenuIconStruct) MenuBuild

func (pop *PopupMenuIconStruct) MenuBuild() *gtk.Menu

MenuBuild: Build popupmenu.

type PopupMenuStruct

type PopupMenuStruct struct {
	Menu *gtk.Menu
	// Indicate what type of function the window has.
	WindowTypeHint gdk.WindowTypeHint // default (WINDOW_TYPE_HINT_POPUP_MENU)
	// left mouse button instead of right
	LMB,

	ReserveToggleSize bool
	// space separator for box (used when image is present)
	BoxSpacing,

	TreeViewMinSelectedRows int

	// Options that can be used with designed function
	OPT_NORMAL,
	OPT_CHECK,
	OPT_RADIO,
	OPT_SEPARATOR,
	OPT_NO_MNEMONIC,
	OPT_RADIO_NEW_GRP ItemOptionsType
	// contains filtered or unexported fields
}

PopupMenuStruct: means that only standard widgets will be used If you want to add icons, prefere using next structure 'PopupMenuIconStruct'

func PopupMenuStructNew

func PopupMenuStructNew() (pop *PopupMenuStruct)

PopupMenuNew: return a new PopupMenuStruct structure

func (*PopupMenuStruct) AddItem

func (pop *PopupMenuStruct) AddItem(
	lbl string, activateFunction interface{}, options ...interface{}) (widgetIdx int, err error)

AddItem: Add item to menu. This version handle checkbutton/radiobutton with groups and classic labels

func (*PopupMenuStruct) AppendToExistingMenu

func (pop *PopupMenuStruct) AppendToExistingMenu(menu *gtk.Menu) *gtk.Menu

AppendToExistingMenu: append "MenuItems" to an existing "*gtk.Menu" Useful when you want to just add some entries to the context menu that already exist in a gtk.TextView or gtk.Entry by using "populate-popup" signal. Notice: GtkWidget > GtkMenu: menu := &gtk.Menu{gtk.MenuShell{gtk.Container{*w}}} Each connection to signal need to re-create the entire menu.

func (*PopupMenuStruct) CheckRMB

func (pop *PopupMenuStruct) CheckRMB(obj interface{}, event *gdk.Event) bool

CheckRMB: Check whether an event comes from the right button of the mouse and display the popup if it is the case at the mouse position.

func (*PopupMenuStruct) CheckRMBFromTreeView

func (pop *PopupMenuStruct) CheckRMBFromTreeView(tv *gtk.TreeView, event *gdk.Event) bool

CheckRMBFromTreeView: May be directly used as callback function for TreeView' "button-press-event" signal, considere to initialize the popup menu before setting this function as callback. Otherwise, the call will generate error "nil pointer ..." NOTE: "button-press-event" signal instead of "button-release-event" must be used to avoid deselecting rows on right click.

func (*PopupMenuStruct) GetCheckMenuItemCurrent

func (pop *PopupMenuStruct) GetCheckMenuItemCurrent() *gtk.CheckMenuItem

Retrieve current GtkCheckMenuItem

func (*PopupMenuStruct) GetIMenuItemIdx

func (pop *PopupMenuStruct) GetIMenuItemIdx(idx int) gtk.IMenuItem

Retrieve the IMenuItem at 'idx' NOTE: Require type assertion!!!

func (*PopupMenuStruct) GetMenuItemCurrent

func (pop *PopupMenuStruct) GetMenuItemCurrent() *gtk.MenuItem

Retrieve current GtkMenuItem

func (*PopupMenuStruct) GetRadioMenuItemCurrent

func (pop *PopupMenuStruct) GetRadioMenuItemCurrent() *gtk.RadioMenuItem

Retrieve current GtkRadioMenuItem

func (*PopupMenuStruct) GetSeparatorMenuItemCurrent

func (pop *PopupMenuStruct) GetSeparatorMenuItemCurrent() *gtk.SeparatorMenuItem

Retrieve current GtkSeparatorMenuItem

func (*PopupMenuStruct) MenuBuild

func (pop *PopupMenuStruct) MenuBuild() *gtk.Menu

MenuBuild: Build popupmenu.

type ProgressBarStruct

type ProgressBarStruct struct {
	RefreshMs    uint
	GifImageName string

	TimeOutContinue bool
	// contains filtered or unexported fields
}

func ProgressBarNew

func ProgressBarNew(progressBar *gtk.ProgressBar) (pbs *ProgressBarStruct)

ProgressBarNew: creat a new 'ProgressBarStruct'

func ProgressGifNew

func ProgressGifNew(varPath interface{}, box *gtk.Box, position int) (pbs *ProgressBarStruct)

ProgressGifNew: create 'ProgressBarStruct' frome given information. Note: 'varPath' could be []byte, filename or *gtk.Image

func (*ProgressBarStruct) Init

func (pbs *ProgressBarStruct) Init(fMain, fEnd func() error)

Init: structure initialization with start and end callback functions.

func (*ProgressBarStruct) StartGif

func (pbs *ProgressBarStruct) StartGif() (err error)

StartGif: launch progressbar as gif animated image.

func (*ProgressBarStruct) StartTicker

func (pbs *ProgressBarStruct) StartTicker() (err error)

StartTicker: start gtk progressbar using golang ticker function.

func (*ProgressBarStruct) StartTimeOut

func (pbs *ProgressBarStruct) StartTimeOut() (err error)

StartTimeOut: start gtk progressbar using 'glib.TimeoutAdd' command

type StatusBar

type StatusBar struct {
	Messages  []string /* Each row contain associated strings refere to contextId number */
	Separator string

	Prefix []string
	// contains filtered or unexported fields
}

func StatusBarStructureNew

func StatusBarStructureNew(originStatusbar *gtk.Statusbar, prefix []string, stackId ...int) (bar *StatusBar)

Init: Initialise structure to handle elements to be displayed.

func (*StatusBar) Add

func (bar *StatusBar) Add(prefix, inString string) (position int)

Add: add new element and return his own position.

func (*StatusBar) CleanAll

func (bar *StatusBar) CleanAll()

CleanAll: remove all elements (set to empty string) from the messages list.

func (*StatusBar) Del

func (bar *StatusBar) Del(pos int) (newLength int)

Del: remove element at defined position and get the new length of elements.

func (*StatusBar) Disp

func (bar *StatusBar) Disp()

Disp: display content of stored elements into statusbar

func (*StatusBar) Init

func (bar *StatusBar) Init(originStatusbar *gtk.Statusbar, prefix []string, stackId ...int)

Init: Initialise structure to handle elements to be displayed.

func (*StatusBar) Set

func (bar *StatusBar) Set(inString string, pos int)

Add: set element at desired position.

func (*StatusBar) Show

func (bar *StatusBar) Show(state bool)

Show: display / hide statusbar

type TitleBar

type TitleBar struct {
	MainTitle string
	Separator string
	// contains filtered or unexported fields
}

func TitleBarStructureNew

func TitleBarStructureNew(window *gtk.Window, title ...string) *TitleBar

func (*TitleBar) Init

func (tb *TitleBar) Init(window *gtk.Window, title ...string)

* Alternative use of TitleBarNew() * in the case where we need to import the structure rather than using it via the imported library.

func (*TitleBar) Reset

func (tb *TitleBar) Reset() string

func (*TitleBar) Update

func (tb *TitleBar) Update(toAdd []string, appendTo ...bool) string

Jump to

Keyboard shortcuts

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