Documentation
¶
Overview ¶
Copyright 2010 The draw2d Authors. All rights reserved. created: 21/11/2010 by Laurent Le Goff Package geometry draws some geometric tests. Modifed by : wiless
Index ¶
- Variables
- func Arc(gc draw2d.GraphicContext, xc, yc, width, height float64)
- func ArcNegative(gc draw2d.GraphicContext, xc, yc, width, height float64)
- func Bubble(gc draw2d.GraphicContext, x, y, width, height float64)
- func CubicCurve(gc draw2d.GraphicContext, x, y, width, height float64)
- func CurveRectangle(gc draw2d.GraphicContext, x0, y0, rectWidth, rectHeight float64, ...)
- func Dash(gc draw2d.GraphicContext, x, y, width, height float64)
- func Draw(gc draw2d.GraphicContext, width, height float64)
- func DrawDummy(w *Window, s WidgetState)
- func FillString(gc draw2d.GraphicContext, x, y, width, height float64)
- func FillStroke(gc draw2d.GraphicContext, x, y, width, height float64)
- func FillStyle(gc draw2d.GraphicContext, x, y, width, height float64)
- func GetIRect(w, h int) image.Rectangle
- func PathTransform(gc draw2d.GraphicContext, x, y, width, height float64)
- func RandomGraph(r image.Rectangle) *image.RGBA
- func RegisterFont(path, name string)
- func SetResourcePath(path, fontName string) error
- func SetTheme(newTheme *Theme)
- func SplitSubN(s string, n int) []string
- func Star(gc draw2d.GraphicContext, x, y, width, height float64)
- func StrokeBorder(img *xgraphics.Image, clr xgraphics.BGRA, margin, width int)
- func StrokeBorderImg(img *image.RGBA, clr color.Color, margin, width int)
- func TrimValues(v float64) float64
- func UseDarkTheme()
- func UseLightTheme()
- func XRectToImageRect(r xrect.Rect) image.Rectangle
- type Alignment
- type Application
- func (a *Application) AddButton(caption string, geo ...int) *Window
- func (a *Application) AddToggleBtn(caption string, geo ...int) *Window
- func (a *Application) AppWin() *Window
- func (a *Application) AutoLayout(l LayoutDirection, newpos ...int)
- func (s *Application) Close()
- func (s *Application) DefaultKeys(enable bool)
- func (s *Application) Empty() *Window
- func (s *Application) FullScreen()
- func (a *Application) Height() int
- func (s *Application) Hide()
- func (s *Application) InvertBackGround()
- func (s *Application) Maximize()
- func (a *Application) NewChildWindow(title string, dims ...int) *Window
- func (a *Application) NewContainer(layout LayoutDirection, dims ...int) *Container
- func (s *Application) NewFloatingWindow(title string, dims ...int) *Window
- func (s *Application) RegisterGlobalKey(keyname string, fn Handler) bool
- func (s *Application) RegisterKey(keyname string, fn Handler) bool
- func (s *Application) Restore()
- func (a *Application) SetDefaultKeys()
- func (a *Application) SetLayoutPadding(dx, dy int)
- func (a *Application) SetLayoutSpacing(dx, dy int)
- func (s *Application) Show()
- func (a *Application) Width() int
- func (a *Application) X() *xgbutil.XUtil
- func (s *Application) XWin() *xwindow.Window
- type Button
- type ButtonWidget
- func (bw *ButtonWidget) IsChecked() bool
- func (bw *ButtonWidget) LoadTheme(str string)
- func (bw *ButtonWidget) Paint()
- func (bw *ButtonWidget) SetChecked(checked bool)
- func (bw *ButtonWidget) SetFontSize(size float64)
- func (bw *ButtonWidget) SetKeybFn(fn func(key string))
- func (bw *ButtonWidget) SetLabel(lbl string)
- func (bw *ButtonWidget) SetOnClick(fn func())
- func (bw *ButtonWidget) SetTitle(title string)
- func (bw *ButtonWidget) SetToggle(toggle bool)
- type CheckBox
- type Container
- func (c *Container) AddButton(caption string, geo ...int) *ButtonWidget
- func (c *Container) AddToggleBtn(caption string, geo ...int) *ButtonWidget
- func (c *Container) AddWidget(widget WindowProvider)
- func (c *Container) RelayoutChildren()
- func (c *Container) SetFontSize(size float64)
- func (c *Container) SetSpacing(dx, dy int)
- type FactorWidgets
- type FontSizeSetter
- type Handler
- type HandlerFunctions
- type ImgButton
- type Label
- func (l *Label) AutoResize(auto bool) *Label
- func (l *Label) InvertColors()
- func (l *Label) SetAlignMode(align TextAlign) *Label
- func (l *Label) SetBackground(c color.Color)
- func (l *Label) SetFontSize(size float64) *Label
- func (l *Label) SetLabel(lbl string)
- func (l *Label) SetTextColor(c color.Color)
- type Layout
- func (l *Layout) AddRegion(r RegionPainter) *Layout
- func (l *Layout) AddRegionAt(r RegionPainter, x, y int) *Layout
- func (l *Layout) DrawOnWidget(w *Widget)
- func (l *Layout) DrawOnWindow(w *Window)
- func (l *Layout) ImageRect() image.Rectangle
- func (l *Layout) Origin() image.Point
- func (l *Layout) Resize(x, y, w, h int)
- func (l *Layout) SetRegion(indx int, r RegionPainter)
- func (l *Layout) Size() image.Point
- type LayoutDirection
- type OnClickFn
- type Pen
- type ProgressBar
- func (p *ProgressBar) FmtString() string
- func (p *ProgressBar) Margin() float64
- func (p *ProgressBar) Parent() *Window
- func (p *ProgressBar) ResetFmtString()
- func (p *ProgressBar) SetBackGroundColor(bc color.Color)
- func (p *ProgressBar) SetBarColor(bc color.Color)
- func (p *ProgressBar) SetBorderWidth(bw float64)
- func (p *ProgressBar) SetDisplayScale(s float64)
- func (p *ProgressBar) SetFmtString(s string)
- func (p *ProgressBar) SetMargin(m float64)
- func (p *ProgressBar) SetTextColor(tc color.Color)
- func (p *ProgressBar) SetValue(v float64)
- func (p ProgressBar) Value() float64
- func (p *ProgressBar) Widget() *Window
- func (p *ProgressBar) X() *xgbutil.XUtil
- type Property
- type Rect
- func (r *Rect) Center() (x, y int)
- func (r *Rect) CenterX() int
- func (r *Rect) CenterY() int
- func (r *Rect) Grow(dw, dh int) *Rect
- func (r *Rect) ImageRect() image.Rectangle
- func (r *Rect) MoveTo(x, y int) *Rect
- func (r *Rect) ReSize(w, h int) *Rect
- func (r *Rect) ShiftBy(dx, dy int) *Rect
- func (r *Rect) ShiftDown(dy int) *Rect
- func (r *Rect) ShiftRight(dx int) *Rect
- func (r *Rect) WithPadding(dx, dy int) Rect
- type Region
- type RegionPainter
- type RegionPainterFn
- type ScrollView
- func (s *ScrollView) AddWidget(w *Widget)
- func (s *ScrollView) IsVisible() bool
- func (s *ScrollView) ScrollChilds(dx, dy int)
- func (s *ScrollView) ScrollDown()
- func (s *ScrollView) ScrollUp()
- func (s *ScrollView) SetBackground(c color.Color)
- func (s *ScrollView) SetMaxSteps(maxsteps int)
- func (s *ScrollView) SetStepSize(step int)
- func (s *ScrollView) ShowScrollBars(show bool)
- func (s *ScrollView) View() *Window
- type Slider
- type TextAlign
- type TextBox
- func (t *TextBox) AddRulers()
- func (t *TextBox) AppendLine(str string)
- func (t *TextBox) InvertColors()
- func (t *TextBox) SetFontSize(size float64) *TextBox
- func (t *TextBox) SetReadOnly(readonly bool)
- func (t *TextBox) SetText(txt string)
- func (t *TextBox) SetTextColor(c color.Color)
- func (t *TextBox) ShowIBeam()
- type Theme
- type Widget
- func (w *Widget) Align(alignment Alignment)
- func (w *Widget) AttachHandlers() *Widget
- func (w *Widget) Close()
- func (w *Widget) Context() *draw2dimg.GraphicContext
- func (ww *Widget) CreateChild(dims ...int) *Widget
- func (w *Widget) GetRect() Rect
- func (w *Widget) ID() xproto.Window
- func (w *Widget) InvertColors()
- func (w *Widget) LoadTheme(str string)
- func (w *Widget) Move(x, y int)
- func (w *Widget) Paint()
- func (w *Widget) PaintRegions()
- func (w *Widget) RePaint()
- func (w *Widget) SetBackground(c color.Color)
- func (w *Widget) SetChildrenFontSize(fsize float64)
- func (w *Widget) SetFontSize(fsize float64)
- func (w *Widget) SetModal(modal bool)
- func (w *Widget) SetTextColor(c color.Color)
- func (w *Widget) SetTitle(title string)
- func (w *Widget) SetX(X *xgbutil.XUtil)
- func (w *Widget) UpdateCanvas()
- func (w *Widget) Win() *Window
- type WidgetState
- type Window
- func (w *Window) Align(alignment Alignment)
- func (w *Window) Animate(t int)
- func (w *Window) AnimateProperty(d time.Duration, start, stop Property)
- func (w *Window) Click()
- func (w *Window) CreateRawImage(x, y, ww, hh int) *image.RGBA
- func (w *Window) Draw(X *xgbutil.XUtil, e xevent.ExposeEvent)
- func (w *Window) Filler(x, y int) xgraphics.BGRA
- func (w *Window) Hide()
- func (w *Window) IsChecked() bool
- func (w *Window) Move(x, y int)
- func (w *Window) OnClick(fn func())
- func (w *Window) OnClickAdv(fn OnClickFn)
- func (w *Window) OnMove(fn func(x, y int))
- func (w *Window) OnMoveComplete(fn func(x, y int))
- func (w *Window) OnResizeComplete(fn func(w, h int))
- func (w *Window) OnSizeChange(fn func(w, h int))
- func (w *Window) Paint()
- func (w *Window) PaintOnce()
- func (w *Window) Plot()
- func (w Window) RawImage() *image.RGBA
- func (w *Window) ReDrawImage()
- func (w *Window) Reparent(newParent xproto.Window, x, y int) error
- func (w *Window) Resize(width, height int)
- func (w *Window) SetBGcolor(c color.Color)
- func (w *Window) SetBackGround(c colorful.Color)
- func (w *Window) SetMargin(m float64)
- func (w *Window) SetTitle(t string)
- func (w *Window) Show()
- func (w *Window) Title() string
- func (w *Window) Toggle()
- func (w *Window) ToggleVisibility()
- func (w *Window) UpdatePlot(img image.Image)
- func (w *Window) Win() *Window
- func (w *Window) X() *xgbutil.XUtil
- func (w *Window) XProtoWin() xproto.Window
- func (w *Window) XWin() *xwindow.Window
- type WindowProvider
Constants ¶
This section is empty.
Variables ¶
var Black = color.RGBA{0, 0, 0, 255}
var DEBUG_LEVEL = 0
var DarkGray = color.RGBA{20, 20, 20, 255}
var DarkGreen = xgraphics.BGRA{0, 150, 0, 255}
var Green = color.RGBA{0, 255, 0, 255}
var LightGray = xgraphics.BGRA{200, 200, 200, 255}
var LightGreen = xgraphics.BGRA{0, 50, 0, 255}
var White = color.RGBA{255, 255, 255, 255}
Functions ¶
func Arc ¶
func Arc(gc draw2d.GraphicContext, xc, yc, width, height float64)
Arc draws an arc with a positive angle (clockwise)
func ArcNegative ¶
func ArcNegative(gc draw2d.GraphicContext, xc, yc, width, height float64)
ArcNegative draws an arc with a negative angle (anti clockwise).
func Bubble ¶
func Bubble(gc draw2d.GraphicContext, x, y, width, height float64)
Bubble draws a text balloon.
func CubicCurve ¶
func CubicCurve(gc draw2d.GraphicContext, x, y, width, height float64)
CubicCurve draws a cubic curve with its control points.
func CurveRectangle ¶
func CurveRectangle(gc draw2d.GraphicContext, x0, y0, rectWidth, rectHeight float64, stroke, fill color.Color)
CurveRectangle draws a rectangle with bezier curves (not rounded rectangle).
func Dash ¶
func Dash(gc draw2d.GraphicContext, x, y, width, height float64)
Dash draws a line with a dash pattern
func Draw ¶
func Draw(gc draw2d.GraphicContext, width, height float64)
Draw all figures in a nice 4x3 grid.
func DrawDummy ¶
func DrawDummy(w *Window, s WidgetState)
func FillString ¶
func FillString(gc draw2d.GraphicContext, x, y, width, height float64)
FillString draws a filled and stroked string.
func FillStroke ¶
func FillStroke(gc draw2d.GraphicContext, x, y, width, height float64)
FillStroke first fills and afterwards strokes a path.
func FillStyle ¶
func FillStyle(gc draw2d.GraphicContext, x, y, width, height float64)
FillStyle demonstrates the difference between even odd and non zero winding rule.
func PathTransform ¶
func PathTransform(gc draw2d.GraphicContext, x, y, width, height float64)
PathTransform scales a path differently in horizontal and vertical direction.
func RandomGraph ¶
RandomGraph generates an image with a random sine wave graph.
func SetResourcePath ¶
SetResourcePath sets the path for UI resources like fonts The path parameter is the directory containing the font files.
func SetTheme ¶ added in v1.1.1
func SetTheme(newTheme *Theme)
SetTheme allows updating the global theme at runtime. To apply the new theme to existing widgets, they would need to be explicitly redrawn or have their LoadTheme/ApplyTheme methods called.
func Star ¶
func Star(gc draw2d.GraphicContext, x, y, width, height float64)
Star draws many lines from a center.
func TrimValues ¶ added in v1.0.2
func UseDarkTheme ¶ added in v1.1.1
func UseDarkTheme()
UseDarkTheme sets the global theme to the predefined DarkTheme.
func UseLightTheme ¶ added in v1.1.1
func UseLightTheme()
UseLightTheme sets the global theme to the predefined LightTheme.
Types ¶
type Alignment ¶ added in v1.1.1
type Alignment int
Alignment specifies the position relative to a parent.
type Application ¶
type Application struct {
NWindows int
Childs []*xwindow.Window
KeyMaps map[string]Handler
ClickMaps map[xproto.Window]OnClickFn
Debug bool
Dark bool
// contains filtered or unexported fields
}
Application represents an X11 application, managing windows and events.
func NewApp ¶
func NewApp(fullscreen bool, width, height int) *Application
NewApp creates a new application with a default title and specified dimensions.
func NewApplication ¶
func NewApplication(title string, width, height int, resizeable, fullApplication bool) *Application
NewApplication creates a new X11 application with the given title, dimensions, and resize/fullscreen options.
func (*Application) AddToggleBtn ¶
func (a *Application) AddToggleBtn(caption string, geo ...int) *Window
func (*Application) AppWin ¶
func (a *Application) AppWin() *Window
AppWin returns the main application window.
func (*Application) AutoLayout ¶
func (a *Application) AutoLayout(l LayoutDirection, newpos ...int)
AutoLayout sets the automatic layout direction for new child windows.
func (*Application) DefaultKeys ¶
func (s *Application) DefaultKeys(enable bool)
DefaultKeys enables or disables default keybindings for the application (e.g., 'q' for close, 'f' for fullscreen).
func (*Application) Empty ¶
func (s *Application) Empty() *Window
Empty returns an empty Window associated with the application's root window.
func (*Application) FullScreen ¶
func (s *Application) FullScreen()
func (*Application) Height ¶
func (a *Application) Height() int
Height returns the height of the application's screen in pixels.
func (*Application) Hide ¶ added in v1.0.2
func (s *Application) Hide()
https://specifications.freedesktop.org/wm-spec/1.3/ar01s05.html
func (*Application) InvertBackGround ¶
func (s *Application) InvertBackGround()
func (*Application) Maximize ¶ added in v1.0.2
func (s *Application) Maximize()
func (*Application) NewChildWindow ¶
func (a *Application) NewChildWindow(title string, dims ...int) *Window
func (*Application) NewContainer ¶ added in v1.1.1
func (a *Application) NewContainer(layout LayoutDirection, dims ...int) *Container
func (*Application) NewFloatingWindow ¶
func (s *Application) NewFloatingWindow(title string, dims ...int) *Window
func (*Application) RegisterGlobalKey ¶
func (s *Application) RegisterGlobalKey(keyname string, fn Handler) bool
RegisterGlobalKey registers a key to be handled globally by the application. This will grab the keyboard, meaning no other application will receive keyboard input.
func (*Application) RegisterKey ¶
func (s *Application) RegisterKey(keyname string, fn Handler) bool
RegisterKey registers a key with a function to be handled by the application.
func (*Application) Restore ¶ added in v1.0.2
func (s *Application) Restore()
func (*Application) SetDefaultKeys ¶
func (a *Application) SetDefaultKeys()
func (*Application) SetLayoutPadding ¶ added in v1.1.1
func (a *Application) SetLayoutPadding(dx, dy int)
func (*Application) SetLayoutSpacing ¶
func (a *Application) SetLayoutSpacing(dx, dy int)
func (*Application) Show ¶
func (s *Application) Show()
Show starts the application's event loop and displays the main window.
func (*Application) Width ¶
func (a *Application) Width() int
Width returns the width of the application's screen in pixels.
func (*Application) X ¶
func (a *Application) X() *xgbutil.XUtil
X returns the underlying *xgbutil.XUtil connection for the application.
func (*Application) XWin ¶
func (s *Application) XWin() *xwindow.Window
XWin returns the underlying *xwindow.Window of the application's main window.
type ButtonWidget ¶ added in v1.1.1
type ButtonWidget struct {
*Widget
// contains filtered or unexported fields
}
ButtonWidget represents a clickable button UI element.
func NewButtonWidget ¶ added in v1.1.1
func NewButtonWidget(title string, p *Window, dims ...int) *ButtonWidget
NewButtonWidget creates a new ButtonWidget.
func (*ButtonWidget) IsChecked ¶ added in v1.1.1
func (bw *ButtonWidget) IsChecked() bool
IsChecked returns true if the toggle button is currently checked.
func (*ButtonWidget) LoadTheme ¶ added in v1.1.1
func (bw *ButtonWidget) LoadTheme(str string)
func (*ButtonWidget) Paint ¶ added in v1.1.1
func (bw *ButtonWidget) Paint()
SetLabel sets the text displayed on the button.
func (*ButtonWidget) SetChecked ¶ added in v1.1.1
func (bw *ButtonWidget) SetChecked(checked bool)
SetChecked sets the checked state of a toggle button.
func (*ButtonWidget) SetFontSize ¶ added in v1.1.1
func (bw *ButtonWidget) SetFontSize(size float64)
SetFontSize sets the font size of the button's text.
func (*ButtonWidget) SetKeybFn ¶ added in v1.1.1
func (bw *ButtonWidget) SetKeybFn(fn func(key string))
SetKeybFn sets the function to be called when a keyboard event is received.
func (*ButtonWidget) SetLabel ¶ added in v1.1.1
func (bw *ButtonWidget) SetLabel(lbl string)
func (*ButtonWidget) SetOnClick ¶ added in v1.1.1
func (bw *ButtonWidget) SetOnClick(fn func())
SetOnClick sets the function to be called when the button is clicked.
func (*ButtonWidget) SetTitle ¶ added in v1.1.1
func (bw *ButtonWidget) SetTitle(title string)
SetTitle sets the title of the button. This will update the visible label.
func (*ButtonWidget) SetToggle ¶ added in v1.1.1
func (bw *ButtonWidget) SetToggle(toggle bool)
SetToggle makes the button a toggle button.
type CheckBox ¶
type CheckBox struct {
*Widget
// contains filtered or unexported fields
}
func (*CheckBox) SetChecked ¶ added in v1.1.1
type Container ¶ added in v1.1.1
type Container struct {
Window // Embed the existing Window struct directly
// contains filtered or unexported fields
}
func (*Container) AddButton ¶ added in v1.1.1
func (c *Container) AddButton(caption string, geo ...int) *ButtonWidget
func (*Container) AddToggleBtn ¶ added in v1.1.1
func (c *Container) AddToggleBtn(caption string, geo ...int) *ButtonWidget
func (*Container) AddWidget ¶ added in v1.1.1
func (c *Container) AddWidget(widget WindowProvider)
func (*Container) RelayoutChildren ¶ added in v1.1.1
func (c *Container) RelayoutChildren()
func (*Container) SetFontSize ¶ added in v1.1.1
func (*Container) SetSpacing ¶ added in v1.1.1
type FactorWidgets ¶
type FactorWidgets interface {
Move(x, y int)
}
type FontSizeSetter ¶ added in v1.1.1
type FontSizeSetter interface {
SetFontSize(float64)
}
FontSizeSetter interface for widgets that can have their font size set.
type HandlerFunctions ¶
type HandlerFunctions struct {
ClkAdvFn func(w *Widget, x, y int)
ClkFn func()
HoverFn func()
LeaveFn func()
KeybFn func(key string)
DragStartFn func(w *Widget, global, local image.Point) bool
DragFn func(w *Widget, global, local image.Point) bool
DragEndFn func(w *Widget, global, local image.Point) bool
EnableHover bool
}
type ImgButton ¶
type ImgButton struct {
*Widget
// contains filtered or unexported fields
}
func (*ImgButton) DrawImageEx ¶ added in v1.1.1
func (*ImgButton) ResizeWidget ¶ added in v1.1.1
func (*ImgButton) SetImageAlign ¶ added in v1.1.1
func (*ImgButton) SetPicture ¶
type Label ¶
type Label struct {
*Widget
// contains filtered or unexported fields
}
func (*Label) AutoResize ¶
func (*Label) InvertColors ¶ added in v1.1.1
func (l *Label) InvertColors()
func (*Label) SetAlignMode ¶
func (*Label) SetBackground ¶
func (*Label) SetFontSize ¶
func (*Label) SetTextColor ¶ added in v1.1.1
type Layout ¶
type Layout struct {
// contains filtered or unexported fields
}
func CreateLayout ¶
func (*Layout) AddRegion ¶
func (l *Layout) AddRegion(r RegionPainter) *Layout
func (*Layout) AddRegionAt ¶
func (l *Layout) AddRegionAt(r RegionPainter, x, y int) *Layout
func (*Layout) DrawOnWidget ¶
func (*Layout) DrawOnWindow ¶
func (*Layout) SetRegion ¶
func (l *Layout) SetRegion(indx int, r RegionPainter)
type LayoutDirection ¶
type LayoutDirection int
LayoutDirection specifies the direction for automatic widget layout.
const ( // LayoutNone indicates no automatic layout direction. LayoutNone LayoutDirection = iota // LayoutHor indicates horizontal layout. LayoutHor // LayoutVer indicates vertical layout. LayoutVer )
type OnClickFn ¶
OnClickFn defines the signature for advanced click handlers that receive window and coordinate information.
type ProgressBar ¶
func NewProgressBar ¶
func NewProgressBar(title string, p *Window, dims ...int) *ProgressBar
func (*ProgressBar) FmtString ¶
func (p *ProgressBar) FmtString() string
func (*ProgressBar) Margin ¶
func (p *ProgressBar) Margin() float64
func (*ProgressBar) Parent ¶
func (p *ProgressBar) Parent() *Window
func (*ProgressBar) ResetFmtString ¶
func (p *ProgressBar) ResetFmtString()
func (*ProgressBar) SetBackGroundColor ¶
func (p *ProgressBar) SetBackGroundColor(bc color.Color)
func (*ProgressBar) SetBarColor ¶
func (p *ProgressBar) SetBarColor(bc color.Color)
func (*ProgressBar) SetBorderWidth ¶
func (p *ProgressBar) SetBorderWidth(bw float64)
func (*ProgressBar) SetDisplayScale ¶
func (p *ProgressBar) SetDisplayScale(s float64)
func (*ProgressBar) SetFmtString ¶
func (p *ProgressBar) SetFmtString(s string)
func (*ProgressBar) SetMargin ¶
func (p *ProgressBar) SetMargin(m float64)
func (*ProgressBar) SetTextColor ¶
func (p *ProgressBar) SetTextColor(tc color.Color)
func (*ProgressBar) SetValue ¶
func (p *ProgressBar) SetValue(v float64)
Sets the value in the fraction 0 to 1
func (ProgressBar) Value ¶
func (p ProgressBar) Value() float64
return the value in the scale 0 to 1
func (*ProgressBar) Widget ¶
func (p *ProgressBar) Widget() *Window
func (*ProgressBar) X ¶
func (p *ProgressBar) X() *xgbutil.XUtil
type Property ¶
Property represents geometric properties of a window for animation.
type Region ¶
type RegionPainter ¶
type RegionPainterFn ¶
type ScrollView ¶
type ScrollView struct {
*Widget
// contains filtered or unexported fields
}
func NewScrollView ¶
func NewScrollView(title string, p *Window, dims ...int) *ScrollView
func (*ScrollView) AddWidget ¶
func (s *ScrollView) AddWidget(w *Widget)
func (*ScrollView) IsVisible ¶
func (s *ScrollView) IsVisible() bool
returns if the scrollbars are visible
func (*ScrollView) ScrollChilds ¶
func (s *ScrollView) ScrollChilds(dx, dy int)
func (*ScrollView) ScrollDown ¶
func (s *ScrollView) ScrollDown()
func (*ScrollView) ScrollUp ¶
func (s *ScrollView) ScrollUp()
func (*ScrollView) SetBackground ¶
func (s *ScrollView) SetBackground(c color.Color)
func (*ScrollView) SetMaxSteps ¶
func (s *ScrollView) SetMaxSteps(maxsteps int)
func (*ScrollView) SetStepSize ¶
func (s *ScrollView) SetStepSize(step int)
func (*ScrollView) ShowScrollBars ¶
func (s *ScrollView) ShowScrollBars(show bool)
func (*ScrollView) View ¶
func (s *ScrollView) View() *Window
type Slider ¶ added in v1.0.2
type Slider struct {
*ProgressBar
// contains filtered or unexported fields
}
func (*Slider) AddListeners ¶ added in v1.0.2
func (s *Slider) AddListeners()
func (*Slider) SetMaxValue ¶ added in v1.0.2
func (*Slider) SetStepSize ¶ added in v1.0.2
type TextBox ¶
type TextBox struct {
*Widget
// contains filtered or unexported fields
}
func NewTextBox ¶
NewTextBox creates a child TextBox widget in the roots of Window p
func (*TextBox) AppendLine ¶
func (*TextBox) InvertColors ¶ added in v1.1.1
func (t *TextBox) InvertColors()
func (*TextBox) SetFontSize ¶ added in v1.1.1
func (*TextBox) SetReadOnly ¶
func (*TextBox) SetTextColor ¶ added in v1.1.1
type Theme ¶ added in v1.1.1
type Theme struct {
BackgroundColor color.Color
ForegroundColor color.Color
LineColor color.Color
TextColor color.Color
BarColor color.Color
CheckboxCheckedColor color.Color
CheckboxUncheckedColor color.Color
CheckboxBorderColor color.Color
BaseHue float64 // Base hue for generating color variations
}
Theme holds all the color definitions for the UI.
var CurrentTheme *Theme
CurrentTheme is the global instance of the active theme.
var DarkTheme *Theme
Predefined themes
var LightTheme *Theme
func DarkThemeWithAccent ¶ added in v1.1.1
DarkThemeWithAccent generates a dark theme with a specified accent color.
func LightThemeWithAccent ¶ added in v1.1.1
LightThemeWithAccent generates a light theme with a specified accent color.
type Widget ¶
type Widget struct {
xrect.Rect
*Layout
/// Handlers
HandlerFunctions
// contains filtered or unexported fields
}
func WidgetFactory ¶
func (*Widget) AttachHandlers ¶
func (*Widget) Context ¶
func (w *Widget) Context() *draw2dimg.GraphicContext
func (*Widget) CreateChild ¶
func (*Widget) InvertColors ¶ added in v1.1.1
func (w *Widget) InvertColors()
InvertColors swaps the background and text colors of the widget.
func (*Widget) PaintRegions ¶
func (w *Widget) PaintRegions()
func (*Widget) SetBackground ¶
func (*Widget) SetChildrenFontSize ¶ added in v1.1.1
func (*Widget) SetFontSize ¶
func (*Widget) SetTextColor ¶ added in v1.1.1
func (*Widget) UpdateCanvas ¶
func (w *Widget) UpdateCanvas()
type WidgetState ¶
type WidgetState int
WidgetState represents the visual state of a widget.
const ( StateNormal WidgetState = iota StateHovered StatePressed StateReleased StateChecked // For toggle buttons StateSpecial StateHoveredChecked )
type Window ¶
type Window struct {
//parent *xwindow.Window
*xwindow.Window
Rect
// contains filtered or unexported fields
}
Window represents an X11 window with UI capabilities.
func (*Window) AnimateProperty ¶
AnimateProperty animates a window's properties over a duration. (Currently a stub)
func (*Window) Click ¶
func (w *Window) Click()
Click programmatically triggers the click handlers associated with the window.
func (*Window) CreateRawImage ¶
CreateRawImage creates a new RGBA image associated with the window for direct drawing.
func (*Window) Draw ¶
func (w *Window) Draw(X *xgbutil.XUtil, e xevent.ExposeEvent)
Draw handles expose events to redraw parts of the window.
func (*Window) OnClick ¶
func (w *Window) OnClick(fn func())
OnClick sets a simple click handler for the window.
func (*Window) OnClickAdv ¶
OnClickAdv sets an advanced click handler that receives the window and click coordinates.
func (*Window) OnMoveComplete ¶ added in v1.1.1
func (*Window) OnResizeComplete ¶ added in v1.1.1
func (*Window) OnSizeChange ¶ added in v1.1.1
func (*Window) PaintOnce ¶
func (w *Window) PaintOnce()
PaintOnce draws the window's background and label a single time.
func (*Window) Plot ¶
func (w *Window) Plot()
Plot draws a random graph on the window. Used for demonstration.
func (*Window) ReDrawImage ¶
func (w *Window) ReDrawImage()
ReDrawImage redraws the window from its raw image buffer.
func (*Window) SetBGcolor ¶
SetBGcolor sets the background color of the window using a color.Color and redraws it.
func (*Window) SetBackGround ¶
SetBackGround sets the background color of the window using a colorful.Color.
func (*Window) Toggle ¶
func (w *Window) Toggle()
Toggle changes the checked state of the window if it's a checkbox.
func (*Window) ToggleVisibility ¶ added in v1.1.1
func (w *Window) ToggleVisibility()
func (*Window) UpdatePlot ¶
UpdatePlot updates the window content from an image.
type WindowProvider ¶ added in v1.1.1
type WindowProvider interface {
Win() *Window
Paint()
}
WindowProvider interface defines a method to retrieve the underlying *Window.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
samples
|
|
|
app1
command
|
|
|
app2
command
|
|
|
app3
command
sample code to test progressbar
|
sample code to test progressbar |
|
autolayout
command
|
|
|
label
command
|
|
|
layout
command
|
|
|
scrollview
command
|
|
|
slider
command
sample code to test progressbar
|
sample code to test progressbar |
|
textbox
command
sample code to test progressbar
|
sample code to test progressbar |
|
transparent_bg
command
|
|
|
transparent_test
command
|

