Documentation ¶
Index ¶
- Constants
- func HandleKeyboardShortcuts(state *State)
- type BackendState
- func (s *BackendState) AddKeyPress(k Key)
- func (s *BackendState) AddScroll(x, y int)
- func (s *BackendState) AddTextInput(text string)
- func (s *BackendState) AnimationRequested() bool
- func (s *BackendState) Cursor() Cursor
- func (s *BackendState) GrabMouse()
- func (s *BackendState) QuitRequested() bool
- func (s *BackendState) RefocusRequested() bool
- func (s *BackendState) ReleaseMouse(b MouseButton)
- func (s *BackendState) ResetEvents()
- func (state *BackendState) ResetRequests()
- func (s *BackendState) SetBlink(b bool)
- func (s *BackendState) SetHovered(h bool)
- func (s *BackendState) SetModifiers(m Modifier)
- func (s *BackendState) SetMouseButtons(b MouseButton)
- func (s *BackendState) SetMouseClicks(clicks int)
- func (s *BackendState) SetMousePosition(x, y int)
- func (s *BackendState) SetWindowSize(w, h int)
- func (s *BackendState) UpdateRequested() bool
- func (s *BackendState) WindowTitle() string
- type Component
- type Cursor
- type Key
- type Modifier
- type MouseButton
- type Popup
- type Root
- type State
- func (s *State) AnimationSpeed() float32
- func (s *State) Blink() bool
- func (s *State) ClickCount() int
- func (s *State) ClipboardString() string
- func (s *State) CloseDialog()
- func (s *State) ClosePopups()
- func (s *State) ConsumeScroll()
- func (s *State) DisableTabFocus()
- func (s *State) DraggedContent() (content interface{}, drop bool)
- func (s *State) DrawChild(g *draw.Buffer, bounds image.Rectangle, c Component)
- func (s *State) FocusNext()
- func (s *State) FocusPrevious()
- func (s *State) GetVisibilityRequest() (image.Rectangle, bool)
- func (s *State) HasKeyboardFocus() bool
- func (s *State) HasModifiers(m Modifier) bool
- func (s *State) HasMouseFocus() bool
- func (s *State) HasPopups() bool
- func (s *State) InitiateDrag(content interface{})
- func (s *State) IsHovered() bool
- func (s *State) KeyPresses() []Key
- func (s *State) KeyboardFocus() Component
- func (s *State) MouseButtonDown(b MouseButton) bool
- func (s *State) MouseClick(b MouseButton) bool
- func (s *State) MousePos() image.Point
- func (s *State) OpenDialog(d Component)
- func (s *State) OpenPopup(bounds image.Rectangle, d Component) Popup
- func (s *State) PeekKeyPresses() []Key
- func (s *State) Quit()
- func (s *State) RequestAnimation()
- func (s *State) RequestRefocus()
- func (s *State) RequestUpdate()
- func (s *State) RequestVisible(r image.Rectangle)
- func (s *State) Scroll() image.Point
- func (s *State) SetBlink()
- func (s *State) SetClipboardString(c string)
- func (s *State) SetCursor(c Cursor)
- func (s *State) SetKeyboardFocus(c Component)
- func (s *State) SetRoot(r Root)
- func (s *State) SetWindowTitle(title string)
- func (s *State) TextInput() string
- func (s *State) UpdateChild(g *draw.Buffer, bounds image.Rectangle, c Component)
- func (s *State) WindowBounds() image.Rectangle
Constants ¶
const MenuDrag menuDrag = 0
Variables ¶
This section is empty.
Functions ¶
func HandleKeyboardShortcuts ¶
func HandleKeyboardShortcuts(state *State)
Types ¶
type BackendState ¶
type BackendState struct { State // contains filtered or unexported fields }
func (*BackendState) AddKeyPress ¶
func (s *BackendState) AddKeyPress(k Key)
func (*BackendState) AddScroll ¶
func (s *BackendState) AddScroll(x, y int)
func (*BackendState) AddTextInput ¶
func (s *BackendState) AddTextInput(text string)
func (*BackendState) AnimationRequested ¶
func (s *BackendState) AnimationRequested() bool
func (*BackendState) Cursor ¶
func (s *BackendState) Cursor() Cursor
func (*BackendState) GrabMouse ¶
func (s *BackendState) GrabMouse()
func (*BackendState) QuitRequested ¶
func (s *BackendState) QuitRequested() bool
func (*BackendState) RefocusRequested ¶
func (s *BackendState) RefocusRequested() bool
func (*BackendState) ReleaseMouse ¶
func (s *BackendState) ReleaseMouse(b MouseButton)
func (*BackendState) ResetEvents ¶
func (s *BackendState) ResetEvents()
func (*BackendState) ResetRequests ¶
func (state *BackendState) ResetRequests()
func (*BackendState) SetBlink ¶
func (s *BackendState) SetBlink(b bool)
func (*BackendState) SetHovered ¶
func (s *BackendState) SetHovered(h bool)
func (*BackendState) SetModifiers ¶
func (s *BackendState) SetModifiers(m Modifier)
func (*BackendState) SetMouseButtons ¶
func (s *BackendState) SetMouseButtons(b MouseButton)
func (*BackendState) SetMouseClicks ¶
func (s *BackendState) SetMouseClicks(clicks int)
func (*BackendState) SetMousePosition ¶
func (s *BackendState) SetMousePosition(x, y int)
func (*BackendState) SetWindowSize ¶
func (s *BackendState) SetWindowSize(w, h int)
func (*BackendState) UpdateRequested ¶
func (s *BackendState) UpdateRequested() bool
func (*BackendState) WindowTitle ¶
func (s *BackendState) WindowTitle() string
type Key ¶
type Key int
const ( KeyUnknown Key = iota KeyA KeyB KeyC KeyD KeyE KeyF KeyG KeyH KeyI KeyJ KeyK KeyL KeyM KeyN KeyO KeyP KeyQ KeyR KeyS KeyT KeyU KeyV KeyW KeyX KeyY KeyZ Key1 Key2 Key3 Key4 Key5 Key6 Key7 Key8 Key9 Key0 KeyEnter KeyEscape KeyBackspace KeyTab KeySpace KeyCapsLock KeyF1 KeyF2 KeyF3 KeyF4 KeyF5 KeyF6 KeyF7 KeyF8 KeyF9 KeyF10 KeyF11 KeyF12 KeyPrintScreen KeyScrollLock KeyPause KeyInsert KeyHome KeyPageUp KeyDelete KeyEnd KeyPageDown KeyRight KeyLeft KeyDown KeyUp KeyNumLock KeyNumpadDiv KeyNumpadMul KeyNumpadMinus KeyNumpadPlus KeyNumpadEnter KeyNumpad1 KeyNumpad2 KeyNumpad3 KeyNumpad4 KeyNumpad5 KeyNumpad6 KeyNumpad7 KeyNumpad8 KeyNumpad9 KeyNumpad0 KeyNumpadDot KeyMenu KeyLeftControl KeyLeftShift KeyLeftAlt KeyLeftSuper KeyRightControl KeyRightShift KeyRightAlt KeyRightSuper )
type MouseButton ¶
type MouseButton byte
const ( MouseLeft MouseButton = 1 << iota MouseMiddle MouseRight MouseForward MouseBack )
type State ¶
type State struct {
// contains filtered or unexported fields
}
The State is a components connection to the application. It can be used to query input events and to request actions.
func (*State) AnimationSpeed ¶
AnimationSpeed returns the time since the last call to RequestAnimation in seconds.
func (*State) Blink ¶
Blink returns the current state of blinking elements. This is mostly indended for the cursor in text fields.
func (*State) ClickCount ¶
ClickCount returns the number of consecutive mouse clicks.
func (*State) ClipboardString ¶
ClipboardString returns the contents of the clipboard.
func (*State) CloseDialog ¶
func (s *State) CloseDialog()
CloseDialog closes the currently open dialog, if any.
func (*State) ConsumeScroll ¶
func (s *State) ConsumeScroll()
ConsumeScroll notifies the State that the scroll amount has been used and should not be used by any other components.
func (*State) DisableTabFocus ¶
func (s *State) DisableTabFocus()
DisableTabFocus disables focus cycling with the tab key for the current component.
func (*State) DraggedContent ¶
DraggedContent returns information abount a drag and drop gesture currently in progress. If there is no drag and drop gesture, or the mouse cursor is not above the current component, content will be nil. Otherwise, content will be the value passed to InitiateDrag. drop will be true if the mouse was released just before the current update.
func (*State) FocusNext ¶
func (s *State) FocusNext()
SetKeyboardFocus requests that the next component will receive keyboard events.
func (*State) FocusPrevious ¶
func (s *State) FocusPrevious()
SetKeyboardFocus requests that the previous component will receive keyboard events.
func (*State) GetVisibilityRequest ¶
GetVisibilityRequest returns the rectangle passed to RequestVisible by a child of the current component. This method should be called after UpdateChild. The returned rectangle will be translated relative to the current component. If the second return value is false, RequestVisible was not called.
func (*State) HasKeyboardFocus ¶
HasKeyboardFocus returns true if the current component receives keyboard events.
func (*State) HasModifiers ¶
HasModifiers returns true if the given modifiers are currently active.
func (*State) HasMouseFocus ¶
HasMouseFocus returns true if the current component receives mouse events, i.e. if it is hovered or grabbed.
func (*State) InitiateDrag ¶
func (s *State) InitiateDrag(content interface{})
InitiateDrag starts a drag and drop gesture.
func (*State) KeyPresses ¶
KeyPresses returns a list of key events that the current component should process.
func (*State) KeyboardFocus ¶
KeyboardFocus returns the component that currently receives keyboard events.
func (*State) MouseButtonDown ¶
func (s *State) MouseButtonDown(b MouseButton) bool
MouseButtonDown returns true if a given mouse button is pressed.
func (*State) MouseClick ¶
func (s *State) MouseClick(b MouseButton) bool
MouseClick returns true if a given mouse button was clicked between the current and last update.
func (*State) MousePos ¶
MousePos returns the position of the cursor relative to the current component.
func (*State) OpenDialog ¶
OpenDialog displays the given component as a dialog. While a dialog is open, other components do not receive any events. Only one dialog may be open at a time.
func (*State) PeekKeyPresses ¶
PeekKeyPresses returns a list of key events. Unlike KeyPresses, this method returns events even if they are not intended for the current component.
func (*State) RequestAnimation ¶
func (s *State) RequestAnimation()
RequestAnimation requests that the ui should be updated again after a short amount of time.
func (*State) RequestRefocus ¶
func (s *State) RequestRefocus()
RequestRefocus requests that the component receiving mouse events should be determined again. This method should rarely be called by normal components.
func (*State) RequestUpdate ¶
func (s *State) RequestUpdate()
RequestUpdate requests that the ui should be updated again after the current update. This method will typically be called if an input event causes a change to the layout or to components that may have already been updated.
func (*State) RequestVisible ¶
RequestVisible should be called to request that the current component should be scrolled, so that the given rectangle is visible.
func (*State) SetBlink ¶
func (s *State) SetBlink()
SetBlink requests that blinking elements should be visible.
func (*State) SetClipboardString ¶
SetClipboardString sets the contents of the clipboard.
func (*State) SetKeyboardFocus ¶
SetKeyboardFocus requests that the given component will receive keyboard events.
func (*State) SetWindowTitle ¶
SetCursor sets the title of the window.
func (*State) TextInput ¶
TextInput returns the string that would be generated by key inputs. Key presses that contributed to the text input will still appear in KeyPresses().
func (*State) UpdateChild ¶
UpdateChild calls another component's Update method with a State that will deliver the correct events.
func (*State) WindowBounds ¶
WindowBounds returns the bounds of the window relative to the current component's origin. This means the minimum point of the returned Rect will most likely be negative.