desktop

package
v2.2.3 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2022 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Overview

Package desktop provides desktop specific driver functionality.

Index

Constants

View Source
const (
	// KeyNone represents no key
	KeyNone fyne.KeyName = ""
	// KeyShiftLeft represents the left shift key
	KeyShiftLeft fyne.KeyName = "LeftShift"
	// KeyShiftRight represents the right shift key
	KeyShiftRight fyne.KeyName = "RightShift"
	// KeyControlLeft represents the left control key
	KeyControlLeft fyne.KeyName = "LeftControl"
	// KeyControlRight represents the right control key
	KeyControlRight fyne.KeyName = "RightControl"
	// KeyAltLeft represents the left alt key
	KeyAltLeft fyne.KeyName = "LeftAlt"
	// KeyAltRight represents the right alt key
	KeyAltRight fyne.KeyName = "RightAlt"
	// KeySuperLeft represents the left "Windows" key (or "Command" key on macOS)
	KeySuperLeft fyne.KeyName = "LeftSuper"
	// KeySuperRight represents the right "Windows" key (or "Command" key on macOS)
	KeySuperRight fyne.KeyName = "RightSuper"
	// KeyMenu represents the left or right menu / application key
	KeyMenu fyne.KeyName = "Menu"
	// KeyPrintScreen represents the key used to cause a screen capture
	KeyPrintScreen fyne.KeyName = "PrintScreen"

	// KeyCapsLock represents the caps lock key, tapping once is the down event then again is the up
	KeyCapsLock fyne.KeyName = "CapsLock"
)
View Source
const (
	// ShiftModifier represents a shift key being held
	//
	// Deprecated: Use fyne.KeyModifierShift instead.
	ShiftModifier = fyne.KeyModifierShift
	// ControlModifier represents the ctrl key being held
	//
	// Deprecated: Use fyne.KeyModifierControl instead.
	ControlModifier = fyne.KeyModifierControl
	// AltModifier represents either alt keys being held
	//
	// Deprecated: Use fyne.KeyModifierAlt instead.
	AltModifier = fyne.KeyModifierAlt
	// SuperModifier represents either super keys being held
	//
	// Deprecated: Use fyne.KeyModifierSuper instead.
	SuperModifier = fyne.KeyModifierSuper
)

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App interface {
	SetSystemTrayMenu(menu *fyne.Menu)
	SetSystemTrayIcon(icon fyne.Resource)
}

App defines the desktop specific extensions to a fyne.App.

Since: 2.2

type Canvas

type Canvas interface {
	OnKeyDown() func(*fyne.KeyEvent)
	SetOnKeyDown(func(*fyne.KeyEvent))
	OnKeyUp() func(*fyne.KeyEvent)
	SetOnKeyUp(func(*fyne.KeyEvent))
}

Canvas defines the desktop specific extensions to a fyne.Canvas.

type Cursor

type Cursor interface {
	// Image returns the image for the given cursor, or nil if none should be shown.
	// It also returns the x and y pixels that should act as the hot-spot (measured from top left corner).
	Image() (image.Image, int, int)
}

Cursor interface is used for objects that desire a specific cursor.

Since: 2.0

type Cursorable

type Cursorable interface {
	Cursor() Cursor
}

Cursorable describes any CanvasObject that needs a cursor change

type CustomShortcut

type CustomShortcut struct {
	fyne.KeyName
	Modifier fyne.KeyModifier
}

CustomShortcut describes a shortcut desktop event.

func (*CustomShortcut) Key

func (cs *CustomShortcut) Key() fyne.KeyName

Key returns the key name of this shortcut. @implements KeyboardShortcut

func (*CustomShortcut) Mod

func (cs *CustomShortcut) Mod() fyne.KeyModifier

Mod returns the modifier of this shortcut. @implements KeyboardShortcut

func (*CustomShortcut) ShortcutName

func (cs *CustomShortcut) ShortcutName() string

ShortcutName returns the shortcut name associated to the event

type Driver

type Driver interface {
	// Create a new borderless window that is centered on screen
	CreateSplashWindow() fyne.Window
}

Driver represents the extended capabilities of a desktop driver

type Hoverable

type Hoverable interface {
	// MouseIn is a hook that is called if the mouse pointer enters the element.
	MouseIn(*MouseEvent)
	// MouseMoved is a hook that is called if the mouse pointer moved over the element.
	MouseMoved(*MouseEvent)
	// MouseOut is a hook that is called if the mouse pointer leaves the element.
	MouseOut()
}

Hoverable is used when a canvas object wishes to know if a pointer device moves over it.

type Keyable

type Keyable interface {
	fyne.Focusable

	KeyDown(*fyne.KeyEvent)
	KeyUp(*fyne.KeyEvent)
}

Keyable describes any focusable canvas object that can accept desktop key events. This is the traditional key down and up event that is not applicable to all devices.

type Modifier deprecated

type Modifier = fyne.KeyModifier

Modifier captures any key modifiers (shift etc.) pressed during a key event

Deprecated: Use fyne.KeyModifier instead.

type MouseButton

type MouseButton int

MouseButton represents a single button in a desktop MouseEvent

const (
	// MouseButtonPrimary is the most common mouse button - on some systems the only one.
	// This will normally be on the left side of a mouse.
	//
	// Since: 2.0
	MouseButtonPrimary MouseButton = 1 << iota

	// MouseButtonSecondary is the secondary button on most mouse input devices.
	// This will normally be on the right side of a mouse.
	//
	// Since: 2.0
	MouseButtonSecondary

	// MouseButtonTertiary is the middle button on the mouse, assuming it has one.
	//
	// Since: 2.0
	MouseButtonTertiary

	// LeftMouseButton is the most common mouse button - on some systems the only one.
	//
	// Deprecated: use MouseButtonPrimary which will adapt to mouse configuration.
	LeftMouseButton = MouseButtonPrimary

	// RightMouseButton is the secondary button on most mouse input devices.
	//
	// Deprecated: use MouseButtonSecondary which will adapt to mouse configuration.
	RightMouseButton = MouseButtonSecondary
)

type MouseEvent

type MouseEvent struct {
	fyne.PointEvent
	Button   MouseButton
	Modifier fyne.KeyModifier
}

MouseEvent contains data relating to desktop mouse events

type Mouseable

type Mouseable interface {
	MouseDown(*MouseEvent)
	MouseUp(*MouseEvent)
}

Mouseable represents desktop mouse events that can be sent to CanvasObjects

type StandardCursor

type StandardCursor int

StandardCursor represents a standard Fyne cursor. These values were previously of type `fyne.Cursor`.

Since: 2.0

const (
	// DefaultCursor is the default cursor typically an arrow
	DefaultCursor StandardCursor = iota
	// TextCursor is the cursor often used to indicate text selection
	TextCursor
	// CrosshairCursor is the cursor often used to indicate bitmaps
	CrosshairCursor
	// PointerCursor is the cursor often used to indicate a link
	PointerCursor
	// HResizeCursor is the cursor often used to indicate horizontal resize
	HResizeCursor
	// VResizeCursor is the cursor often used to indicate vertical resize
	VResizeCursor
	// HiddenCursor will cause the cursor to not be shown
	HiddenCursor
)

func (StandardCursor) Image

func (d StandardCursor) Image() (image.Image, int, int)

Image is not used for any of the StandardCursor types.

Since: 2.0

Jump to

Keyboard shortcuts

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