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: 3

Documentation

Index

Constants

View Source
const (
	FC_DLG_DEFAULT fcOpt = 1 << iota
	FC_DLG_SEL_FLD
	FC_DLG_CREATE_FLD
	FC_DLG_OPEN
	FC_DLG_OPEN_ENTRY // Open with 'entry', like in 'save' dialog
	FC_DLG_SAVE
	FC_NOT_ASK_OVERWRITE
	FC_NOT_KEEP_ABOVE
	FC_PREVIEW
	FC_NOT_MODAL
	FC_MULTI_SELECT
	FC_NOT_LOCAL_ONLY
)

Variables

View Source
var (
	UserAbortError = errors.New("Action aborted by user !")
)

***************************

  • FileChooser implementation. ***************************

Functions

func ColorChooserDialogAndGetFloat64Val

func ColorChooserDialogAndGetFloat64Val(parentWindow *gtk.Window, title string, orgCol []float64) (outFloat64 []float64, outStr string)

ColorChooserDialogAndGetHexValue: Open color chooser dialog and retrieve value. String return is converted like this: "rgb(239,41,41)" to "#EF2929".

func FileChooser

func FileChooser(window *gtk.Window, dlgType, title, filename string, options ...bool) (outFilename string, result bool, err error)

FileChooser: Display a file chooser dialog. dlgType: "open", "save", "create-folder", "select-folder" as dlgType. title = "": auto choice based on dialog type. options: 1-keepAbove, 2-enablePreviewImages, 3-setModal, 4-askOverwrite Default: 1- true, 2- false, 3- true, 4- true

func FileChooserN

func FileChooserN(window *gtk.Window, title, filename string, options fcOpt) (outFilename string, result bool, err error)

FileChooser: Display a file chooser dialog box.

  • By default, 'keepAbove', 'setModal', 'askOverwrite' are enabled. title = "": auto choice based on dialog type.

  • Parameters: title, filename string, options fcOpt where 'options' means: 'dlgType' as FC_DLG_XXX and FC_XXX for dialog options. i.e: "title dialog", "/home/user/.config/x.txt", FC_DLG_SAVE|FC_ASK_OVERWRITE|FC_MODAL' means open a saving dialog, ask for overwrite and set it as modal dialog.

    NOTE: 'FileChooserOptionsNew' gives a structure which contains all the available options and can be declared as a global variable and then used whenever needed.

func FileChooserOptionsNew

func FileChooserOptionsNew() *fcOptions

FileChooserOptionsNew: create a new structure containing the available options/dialogType used as the parameters for the 'FileChooserN' function.

Types

type Calendar

type Calendar struct {
	TitleWindow      string
	ImageTop         interface{}
	LabelHour        string
	ButtonsImages    []interface{}
	ButtonsLabels    []string
	ButtonsSize      int
	ButtonOkPosition int // Specify the position of the "validate" button (start at 0 from left)
	Width            int
	Height           int
	Resizable        bool
	KeepAbove        bool
	Result           *CalendarData
	DisplayTime      bool
	// contains filtered or unexported fields
}

This structure and methods give a convenient way to display and use a calendar window to setting and retrieving calendar values.

func CalendarNew

func CalendarNew(parentWindow *gtk.Window, calData *CalendarData, titleWindow string,
	topImage interface{}, buttons []string, imagesButtons ...interface{}) *Calendar

CalendarNew: create new structure and initialize it.

func (*Calendar) Init

func (cal *Calendar) Init(parentWindow *gtk.Window, calData *CalendarData, titleWindow string,
	topImage interface{}, buttons []string, imagesButtons ...interface{})

Init: Initialize structure

func (*Calendar) Run

func (cal *Calendar) Run() (ok bool, err error)

Show: Display about box

type CalendarData

type CalendarData struct {
	Year,
	Month,
	Day,
	Hour,
	Min,
	Sec int
	BlankTime time.Time // Used when no time is defined
	// contains filtered or unexported fields
}

func CalendarDataNew

func CalendarDataNew() (calData *CalendarData)

CalendarDataNew: create a new calendarData structure

func (*CalendarData) FromLayout

func (calData *CalendarData) FromLayout(in string) (err error)

FromLayout: build CalendarData using this layout: "2006.01.02.15.04.05"

func (*CalendarData) FromTime

func (calData *CalendarData) FromTime(inTime time.Time)

FromTime

func (*CalendarData) Init

func (calData *CalendarData) Init(t ...time.Time)

Init: set values relatives "t" or time.Time{} if not specified.

func (*CalendarData) ToCalData

func (calData *CalendarData) ToCalData(cal *Calendar)

calendarToCalData:

func (*CalendarData) ToCalendar

func (calData *CalendarData) ToCalendar(cal *Calendar)

calDataToCalendar:

func (*CalendarData) ToLayout

func (calData *CalendarData) ToLayout() (out string)

ToLayout: fill missing char to complies with "2006.01.02.15.04.05", the magical reference format.

func (*CalendarData) ToTime

func (calData *CalendarData) ToTime() (outTime time.Time)

ToTime:

func (*CalendarData) ToTimeAsUTC

func (calData *CalendarData) ToTimeAsUTC() (outTime time.Time)

ToTimeAsUTC: convert given time to native UTC (based on local time zone), entered time H,M,S will be considered as UTC (useful for files time comparaison that always calculated using UTC).

Jump to

Keyboard shortcuts

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