Documentation ¶
Index ¶
- Constants
- func HandleKeyboardShortcuts(state *State)
- type BackendState
- func (s *BackendState) AddKeyPress(k Key)
- func (s *BackendState) AddScroll(x, y float64)
- 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 (s *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 float64)
- func (s *BackendState) SetTheme(t Theme)
- func (s *BackendState) SetWindowSize(w, h float64)
- 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(bounds draw.Rect, c Component)
- func (s *State) FocusNext()
- func (s *State) FocusPrevious()
- func (s *State) GetVisibilityRequest() (draw.Rect, 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() (float64, float64)
- func (s *State) OpenDialog(d Component)
- func (s *State) OpenPopup(bounds draw.Rect, 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 draw.Rect)
- func (s *State) Scroll() (float64, float64)
- 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) SetTheme(t Theme)
- func (s *State) SetWindowTitle(title string)
- func (s *State) Size() (float64, float64)
- func (s *State) TextInput() string
- func (s *State) Theme() Theme
- func (s *State) UpdateChild(bounds draw.Rect, c Component)
- func (s *State) WindowBounds() draw.Rect
- type Theme
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 float64)
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 (s *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 float64)
func (*BackendState) SetTheme ¶
func (s *BackendState) SetTheme(t Theme)
func (*BackendState) SetWindowSize ¶
func (s *BackendState) SetWindowSize(w, h float64)
func (*BackendState) UpdateRequested ¶
func (s *BackendState) UpdateRequested() bool
func (*BackendState) WindowTitle ¶
func (s *BackendState) WindowTitle() string
type Key ¶
type Key string
const ( KeyUnknown Key = "Unknown" KeyEscape Key = "Escape" KeyF1 Key = "F1" KeyF2 Key = "F2" KeyF3 Key = "F3" KeyF4 Key = "F4" KeyF5 Key = "F5" KeyF6 Key = "F6" KeyF7 Key = "F7" KeyF8 Key = "F8" KeyF9 Key = "F9" KeyF10 Key = "F10" KeyF11 Key = "F11" KeyF12 Key = "F12" KeyPrintScreen Key = "Print" KeyScrollLock Key = "Scroll Lock" KeyPause Key = "Pause" KeyInsert Key = "Insert" KeyHome Key = "Home" KeyPageUp Key = "Page Up" KeyDelete Key = "Delete" KeyEnd Key = "End" KeyPageDown Key = "Page Down" KeyEnter Key = "Enter" KeyBackspace Key = "Backspace" KeyTab Key = "Tab" KeySpace Key = "Space" KeyCapsLock Key = "Caps Lock" KeyUp Key = "Up" KeyLeft Key = "Left" KeyDown Key = "Down" KeyRight Key = "Right" KeyNumLock Key = "Num Lock" KeyNumpadDiv Key = "Numpad /" KeyNumpadMul Key = "Numpad *" KeyNumpadMinus Key = "Numpad -" KeyNumpadPlus Key = "Numpad +" KeyNumpadEnter Key = "Numpad Enter" KeyNumpad1 Key = "Numpad 1" KeyNumpad2 Key = "Numpad 2" KeyNumpad3 Key = "Numpad 3" KeyNumpad4 Key = "Numpad 4" KeyNumpad5 Key = "Numpad 5" KeyNumpad6 Key = "Numpad 6" KeyNumpad7 Key = "Numpad 7" KeyNumpad8 Key = "Numpad 8" KeyNumpad9 Key = "Numpad 9" KeyNumpad0 Key = "Numpad 0" KeyNumpadDecimal Key = "Numpad ." KeyMenu Key = "Menu" KeyLeftControl Key = "Left Control" KeyLeftShift Key = "Left Shift" KeyLeftAlt Key = "Left Alt" KeyLeftSuper Key = "Left Super" KeyRightControl Key = "Right Control" KeyRightShift Key = "Right Shift" KeyRightAlt Key = "Right Alt" KeyRightSuper Key = "Right Super" )
type MouseButton ¶
type MouseButton byte
const ( MouseLeft MouseButton = 1 << iota MouseMiddle MouseRight MouseForward MouseBack )
type State ¶
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.