ui

package
v0.0.0-...-8faa606 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2023 License: MIT Imports: 12 Imported by: 1

Documentation

Rendered for windows/amd64

Index

Constants

This section is empty.

Variables

View Source
var TaskDlg _TaskDlgT

Displays various modal prompts which the user must interact to.

The methods are high-level wrappers to TaskDialogIndirect, which is a modern replacement to the old MessageBox method.

Functions

func ButtonOpts

func ButtonOpts() *_ButtonO

Options for NewButton().

func CheckBoxOpts

func CheckBoxOpts() *_CheckBoxO

Options for NewCheckBox().

func ComboBoxOpts

func ComboBoxOpts() *_ComboBoxO

Options for NewComboBox().

func DateTimePickerOpts

func DateTimePickerOpts() *_DateTimePickerO

Options for NewDateTimePicker().

func EditOpts

func EditOpts() *_EditO

Options for NewEdit().

func ListViewOpts

func ListViewOpts() *_ListViewO

Options for NewListView().

func MonthCalendarOpts

func MonthCalendarOpts() *_MonthCalendarO

Options for NewMonthCalendar().

func ProgressBarOpts

func ProgressBarOpts() *_ProgressBarO

Options for NewProgressBar().

func RadioButtonOpts

func RadioButtonOpts() *_RadioButtonO

Options for NewRadioButton().

func StaticOpts

func StaticOpts() *_StaticO

Options for NewStatic().

func SysLinkOpts

func SysLinkOpts() *_SysLinkO

Options for NewSysLink().

func ToolbarOpts

func ToolbarOpts() *_ToolbarO

Options for NewToolbar().

func TrackbarOpts

func TrackbarOpts() *_TrackbarO

Options for NewTrackbar().

func TreeViewOpts

func TreeViewOpts() *_TreeViewO

Options for NewTreeView().

func WindowControlOpts

func WindowControlOpts() *_WindowControlO

Options for NewWindowControl().

func WindowMainOpts

func WindowMainOpts() *_WindowMainO

Options for NewWindowMain().

func WindowModalOpts

func WindowModalOpts() *_WindowModalO

Options for NewWindowModal().

Types

type AcceleratorTable

type AcceleratorTable interface {

	// Adds a new character accelerator, with a specific command ID.
	AddChar(character rune, modifiers co.ACCELF, cmdId int) AcceleratorTable

	// Adds a new virtual key accelerator, with a specific command ID.
	AddKey(vKey co.VK, modifiers co.ACCELF, cmdId int) AcceleratorTable

	// Free the resources.
	Destroy()

	// Builds the accelerator table once, and returns the HACCEL handle.
	//
	// Further accelerator additions will panic after this call.
	Haccel() win.HACCEL
	// contains filtered or unexported methods
}

Native accelerator table resource.

func NewAcceleratorTable

func NewAcceleratorTable() AcceleratorTable

Creates a new AcceleratorTable.

⚠️ You must defer AcceleratorTable.Destroy().

type AnyControl

type AnyControl interface {
	AnyWindow

	// Returns the ID of this control.
	CtrlId() int

	// Returns the parent of this control.
	Parent() AnyParent
}

Any child window control.

type AnyFocusControl

type AnyFocusControl interface {
	AnyControl

	// Puts the focus on the control by sending a WM_NEXTDLGCTL message. This
	// ensures that the borders will be correctly drawn.
	Focus()
}

Any child window wich can receive the focus.

type AnyNativeControl

type AnyNativeControl interface {
	AnyControl

	// Exposes all the window messages that can be handled with subclassing.
	//
	// Warning: Subclassing is a potentially slow technique, try to use the
	// regular events first.
	//
	// Cannot be called after the control was created.
	OnSubclass() *_EventsWm
}

Any native child window control.

type AnyParent

type AnyParent interface {
	AnyWindow

	// Exposes all the window notifications the can be handled.
	//
	// Cannot be called after the window was created.
	On() *_EventsWmNfy

	// Runs a closure synchronously in the window original UI thread.
	//
	// When in a goroutine, you *MUST* use this method to update the UI,
	// otherwise your application may deadlock.
	RunUiThread(userFunc func())
	// contains filtered or unexported methods
}

Any window that can have child controls.

type AnyTextControl

type AnyTextControl interface {
	AnyControl

	// Sets the text of the control.
	SetText(text string)

	// Retrieves the text of the control.
	Text() string
}

Any child window control which can get/set text.

type AnyWindow

type AnyWindow interface {
	// Returns the underlying HWND handle of this window.
	//
	// Note that this handle is initially zero, existing only after window creation.
	Hwnd() win.HWND
}

Any window.

type Button

type Button interface {
	AnyNativeControl
	AnyFocusControl
	AnyTextControl

	// Exposes all the [Button notifications] the can be handled.
	//
	// Panics if called after the control was created.
	//
	// [Button notifications]: https://learn.microsoft.com/en-us/windows/win32/controls/bumper-button-control-reference-notifications
	On() *_ButtonEvents

	EmulateClick() // Emulates an user click.
	// contains filtered or unexported methods
}

Native button control.

func NewButton

func NewButton(parent AnyParent, opts *_ButtonO) Button

Creates a new Button. Call ui.ButtonOpts() to define the options to be passed to the underlying CreateWindowEx().

Example

var owner ui.AnyParent // initialized somewhere

myButton := ui.NewButton(
	owner,
	ui.ButtonOpts().
		Text("Click me").
		Position(win.POINT{X: 20, Y: 10}),
	),
)

func NewButtonDlg

func NewButtonDlg(parent AnyParent, ctrlId int, horz HORZ, vert VERT) Button

Creates a new Button from a dialog resource.

type CheckBox

type CheckBox interface {
	AnyNativeControl
	AnyFocusControl
	AnyTextControl

	// Exposes all the [Button notifications] the can be handled.
	//
	// Panics if called after the control was created.
	//
	// [Button notifications]: https://learn.microsoft.com/en-us/windows/win32/controls/bumper-button-control-reference-notifications
	On() *_ButtonEvents

	CheckState() co.BST                   // Retrieves the current check state.
	EmulateClick()                        // Emulates an user click.
	IsChecked() bool                      // Tells whether the check box state is checked.
	SetCheckState(state co.BST)           // Sets the current check state.
	SetCheckStateAndTrigger(state co.BST) // Sets the current check state and triggers the click event.
	SetTextAndResize(text string)         // Sets the text and resizes the control to fit it exactly.
	// contains filtered or unexported methods
}

Native check box control.

func NewCheckBox

func NewCheckBox(parent AnyParent, opts *_CheckBoxO) CheckBox

Creates a new CheckBox. Call ui.CheckBoxOpts() to define the options to be passed to the underlying CreateWindowEx().

Example

var owner ui.AnyParent // initialized somewhere

myCheck := ui.NewCheckBox(
	owner,
	ui.CheckBoxOpts().
		Text("Some option").
		Position(win.POINT{X: 20, Y: 10}).
		State(co.BST_CHECKED),
	),
)

func NewCheckBoxDlg

func NewCheckBoxDlg(
	parent AnyParent, ctrlId int,
	horz HORZ, vert VERT) CheckBox

Creates a new CheckBox from a dialog resource.

type ComboBox

type ComboBox interface {
	AnyNativeControl
	AnyFocusControl
	AnyTextControl

	// Exposes all the [ComboBox notifications] the can be handled.
	//
	// Panics if called after the control was created.
	//
	// [ComboBox notifications]: https://learn.microsoft.com/en-us/windows/win32/controls/bumper-combobox-control-reference-notifications
	On() *_ComboBoxEvents

	Items() *_ComboBoxItems // Item methods.
	// contains filtered or unexported methods
}

Native combo box control.

func NewComboBox

func NewComboBox(parent AnyParent, opts *_ComboBoxO) ComboBox

Creates a new ComboBox. Call ui.ComboBoxOpts() to define the options to be passed to the underlying CreateWindowEx().

Example

var owner ui.AnyParent // initialized somewhere

myCombo := ui.NewComboBox(
	owner,
	ui.ComboBoxOpts().
		Text("Some option").
		Position(win.POINT{X: 20, Y: 10}).
		State(co.BST_CHECKED),
	),
)

func NewComboBoxDlg

func NewComboBoxDlg(
	parent AnyParent, ctrlId int,
	horz HORZ, vert VERT) ComboBox

Creates a new ComboBox from a dialog resource.

type ComboBoxItem

type ComboBoxItem struct {
	// contains filtered or unexported fields
}

A single item of a ComboBox.

func (*ComboBoxItem) Delete

func (me *ComboBoxItem) Delete()

Deletes the item.

func (ComboBoxItem) Index

func (me ComboBoxItem) Index() int

Returns the zero-based index of the item.

func (ComboBoxItem) Select

func (me ComboBoxItem) Select()

Selects the item

func (ComboBoxItem) Text

func (me ComboBoxItem) Text() string

Retrieves the text of the item.

type DateTimePicker

type DateTimePicker interface {
	AnyNativeControl
	AnyFocusControl

	// Exposes all the [DateTimePicker notifications] the can be handled.
	//
	// Panics if called after the control was created.
	//
	// [DateTimePicker notifications]: https://learn.microsoft.com/en-us/windows/win32/controls/bumper-date-and-time-picker-control-reference-notifications
	On() *_DateTimePickerEvents

	SetTime(newTime time.Time) // Sets the current time.
	Time() time.Time           // Retrieves current time.
	// contains filtered or unexported methods
}

Native date and time picker control.

func NewDateTimePicker

func NewDateTimePicker(parent AnyParent, opts *_DateTimePickerO) DateTimePicker

Creates a new DateTimePicker. Call ui.DateTimePickerOpts() to define the options to be passed to the underlying CreateWindowEx().

Example

var owner ui.AnyParent // initialized somewhere

myDtp := ui.NewDateTimePicker(
	owner,
	ui.DateTimePickerOpts().
		Position(win.POINT{X: 10, Y: 210}),
	),
)

func NewDateTimePickerDlg

func NewDateTimePickerDlg(
	parent AnyParent, ctrlId int,
	horz HORZ, vert VERT) DateTimePicker

Creates a new DateTimePicker from a dialog resource.

type Edit

type Edit interface {
	AnyNativeControl
	AnyFocusControl
	AnyTextControl

	// Exposes all the [Edit notifications] the can be handled.
	//
	// Panics if called after the control was created.
	//
	// [Edit notifications]: https://learn.microsoft.com/en-us/windows/win32/controls/bumper-edit-control-reference-notifications
	On() *_EditEvents

	HideBalloonTip()                                // Hides a balloon tip, if any.
	LimitText(maxChars int)                         // Limits the length of the text.
	ReplaceSelection(text string)                   // Replaces the current text selection with the given text.
	SelectedRange() (int, int)                      // Retrieves the index of first and last selected chars.
	SelectRange(idxFirst, idxLast int)              // Sets the currently selected chars.
	ShowBalloonTip(title, text string, icon co.TTI) // Displays a balloon tip.
	// contains filtered or unexported methods
}

Native edit control.

func NewEdit

func NewEdit(parent AnyParent, opts *_EditO) Edit

Creates a new Edit. Call ui.EditOpts() to define the options to be passed to the underlying CreateWindowEx().

Example

var owner ui.AnyParent // initialized somewhere

myTxt := ui.NewEdit(
	owner,
	ui.EditOpts().
		Position(win.POINT{X: 10, Y: 20}).
		Size(win.SIZE{Cx: 120}),
	),
)

func NewEditDlg

func NewEditDlg(parent AnyParent, ctrlId int, horz HORZ, vert VERT) Edit

Creates a new Edit from a dialog resource.

type HORZ

type HORZ uint8

Horizontal action to be performed when the parent window is resized.

const (
	HORZ_NONE   HORZ = iota // When parent is resized, nothing happens to the control.
	HORZ_REPOS              // When parent is resized, control moves anchored at right.
	HORZ_RESIZE             // When parent is resized, control is resized together.
)

type ListView

type ListView interface {
	AnyNativeControl
	AnyFocusControl

	// Exposes all the [ListView notifications] the can be handled.
	//
	// Panics if called after the control was created.
	//
	// [ListView notifications]: https://learn.microsoft.com/en-us/windows/win32/controls/bumper-list-view-control-reference-notifications
	On() *_ListViewEvents

	ContextMenu() win.HMENU                                           // Returns the associated context menu, if any.
	Columns() *_ListViewColumns                                       // Column methods.
	EditControl() win.HWND                                            // Retrieves a handle to the edit control being used.
	ExtendedStyle() co.LVS_EX                                         // Retrieves the extended style flags.
	ImageList(which co.LVSIL) win.HIMAGELIST                          // Retrieves one of the current image lists. If the list has LVS_SHAREIMAGELISTS, it's shared, otherwise it will be automatically destroyed.
	Items() *_ListViewItems                                           // Item methods.
	Scroll(horz, vert int)                                            // Scrolls the list view horizontally and vertically, in pixels, from its current position.
	SetExtendedStyle(doSet bool, styles co.LVS_EX)                    // Sets or unsets extended style flags.
	SetImageList(which co.LVSIL, himgl win.HIMAGELIST) win.HIMAGELIST // Sets one of the current image lists. If the list has LVS_SHAREIMAGELISTS, it's shared, otherwise it will be automatically destroyed.
	SetRedraw(allowRedraw bool)                                       // Sends WM_SETREDRAW to enable or disable UI updates.
	SetView(view co.LV_VIEW)                                          // Sets current view.
	View() co.LV_VIEW                                                 // Retrieves current view.
	// contains filtered or unexported methods
}

Native list view control.

func NewListView

func NewListView(parent AnyParent, opts *_ListViewO) ListView

Creates a new ListView. Call ui.ListViewOpts() to define the options to be passed to the underlying CreateWindowEx().

Example

var owner ui.AnyParent // initialized somewhere

myList := ui.NewListView(
	owner,
	ui.ListViewOpts().
		Position(win.POINT{X: 10, Y: 20}).
		Size(win.SIZE{Cx: 120}).
		CtrlExStyles(co.LVS_EX_FULLROWSELECT),
	),
)

func NewListViewDlg

func NewListViewDlg(
	parent AnyParent, ctrlId int,
	horz HORZ, vert VERT, contextMenuId int) ListView

Creates a new ListView from a dialog resource.

type ListViewColumn

type ListViewColumn struct {
	// contains filtered or unexported fields
}

A single column of a ListView.

func (ListViewColumn) Index

func (me ListViewColumn) Index() int

Returns the zero-based index of the column.

func (ListViewColumn) SelectedTexts

func (me ListViewColumn) SelectedTexts() []string

Retrieves all selected item texts under this column.

func (ListViewColumn) SetTitle

func (me ListViewColumn) SetTitle(text string)

Sets the title.

func (ListViewColumn) SetWidth

func (me ListViewColumn) SetWidth(width int)

Sets the width. Will be adjusted to the current system DPI.

func (ListViewColumn) SetWidthToFill

func (me ListViewColumn) SetWidthToFill()

Resizes the column to fill the remaining space.

func (ListViewColumn) Texts

func (me ListViewColumn) Texts() []string

Retrieves all item texts under this column.

func (ListViewColumn) Title

func (me ListViewColumn) Title() string

Retrieves the title of the column.

func (ListViewColumn) Width

func (me ListViewColumn) Width() int

Retrieves the width of the column.

type ListViewItem

type ListViewItem struct {
	// contains filtered or unexported fields
}

A single item of a ListView.

func (ListViewItem) Delete

func (me ListViewItem) Delete()

Deletes the item.

func (ListViewItem) EnsureVisible

func (me ListViewItem) EnsureVisible()

Makes sure the item is visible, scrolling the ListView if needed.

func (ListViewItem) Focus

func (me ListViewItem) Focus()

Sets the item as the focused one.

func (ListViewItem) Index

func (me ListViewItem) Index() int

Returns the zero-based index of the item.

func (ListViewItem) IsSelected

func (me ListViewItem) IsSelected() bool

Tells whether the item is currently selected.

func (ListViewItem) IsVisible

func (me ListViewItem) IsVisible() bool

Tells whether the item is currently visible.

func (ListViewItem) LParam

func (me ListViewItem) LParam() win.LPARAM

Retrieves the custom data associated with the item.

func (ListViewItem) MapIndexToId

func (me ListViewItem) MapIndexToId() int

Returns a ID which uniquely identifies the item.

func (ListViewItem) Rect

func (me ListViewItem) Rect(portion co.LVIR) win.RECT

Retrieves the coordinates of the rectangle surrounding the item.

func (ListViewItem) Select

func (me ListViewItem) Select(isSelected bool)

Selects the item.

func (ListViewItem) SetHot

func (me ListViewItem) SetHot() (previous ListViewItem, hasPrevious bool)

Sets the item as hot, returning the previous one, if any.

func (ListViewItem) SetLParam

func (me ListViewItem) SetLParam(lp win.LPARAM)

Sets the custom data associated with the item.

func (ListViewItem) SetText

func (me ListViewItem) SetText(columnIndex int, text string)

Sets the text of the item.

func (ListViewItem) Text

func (me ListViewItem) Text(columnIndex int) string

Retrieves the text of the item.

func (ListViewItem) Update

func (me ListViewItem) Update()

Sends an LVM_UPDATE message to the item.

type MonthCalendar

type MonthCalendar interface {
	AnyNativeControl
	AnyFocusControl

	// Exposes all the [MonthCalendar notifications] the can be handled.
	//
	// Panics if called after the control was created.
	//
	// [MonthCalendar notifications]: https://learn.microsoft.com/en-us/windows/win32/controls/bumper-month-calendar-control-reference-notifications
	On() *_MonthCalendarEvents

	SelectDate(date time.Time) // Sets the selected date.
	SelectedDate() time.Time   // Retrieves the selected date.
	// contains filtered or unexported methods
}

Native month calendar control.

func NewMonthCalendar

func NewMonthCalendar(parent AnyParent, opts *_MonthCalendarO) MonthCalendar

Creates a new MonthCalendar. Call ui.MonthCalendarOpts() to define the options to be passed to the underlying CreateWindowEx().

Example

var owner ui.AnyParent // initialized somewhere

myCal := ui.NewMonthCalendar(
	owner,
	ui.MonthCalendarOpts().
		Position(win.POINT{X: 50, Y: 50}),
	),
)

func NewMonthCalendarDlg

func NewMonthCalendarDlg(
	parent AnyParent, ctrlId int,
	horz HORZ, vert VERT) MonthCalendar

Creates a new MonthCalendar from a dialog resource.

type ProgressBar

type ProgressBar interface {
	AnyNativeControl

	Pos() int                  // Retrieves the current position.
	SetMarquee(isMarquee bool) // Sets indeterminate state, a graphic animation going back and forth.
	SetPos(pos int)            // Sets the current position.
	SetRange(min, max int)     // Sets the new range. Default is 0-100.
	SetState(state co.PBST)    // Sets the current state (green, yellow, red).
	// contains filtered or unexported methods
}

Native progress bar control.

func NewProgressBar

func NewProgressBar(parent AnyParent, opts *_ProgressBarO) ProgressBar

Creates a new ProgressBar. Call ui.ProgressBarOpts() to define the options to be passed to the underlying CreateWindowEx().

Example

var owner ui.AnyParent // initialized somewhere

myProg := ui.NewProgressBar(
	owner,
	ui.ProgressBarOpts().
		Position(win.POINT{X: 350, Y: 80}),
	),
)

func NewProgressBarDlg

func NewProgressBarDlg(
	parent AnyParent, ctrlId int,
	horz HORZ, vert VERT) ProgressBar

Creates a new ProgressBar from a dialog resource.

type RadioButton

type RadioButton interface {
	AnyNativeControl
	AnyFocusControl
	AnyTextControl

	// Exposes all the [Button notifications] the can be handled.
	//
	// Panics if called after the control was created.
	//
	// [Button notifications]: https://learn.microsoft.com/en-us/windows/win32/controls/bumper-button-control-reference-notifications
	On() *_ButtonEvents

	EmulateClick()                // Emulates an user click.
	IsSelected() bool             // Tells whether this radio button is the selected one in its group.
	Select()                      // Selects the radio button.
	SelectAndTrigger()            // Selects the radio button and triggers the click event.
	SetTextAndResize(text string) // Sets the text and resizes the control to fit it exactly.
	// contains filtered or unexported methods
}

Native radio button control.

Prefer using a RadioGroup instead.

func NewRadioButton

func NewRadioButton(parent AnyParent, opts *_RadioButtonO) RadioButton

Creates a new RadioButton. Call ui.RadioButtonOpts() to define the options to be passed to the underlying CreateWindowEx().

Prefer using the RadioGroup, which manages multiple radio buttons at once.

Example

var owner ui.AnyParent // initialized somewhere

myRadio := ui.NewRadioButton(
	owner,
	ui.RadioButtonOpts().
		Text("Some option").
		Position(win.POINT{X: 10, Y: 40}).
		WndStyles(co.WS_VISIBLE|co.WS_CHILD|co.WS_TABSTOP|co.WS_GROUP),
	),
)

func NewRadioButtonDlg

func NewRadioButtonDlg(
	parent AnyParent, ctrlId int,
	horz HORZ, vert VERT) RadioButton

Creates a new RadioButton from a dialog resource.

type RadioGroup

type RadioGroup interface {

	// Exposes all the [Button notifications] the can be handled by all radios
	// in the group.
	//
	// Panics if called after the control was created.
	//
	// [Button notifications]: https://learn.microsoft.com/en-us/windows/win32/controls/bumper-button-control-reference-notifications
	On() *_RadioButtonEvents

	AsCtrls() []AnyControl         // Returns all radios buttons as AnyControl.
	EnableAll(enable bool)         // Calls EnableWindow on all radio buttons.
	FocusSelected()                // Puts the focus on the currently selected radio button, if any.
	Item(index int) RadioButton    // Returns the RadioButton at the given index.
	Parent() AnyParent             // Returns the parent of the radio buttons.
	Selected() (RadioButton, bool) // Returns the currently selected RadioButton, if any.
	// contains filtered or unexported methods
}

Manages a group of native radio button controls.

func NewRadioGroup

func NewRadioGroup(parent AnyParent, opts ...*_RadioButtonO) RadioGroup

Creates a new RadioGroup, with one or more RadioButton controls. Call ui.RadioButtonOpts() to define the options of each RadioButton to be passed to the underlying CreateWindowEx().

Example

var owner ui.AnyParent // initialized somewhere

myRadios := ui.NewRadioGroup(
	owner,
	ui.RadioButtonOpts().
		Text("First option").
		Position(win.POINT{X: 10, Y: 40}).
		WndStyles(co.WS_VISIBLE|co.WS_CHILD|co.WS_TABSTOP|co.WS_GROUP),
	),
	ui.RadioButtonOpts().
		Text("Second option").
		Position(win.POINT{X: 10, Y: 80}).
		Select(true),
	),
	ui.RadioButtonOpts().
		Text("Third option").
		Position(win.POINT{X: 10, Y: 120}),
	),
)

func NewRadioGroupDlg

func NewRadioGroupDlg(
	parent AnyParent, horz HORZ, vert VERT, ctrlIds ...int) RadioGroup

Creates a new RadioGroup, where each RadioButton is from a dialog resource.

type Static

type Static interface {
	AnyNativeControl
	AnyTextControl

	// Exposes all the [Static notifications] the can be handled.
	//
	// Panics if called after the control was created.
	//
	// [Static notifications]: https://learn.microsoft.com/en-us/windows/win32/controls/bumper-static-control-reference-notifications
	On() *_StaticEvents

	SetTextAndResize(text string) // Sets the text and resizes the control to fit it exactly.
	// contains filtered or unexported methods
}

Native static control.

func NewStatic

func NewStatic(parent AnyParent, opts *_StaticO) Static

Creates a new Static. Call ui.StaticOpts() to define the options to be passed to the underlying CreateWindowEx().

Example

var owner ui.AnyParent // initialized somewhere

myLabel := ui.NewStatic(
	owner,
	ui.StaticOpts().
		Text("Some label").
		Position(win.POINT{X: 20, Y: 10}),
	),
)

func NewStaticDlg

func NewStaticDlg(parent AnyParent, ctrlId int, horz HORZ, vert VERT) Static

Creates a new Static from a dialog resource.

type StatusBar

type StatusBar interface {
	AnyNativeControl

	// Exposes all the [StatusBar notifications] the can be handled.
	//
	// Panics if called after the control was created.
	//
	// [StatusBar notifications]: https://learn.microsoft.com/en-us/windows/win32/controls/bumper-status-bars-reference-notifications
	On() *_StatusBarEvents

	// Parts methods.
	Parts() *_StatusBarParts
	// contains filtered or unexported methods
}

Native status bar control.

func NewStatusBar

func NewStatusBar(parent AnyParent) StatusBar

Creates a new StatusBar.

type StatusBarPart

type StatusBarPart struct {
	// contains filtered or unexported fields
}

A single part of a StatusBar.

func (StatusBarPart) Icon

func (me StatusBarPart) Icon() win.HICON

Retrieves the HICON.

The icon is shared, the StatusBar doesn't own it.

func (StatusBarPart) Index

func (me StatusBarPart) Index() int

Returns the zero-based index of the part.

func (StatusBarPart) SetIcon

func (me StatusBarPart) SetIcon(hIcon win.HICON)

Puts the HICON.

The icon is shared, the StatusBar doesn't own it.

func (StatusBarPart) SetText

func (me StatusBarPart) SetText(text string)

Sets the text.

func (StatusBarPart) Text

func (me StatusBarPart) Text() string

Retrieves the text of the part.

type SysLink interface {
	AnyNativeControl
	AnyFocusControl
	AnyTextControl

	// Exposes all the [SysLink notifications] the can be handled.
	//
	// Panics if called after the control was created.
	//
	// [SysLink notifications]: https://learn.microsoft.com/en-us/windows/win32/controls/bumper-syslink-control-reference-notifications
	On() *_SysLinkEvents

	SetTextAndResize(text string) // Sets the text and resizes the control to fit it exactly.
	// contains filtered or unexported methods
}

Native SysLink control.

func NewSysLink(parent AnyParent, opts *_SysLinkO) SysLink

Creates a new SysLink. Call ui.SysLinkOpts() to define the options to be passed to the underlying CreateWindowEx().

var owner ui.AnyParent // initialized somewhere

myLink := ui.NewSysLink(
	owner,
	ui.SysLinkOpts().
		Text("Click <a href=\"123\">here</a>.").
		Position(win.POINT{X: 20, Y: 10}),
	),
)

func NewSysLinkDlg

func NewSysLinkDlg(parent AnyParent, ctrlId int, horz HORZ, vert VERT) SysLink

Creates a new SysLink from a dialog resource.

type Toolbar

type Toolbar interface {
	AnyNativeControl

	// Exposes all the [Toolbar notifications] the can be handled.
	//
	// Panics if called after the control was created.
	//
	// [Toolbar notifications]: https://learn.microsoft.com/en-us/windows/win32/controls/bumper-toolbar-control-reference-notifications
	On() *_ToolbarEvents

	AutoSize()                                                   // Sends a TB_AUTOSIZE message to resize the toolbar.
	ExtendedStyle() co.TBSTYLE_EX                                // Retrieves the extended style flags.
	Buttons() *_ToolbarButtons                                   // Button methods.
	SetExtendedStyle(doSet bool, styles co.TBSTYLE_EX)           // Sets or unsets extended style flags.
	SetImageList(index int, himgl win.HIMAGELIST) win.HIMAGELIST // Sets the nth image list for the control.
	SetParent(hNewParent win.HWND) win.HWND                      // Sets the window to which the toolbar control sends notification messages.
	// contains filtered or unexported methods
}

Native toolbar control.

func NewToolbar

func NewToolbar(parent AnyParent, opts *_ToolbarO) Toolbar

Creates a new Toolbar. Call ui.ToolbarOpts() to define the options to be passed to the underlying CreateWindowEx().

Example

var owner ui.AnyParent // initialized somewhere

myBar := ui.NewToolbar(
	owner,
	ui.ToolbarOpts().
		CtrlStyles(co.TBSTYLE_BUTTON|co.TBSTYLE_LIST|co.TBSTYLE_FLAT),
	),
)

type Trackbar

type Trackbar interface {
	AnyNativeControl
	AnyFocusControl

	// Exposes all the [Trackbar notifications] the can be handled.
	//
	// Panics if called after the control was created.
	//
	// [Trackbar notifications]: https://learn.microsoft.com/en-us/windows/win32/controls/bumper-trackbar-control-reference-notifications
	On() *_TrackbarEvents

	PageSize() int                // Retrieves the number of positions of page up/down.
	Pos() int                     // Retrieves the current position.
	RangeMax() int                // Retrieves the maximum position.
	RangeMin() int                // Retrieves the mininum position.
	SetPageSize(pageSize int) int // Sets the number of positions of page up/down.
	SetPos(pos int)               // Sets the current position.
	SetRangeMax(max int)          // Sets the maximum position.
	SetRangeMin(min int)          // Sets the minimum position.
	// contains filtered or unexported methods
}

Native trackbar control.

func NewTrackbar

func NewTrackbar(parent AnyParent, opts *_TrackbarO) Trackbar

Creates a new Trackbar. Call ui.TrackbarOpts() to define the options to be passed to the underlying CreateWindowEx().

Example

var owner ui.AnyParent // initialized somewhere

mySlider := ui.NewTrackbar(
	owner,
	ui.TrackbarOpts().
		Position(win.POINT{X: 10, Y: 250}).
		RangeMax(4),
	),
)

func NewTrackbarDlg

func NewTrackbarDlg(
	parent AnyParent, ctrlId int,
	horz HORZ, vert VERT) Trackbar

Creates a new Trackbar from a dialog resource.

type TreeView

type TreeView interface {
	AnyNativeControl
	AnyFocusControl

	// Exposes all the [TreeView notifications] the can be handled.
	//
	// Panics if called after the control was created.
	//
	// [TreeView notifications]: https://learn.microsoft.com/en-us/windows/win32/controls/bumper-tree-view-control-reference-notifications
	On() *_TreeViewEvents

	Items() *_TreeViewItems // Item methods.
	// contains filtered or unexported methods
}

Native tree view control.

func NewTreeView

func NewTreeView(parent AnyParent, opts *_TreeViewO) TreeView

Creates a new TreView. Call ui.TreeViewOpts() to define the options to be passed to the underlying CreateWindowEx().

Example

var owner AnyParent // initialized somewhere

myTree := ui.NewTreeView(
	owner,
	ui.TreeViewOpts().
		Position(win.POINT{X: 10, Y: 240}).
		Size(win.SIZE{Cx: 150, Cy: 100}),
	),
)

func NewTreeViewDlg

func NewTreeViewDlg(
	parent AnyParent, ctrlId int,
	horz HORZ, vert VERT) TreeView

Creates a new TreeView from a dialog resource.

type TreeViewItem

type TreeViewItem struct {
	// contains filtered or unexported fields
}

A single item of a TreeView.

func (TreeViewItem) AddChild

func (me TreeViewItem) AddChild(text string) TreeViewItem

Adds a child to this item.

func (TreeViewItem) Children

func (me TreeViewItem) Children() []TreeViewItem

Retrieves all the children of this item.

func (TreeViewItem) Delete

func (me TreeViewItem) Delete()

Deletes the item and all its children.

func (TreeViewItem) EnsureVisible

func (me TreeViewItem) EnsureVisible()

Makes sure the item is visible, scrolling the TreeView if needed.

func (TreeViewItem) Expand

func (me TreeViewItem) Expand(doExpand bool)

Expands the item.

func (TreeViewItem) Htreeitem

func (me TreeViewItem) Htreeitem() win.HTREEITEM

Returns the unique handle of the item.

func (TreeViewItem) IsExpanded

func (me TreeViewItem) IsExpanded() bool

Tells whether the item is currently expanded.

func (TreeViewItem) IsRoot

func (me TreeViewItem) IsRoot() bool

Tells whether the item is a root item (has no parent).

func (TreeViewItem) LParam

func (me TreeViewItem) LParam() win.LPARAM

Retrieves the custom data associated with the item.

func (TreeViewItem) NextSibling

func (me TreeViewItem) NextSibling() (TreeViewItem, bool)

Retrieves the next item, if any.

func (TreeViewItem) Parent

func (me TreeViewItem) Parent() (TreeViewItem, bool)

Retrieves the parent item, if any.

func (TreeViewItem) PrevSibling

func (me TreeViewItem) PrevSibling() (TreeViewItem, bool)

Retrieves the previous item, if any.

func (TreeViewItem) SetLParam

func (me TreeViewItem) SetLParam(lp win.LPARAM)

Sets the custom data associated with the item.

func (TreeViewItem) SetText

func (me TreeViewItem) SetText(text string)

Sets the text of the item.

func (TreeViewItem) Text

func (me TreeViewItem) Text() string

Retrieves the text of the item.

type VERT

type VERT uint8

Vertical action to be performed when the parent window is resized.

const (
	VERT_NONE   VERT = iota // When parent is resized, nothing happens to the control.
	VERT_REPOS              // When parent is resized, control moves anchored at bottom.
	VERT_RESIZE             // When parent is resized, control is resized together.
)

type WindowControl

type WindowControl interface {
	AnyParent
	AnyControl
}

User-custom child control.

func NewWindowControl

func NewWindowControl(parent AnyParent, opts *_WindowControlO) WindowControl

Creates a new WindowControl. Call WindowControlOpts() to define the options to be passed to the underlying CreateWindowEx().

Example

var owner AnyParent // initialized somewhere

myControl := ui.NewWindowControl(
	owner,
	ui.WindowControlOpts().
		Position(win.POINT{X: 100, Y: 100}).
		Size(win.SIZE{Cx: 300, Cy: 200}).
		RangeMax(4),
	),
)

func NewWindowControlDlg

func NewWindowControlDlg(
	parent AnyParent, dialogId int,
	position win.POINT, horz HORZ, vert VERT) WindowControl

Creates a new WindowControl by loading a dialog resource, with an auto-generated control ID.

If parent is a dialog box, position coordinates are in Dialog Template Units; otherwise, they are in pixels and they will be adjusted to the current system DPI.

func NewWindowControlDlgWithId

func NewWindowControlDlgWithId(
	parent AnyParent, dialogId int,
	position win.POINT, ctrlId int, horz HORZ, vert VERT) WindowControl

Creates a new WindowControl by loading a dialog resource, specifying a control ID.

If parent is a dialog box, position coordinates are in Dialog Template Units; otherwise, they are in pixels and they will be adjusted to the current system DPI.

type WindowMain

type WindowMain interface {
	AnyParent

	// Creates the main window and runs the main application loop.
	//
	// Will block until the window is closed.
	RunAsMain() int
}

User-custom main application window.

func NewWindowMain

func NewWindowMain(opts *_WindowMainO) WindowMain

Creates a new WindowMain. Call WindowMainOpts() to define the options to be passed to the underlying CreateWindowEx().

Example

myWindow := ui.NewWindowMain(
	ui.WindowMainOpts().
		Title("Hello world").
		ClientArea(win.SIZE{Cx: 500, Cy: 400}).
		WndStyles(co.WS_CAPTION | co.WS_SYSMENU | co.WS_CLIPCHILDREN |
			co.WS_BORDER | co.WS_VISIBLE | co.WS_MINIMIZEBOX |
			co.WS_MAXIMIZEBOX | co.WS_SIZEBOX),
		),
)

func NewWindowMainDlg

func NewWindowMainDlg(dialogId, iconId, accelTableId int) WindowMain

Creates a new WindowMain by loading a dialog resource.

Parameters iconId and accelTableId are optional.

type WindowModal

type WindowModal interface {
	AnyParent

	// Creates and shows the modal window.
	//
	// Will block until the window is closed.
	ShowModal(parent AnyParent)
}

User-custom modal window.

func NewWindowModal

func NewWindowModal(opts *_WindowModalO) WindowModal

Creates a new WindowModal. Call WindowModalOpts() to define the options to be passed to the underlying CreateWindowEx().

Example

myModal := ui.NewWindowModal(
	ui.WindowModalOpts().
		Title("My modal window"),
	),
)

func NewWindowModalDlg

func NewWindowModalDlg(dialogId int) WindowModal

Creates a new WindowModal by loading a dialog resource.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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