Documentation ¶
Overview ¶
This a SDL Windowing System for Go Other UI toolkit (or binding) exists (Nulkear, Qt, ...), but I didn't found one for SDL, so I am developping it for my own need.
It means that this Windowing System is far to be complete, the most fast, low-memory that exist, but should be complete enough for me :-).
- The base "class" for all widget is the Widget interface.
- And the base implementation is CoreWidget.
- the root widget (background widget) is the RootWidget.
- and main widget that floats on top of the root widget are MainWidget.
Index ¶
- Constants
- Variables
- func InitFonts() error
- func InitSprites() error
- func NewDragEvent(x, y int32, image string, payload DragPayload)
- func NewDragEventSprite(x, y int32, sprite *sdl.Surface, payload DragPayload)
- func PoolEvent() bool
- func ShowMenu(menu *MenuWidget)
- func ShowModalError(root *RootWidget, title, iconpath, desc string, callback func())
- func ShowModalErrorSurfaceicon(root *RootWidget, title string, iconsurface *sdl.Surface, desc string, ...)
- func ShowModalYesNo(root *RootWidget, title, iconpath, desc string, callbackyes func(), ...)
- func ShowModalYesNoSurfaceicon(root *RootWidget, title string, iconsurface *sdl.Surface, desc string, ...)
- func TriggerEvents()
- type ButtonWidget
- func (self *ButtonWidget) AlignImageLeft(alignleft bool)
- func (self *ButtonWidget) HasFocus(focus bool)
- func (self *ButtonWidget) IsInputWidget() bool
- func (self *ButtonWidget) KeyDown(key sdl.Keycode, mod uint16)
- func (self *ButtonWidget) KeyUp(key sdl.Keycode, mod uint16)
- func (self *ButtonWidget) MouseMove(x, y, xrel, yrel int32)
- func (self *ButtonWidget) MousePressDown(x, y int32, button uint8)
- func (self *ButtonWidget) MousePressUp(x, y int32, button uint8)
- func (self *ButtonWidget) Repaint()
- func (self *ButtonWidget) SetButtonColor(color uint32)
- func (self *ButtonWidget) SetCentered(centered bool)
- func (self *ButtonWidget) SetClicked(callback func())
- func (self *ButtonWidget) SetImage(image string)
- func (self *ButtonWidget) SetImageSurface(img *sdl.Surface)
- func (self *ButtonWidget) SetText(text string)
- func (self *ButtonWidget) SetTextColor(color sdl.Color)
- type CheckboxWidget
- func (self *CheckboxWidget) HasFocus(focus bool)
- func (self *CheckboxWidget) IsInputWidget() bool
- func (self *CheckboxWidget) KeyDown(key sdl.Keycode, mod uint16)
- func (self *CheckboxWidget) MouseMove(x, y, xrel, yrel int32)
- func (self *CheckboxWidget) MousePressDown(x, y int32, button uint8)
- func (self *CheckboxWidget) MousePressUp(x, y int32, button uint8)
- func (self *CheckboxWidget) Repaint()
- func (self *CheckboxWidget) SetClicked(callback func())
- func (self *CheckboxWidget) SetDisabled(disabled bool)
- func (self *CheckboxWidget) SetSelected(selected bool)
- type CoreWidget
- func (self *CoreWidget) AddChild(child Widget)
- func (self *CoreWidget) Destroy()
- func (self *CoreWidget) DragDrop(x, y int32, payload DragPayload) bool
- func (self *CoreWidget) DragEnter(x, y int32, payload DragPayload)
- func (self *CoreWidget) DragLeave(payload DragPayload)
- func (self *CoreWidget) DragMove(x, y int32, payload DragPayload)
- func (self *CoreWidget) DrawLine(x1, y1, x2, y2 int32)
- func (self *CoreWidget) DrawPoint(x, y int32)
- func (self *CoreWidget) FillRect(x, y, w, h int32, c uint32)
- func (self *CoreWidget) Font() *ttf.Font
- func (self *CoreWidget) GetChildren() []Widget
- func (self *CoreWidget) HasFocus(focus bool)
- func (self *CoreWidget) Height() int32
- func (self *CoreWidget) InputText(text string)
- func (self *CoreWidget) IsDirty() bool
- func (self *CoreWidget) IsInputWidget() bool
- func (self *CoreWidget) IsInside(x, y int32) bool
- func (self *CoreWidget) KeyDown(key sdl.Keycode, mod uint16)
- func (self *CoreWidget) KeyUp(key sdl.Keycode, mod uint16)
- func (self *CoreWidget) MouseDoubleClick(x, y int32)
- func (self *CoreWidget) MouseMove(x, y, xrel, yrel int32)
- func (self *CoreWidget) MousePressDown(x, y int32, button uint8)
- func (self *CoreWidget) MousePressUp(x, y int32, button uint8)
- func (self *CoreWidget) Move(x, y int32)
- func (self *CoreWidget) Parent() Widget
- func (self *CoreWidget) PostUpdate()
- func (self *CoreWidget) RemoveChild(child Widget)
- func (self *CoreWidget) Renderer() *sdl.Renderer
- func (self *CoreWidget) Repaint()
- func (self *CoreWidget) Resize(width, height int32)
- func (self *CoreWidget) SetAlphaMod(alpha uint8)
- func (self *CoreWidget) SetCallbackFocusOnNextInputWidget(callback func(forward bool))
- func (self *CoreWidget) SetCallbackValueChanged(callback func())
- func (self *CoreWidget) SetColor(color uint32)
- func (self *CoreWidget) SetDirtyFalse()
- func (self *CoreWidget) SetDrawColor(r, g, b, c uint8)
- func (self *CoreWidget) SetDrawColorHex(color uint32)
- func (self *CoreWidget) SetFont(font *ttf.Font)
- func (self *CoreWidget) SetParent(father Widget)
- func (self *CoreWidget) Surface() *sdl.Surface
- func (self *CoreWidget) TranslateXYToWidget(globalX, globalY int32) (x, y int32)
- func (self *CoreWidget) Width() int32
- func (self *CoreWidget) WriteText(x, y int32, str string, color sdl.Color) (int32, int32)
- func (self *CoreWidget) WriteTextCenter(x, y int32, str string, color sdl.Color)
- func (self *CoreWidget) X() int32
- func (self *CoreWidget) Y() int32
- type DragPayload
- type DropdownWidget
- func (self *DropdownWidget) HasFocus(hasfocus bool)
- func (self *DropdownWidget) IsInputWidget() bool
- func (self *DropdownWidget) KeyDown(key sdl.Keycode, mod uint16)
- func (self *DropdownWidget) MouseMove(x, y, xrel, yrel int32)
- func (self *DropdownWidget) MousePressDown(x, y int32, button uint8)
- func (self *DropdownWidget) MousePressUp(x, y int32, button uint8)
- func (self *DropdownWidget) Repaint()
- func (self *DropdownWidget) SetActiveChoice(choice int32)
- func (self *DropdownWidget) SetChoices(choices []string)
- func (self *DropdownWidget) SetClicked(callback func())
- type FlatButtonWidget
- type Hr
- type InputWidget
- func (self *InputWidget) GetText() string
- func (self *InputWidget) HasFocus(focus bool)
- func (self *InputWidget) InputText(text string)
- func (self *InputWidget) IsInputWidget() bool
- func (self *InputWidget) KeyDown(key sdl.Keycode, mod uint16)
- func (self *InputWidget) MouseMove(x, y, xrel, yrel int32)
- func (self *InputWidget) MousePressDown(x, y int32, button uint8)
- func (self *InputWidget) MousePressUp(x, y int32, button uint8)
- func (self *InputWidget) Repaint()
- func (self *InputWidget) SetEnterCallback(callback func())
- func (self *InputWidget) SetInnerColor(color uint32)
- func (self *InputWidget) SetText(str string)
- type LabelWidget
- func (self *LabelWidget) AlignImageLeft(alignleft bool)
- func (self *LabelWidget) Repaint()
- func (self *LabelWidget) SetCentered(centered bool)
- func (self *LabelWidget) SetImage(image string)
- func (self *LabelWidget) SetImageSurface(img *sdl.Surface)
- func (self *LabelWidget) SetText(label string)
- func (self *LabelWidget) SetTextColor(color sdl.Color)
- type ListWidget
- func (self *ListWidget) AddItem(label string)
- func (self *ListWidget) GetCurrentItem() *ListWidgetItem
- func (self *ListWidget) GetItems() []*ListWidgetItem
- func (self *ListWidget) HasFocus(focus bool)
- func (self *ListWidget) IsInputWidget() bool
- func (self *ListWidget) KeyDown(key sdl.Keycode, mod uint16)
- func (self *ListWidget) MouseMove(x, y, xrel, yrel int32)
- func (self *ListWidget) MousePressDown(x, y int32, button uint8)
- func (self *ListWidget) MousePressUp(x, y int32, button uint8)
- func (self *ListWidget) RemoveAllItems()
- func (self *ListWidget) RemoveItem(item *ListWidgetItem)
- func (self *ListWidget) Repaint()
- func (self *ListWidget) Resize(width, height int32)
- func (self *ListWidget) SelectItem(item *ListWidgetItem)
- type ListWidgetItem
- type MainWidget
- func (self *MainWidget) AddChild(child Widget)
- func (self *MainWidget) Center(root *RootWidget)
- func (self *MainWidget) HasFocus(focus bool)
- func (self *MainWidget) IsInside(x, y int32) bool
- func (self *MainWidget) MouseMove(x, y, xrel, yrel int32)
- func (self *MainWidget) MousePressDown(x, y int32, button uint8)
- func (self *MainWidget) MousePressUp(x, y int32, button uint8)
- func (self *MainWidget) RemoveChild(child Widget)
- func (self *MainWidget) Repaint()
- func (self *MainWidget) Resize(width, height int32)
- func (self *MainWidget) SetCloseCallback(callback func())
- func (self *MainWidget) SetInnerWidget(widget Widget) bool
- func (self *MainWidget) SetMenuBar(menubar *MenuBarWidget)
- func (self *MainWidget) SetTitle(label string)
- type MenuBarWidget
- func (self *MenuBarWidget) AddItem(item MenuItem)
- func (self *MenuBarWidget) HasFocus(hasfocus bool)
- func (self *MenuBarWidget) KeyDown(key sdl.Keycode, mod uint16)
- func (self *MenuBarWidget) MouseMove(x, y, xrel, yrel int32)
- func (self *MenuBarWidget) MousePressDown(x, y int32, button uint8)
- func (self *MenuBarWidget) MousePressUp(x, y int32, button uint8)
- func (self *MenuBarWidget) Repaint()
- type MenuItem
- type MenuItemLabel
- type MenuWidget
- func (self *MenuWidget) AddItem(item MenuItem)
- func (self *MenuWidget) Destroy()
- func (self *MenuWidget) KeyDown(key sdl.Keycode, mod uint16)
- func (self *MenuWidget) MouseMove(x, y, xrel, yrel int32)
- func (self *MenuWidget) MousePressDown(x, y int32, button uint8)
- func (self *MenuWidget) MousePressUp(x, y int32, button uint8)
- func (self *MenuWidget) Repaint()
- type RootWidget
- type ScrollWidget
- func (self *ScrollWidget) PostUpdate()
- func (self *ScrollWidget) Repaint()
- func (self *ScrollWidget) Resize(width, height int32)
- func (self *ScrollWidget) SetHorizontalPosition(position int32)
- func (self *ScrollWidget) SetInnerWidget(widget Widget) bool
- func (self *ScrollWidget) SetVerticalPosition(position int32)
- func (self *ScrollWidget) ShowBezel(bezel bool)
- func (self *ScrollWidget) ShowHorizontalScrollbar(showH bool)
- func (self *ScrollWidget) ShowVerticalScrollbar(showV bool)
- type ScrollbarWidget
- func (self *ScrollbarWidget) MouseMove(x, y, xrel, yrel int32)
- func (self *ScrollbarWidget) MousePressDown(x, y int32, button uint8)
- func (self *ScrollbarWidget) MousePressUp(x, y int32, button uint8)
- func (self *ScrollbarWidget) Repaint()
- func (self *ScrollbarWidget) SetCallback(callback Scrollbarcallback)
- func (self *ScrollbarWidget) SetMaximum(m int32)
- func (self *ScrollbarWidget) SetMinimum(m int32)
- func (self *ScrollbarWidget) SetPosition(position int32)
- type Scrollbarcallback
- type SplitWidget
- func (self *SplitWidget) MouseMove(x, y, xrel, yrel int32)
- func (self *SplitWidget) MousePressDown(x, y int32, button uint8)
- func (self *SplitWidget) MousePressUp(x, y int32, button uint8)
- func (self *SplitWidget) Place(position int32)
- func (self *SplitWidget) Repaint()
- func (self *SplitWidget) SetCallback(callback func())
- func (self *SplitWidget) SetMovable(movable bool)
- type SplitviewWidget
- func (self *SplitviewWidget) PlaceSplitBar(position int32)
- func (self *SplitviewWidget) Resize(width, height int32)
- func (self *SplitviewWidget) SetLeftWidget(widget Widget) bool
- func (self *SplitviewWidget) SetRightWidget(widget Widget) bool
- func (self *SplitviewWidget) SplitBarMovable(movable bool)
- type TabWidget
- type TableData
- type TableWidget
- type TextAreaWidget
- func (self *TextAreaWidget) GetText() string
- func (self *TextAreaWidget) HasFocus(focus bool)
- func (self *TextAreaWidget) InputText(text string)
- func (self *TextAreaWidget) IsInputWidget() bool
- func (self *TextAreaWidget) KeyDown(key sdl.Keycode, mod uint16)
- func (self *TextAreaWidget) MouseMove(x, y, xrel, yrel int32)
- func (self *TextAreaWidget) MousePressDown(x, y int32, button uint8)
- func (self *TextAreaWidget) MousePressUp(x, y int32, button uint8)
- func (self *TextAreaWidget) Repaint()
- func (self *TextAreaWidget) Resize(w, h int32)
- func (self *TextAreaWidget) SetDisabled(disabled bool)
- func (self *TextAreaWidget) SetHeightChangeCallback(callback func(int32))
- func (self *TextAreaWidget) SetText(text string)
- func (self *TextAreaWidget) SetYOffset(offset int32)
- func (self *TextAreaWidget) SetYOffsetChangedCallback(callback func(int32))
- func (self *TextAreaWidget) ShowLineNumber()
- func (self *TextAreaWidget) UpdatePosition(x, y int32)
- type TimerEvent
- type TreeViewItem
- type TreeViewItemWalkfunc
- type TreeViewWidget
- func (self *TreeViewWidget) AddItem(item *TreeViewItem)
- func (self *TreeViewWidget) MousePressDown(x, y int32, button uint8)
- func (self *TreeViewWidget) RemoveItem(item *TreeViewItem)
- func (self *TreeViewWidget) Repaint()
- func (self *TreeViewWidget) Resize(width, height int32)
- func (self *TreeViewWidget) SetFocusOn(item *TreeViewItem)
- type VBoxWidget
- type Widget
Constants ¶
const ( GLYPH_SPACE = 0 GLYPH_TAB = 1 GLYPH_WORD = 2 GLYPH_END = 3 GLYPH_ENTER = 4 )
const HEADER_HEIGHT = 25
const (
SCROLLBAR_WIDTH = 17
)
Variables ¶
var LatoRegular12 *ttf.Font
var LatoRegular14 *ttf.Font
var LatoRegular20 *ttf.Font
var LatoRegular24 *ttf.Font
Functions ¶
func InitSprites ¶
func InitSprites() error
func NewDragEvent ¶
func NewDragEvent(x, y int32, image string, payload DragPayload)
func NewDragEventSprite ¶
func NewDragEventSprite(x, y int32, sprite *sdl.Surface, payload DragPayload)
usually in a MouseButtonDown
func PoolEvent ¶
func PoolEvent() bool
main loop event function. see func Init(width,height int32) for an example
func ShowMenu ¶
func ShowMenu(menu *MenuWidget)
func ShowModalError ¶
func ShowModalError(root *RootWidget, title, iconpath, desc string, callback func())
func ShowModalErrorSurfaceicon ¶
func ShowModalErrorSurfaceicon(root *RootWidget, title string, iconsurface *sdl.Surface, desc string, callback func())
func ShowModalYesNo ¶
func ShowModalYesNo(root *RootWidget, title, iconpath, desc string, callbackyes func(), callbackno func())
func ShowModalYesNoSurfaceicon ¶
func ShowModalYesNoSurfaceicon(root *RootWidget, title string, iconsurface *sdl.Surface, desc string, callbackyes func(), callbackno func())
func TriggerEvents ¶
func TriggerEvents()
For now, the events are not running into their own thread, so we must pool regularly, if an event has to be trigger. You don't need to call this function normally. It is done in the main loop ( PoolEvent(bool) )
Types ¶
type ButtonWidget ¶
type ButtonWidget struct { CoreWidget // contains filtered or unexported fields }
func NewButtonWidget ¶
func NewButtonWidget(w, h int32, s string) *ButtonWidget
func (*ButtonWidget) AlignImageLeft ¶
func (self *ButtonWidget) AlignImageLeft(alignleft bool)
func (*ButtonWidget) HasFocus ¶
func (self *ButtonWidget) HasFocus(focus bool)
func (*ButtonWidget) IsInputWidget ¶
func (self *ButtonWidget) IsInputWidget() bool
func (*ButtonWidget) MouseMove ¶
func (self *ButtonWidget) MouseMove(x, y, xrel, yrel int32)
func (*ButtonWidget) MousePressDown ¶
func (self *ButtonWidget) MousePressDown(x, y int32, button uint8)
func (*ButtonWidget) MousePressUp ¶
func (self *ButtonWidget) MousePressUp(x, y int32, button uint8)
func (*ButtonWidget) Repaint ¶
func (self *ButtonWidget) Repaint()
func (*ButtonWidget) SetButtonColor ¶
func (self *ButtonWidget) SetButtonColor(color uint32)
func (*ButtonWidget) SetCentered ¶
func (self *ButtonWidget) SetCentered(centered bool)
func (*ButtonWidget) SetClicked ¶
func (self *ButtonWidget) SetClicked(callback func())
func (*ButtonWidget) SetImage ¶
func (self *ButtonWidget) SetImage(image string)
func (*ButtonWidget) SetImageSurface ¶
func (self *ButtonWidget) SetImageSurface(img *sdl.Surface)
func (*ButtonWidget) SetText ¶
func (self *ButtonWidget) SetText(text string)
func (*ButtonWidget) SetTextColor ¶
func (self *ButtonWidget) SetTextColor(color sdl.Color)
type CheckboxWidget ¶
type CheckboxWidget struct { CoreWidget Selected bool // contains filtered or unexported fields }
func NewCheckboxWidget ¶
func NewCheckboxWidget() *CheckboxWidget
func (*CheckboxWidget) HasFocus ¶
func (self *CheckboxWidget) HasFocus(focus bool)
func (*CheckboxWidget) IsInputWidget ¶
func (self *CheckboxWidget) IsInputWidget() bool
func (*CheckboxWidget) MouseMove ¶
func (self *CheckboxWidget) MouseMove(x, y, xrel, yrel int32)
func (*CheckboxWidget) MousePressDown ¶
func (self *CheckboxWidget) MousePressDown(x, y int32, button uint8)
func (*CheckboxWidget) MousePressUp ¶
func (self *CheckboxWidget) MousePressUp(x, y int32, button uint8)
func (*CheckboxWidget) Repaint ¶
func (self *CheckboxWidget) Repaint()
func (*CheckboxWidget) SetClicked ¶
func (self *CheckboxWidget) SetClicked(callback func())
func (*CheckboxWidget) SetDisabled ¶
func (self *CheckboxWidget) SetDisabled(disabled bool)
func (*CheckboxWidget) SetSelected ¶
func (self *CheckboxWidget) SetSelected(selected bool)
type CoreWidget ¶
type CoreWidget struct {
// contains filtered or unexported fields
}
main "abstract" class that implement the Widget interface Mostly it is used as a base class for all other widgets
One comment: each CoreWidget (and derivated), keep a bitmap of its content (into a surface *sdl.Surface) member It allows to compose sub element into main element easier, and to provide cache when we need to refresh the content.
func NewCoreWidget ¶
func NewCoreWidget(w, h int32) *CoreWidget
func (*CoreWidget) AddChild ¶
func (self *CoreWidget) AddChild(child Widget)
func (*CoreWidget) Destroy ¶
func (self *CoreWidget) Destroy()
func (*CoreWidget) DragDrop ¶
func (self *CoreWidget) DragDrop(x, y int32, payload DragPayload) bool
func (*CoreWidget) DragEnter ¶
func (self *CoreWidget) DragEnter(x, y int32, payload DragPayload)
func (*CoreWidget) DragLeave ¶
func (self *CoreWidget) DragLeave(payload DragPayload)
func (*CoreWidget) DragMove ¶
func (self *CoreWidget) DragMove(x, y int32, payload DragPayload)
func (*CoreWidget) DrawLine ¶
func (self *CoreWidget) DrawLine(x1, y1, x2, y2 int32)
func (*CoreWidget) DrawPoint ¶
func (self *CoreWidget) DrawPoint(x, y int32)
func (*CoreWidget) FillRect ¶
func (self *CoreWidget) FillRect(x, y, w, h int32, c uint32)
func (*CoreWidget) Font ¶
func (self *CoreWidget) Font() *ttf.Font
func (*CoreWidget) GetChildren ¶
func (self *CoreWidget) GetChildren() []Widget
func (*CoreWidget) HasFocus ¶
func (self *CoreWidget) HasFocus(focus bool)
func (*CoreWidget) Height ¶
func (self *CoreWidget) Height() int32
func (*CoreWidget) InputText ¶
func (self *CoreWidget) InputText(text string)
func (*CoreWidget) IsDirty ¶
func (self *CoreWidget) IsDirty() bool
to know if the widget has to be repaint (i.e. PostUpdate() has been called)
func (*CoreWidget) IsInputWidget ¶
func (self *CoreWidget) IsInputWidget() bool
func (*CoreWidget) IsInside ¶
func (self *CoreWidget) IsInside(x, y int32) bool
This function seems to be obvious, but if we want to create widget that are not squared (like MainWindow), the calculation is a bit more complicated
func (*CoreWidget) MouseDoubleClick ¶
func (self *CoreWidget) MouseDoubleClick(x, y int32)
func (*CoreWidget) MouseMove ¶
func (self *CoreWidget) MouseMove(x, y, xrel, yrel int32)
func (*CoreWidget) MousePressDown ¶
func (self *CoreWidget) MousePressDown(x, y int32, button uint8)
func (*CoreWidget) MousePressUp ¶
func (self *CoreWidget) MousePressUp(x, y int32, button uint8)
func (*CoreWidget) Move ¶
func (self *CoreWidget) Move(x, y int32)
func (*CoreWidget) Parent ¶
func (self *CoreWidget) Parent() Widget
func (*CoreWidget) PostUpdate ¶
func (self *CoreWidget) PostUpdate()
method used (internaly) to specify that this widget's content changed and needs to be refreshed.
func (*CoreWidget) RemoveChild ¶
func (self *CoreWidget) RemoveChild(child Widget)
func (*CoreWidget) Renderer ¶
func (self *CoreWidget) Renderer() *sdl.Renderer
func (*CoreWidget) Repaint ¶
func (self *CoreWidget) Repaint()
One of the main window: how do we want to write to our widget content
func (*CoreWidget) Resize ¶
func (self *CoreWidget) Resize(width, height int32)
when we resize we need to destroy the current surface, recreate it, and trigger a PostUpdate() to ask for a refresh
func (*CoreWidget) SetAlphaMod ¶
func (self *CoreWidget) SetAlphaMod(alpha uint8)
func (*CoreWidget) SetCallbackFocusOnNextInputWidget ¶
func (self *CoreWidget) SetCallbackFocusOnNextInputWidget(callback func(forward bool))
func (*CoreWidget) SetCallbackValueChanged ¶
func (self *CoreWidget) SetCallbackValueChanged(callback func())
func (*CoreWidget) SetColor ¶
func (self *CoreWidget) SetColor(color uint32)
func (*CoreWidget) SetDirtyFalse ¶
func (self *CoreWidget) SetDirtyFalse()
func (*CoreWidget) SetDrawColor ¶
func (self *CoreWidget) SetDrawColor(r, g, b, c uint8)
func (*CoreWidget) SetDrawColorHex ¶
func (self *CoreWidget) SetDrawColorHex(color uint32)
the color should be 0xrrggbbaa (r=red, g=green, b=blue, a=alpha)
func (*CoreWidget) SetFont ¶
func (self *CoreWidget) SetFont(font *ttf.Font)
func (*CoreWidget) SetParent ¶
func (self *CoreWidget) SetParent(father Widget)
func (*CoreWidget) Surface ¶
func (self *CoreWidget) Surface() *sdl.Surface
func (*CoreWidget) TranslateXYToWidget ¶
func (self *CoreWidget) TranslateXYToWidget(globalX, globalY int32) (x, y int32)
func (*CoreWidget) Width ¶
func (self *CoreWidget) Width() int32
func (*CoreWidget) WriteTextCenter ¶
func (self *CoreWidget) WriteTextCenter(x, y int32, str string, color sdl.Color)
Write text into the surface but centered
func (*CoreWidget) X ¶
func (self *CoreWidget) X() int32
X() and Y() correspond to the position of this widget into its parent widget
func (*CoreWidget) Y ¶
func (self *CoreWidget) Y() int32
X() and Y() correspond to the position of this widget into its parent widget
type DragPayload ¶
type DropdownWidget ¶
type DropdownWidget struct { CoreWidget Choices []string ActiveChoice int32 // contains filtered or unexported fields }
func NewDropdownWidget ¶
func NewDropdownWidget(w, h int32, choices []string) *DropdownWidget
func (*DropdownWidget) HasFocus ¶
func (self *DropdownWidget) HasFocus(hasfocus bool)
func (*DropdownWidget) IsInputWidget ¶
func (self *DropdownWidget) IsInputWidget() bool
func (*DropdownWidget) MouseMove ¶
func (self *DropdownWidget) MouseMove(x, y, xrel, yrel int32)
func (*DropdownWidget) MousePressDown ¶
func (self *DropdownWidget) MousePressDown(x, y int32, button uint8)
func (*DropdownWidget) MousePressUp ¶
func (self *DropdownWidget) MousePressUp(x, y int32, button uint8)
func (*DropdownWidget) Repaint ¶
func (self *DropdownWidget) Repaint()
func (*DropdownWidget) SetActiveChoice ¶
func (self *DropdownWidget) SetActiveChoice(choice int32)
func (*DropdownWidget) SetChoices ¶
func (self *DropdownWidget) SetChoices(choices []string)
func (*DropdownWidget) SetClicked ¶
func (self *DropdownWidget) SetClicked(callback func())
type FlatButtonWidget ¶
type FlatButtonWidget struct {
ButtonWidget
}
func NewFlatButtonWidget ¶
func NewFlatButtonWidget(w, h int32, s string) *FlatButtonWidget
func (*FlatButtonWidget) Repaint ¶
func (self *FlatButtonWidget) Repaint()
type Hr ¶
type Hr struct {
CoreWidget
}
type InputWidget ¶
type InputWidget struct { CoreWidget // contains filtered or unexported fields }
func NewInputWidget ¶
func NewInputWidget(w, h int32, s string) *InputWidget
func (*InputWidget) GetText ¶
func (self *InputWidget) GetText() string
func (*InputWidget) HasFocus ¶
func (self *InputWidget) HasFocus(focus bool)
func (*InputWidget) InputText ¶
func (self *InputWidget) InputText(text string)
func (*InputWidget) IsInputWidget ¶
func (self *InputWidget) IsInputWidget() bool
func (*InputWidget) MouseMove ¶
func (self *InputWidget) MouseMove(x, y, xrel, yrel int32)
func (*InputWidget) MousePressDown ¶
func (self *InputWidget) MousePressDown(x, y int32, button uint8)
func (*InputWidget) MousePressUp ¶
func (self *InputWidget) MousePressUp(x, y int32, button uint8)
func (*InputWidget) Repaint ¶
func (self *InputWidget) Repaint()
func (*InputWidget) SetEnterCallback ¶
func (self *InputWidget) SetEnterCallback(callback func())
func (*InputWidget) SetInnerColor ¶
func (self *InputWidget) SetInnerColor(color uint32)
func (*InputWidget) SetText ¶
func (self *InputWidget) SetText(str string)
type LabelWidget ¶
type LabelWidget struct { CoreWidget // contains filtered or unexported fields }
func NewLabelWidget ¶
func NewLabelWidget(w, h int32, s string) *LabelWidget
func (*LabelWidget) AlignImageLeft ¶
func (self *LabelWidget) AlignImageLeft(alignleft bool)
func (*LabelWidget) Repaint ¶
func (self *LabelWidget) Repaint()
func (*LabelWidget) SetCentered ¶
func (self *LabelWidget) SetCentered(centered bool)
func (*LabelWidget) SetImage ¶
func (self *LabelWidget) SetImage(image string)
func (*LabelWidget) SetImageSurface ¶
func (self *LabelWidget) SetImageSurface(img *sdl.Surface)
func (*LabelWidget) SetText ¶
func (self *LabelWidget) SetText(label string)
func (*LabelWidget) SetTextColor ¶
func (self *LabelWidget) SetTextColor(color sdl.Color)
type ListWidget ¶
type ListWidget struct { CoreWidget // contains filtered or unexported fields }
ListWidget represent a vertical list of labels
func NewListWidget ¶
func NewListWidget(w, h int32) *ListWidget
func (*ListWidget) AddItem ¶
func (self *ListWidget) AddItem(label string)
func (*ListWidget) GetCurrentItem ¶
func (self *ListWidget) GetCurrentItem() *ListWidgetItem
func (*ListWidget) GetItems ¶
func (self *ListWidget) GetItems() []*ListWidgetItem
func (*ListWidget) HasFocus ¶
func (self *ListWidget) HasFocus(focus bool)
func (*ListWidget) IsInputWidget ¶
func (self *ListWidget) IsInputWidget() bool
func (*ListWidget) MouseMove ¶
func (self *ListWidget) MouseMove(x, y, xrel, yrel int32)
func (*ListWidget) MousePressDown ¶
func (self *ListWidget) MousePressDown(x, y int32, button uint8)
func (*ListWidget) MousePressUp ¶
func (self *ListWidget) MousePressUp(x, y int32, button uint8)
func (*ListWidget) RemoveAllItems ¶
func (self *ListWidget) RemoveAllItems()
func (*ListWidget) RemoveItem ¶
func (self *ListWidget) RemoveItem(item *ListWidgetItem)
func (*ListWidget) Repaint ¶
func (self *ListWidget) Repaint()
func (*ListWidget) Resize ¶
func (self *ListWidget) Resize(width, height int32)
func (*ListWidget) SelectItem ¶
func (self *ListWidget) SelectItem(item *ListWidgetItem)
type ListWidgetItem ¶
type ListWidgetItem struct { CoreWidget // contains filtered or unexported fields }
func NewListWidgetItem ¶
func NewListWidgetItem(h, w int32, label string, listwidget *ListWidget) *ListWidgetItem
func (*ListWidgetItem) GetText ¶
func (self *ListWidgetItem) GetText() string
func (*ListWidgetItem) Repaint ¶
func (self *ListWidgetItem) Repaint()
func (*ListWidgetItem) Selected ¶
func (self *ListWidgetItem) Selected(selected bool)
type MainWidget ¶
type MainWidget struct { CoreWidget // contains filtered or unexported fields }
This specific widget is a "main" widget, that float on top of the RootWidget, and have a title bar (in grey/yellow) This is decorator, in the sense that, it holds a sub-widget (that you can customize with SetInnerWidget() )
You can also set (or not) a menu bar (SetMenuBar() )
func NewMainWidget ¶
func NewMainWidget(w, h int32, s string, expandable bool, resizable bool) *MainWidget
func (*MainWidget) AddChild ¶
func (self *MainWidget) AddChild(child Widget)
func (*MainWidget) Center ¶
func (self *MainWidget) Center(root *RootWidget)
func (*MainWidget) HasFocus ¶
func (self *MainWidget) HasFocus(focus bool)
func (*MainWidget) IsInside ¶
func (self *MainWidget) IsInside(x, y int32) bool
func (*MainWidget) MouseMove ¶
func (self *MainWidget) MouseMove(x, y, xrel, yrel int32)
func (*MainWidget) MousePressDown ¶
func (self *MainWidget) MousePressDown(x, y int32, button uint8)
func (*MainWidget) MousePressUp ¶
func (self *MainWidget) MousePressUp(x, y int32, button uint8)
func (*MainWidget) RemoveChild ¶
func (self *MainWidget) RemoveChild(child Widget)
func (*MainWidget) Repaint ¶
func (self *MainWidget) Repaint()
func (*MainWidget) Resize ¶
func (self *MainWidget) Resize(width, height int32)
func (*MainWidget) SetCloseCallback ¶
func (self *MainWidget) SetCloseCallback(callback func())
func (*MainWidget) SetInnerWidget ¶
func (self *MainWidget) SetInnerWidget(widget Widget) bool
func (*MainWidget) SetMenuBar ¶
func (self *MainWidget) SetMenuBar(menubar *MenuBarWidget)
func (*MainWidget) SetTitle ¶
func (self *MainWidget) SetTitle(label string)
type MenuBarWidget ¶
type MenuBarWidget struct { MenuWidget // contains filtered or unexported fields }
special type of menu: the MenuBar.
It is a regular widget, but that can spawn menus
func NewMenuBarWidget ¶
func NewMenuBarWidget() *MenuBarWidget
func (*MenuBarWidget) AddItem ¶
func (self *MenuBarWidget) AddItem(item MenuItem)
func (*MenuBarWidget) HasFocus ¶
func (self *MenuBarWidget) HasFocus(hasfocus bool)
func (*MenuBarWidget) MouseMove ¶
func (self *MenuBarWidget) MouseMove(x, y, xrel, yrel int32)
func (*MenuBarWidget) MousePressDown ¶
func (self *MenuBarWidget) MousePressDown(x, y int32, button uint8)
func (*MenuBarWidget) MousePressUp ¶
func (self *MenuBarWidget) MousePressUp(x, y int32, button uint8)
func (*MenuBarWidget) Repaint ¶
func (self *MenuBarWidget) Repaint()
type MenuItemLabel ¶
type MenuItemLabel struct { Label string ClickCallback func() // contains filtered or unexported fields }
func NewMenuItemLabel ¶
func NewMenuItemLabel(label string, callback func()) *MenuItemLabel
func (*MenuItemLabel) Clicked ¶
func (self *MenuItemLabel) Clicked()
func (*MenuItemLabel) Destroy ¶
func (self *MenuItemLabel) Destroy()
func (*MenuItemLabel) SetSubMenu ¶
func (self *MenuItemLabel) SetSubMenu(sub *MenuWidget)
func (*MenuItemLabel) SubMenu ¶
func (self *MenuItemLabel) SubMenu() *MenuWidget
func (*MenuItemLabel) WidthHeight ¶
func (self *MenuItemLabel) WidthHeight() (int32, int32)
type MenuWidget ¶
type MenuWidget struct { CoreWidget // contains filtered or unexported fields }
MenuWidget: representation of a (floating) menu. It is composed of several MenuItem (that could have sub-menus)
in the main loop if menuInitiator widget exists, then: - if MouseMove -> find the corresponding menuInitiator/menu and
- on the widget: destroy childs and treat the event (eventually create child)
- if MouseDown and we are not on menuInitiator/menu -> destroy everything - if MouseUp
- if we are not on the menuInitiator/menu -> destroy everything
- else we send a MouseUp on the menuInitiator/menu
func NewMenuWidget ¶
func NewMenuWidget() *MenuWidget
func (*MenuWidget) AddItem ¶
func (self *MenuWidget) AddItem(item MenuItem)
func (*MenuWidget) Destroy ¶
func (self *MenuWidget) Destroy()
func (*MenuWidget) MouseMove ¶
func (self *MenuWidget) MouseMove(x, y, xrel, yrel int32)
func (*MenuWidget) MousePressDown ¶
func (self *MenuWidget) MousePressDown(x, y int32, button uint8)
func (*MenuWidget) MousePressUp ¶
func (self *MenuWidget) MousePressUp(x, y int32, button uint8)
func (*MenuWidget) Repaint ¶
func (self *MenuWidget) Repaint()
type RootWidget ¶
type RootWidget struct { CoreWidget // contains filtered or unexported fields }
The RootWidget is the background widget that fill up all the desktop window
func Init ¶
func Init(width, height int32) *RootWidget
When we start the program, we must call this function to initialize SDL and provide the resulting RootWidget
The minimum program you can write is:
func main() { root := sws.Init(800,600) for sws.PoolEvent() == false { } }
func NewRootWidget ¶
func NewRootWidget(window *sdl.Window) *RootWidget
func (*RootWidget) RaiseToTop ¶
func (self *RootWidget) RaiseToTop(widget Widget)
to put on top of the widget stack a particular widget Mainly used for MainWidget
func (*RootWidget) RemoveChild ¶
func (self *RootWidget) RemoveChild(child Widget)
func (*RootWidget) SetFocus ¶
func (root *RootWidget) SetFocus(widget Widget)
When we need to get keyboard event (especially), we need to get the focus
func (*RootWidget) SetModal ¶
func (self *RootWidget) SetModal(widget Widget)
func (*RootWidget) WindowSurface ¶
func (self *RootWidget) WindowSurface() *sdl.Surface
func (*RootWidget) WindowUpdateSurface ¶
func (self *RootWidget) WindowUpdateSurface()
type ScrollWidget ¶
type ScrollWidget struct { CoreWidget // contains filtered or unexported fields }
func NewScrollWidget ¶
func NewScrollWidget(w, h int32) *ScrollWidget
func (*ScrollWidget) PostUpdate ¶
func (self *ScrollWidget) PostUpdate()
func (*ScrollWidget) Repaint ¶
func (self *ScrollWidget) Repaint()
func (*ScrollWidget) Resize ¶
func (self *ScrollWidget) Resize(width, height int32)
func (*ScrollWidget) SetHorizontalPosition ¶
func (self *ScrollWidget) SetHorizontalPosition(position int32)
func (*ScrollWidget) SetInnerWidget ¶
func (self *ScrollWidget) SetInnerWidget(widget Widget) bool
func (*ScrollWidget) SetVerticalPosition ¶
func (self *ScrollWidget) SetVerticalPosition(position int32)
func (*ScrollWidget) ShowBezel ¶
func (self *ScrollWidget) ShowBezel(bezel bool)
func (*ScrollWidget) ShowHorizontalScrollbar ¶
func (self *ScrollWidget) ShowHorizontalScrollbar(showH bool)
func (*ScrollWidget) ShowVerticalScrollbar ¶
func (self *ScrollWidget) ShowVerticalScrollbar(showV bool)
type ScrollbarWidget ¶
type ScrollbarWidget struct { CoreWidget Currentposition int32 // in the targeted widget: so from minimum to maximum // contains filtered or unexported fields }
func NewScrollbarWidget ¶
func NewScrollbarWidget(w, h int32, horizontal bool) *ScrollbarWidget
func (*ScrollbarWidget) MouseMove ¶
func (self *ScrollbarWidget) MouseMove(x, y, xrel, yrel int32)
func (*ScrollbarWidget) MousePressDown ¶
func (self *ScrollbarWidget) MousePressDown(x, y int32, button uint8)
func (*ScrollbarWidget) MousePressUp ¶
func (self *ScrollbarWidget) MousePressUp(x, y int32, button uint8)
func (*ScrollbarWidget) Repaint ¶
func (self *ScrollbarWidget) Repaint()
func (*ScrollbarWidget) SetCallback ¶
func (self *ScrollbarWidget) SetCallback(callback Scrollbarcallback)
func (*ScrollbarWidget) SetMaximum ¶
func (self *ScrollbarWidget) SetMaximum(m int32)
func (*ScrollbarWidget) SetMinimum ¶
func (self *ScrollbarWidget) SetMinimum(m int32)
func (*ScrollbarWidget) SetPosition ¶
func (self *ScrollbarWidget) SetPosition(position int32)
type Scrollbarcallback ¶
type Scrollbarcallback func(currentposition int32)
type SplitWidget ¶
type SplitWidget struct { CoreWidget // contains filtered or unexported fields }
func NewSplitWidget ¶
func NewSplitWidget(horizontal bool) *SplitWidget
func (*SplitWidget) MouseMove ¶
func (self *SplitWidget) MouseMove(x, y, xrel, yrel int32)
func (*SplitWidget) MousePressDown ¶
func (self *SplitWidget) MousePressDown(x, y int32, button uint8)
func (*SplitWidget) MousePressUp ¶
func (self *SplitWidget) MousePressUp(x, y int32, button uint8)
func (*SplitWidget) Place ¶
func (self *SplitWidget) Place(position int32)
func (*SplitWidget) Repaint ¶
func (self *SplitWidget) Repaint()
func (*SplitWidget) SetCallback ¶
func (self *SplitWidget) SetCallback(callback func())
func (*SplitWidget) SetMovable ¶
func (self *SplitWidget) SetMovable(movable bool)
type SplitviewWidget ¶
type SplitviewWidget struct { CoreWidget // contains filtered or unexported fields }
func NewSplitviewWidget ¶
func NewSplitviewWidget(w, h int32, horizontal bool) *SplitviewWidget
func (*SplitviewWidget) PlaceSplitBar ¶
func (self *SplitviewWidget) PlaceSplitBar(position int32)
func (*SplitviewWidget) Resize ¶
func (self *SplitviewWidget) Resize(width, height int32)
func (*SplitviewWidget) SetLeftWidget ¶
func (self *SplitviewWidget) SetLeftWidget(widget Widget) bool
func (*SplitviewWidget) SetRightWidget ¶
func (self *SplitviewWidget) SetRightWidget(widget Widget) bool
func (*SplitviewWidget) SplitBarMovable ¶
func (self *SplitviewWidget) SplitBarMovable(movable bool)
type TabWidget ¶
type TabWidget struct { CoreWidget // contains filtered or unexported fields }
func NewTabWidget ¶
func (*TabWidget) MousePressDown ¶
type TableData ¶
type TableData interface { GetNbColumns() int32 GetNbRows() int32 GetHeader(column int32) (string, int32) GetCell(colum, row int32) string // when the table grows/shrink SetRowUpdateCallback(callback func()) // when the table need to be refreshed SetDataChangeCallback(callback func()) }
TableData is an interface use to provide the Model (MVC) aka the table datas
type TableWidget ¶
type TableWidget struct { CoreWidget // contains filtered or unexported fields }
func NewTableWidget ¶
func NewTableWidget(w, h int32, tabledata TableData) *TableWidget
NewTableWidget create a table widget, you need to provide a Model i.e. a TableData object When you create a table widget, the number of column is fixed (you cannot add/remove columns for the moment)
func (*TableWidget) Repaint ¶
func (self *TableWidget) Repaint()
func (*TableWidget) Resize ¶
func (self *TableWidget) Resize(width, height int32)
func (*TableWidget) SetHeaderTextColor ¶
func (self *TableWidget) SetHeaderTextColor(color sdl.Color)
func (*TableWidget) SetTextColor ¶
func (self *TableWidget) SetTextColor(color sdl.Color)
type TextAreaWidget ¶
type TextAreaWidget struct { CoreWidget // contains filtered or unexported fields }
func NewTextAreaWidget ¶
func NewTextAreaWidget(w, h int32, s string) *TextAreaWidget
func (*TextAreaWidget) GetText ¶
func (self *TextAreaWidget) GetText() string
func (*TextAreaWidget) HasFocus ¶
func (self *TextAreaWidget) HasFocus(focus bool)
func (*TextAreaWidget) InputText ¶
func (self *TextAreaWidget) InputText(text string)
func (*TextAreaWidget) IsInputWidget ¶
func (self *TextAreaWidget) IsInputWidget() bool
func (*TextAreaWidget) MouseMove ¶
func (self *TextAreaWidget) MouseMove(x, y, xrel, yrel int32)
func (*TextAreaWidget) MousePressDown ¶
func (self *TextAreaWidget) MousePressDown(x, y int32, button uint8)
func (*TextAreaWidget) MousePressUp ¶
func (self *TextAreaWidget) MousePressUp(x, y int32, button uint8)
func (*TextAreaWidget) Repaint ¶
func (self *TextAreaWidget) Repaint()
func (*TextAreaWidget) Resize ¶
func (self *TextAreaWidget) Resize(w, h int32)
func (*TextAreaWidget) SetDisabled ¶
func (self *TextAreaWidget) SetDisabled(disabled bool)
func (*TextAreaWidget) SetHeightChangeCallback ¶
func (self *TextAreaWidget) SetHeightChangeCallback(callback func(int32))
SetHeightChangeCallback is used to inform when the text grows/shrink in term of number of lines
func (*TextAreaWidget) SetText ¶
func (self *TextAreaWidget) SetText(text string)
func (*TextAreaWidget) SetYOffset ¶
func (self *TextAreaWidget) SetYOffset(offset int32)
func (*TextAreaWidget) SetYOffsetChangedCallback ¶
func (self *TextAreaWidget) SetYOffsetChangedCallback(callback func(int32))
SetHeightChangeCallback is used to inform when we scroll down/up
func (*TextAreaWidget) ShowLineNumber ¶
func (self *TextAreaWidget) ShowLineNumber()
func (*TextAreaWidget) UpdatePosition ¶
func (self *TextAreaWidget) UpdatePosition(x, y int32)
type TimerEvent ¶
type TimerEvent struct {
// contains filtered or unexported fields
}
The TimerEvent struct is an opaque object, you mainly use func TimerAddEvent() and StopRepeat() functions
TimerEvent are used to trigger an callback at a later time. It can be one-shot or repeatable.
func TimerAddEvent ¶
func TimerAddEvent(triggertime time.Time, repeat time.Duration, trigger func(evt *TimerEvent)) *TimerEvent
Main entry point to create a new timer (and place it into the event queue)
If repeat>0, this event is repeatable (until stopped. See StopRepeat())
func (*TimerEvent) StopRepeat ¶
func (te *TimerEvent) StopRepeat() bool
When you need to stop a repeatable event, call this function
type TreeViewItem ¶
type TreeViewItem struct { CoreWidget // contains filtered or unexported fields }
func NewTreeViewItem ¶
func NewTreeViewItem(label string, icon string, callback func()) *TreeViewItem
func (*TreeViewItem) AddSubItem ¶
func (self *TreeViewItem) AddSubItem(item *TreeViewItem)
we add & refresh
func (*TreeViewItem) MousePressDown ¶
func (self *TreeViewItem) MousePressDown(shift, x, y int32, button uint8)
if we click on arrow -> we open/close (and refresh) if we click on the rest -> we emit a callback (and grab the focus)
func (*TreeViewItem) RemoveSubItem ¶
func (self *TreeViewItem) RemoveSubItem(item *TreeViewItem)
func (*TreeViewItem) Repaint ¶
func (self *TreeViewItem) Repaint(shift int32)
paint on shift*16, arrow, icon, text
func (*TreeViewItem) SetFocus ¶
func (self *TreeViewItem) SetFocus(focus bool)
to know if we highlight (or not) this row
type TreeViewItemWalkfunc ¶
type TreeViewItemWalkfunc func(level int32, item *TreeViewItem)
type TreeViewWidget ¶
type TreeViewWidget struct { CoreWidget // contains filtered or unexported fields }
func NewTreeViewWidget ¶
func NewTreeViewWidget() *TreeViewWidget
func (*TreeViewWidget) AddItem ¶
func (self *TreeViewWidget) AddItem(item *TreeViewItem)
func (*TreeViewWidget) MousePressDown ¶
func (self *TreeViewWidget) MousePressDown(x, y int32, button uint8)
func (*TreeViewWidget) RemoveItem ¶
func (self *TreeViewWidget) RemoveItem(item *TreeViewItem)
func (*TreeViewWidget) Repaint ¶
func (self *TreeViewWidget) Repaint()
func (*TreeViewWidget) Resize ¶
func (self *TreeViewWidget) Resize(width, height int32)
func (*TreeViewWidget) SetFocusOn ¶
func (self *TreeViewWidget) SetFocusOn(item *TreeViewItem)
select a specific TreeViewItem (but do not open automatically til this item)
type VBoxWidget ¶
type VBoxWidget struct {
CoreWidget
}
a simple vertical box container
func NewVBoxWidget ¶
func NewVBoxWidget(w, h int32) *VBoxWidget
func (*VBoxWidget) AddChild ¶
func (self *VBoxWidget) AddChild(child Widget)
func (*VBoxWidget) AddChildTop ¶
func (self *VBoxWidget) AddChildTop(child Widget)
func (*VBoxWidget) Rebox ¶
func (self *VBoxWidget) Rebox()
Rebox assumes that children changes from size (from height in fact), and recompute position
func (*VBoxWidget) RemoveAllChildren ¶
func (self *VBoxWidget) RemoveAllChildren()
func (*VBoxWidget) RemoveChild ¶
func (self *VBoxWidget) RemoveChild(child Widget)
func (*VBoxWidget) Resize ¶
func (self *VBoxWidget) Resize(width, height int32)
type Widget ¶
type Widget interface { AddChild(child Widget) RemoveChild(child Widget) Move(x, y int32) Resize(width, height int32) Surface() *sdl.Surface SetAlphaMod(alpha uint8) Renderer() *sdl.Renderer GetChildren() []Widget Parent() Widget SetParent(Widget) Repaint() X() int32 Y() int32 Width() int32 Height() int32 MouseDoubleClick(x, y int32) MousePressDown(x, y int32, button uint8) MousePressUp(x, y int32, button uint8) MouseMove(x, y, xrel, yrel int32) KeyDown(key sdl.Keycode, mod uint16) KeyUp(key sdl.Keycode, mod uint16) InputText(string) TranslateXYToWidget(globalX, globalY int32) (x, y int32) IsInside(x, y int32) bool Font() *ttf.Font Destroy() DragMove(x, y int32, payload DragPayload) DragEnter(x, y int32, payload DragPayload) DragLeave(payload DragPayload) DragDrop(x, y int32, payload DragPayload) bool IsDirty() bool PostUpdate() // deal with current focus HasFocus(focus bool) // to know if this widget receive input (checkbox, input text, slider, button, ...) IsInputWidget() bool // when we press tab and want to switch to the next input widget SetCallbackFocusOnNextInputWidget(callback func(forward bool)) // when the input widget see its "value" changed SetCallbackValueChanged(callback func()) }
"Abstract" class of all widget
Source Files ¶
- buttonwidget.go
- checkboxwidget.go
- corewidget.go
- dropdownwidget.go
- flatbuttonwidget.go
- fonts.go
- hrwidget.go
- inputwidget.go
- labelwidget.go
- listwidget.go
- mainwidget.go
- menuwidget.go
- modal.go
- scrollbarwidget.go
- scrollwidget.go
- splitviewwidget.go
- sprite.go
- sws.go
- tablewidget.go
- tabwidget.go
- textareawidget.go
- timer.go
- treeviewwidget.go
- vboxwidget.go