giu

package module
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2025 License: MIT Imports: 40 Imported by: 246

README

giu

Go Report Card Build Status Go Reference Discord Shield

A rapid cross-platform GUI framework for Go based on Dear ImGui and the great Go binding imgui-go.

Any contribution (features, widgets, tutorials, documents, etc...) is appreciated!

Sponsor

(This library is available under a free and permissive license, but needs financial support to sustain its continued improvements. In addition to maintenance and stability there are many desirable features yet to be added. If you are using giu, please consider reaching out.)

Businesses: support continued development and maintenance via invoiced technical support, maintenance, sponsoring contracts:

E-mail: [email protected]

Individuals: support continued development and maintenance here.

Documentation

For documentation refer to our wiki, examples, GoDoc, or just take a look at comments in code.

Supported Platforms

giu is built upon GLFW v3.3, so ideally giu could support all platforms that GLFW v3.3 supports.

  • Windows (Windows 10 x64 and Windows 11 x64)
  • macOS (macOS v10.15 and macOS Big Sur)
  • Linux (thanks remeh for testing it)
  • Raspberry Pi 3B (thanks sndvaps for testing it)

Features

Compared to other Dear ImGui golang bindings, giu has the following features:

  • Small executable file size (<3MB after UPX compression for the example/helloworld demo).
  • Live-updating during the resizing of the OS window (implemented on GLFW 3.3 and OpenGL 3.2).
  • Support for displaying various languages without any font setting. Giu will rebuild font atlas incrementally according to texts in UI between frames.
  • Redraws only when user event occurs. Costs only 0.5% CPU usage with 60FPS.
  • Declarative UI (see examples for more details).
  • DPI awareness (auto scaling font and UI to adapt to high DPI monitors).
  • Drop in usage; no need to implement render and platform.
  • OS clipboard support.

Screenshot Screenshot1 Screenshot2

Hello world

package main

import (
        "fmt"

        g "github.com/AllenDang/giu"
)

func onClickMe() {
        fmt.Println("Hello world!")
}

func onImSoCute() {
        fmt.Println("Im sooooooo cute!!")
}

func loop() {
        g.SingleWindow().Layout(
                g.Label("Hello world from giu"),
                g.Row(
                        g.Button("Click Me").OnClick(onClickMe),
                        g.Button("I'm so cute").OnClick(onImSoCute),
                ),
        )
}

func main() {
        wnd := g.NewMasterWindow("Hello world", 400, 200, g.MasterWindowFlagsNotResizable)
        wnd.Run(loop)
}

Here is the result:

Helloworld

Quick introduction

What is immediate mode GUI?

Immediate mode GUI system means the UI control doesn't retain its state and value. For example, calling giu.InputText(&str) will display a input text box on screen, and the user entered value will be stored in &str. Input text box doesn't know anything about it.

And the loop method in the Hello world example is in charge of drawing all widgets based on the parameters passed into them. This method will be invoked 30 times per second to reflect interactive states (like clicked, hovered, value-changed, etc.). It will be the place you define the UI structure.

The layout and sizing system

By default, any widget placed inside a container's Layout will be placed vertically.

To create a row of widgets (i.e. place widgets one by one horizontally), use the Row() method. For example giu.Row(Label(...), Button(...)) will create a Label next to a Button.

To create a column of widgets (i.e. place widgets one by one vertically) inside a row, use the Column() method.

Any widget that has a Size() method, can set its size explicitly. Note that you can pass a negative value to Size(), which will fill the remaining width/height value. For example, InputText(...).Size(giu.Auto) will create an input text box with the longest width that its container has left.

Containers
MasterWindow

A MasterWindow means the platform native window implemented by the OS. All subwindows and widgets will be placed inside it.

Window

A Window is a container with a title bar, and can be collapsed. SingleWindow is a special kind of window that will occupy all the available space of MasterWindow.

Child

A Child is like a panel in other GUI frameworks - it can have a background color and border.

Widgets

Check examples/widgets for all kinds of widgets.

Install

The backend of giu depends on OpenGL 3.3, make sure your environment supports it (as far as I know, some Virtual Machines like VirtualBox doesn't support it).

MacOS
xcode-select --install
go get github.com/AllenDang/giu
Windows
  1. Install mingw download here. Thanks @alchem1ster!
  2. Add the binaries folder of mingw to the path (usually is \mingw64\bin).
  3. go get github.com/AllenDang/giu
Linux

First you need to install the required dependencies:

sudo apt install libx11-dev libxcursor-dev libxrandr-dev libxinerama-dev libxi-dev libglx-dev libgl1-mesa-dev libxxf86vm-dev

on Red Hat based distributions:

sudo dnf install libX11-devel libXcursor-devel libXrandr-devel libXinerama-devel libXi-devel libGL-devel libXxf86vm-devel

you may also need to install C/C++ compiler (like g++) if it isn't already installed. Follow go compiler prompts.

Then, a simple go build will work.

Cross-compiling is a bit more complicated. Let's say that you want to build for arm64. This is what you would need to do:

sudo dpkg --add-architecture arm64
sudo apt update
sudo apt install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu \
    libx11-dev:arm64 libxcursor-dev:arm64 libxrandr-dev:arm64 libxinerama-dev:arm64 libxi-dev:arm64 libglx-dev:arm64 libgl1-mesa-dev:arm64 libxxf86vm-dev:arm64
GOOS=linux GOARCH=arm64 CGO_ENABLED=1 CC=aarch64-linux-gnu-gcc CXX=aarch64-linux-gnu-g++ HOST=aarch64-linux-gnu go build -v

Deploying

Build MacOS version on MacOS
go build -ldflags "-s -w" .
Build Windows version on Windows
go build -ldflags "-s -w -H=windowsgui -extldflags=-static" .
Build Windows version on MacOS/Linux
  1. Install mingw-64.

on Mac:

brew install mingw-w64

on Linux:

sudo dnf install mingw64-gcc mingw64-gcc-c++ mingw64-winpthreads-static
  1. Prepare and embed the application icon into the executable and build.
cat > YourExeName.rc << EOL
id ICON "./res/app_win.ico"
GLFW_ICON ICON "./res/app_win.ico"
EOL

x86_64-w64-mingw32-windres YourExeName.rc -O coff -o YourExeName.syso
GOOS=windows GOARCH=amd64 CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ HOST=x86_64-w64-mingw32 go build -ldflags "-s -w -H=windowsgui -extldflags=-static" -p 4 -v -o YourExeName.exe

rm YourExeName.syso
rm YourExeName.rc

Contribution

All kinds of pull requests (document, demo, screenshots, code, etc.) are more than welcome!

Star History

Star History Chart

Documentation

Overview

Package giu - A rapid cross-platform GUI framework for Go based on Dear ImGui and the great Go binding imgui-go.

for details and usage see README of the project.

Index

Constants

View Source
const (
	DirectionLeft  = Direction(imgui.DirLeft)
	DirectionRight = Direction(imgui.DirRight)
	DirectionUp    = Direction(imgui.DirUp)
	DirectionDown  = Direction(imgui.DirDown)
)

directions.

View Source
const (
	// InputTextFlagsNone sets everything default.
	InputTextFlagsNone = InputTextFlags(imgui.InputTextFlagsNone)
	// InputTextFlagsCharsDecimal allows 0123456789.+-.
	InputTextFlagsCharsDecimal = InputTextFlags(imgui.InputTextFlagsCharsDecimal)
	// InputTextFlagsCharsHexadecimal allow 0123456789ABCDEFabcdef.
	InputTextFlagsCharsHexadecimal = InputTextFlags(imgui.InputTextFlagsCharsHexadecimal)
	// InputTextFlagsCharsUppercase turns a..z into A..Z.
	InputTextFlagsCharsUppercase = InputTextFlags(imgui.InputTextFlagsCharsUppercase)
	// InputTextFlagsCharsNoBlank filters out spaces, tabs.
	InputTextFlagsCharsNoBlank = InputTextFlags(imgui.InputTextFlagsCharsNoBlank)
	// InputTextFlagsAutoSelectAll selects entire text when first taking mouse focus.
	InputTextFlagsAutoSelectAll = InputTextFlags(imgui.InputTextFlagsAutoSelectAll)
	// InputTextFlagsEnterReturnsTrue returns 'true' when Enter is pressed (as opposed to when the value was modified).
	InputTextFlagsEnterReturnsTrue = InputTextFlags(imgui.InputTextFlagsEnterReturnsTrue)
	// InputTextFlagsCallbackCompletion for callback on pressing TAB (for completion handling).
	InputTextFlagsCallbackCompletion = InputTextFlags(imgui.InputTextFlagsCallbackCompletion)
	// InputTextFlagsCallbackHistory for callback on pressing Up/Down arrows (for history handling).
	InputTextFlagsCallbackHistory = InputTextFlags(imgui.InputTextFlagsCallbackHistory)
	// InputTextFlagsCallbackAlways for callback on each iteration. User code may query cursor position, modify text buffer.
	InputTextFlagsCallbackAlways = InputTextFlags(imgui.InputTextFlagsCallbackAlways)
	// InputTextFlagsCallbackCharFilter for callback on character inputs to replace or discard them.
	// Modify 'EventChar' to replace or discard, or return 1 in callback to discard.
	InputTextFlagsCallbackCharFilter = InputTextFlags(imgui.InputTextFlagsCallbackCharFilter)
	// InputTextFlagsAllowTabInput when pressing TAB to input a '\t' character into the text field.
	InputTextFlagsAllowTabInput = InputTextFlags(imgui.InputTextFlagsAllowTabInput)
	// InputTextFlagsCtrlEnterForNewLine in multi-line mode, unfocus with Enter, add new line with Ctrl+Enter
	// (default is opposite: unfocus with Ctrl+Enter, add line with Enter).
	InputTextFlagsCtrlEnterForNewLine = InputTextFlags(imgui.InputTextFlagsCtrlEnterForNewLine)
	// InputTextFlagsNoHorizontalScroll disables following the cursor horizontally.
	InputTextFlagsNoHorizontalScroll = InputTextFlags(imgui.InputTextFlagsNoHorizontalScroll)

	// InputTextFlagsReadOnly sets read-only mode.
	InputTextFlagsReadOnly = InputTextFlags(imgui.InputTextFlagsReadOnly)
	// InputTextFlagsPassword sets password mode, display all characters as '*'.
	InputTextFlagsPassword = InputTextFlags(imgui.InputTextFlagsPassword)
	// InputTextFlagsNoUndoRedo disables undo/redo. Note that input text owns the text data while active,
	// if you want to provide your own undo/redo stack you need e.g. to call ClearActiveID().
	InputTextFlagsNoUndoRedo = InputTextFlags(imgui.InputTextFlagsNoUndoRedo)
	// InputTextFlagsCharsScientific allows 0123456789.+-*/eE (Scientific notation input).
	InputTextFlagsCharsScientific = InputTextFlags(imgui.InputTextFlagsCharsScientific)
)

input text flags.

View Source
const (
	// ComboFlagsNone default = 0.
	ComboFlagsNone = ComboFlags(imgui.ComboFlagsNone)
	// ComboFlagsPopupAlignLeft aligns the popup toward the left by default.
	ComboFlagsPopupAlignLeft = ComboFlags(imgui.ComboFlagsPopupAlignLeft)
	// ComboFlagsHeightSmall has maxValue ~4 items visible.
	// Tip: If you want your combo popup to be a specific size you can use SetNextWindowSizeConstraints() prior to calling BeginCombo().
	ComboFlagsHeightSmall = ComboFlags(imgui.ComboFlagsHeightSmall)
	// ComboFlagsHeightRegular has maxValue ~8 items visible (default).
	ComboFlagsHeightRegular = ComboFlags(imgui.ComboFlagsHeightRegular)
	// ComboFlagsHeightLarge has maxValue ~20 items visible.
	ComboFlagsHeightLarge = ComboFlags(imgui.ComboFlagsHeightLarge)
	// ComboFlagsHeightLargest has as many fitting items as possible.
	ComboFlagsHeightLargest = ComboFlags(imgui.ComboFlagsHeightLargest)
	// ComboFlagsNoArrowButton displays on the preview box without the square arrow button.
	ComboFlagsNoArrowButton = ComboFlags(imgui.ComboFlagsNoArrowButton)
	// ComboFlagsNoPreview displays only a square arrow button.
	ComboFlagsNoPreview = ComboFlags(imgui.ComboFlagsNoPreview)
)

combo flags list.

View Source
const (
	// SelectableFlagsNone default = 0.
	SelectableFlagsNone = SelectableFlags(imgui.SelectableFlagsNone)
	// SelectableFlagsDontClosePopups makes clicking the selectable not close any parent popup windows.
	SelectableFlagsDontClosePopups = SelectableFlags(imgui.SelectableFlagsNoAutoClosePopups)
	// SelectableFlagsSpanAllColumns allows the selectable frame to span all columns (text will still fit in current column).
	SelectableFlagsSpanAllColumns = SelectableFlags(imgui.SelectableFlagsSpanAllColumns)
	// SelectableFlagsAllowDoubleClick generates press events on double clicks too.
	SelectableFlagsAllowDoubleClick = SelectableFlags(imgui.SelectableFlagsAllowDoubleClick)
	// SelectableFlagsDisabled disallows selection and displays text in a greyed out color.
	SelectableFlagsDisabled = SelectableFlags(imgui.SelectableFlagsDisabled)
)

selectable flags list.

View Source
const (
	// TabItemFlagsNone default = 0.
	TabItemFlagsNone = TabItemFlags(imgui.TabItemFlagsNone)
	// TabItemFlagsUnsavedDocument Append '*' to title without affecting the ID, as a convenience to avoid using the
	// ### operator. Also: tab is selected on closure and closure is deferred by one frame to allow code to undo it
	// without flicker.
	TabItemFlagsUnsavedDocument = TabItemFlags(imgui.TabItemFlagsUnsavedDocument)
	// TabItemFlagsSetSelected Trigger flag to programmatically make the tab selected when calling BeginTabItem().
	TabItemFlagsSetSelected = TabItemFlags(imgui.TabItemFlagsSetSelected)
	// TabItemFlagsNoCloseWithMiddleMouseButton  Disable behavior of closing tabs (that are submitted with
	// p_open != NULL) with middle mouse button. You can still repro this behavior on user's side with if
	// (IsItemHovered() && IsMouseClicked(2)) *p_open = false.
	TabItemFlagsNoCloseWithMiddleMouseButton = TabItemFlags(imgui.TabItemFlagsNoCloseWithMiddleMouseButton)
)

tab item flags list.

View Source
const (
	// TabBarFlagsNone default = 0.
	TabBarFlagsNone = TabBarFlags(imgui.TabBarFlagsNone)
	// TabBarFlagsReorderable Allow manually dragging tabs to re-order them + New tabs are appended at the end of list.
	TabBarFlagsReorderable = TabBarFlags(imgui.TabBarFlagsReorderable)
	// TabBarFlagsAutoSelectNewTabs Automatically select new tabs when they appear.
	TabBarFlagsAutoSelectNewTabs = TabBarFlags(imgui.TabBarFlagsAutoSelectNewTabs)
	// TabBarFlagsTabListPopupButton Disable buttons to open the tab list popup.
	TabBarFlagsTabListPopupButton = TabBarFlags(imgui.TabBarFlagsTabListPopupButton)
	// TabBarFlagsNoCloseWithMiddleMouseButton Disable behavior of closing tabs (that are submitted with p_open != NULL)
	// with middle mouse button. You can still repro this behavior on user's side with if
	// (IsItemHovered() && IsMouseClicked(2)) *p_open = false.
	TabBarFlagsNoCloseWithMiddleMouseButton = TabBarFlags(imgui.TabBarFlagsNoCloseWithMiddleMouseButton)
	// TabBarFlagsNoTabListScrollingButtons Disable scrolling buttons (apply when fitting policy is
	// TabBarFlagsFittingPolicyScroll).
	TabBarFlagsNoTabListScrollingButtons = TabBarFlags(imgui.TabBarFlagsNoTabListScrollingButtons)
	// TabBarFlagsNoTooltip Disable tooltips when hovering a tab.
	TabBarFlagsNoTooltip = TabBarFlags(imgui.TabBarFlagsNoTooltip)
	// TabBarFlagsFittingPolicyResizeDown Resize tabs when they don't fit.
	TabBarFlagsFittingPolicyResizeDown = TabBarFlags(imgui.TabBarFlagsFittingPolicyResizeDown)
	// TabBarFlagsFittingPolicyScroll Add scroll buttons when tabs don't fit.
	TabBarFlagsFittingPolicyScroll = TabBarFlags(imgui.TabBarFlagsFittingPolicyScroll)
	// TabBarFlagsFittingPolicyMask combines
	// TabBarFlagsFittingPolicyResizeDown and TabBarFlagsFittingPolicyScroll.
	TabBarFlagsFittingPolicyMask = TabBarFlags(imgui.TabBarFlagsFittingPolicyMask)
	// TabBarFlagsFittingPolicyDefault alias for TabBarFlagsFittingPolicyResizeDown.
	TabBarFlagsFittingPolicyDefault = TabBarFlags(imgui.TabBarFlagsFittingPolicyDefault)
)

tab bar flags list.

View Source
const (
	// TreeNodeFlagsNone default = 0.
	TreeNodeFlagsNone = TreeNodeFlags(imgui.TreeNodeFlagsNone)
	// TreeNodeFlagsSelected draws as selected.
	TreeNodeFlagsSelected = TreeNodeFlags(imgui.TreeNodeFlagsSelected)
	// TreeNodeFlagsFramed draws full colored frame (e.g. for CollapsingHeader).
	TreeNodeFlagsFramed = TreeNodeFlags(imgui.TreeNodeFlagsFramed)
	// TreeNodeFlagsAllowItemOverlap hit testing to allow subsequent widgets to overlap this one.
	TreeNodeFlagsAllowItemOverlap = TreeNodeFlags(imgui.TreeNodeFlagsAllowOverlap)
	// TreeNodeFlagsNoTreePushOnOpen doesn't do a TreePush() when open
	// (e.g. for CollapsingHeader) = no extra indent nor pushing on ID stack.
	TreeNodeFlagsNoTreePushOnOpen = TreeNodeFlags(imgui.TreeNodeFlagsNoTreePushOnOpen)
	// TreeNodeFlagsNoAutoOpenOnLog doesn't automatically and temporarily open node when Logging is active
	// (by default logging will automatically open tree nodes).
	TreeNodeFlagsNoAutoOpenOnLog = TreeNodeFlags(imgui.TreeNodeFlagsNoAutoOpenOnLog)
	// TreeNodeFlagsDefaultOpen defaults node to be open.
	TreeNodeFlagsDefaultOpen = TreeNodeFlags(imgui.TreeNodeFlagsDefaultOpen)
	// TreeNodeFlagsOpenOnDoubleClick needs double-click to open node.
	TreeNodeFlagsOpenOnDoubleClick = TreeNodeFlags(imgui.TreeNodeFlagsOpenOnDoubleClick)
	// TreeNodeFlagsOpenOnArrow opens only when clicking on the arrow part.
	// If TreeNodeFlagsOpenOnDoubleClick is also set, single-click arrow or double-click all box to open.
	TreeNodeFlagsOpenOnArrow = TreeNodeFlags(imgui.TreeNodeFlagsOpenOnArrow)
	// TreeNodeFlagsLeaf allows no collapsing, no arrow (use as a convenience for leaf nodes).
	TreeNodeFlagsLeaf = TreeNodeFlags(imgui.TreeNodeFlagsLeaf)
	// TreeNodeFlagsBullet displays a bullet instead of an arrow.
	TreeNodeFlagsBullet = TreeNodeFlags(imgui.TreeNodeFlagsBullet)
	// TreeNodeFlagsFramePadding uses FramePadding (even for an unframed text node) to
	// vertically align text baseline to regular widget height. Equivalent to calling AlignTextToFramePadding().
	TreeNodeFlagsFramePadding = TreeNodeFlags(imgui.TreeNodeFlagsFramePadding)
	// TreeNodeFlagsSpanAvailWidth extends hit box to the right-most edge, even if not framed.
	// This is not the default in order to allow adding other items on the same line.
	// In the future we may refactor the hit system to be front-to-back, allowing natural overlaps
	// and then this can become the default.
	TreeNodeFlagsSpanAvailWidth = TreeNodeFlags(imgui.TreeNodeFlagsSpanAvailWidth)
	// TreeNodeFlagsSpanFullWidth extends hit box to the left-most and right-most edges (bypass the indented area).
	TreeNodeFlagsSpanFullWidth = TreeNodeFlags(imgui.TreeNodeFlagsSpanFullWidth)
	// TreeNodeFlagsNavLeftJumpsBackHere (WIP) Nav: left direction may move to this TreeNode() from any of its child
	// (items submitted between TreeNode and TreePop).
	TreeNodeFlagsNavLeftJumpsBackHere = TreeNodeFlags(imgui.TreeNodeFlagsNavLeftJumpsBackHere)
	// TreeNodeFlagsCollapsingHeader combines TreeNodeFlagsFramed and TreeNodeFlagsNoAutoOpenOnLog.
	TreeNodeFlagsCollapsingHeader = TreeNodeFlags(imgui.TreeNodeFlagsCollapsingHeader)
)

tree node flags list.

View Source
const (
	FocusedFlagsNone             = (imgui.FocusedFlagsNone)
	FocusedFlagsChildWindows     = (imgui.FocusedFlagsChildWindows)   // Return true if any children of the window is focused
	FocusedFlagsRootWindow       = (imgui.FocusedFlagsRootWindow)     // Test from root window (top most parent of the current hierarchy)
	FocusedFlagsAnyWindow        = (imgui.FocusedFlagsAnyWindow)      // Return true if any window is focused. Important: If you are trying to tell how to dispatch your low-level inputs do NOT use this. Use 'io.WantCaptureMouse' instead! Please read the FAQ!
	FocusedFlagsNoPopupHierarchy = imgui.FocusedFlagsNoPopupHierarchy // Do not consider popup hierarchy (do not treat popup emitter as parent of popup) (when used with ChildWindows or RootWindow)
	// FocusedFlagsDockHierarchy               = 1 << 4   // Consider docking hierarchy (treat dockspace host as parent of docked window) (when used with ChildWindows or RootWindow).
	FocusedFlagsRootAndChildWindows = imgui.FocusedFlagsRootAndChildWindows
)

focused flags list.

View Source
const (
	// HoveredFlagsNone Return true if directly over the item/window, not obstructed by another window,
	// not obstructed by an active popup or modal blocking inputs under them.
	HoveredFlagsNone = HoveredFlags(imgui.HoveredFlagsNone)
	// HoveredFlagsChildWindows IsWindowHovered() only: Return true if any children of the window is hovered.
	HoveredFlagsChildWindows = HoveredFlags(imgui.HoveredFlagsChildWindows)
	// HoveredFlagsRootWindow IsWindowHovered() only: Test from root window (top most parent of the current hierarchy).
	HoveredFlagsRootWindow = HoveredFlags(imgui.HoveredFlagsRootWindow)
	// HoveredFlagsAnyWindow IsWindowHovered() only: Return true if any window is hovered.
	HoveredFlagsAnyWindow = HoveredFlags(imgui.HoveredFlagsAnyWindow)
	// HoveredFlagsAllowWhenBlockedByPopup Return true even if a popup window is normally blocking access to this item/window.
	HoveredFlagsAllowWhenBlockedByPopup = HoveredFlags(imgui.HoveredFlagsAllowWhenBlockedByPopup)
	// HoveredFlagsAllowWhenBlockedByActiveItem Return true even if an active item is blocking access to this item/window.
	// Useful for Drag and Drop patterns.
	HoveredFlagsAllowWhenBlockedByActiveItem = HoveredFlags(imgui.HoveredFlagsAllowWhenBlockedByActiveItem)
	// HoveredFlagsAllowWhenOverlapped Return true even if the position is overlapped by another window.
	HoveredFlagsAllowWhenOverlapped = HoveredFlags(imgui.HoveredFlagsAllowWhenOverlapped)
	// HoveredFlagsAllowWhenDisabled Return true even if the item is disabled.
	HoveredFlagsAllowWhenDisabled = HoveredFlags(imgui.HoveredFlagsAllowWhenDisabled)
)

hovered flags list.

View Source
const (
	SliderFlagsNone = SliderFlags(imgui.SliderFlagsNone)
	// Clamp value to minValue/maxValue bounds when input manually with CTRL+Click. By default CTRL+Click allows going out of bounds.
	SliderFlagsAlwaysClamp = SliderFlags(imgui.SliderFlagsAlwaysClamp)
	// Make the widget logarithmic (linear otherwise). Consider using ImGuiSliderFlagsNoRoundToFormat = SliderFlags(imgui.SliderFlagsNoRoundToFormat)
	// a format-string with small amount of digits.
	SliderFlagsLogarithmic = SliderFlags(imgui.SliderFlagsLogarithmic)
	// Disable rounding underlying value to match precision of the display format string (e.g. %.3f values are rounded to those 3 digits).
	SliderFlagsNoRoundToFormat = SliderFlags(imgui.SliderFlagsNoRoundToFormat)
	// Disable CTRL+Click or Enter key allowing to input text directly into the widget.
	SliderFlagsNoInput = SliderFlags(imgui.SliderFlagsNoInput)
	// [Internal] We treat using those bits as being potentially a 'float power' argument from the previous API that has got miscast
	// to this enum, and will trigger an assert if needed.
	SliderFlagsInvalidMask = SliderFlags(imgui.SliderFlagsInvalidMask)
)

slider flags.

View Source
const (
	PlotFlagsNone        = PlotFlags(implot.FlagsNone)
	PlotFlagsNoTitle     = PlotFlags(implot.FlagsNoTitle)
	PlotFlagsNoLegend    = PlotFlags(implot.FlagsNoLegend)
	PlotFlagsNoMenus     = PlotFlags(implot.FlagsNoMenus)
	PlotFlagsNoBoxSelect = PlotFlags(implot.FlagsNoBoxSelect)
	// 	PlotFlagsNoMousePos  = PlotFlags(implot.FlagsNoMousePos)
	// 	PlotFlagsNoHighlight = PlotFlags(implot.FlagsNoHighlight)
	// PlotFlagsNoChild = PlotFlags(implot.FlagsNoChild).
	PlotFlagsEqual = PlotFlags(implot.FlagsEqual)
	// 	PlotFlagsYAxis2      = PlotFlags(implot.FlagsYAxis2)
	// 	PlotFlagsYAxis3      = PlotFlags(implot.FlagsYAxis3)
	// 	PlotFlagsQuery       = PlotFlags(implot.FlagsQuery)
	PlotFlagsCrosshairs = PlotFlags(implot.FlagsCrosshairs)
	// 	PlotFlagsAntiAliased = PlotFlags(implot.FlagsAntiAliased)
	PlotFlagsCanvasOnly = PlotFlags(implot.FlagsCanvasOnly)
)

plot flags.

View Source
const (
	KeyNone           = Key(imgui.KeyNone)
	KeySpace          = Key(imgui.KeySpace)
	KeyApostrophe     = Key(imgui.KeyApostrophe)
	KeyComma          = Key(imgui.KeyComma)
	KeyMinus          = Key(imgui.KeyMinus)
	KeyPeriod         = Key(imgui.KeyPeriod)
	KeySlash          = Key(imgui.KeySlash)
	Key0              = Key(imgui.Key0)
	Key1              = Key(imgui.Key1)
	Key2              = Key(imgui.Key2)
	Key3              = Key(imgui.Key3)
	Key4              = Key(imgui.Key4)
	Key5              = Key(imgui.Key5)
	Key6              = Key(imgui.Key6)
	Key7              = Key(imgui.Key7)
	Key8              = Key(imgui.Key8)
	Key9              = Key(imgui.Key9)
	KeySemicolon      = Key(imgui.KeySemicolon)
	KeyEqual          = Key(imgui.KeyEqual)
	KeyA              = Key(imgui.KeyA)
	KeyB              = Key(imgui.KeyB)
	KeyC              = Key(imgui.KeyC)
	KeyD              = Key(imgui.KeyD)
	KeyE              = Key(imgui.KeyE)
	KeyF              = Key(imgui.KeyF)
	KeyG              = Key(imgui.KeyG)
	KeyH              = Key(imgui.KeyH)
	KeyI              = Key(imgui.KeyI)
	KeyJ              = Key(imgui.KeyJ)
	KeyK              = Key(imgui.KeyK)
	KeyL              = Key(imgui.KeyL)
	KeyM              = Key(imgui.KeyM)
	KeyN              = Key(imgui.KeyN)
	KeyO              = Key(imgui.KeyO)
	KeyP              = Key(imgui.KeyP)
	KeyQ              = Key(imgui.KeyQ)
	KeyR              = Key(imgui.KeyR)
	KeyS              = Key(imgui.KeyS)
	KeyT              = Key(imgui.KeyT)
	KeyU              = Key(imgui.KeyU)
	KeyV              = Key(imgui.KeyV)
	KeyW              = Key(imgui.KeyW)
	KeyX              = Key(imgui.KeyX)
	KeyY              = Key(imgui.KeyY)
	KeyZ              = Key(imgui.KeyZ)
	KeyLeftBracket    = Key(imgui.KeyLeftBracket)
	KeyBackslash      = Key(imgui.KeyBackslash)
	KeyRightBracket   = Key(imgui.KeyRightBracket)
	KeyGraveAccent    = Key(imgui.KeyGraveAccent)
	KeyEscape         = Key(imgui.KeyEscape)
	KeyEnter          = Key(imgui.KeyEnter)
	KeyTab            = Key(imgui.KeyTab)
	KeyBackspace      = Key(imgui.KeyBackspace)
	KeyInsert         = Key(imgui.KeyInsert)
	KeyDelete         = Key(imgui.KeyDelete)
	KeyRight          = Key(imgui.KeyRightArrow)
	KeyLeft           = Key(imgui.KeyLeftArrow)
	KeyDown           = Key(imgui.KeyDownArrow)
	KeyUp             = Key(imgui.KeyUpArrow)
	KeyPageUp         = Key(imgui.KeyPageUp)
	KeyPageDown       = Key(imgui.KeyPageDown)
	KeyHome           = Key(imgui.KeyHome)
	KeyEnd            = Key(imgui.KeyEnd)
	KeyCapsLock       = Key(imgui.KeyCapsLock)
	KeyScrollLock     = Key(imgui.KeyScrollLock)
	KeyNumLock        = Key(imgui.KeyNumLock)
	KeyPrintScreen    = Key(imgui.KeyPrintScreen)
	KeyPause          = Key(imgui.KeyPause)
	KeyF1             = Key(imgui.KeyF1)
	KeyF2             = Key(imgui.KeyF2)
	KeyF3             = Key(imgui.KeyF3)
	KeyF4             = Key(imgui.KeyF4)
	KeyF5             = Key(imgui.KeyF5)
	KeyF6             = Key(imgui.KeyF6)
	KeyF7             = Key(imgui.KeyF7)
	KeyF8             = Key(imgui.KeyF8)
	KeyF9             = Key(imgui.KeyF9)
	KeyF10            = Key(imgui.KeyF10)
	KeyF11            = Key(imgui.KeyF11)
	KeyF12            = Key(imgui.KeyF12)
	KeyNumPad0        = Key(glfwbackend.GLFWKeyKp0)
	KeyNumPad1        = Key(glfwbackend.GLFWKeyKp1)
	KeyNumPad2        = Key(glfwbackend.GLFWKeyKp2)
	KeyNumPad3        = Key(glfwbackend.GLFWKeyKp3)
	KeyNumPad4        = Key(glfwbackend.GLFWKeyKp4)
	KeyNumPad5        = Key(glfwbackend.GLFWKeyKp5)
	KeyNumPad6        = Key(glfwbackend.GLFWKeyKp6)
	KeyNumPad7        = Key(glfwbackend.GLFWKeyKp7)
	KeyNumPad8        = Key(glfwbackend.GLFWKeyKp8)
	KeyNumPad9        = Key(glfwbackend.GLFWKeyKp9)
	KeyNumPadDecimal  = Key(glfwbackend.GLFWKeyKpDecimal)
	KeyNumPadDivide   = Key(glfwbackend.GLFWKeyKpDivide)
	KeyNumPadMultiply = Key(glfwbackend.GLFWKeyKpMultiply)
	KeyNumPadSubtract = Key(glfwbackend.GLFWKeyKpSubtract)
	KeyNumPadAdd      = Key(glfwbackend.GLFWKeyKpAdd)
	KeyNumPadEnter    = Key(glfwbackend.GLFWKeyKpEnter)
	KeyNumPadEqual    = Key(glfwbackend.GLFWKeyKpEqual)
	KeyLeftShift      = Key(imgui.KeyLeftShift)
	KeyLeftControl    = Key(imgui.KeyLeftCtrl)
	KeyLeftAlt        = Key(imgui.KeyLeftAlt)
	KeyLeftSuper      = Key(imgui.KeyLeftSuper)
	KeyRightShift     = Key(imgui.KeyRightShift)
	KeyRightControl   = Key(imgui.KeyRightCtrl)
	KeyRightAlt       = Key(imgui.KeyRightAlt)
	KeyRightSuper     = Key(imgui.KeyRightSuper)
	KeyMenu           = Key(imgui.KeyMenu)
	KeyWorld1         = Key(glfwbackend.GLFWKeyWorld1)
	KeyWorld2         = Key(glfwbackend.GLFWKeyWorld2)
	KeyUnknown        = Key(-1)
)

These key codes are inspired by the USB HID Usage Tables v1.12 (p. 53-60), but re-arranged to map to 7-bit ASCII for printable keys (function keys are put in the 256+ range).

modifier keys.

View Source
const (
	DialogResultOK     DialogResult = true
	DialogResultCancel DialogResult = false

	DialogResultYes = DialogResultOK
	DialogResultNo  = DialogResultCancel
)

dialog results.

View Source
const (
	AxisX1 = implot.AxisX1
	AxisX2 = implot.AxisX2
	AxisX3 = implot.AxisX3
	AxisY1 = implot.AxisY1
	AxisY2 = implot.AxisY2
	AxisY3 = implot.AxisY3
)

Available axes.

View Source
const (
	// MouseCursorNone no mouse cursor.
	MouseCursorNone = MouseCursorType(imgui.MouseCursorNone)
	// MouseCursorArrow standard arrow mouse cursor.
	MouseCursorArrow = MouseCursorType(imgui.MouseCursorArrow)
	// MouseCursorTextInput when hovering over InputText, etc.
	MouseCursorTextInput = MouseCursorType(imgui.MouseCursorTextInput)
	// MouseCursorResizeAll (Unused by imgui functions).
	MouseCursorResizeAll = MouseCursorType(imgui.MouseCursorResizeAll)
	// MouseCursorResizeNS when hovering over an horizontal border.
	MouseCursorResizeNS = MouseCursorType(imgui.MouseCursorResizeNS)
	// MouseCursorResizeEW when hovering over a vertical border or a column.
	MouseCursorResizeEW = MouseCursorType(imgui.MouseCursorResizeEW)
	// MouseCursorResizeNESW when hovering over the bottom-left corner of a window.
	MouseCursorResizeNESW = MouseCursorType(imgui.MouseCursorResizeNESW)
	// MouseCursorResizeNWSE when hovering over the bottom-right corner of a window.
	MouseCursorResizeNWSE = MouseCursorType(imgui.MouseCursorResizeNWSE)
	// MouseCursorHand (Unused by imgui functions. Use for e.g. hyperlinks).
	MouseCursorHand  = MouseCursorType(imgui.MouseCursorHand)
	MouseCursorCount = MouseCursorType(imgui.MouseCursorCOUNT)
)

cursor types.

View Source
const (
	TextureFilterNearest = iota
	TextureFilterLinear
	TextureFilterNearestMipmapNearest
	TextureFilterLinearMipmapNearest
	TextureFilterNearestMipmapLinear
	TextureFilterLinearMipmapLinear
)

Texture filtering types.

View Source
const (
	// Auto is used to widget.Size to indicate height or width to occupy available spaces.
	Auto float32 = -1
)

Variables

View Source
var ErrIsLoading = errors.New("cannot reset surface state while loading")

ErrIsLoading is an error indicating that the surface state cannot be reset while loading.

View Source
var ErrNeedReset = errors.New("cannot load surface without a reset. Should call (*StatefulReflectiveBoundTexture).ResetState()")

ErrNeedReset is an error indicating that the surface cannot be loaded without a reset. The method (*StatefulReflectiveBoundTexture).ResetState() should be called.

View Source
var ErrNilRGBA = errors.New("surface RGBA Result is nil")

ErrNilRGBA is an error that indicates the RGBA surface result is nil.

Functions

func AlignTextToFramePadding

func AlignTextToFramePadding()

AlignTextToFramePadding vertically aligns upcoming text baseline to FramePadding.y so that it will align properly to regularly framed items. Call if you have text on a line before a framed item.

func Assert added in v0.6.0

func Assert(cond bool, t, method, msg string, args ...any)

Assert checks if cond. If not cond, it alls golang panic.

func CalcTextSize

func CalcTextSize(text string) (width, height float32)

CalcTextSize calls CalcTextSizeV(text, false, -1).

func CalcTextSizeV added in v0.6.0

func CalcTextSizeV(text string, hideAfterDoubleHash bool, wrapWidth float32) (w, h float32)

CalcTextSizeV calculates text dimensions.

func CloseCurrentPopup

func CloseCurrentPopup()

CloseCurrentPopup closes currently opened popup. If no popups opened, no action will be taken.

func ColorToUint added in v0.8.0

func ColorToUint(col color.Color) uint32

ColorToUint converts GO color into Uint32 color it is 0xRRGGBBAA.

func Deg2Rad added in v0.10.0

func Deg2Rad(deg float32) float32

Deg2Rad converts degrees to radians.

func EnqueueNewTextureFromRgba added in v0.6.2

func EnqueueNewTextureFromRgba(rgba image.Image, loadCb func(t *Texture))

EnqueueNewTextureFromRgba adds loading texture request to loading queue it allows us to run this method in main loop NOTE: remember to call it after NewMasterWindow!

func GetAvailableRegion added in v0.5.5

func GetAvailableRegion() (width, height float32)

GetAvailableRegion returns region available for rendering. it is always WindowSize-WindowPadding*2.

func GetCursorPos

func GetCursorPos() image.Point

GetCursorPos gets imgui drawing cursor inside of current window.

func GetCursorScreenPos

func GetCursorScreenPos() image.Point

GetCursorScreenPos returns imgui drawing cursor on the screen.

func GetFramePadding

func GetFramePadding() (x, y float32)

GetFramePadding returns current frame padding.

func GetItemInnerSpacing

func GetItemInnerSpacing() (w, h float32)

GetItemInnerSpacing returns current item inner spacing.

func GetItemSpacing added in v0.4.2

func GetItemSpacing() (w, h float32)

GetItemSpacing returns current item spacing.

func GetMousePos added in v0.4.1

func GetMousePos() image.Point

GetMousePos returns mouse position.

func GetState added in v0.7.0

func GetState[T any, PT genericDisposable[T]](c *GIUContext, id ID) PT

GetState is a generic version of Context.GetState.

func GetWidgetWidth added in v0.6.0

func GetWidgetWidth(w Widget) (result float32)

GetWidgetWidth returns a width of widget NOTE: THIS IS A BETA SOLUTION and may contain bugs in most cases, you may want to use supported by imgui GetItemRectSize. There is an upstream issue for this problem: https://github.com/ocornut/imgui/issues/3714

This function is just a workaround used in giu.

NOTE: user-defined widgets, which contains more than one giu widget will be processed incorrectly (only width of the last built widget will be processed)

here is a list of known bugs:

if you find anything else, please report it on https://github.com/AllenDang/giu Any contribution is appreciated!

func GetWindowPadding

func GetWindowPadding() (x, y float32)

GetWindowPadding returns window padding.

func ImageToRgba added in v0.6.0

func ImageToRgba(img image.Image) *image.RGBA

ImageToRgba converts image.Image to *image.RGBA.

func IsItemActive

func IsItemActive() bool

IsItemActive returns true if item is active.

func IsItemClicked added in v0.5.0

func IsItemClicked(mouseButton MouseButton) bool

IsItemClicked returns true if mouse is clicked NOTE: if you're looking for clicking detection, see EventHandler.go.

func IsItemHovered

func IsItemHovered() bool

IsItemHovered returns true if mouse is over the item.

func IsKeyDown

func IsKeyDown(key Key) bool

IsKeyDown returns true if key `key` is down.

func IsKeyPressed

func IsKeyPressed(key Key) bool

IsKeyPressed returns true if key `key` is pressed.

func IsKeyReleased

func IsKeyReleased(key Key) bool

IsKeyReleased returns true if key `key` is released.

func IsMouseClicked

func IsMouseClicked(button MouseButton) bool

IsMouseClicked returns true if mouse button `button` is clicked NOTE: if you're looking for clicking detection, see EventHandler.go.

func IsMouseDoubleClicked

func IsMouseDoubleClicked(button MouseButton) bool

IsMouseDoubleClicked returns true if mouse button `button` is double clicked.

func IsMouseDown

func IsMouseDown(button MouseButton) bool

IsMouseDown returns true if mouse button `button` is down.

func IsMouseReleased

func IsMouseReleased(button MouseButton) bool

IsMouseReleased returns true if mouse button `button` is released.

func IsWindowAppearing

func IsWindowAppearing() bool

IsWindowAppearing returns true if window is appearing.

func IsWindowCollapsed added in v0.4.1

func IsWindowCollapsed() bool

IsWindowCollapsed returns true if window is disappearing.

func IsWindowFocused added in v0.4.1

func IsWindowFocused(flags FocusedFlags) bool

IsWindowFocused returns true if window is focused NOTE: see also (*Window).HasFocus and (*Window).BringToFront.

func IsWindowHovered added in v0.4.1

func IsWindowHovered(flags HoveredFlags) bool

IsWindowHovered returns true if the window is hovered.

func LoadImage

func LoadImage(imgPath string) (*image.RGBA, error)

LoadImage loads image from file and returns *image.RGBA.

func NewTextureFromRgba

func NewTextureFromRgba(rgba image.Image, loadCallback func(*Texture))

NewTextureFromRgba creates a new texture from image.Image and, when it is done, calls loadCallback(loadedTexture).

func OpenPopup

func OpenPopup(name string)

OpenPopup opens a popup with specified id. NOTE: you need to build this popup first (see Pop(Modal)Widget).

func OpenURL added in v0.6.0

func OpenURL(url string)

OpenURL opens `url` in default browser.

func PNGToRgba added in v0.9.0

func PNGToRgba(file fs.File) (*image.RGBA, error)

PNGToRgba loads image file interface and assume caller takes care of interface proper closing.

func ParseCSSStyleSheet added in v0.7.0

func ParseCSSStyleSheet(data []byte) error

ParseCSSStyleSheet parses CSS stylesheet and stores the rules in giu context.

func PopClipRect added in v0.4.2

func PopClipRect()

PopClipRect should be called to end PushClipRect.

func PopFont

func PopFont()

PopFont pops the font (should be called after PushFont).

func PopItemWidth

func PopItemWidth()

PopItemWidth should be called to stop applying PushItemWidth effect If it isn't called imgui will panic.

func PopStyle

func PopStyle()

PopStyle should be called to stop applying style. It should be called as many times, as you called PushStyle... NOTE: If you don't call PopStyle imgui will panic.

func PopStyleColor

func PopStyleColor()

PopStyleColor is used to stop applying colors styles. It should be called after each PushStyleColor... (for each push) If PopStyleColor wasn't called after PushColor... or was called improperly, imgui will panic.

func PopStyleColorV

func PopStyleColorV(count int)

PopStyleColorV does similar to PopStyleColor, but allows to specify how much style colors would you like to pop.

func PopStyleV

func PopStyleV(count int)

PopStyleV does similarly to PopStyle, but allows to specify number of styles you're going to pop.

func PopTextWrapPos

func PopTextWrapPos()

PopTextWrapPos should be called as many times as PushTextWrapPos on each frame.

func PushButtonTextAlign

func PushButtonTextAlign(width, height float32)

PushButtonTextAlign sets alignment for button text. Defaults to (0.0f,0.5f) for left-aligned,vertically centered.

func PushClipRect added in v0.4.2

func PushClipRect(clipRectMin, clipRectMax image.Point, intersectWithClipRect bool)

PushClipRect pushes a clipping rectangle for both ImGui logic (hit-testing etc.) and low-level ImDrawList rendering.

func PushColorButton

func PushColorButton(col color.Color)

PushColorButton calls PushStyleColor(StyleColorButton,...) NOTE: don't forget to call PopStyleColor()!

func PushColorButtonActive

func PushColorButtonActive(col color.Color)

PushColorButtonActive calls PushStyleColor(StyleColorButtonActive,...) NOTE: don't forget to call PopStyleColor()!

func PushColorButtonHovered

func PushColorButtonHovered(col color.Color)

PushColorButtonHovered calls PushStyleColor(StyleColorButtonHovered,...) NOTE: don't forget to call PopStyleColor()!

func PushColorFrameBg

func PushColorFrameBg(col color.Color)

PushColorFrameBg calls PushStyleColor(StyleColorFrameBg,...) NOTE: don't forget to call PopStyleColor()!

func PushColorText

func PushColorText(col color.Color)

PushColorText calls PushStyleColor(StyleColorText,...) NOTE: don't forget to call PopStyleColor()!

func PushColorTextDisabled

func PushColorTextDisabled(col color.Color)

PushColorTextDisabled calls PushStyleColor(StyleColorTextDisabled,...) NOTE: don't forget to call PopStyleColor()!

func PushColorWindowBg

func PushColorWindowBg(col color.Color)

PushColorWindowBg calls PushStyleColor(StyleColorWindowBg,...) NOTE: don't forget to call PopStyleColor()!

func PushFont

func PushFont(font *FontInfo) bool

PushFont sets font to "font" NOTE: PopFont has to be called NOTE: Don't use PushFont. use StyleSetter instead.

func PushFramePadding

func PushFramePadding(width, height float32)

PushFramePadding calls PushStyleVar(StyleFramePadding,...)

func PushItemSpacing

func PushItemSpacing(width, height float32)

PushItemSpacing calls PushStyleVar(StyleVarItemSpacing,...)

func PushItemWidth

func PushItemWidth(width float32)

PushItemWidth sets following item's widths NOTE: don't forget to call PopItemWidth! If you don't do so, imgui will panic.

func PushSelectableTextAlign

func PushSelectableTextAlign(width, height float32)

PushSelectableTextAlign sets alignment for selectable text. Defaults to (0.0f,0.5f) for left-aligned,vertically centered.

func PushStyleColor added in v0.5.5

func PushStyleColor(id StyleColorID, col color.Color)

PushStyleColor wraps imgui.PushStyleColorVec4 NOTE: don't forget to call PopStyleColor()!

func PushTextWrapPos

func PushTextWrapPos()

PushTextWrapPos adds the position, where the text should be wrapped. use PushTextWrapPos, render text. If text reaches frame end, rendering will be continued at the start pos in line below. NOTE: Don't forget to call PopWrapTextPos NOTE: it is done automatically in LabelWidget (see (*LabelWidget).Wrapped()).

func PushWindowPadding

func PushWindowPadding(width, height float32)

PushWindowPadding calls PushStyleVar(StyleWindowPadding,...)

func SameLine

func SameLine()

SameLine wraps imgui.SomeLine Don't use if you don't have to (use RowWidget instead).

func SetCursorPos added in v0.5.5

func SetCursorPos(pos image.Point)

SetCursorPos sets imgui drawing cursor inside of current window.

func SetCursorScreenPos added in v0.5.5

func SetCursorScreenPos(pos image.Point)

SetCursorScreenPos sets imgui drawing cursor on the screen.

func SetItemDefaultFocus

func SetItemDefaultFocus()

SetItemDefaultFocus set the item focused by default.

func SetKeyboardFocusHere

func SetKeyboardFocusHere()

SetKeyboardFocusHere sets keyboard focus at *NEXT* widget.

func SetKeyboardFocusHereV

func SetKeyboardFocusHereV(i int)

SetKeyboardFocusHereV sets keyboard on the next widget. Use positive 'offset' to access sub components of a multiple component widget. Use -1 to access previous widget.

func SetMouseCursor

func SetMouseCursor(cursor MouseCursorType)

SetMouseCursor sets mouse cursor layout.

func SetNextWindowPos added in v0.5.0

func SetNextWindowPos(x, y float32)

SetNextWindowPos sets position of next window.

func SetNextWindowSize

func SetNextWindowSize(width, height float32)

SetNextWindowSize sets size of the next window.

func SetNextWindowSizeV

func SetNextWindowSizeV(width, height float32, condition ExecCondition)

SetNextWindowSizeV does similar to SetNextWIndowSize but allows to specify imgui.Cond.

func SetState added in v0.7.0

func SetState[T any, PT genericDisposable[T]](c *GIUContext, id ID, data PT)

SetState is a generic version of Context.SetState.

func StyleColorIDStrings added in v0.10.0

func StyleColorIDStrings() []string

StyleColorIDStrings returns a slice of all String values of the enum

func StylePlotColorIDStrings added in v0.10.0

func StylePlotColorIDStrings() []string

StylePlotColorIDStrings returns a slice of all String values of the enum

func StylePlotVarIDStrings added in v0.10.0

func StylePlotVarIDStrings() []string

StylePlotVarIDStrings returns a slice of all String values of the enum

func StyleVarIDStrings added in v0.10.0

func StyleVarIDStrings() []string

StyleVarIDStrings returns a slice of all String values of the enum

func ToVec2

func ToVec2(pt image.Point) imgui.Vec2

ToVec2 converts image.Point to imgui.Vec2.

func ToVec4Color

func ToVec4Color(col color.Color) imgui.Vec4

ToVec4Color converts rgba color to imgui.Vec4.

func UintToColor added in v0.8.0

func UintToColor(col uint32) *color.RGBA

UintToColor converts uint32 of form 0xRRGGBB into color.RGBA.

func Update

func Update()

Update updates giu app it is done by default after each frame. However because frames stops rendering, when no user action is done, it may be necessary to Update ui manually at some point.

func Vec4ToRGBA

func Vec4ToRGBA(vec4 imgui.Vec4) color.RGBA

Vec4ToRGBA converts imgui's Vec4 to golang rgba color.

Types

type Action added in v0.7.0

type Action int

Action represents key status change type.

const (
	Release Action = iota
	Press
	Repeat
)

Actions.

type AlignmentSetter added in v0.6.0

type AlignmentSetter struct {
	// contains filtered or unexported fields
}

AlignmentSetter allows to align to right / center a widget or widgets group. NOTE: Because of AlignSetter uses experimental GetWidgetWidth, it is experimental too. usage: see examples/align

list of known bugs: - BUG: there is some bug with SelectableWidget.

func Align added in v0.6.0

func Align(at AlignmentType) *AlignmentSetter

Align sets widgets alignment.

func (*AlignmentSetter) Build added in v0.6.0

func (a *AlignmentSetter) Build()

Build implements Widget interface.

func (*AlignmentSetter) ID added in v0.6.0

func (a *AlignmentSetter) ID(id ID) *AlignmentSetter

ID allows to manually set AlignmentSetter ID NOTE: there isn't any known reason to use this method, however it is here for some random cases. YOU DON'T NEED TO USE IT in normal cases.

func (*AlignmentSetter) To added in v0.6.0

func (a *AlignmentSetter) To(widgets ...Widget) *AlignmentSetter

To sets a layout, alignment should be applied to.

type AlignmentType added in v0.6.0

type AlignmentType byte

AlignmentType represents a bype of alignment to use with AlignSetter.

const (
	// AlignLeft is here just for clarity.
	// if set, no action is taken so don't use it.
	AlignLeft AlignmentType = iota
	// AlignCenter centers widget.
	AlignCenter
	// AlignRight aligns a widget to right side of window.
	AlignRight
)

type ArrowButtonWidget added in v0.4.2

type ArrowButtonWidget struct {
	// contains filtered or unexported fields
}

ArrowButtonWidget represents a square button with an arrow.

func ArrowButton added in v0.4.2

func ArrowButton(dir Direction) *ArrowButtonWidget

ArrowButton creates ArrowButtonWidget.

func (*ArrowButtonWidget) Build added in v0.4.2

func (b *ArrowButtonWidget) Build()

Build implements Widget interface.

func (*ArrowButtonWidget) ID added in v0.6.0

ID allows to manually set widget's id.

func (*ArrowButtonWidget) OnClick added in v0.5.0

func (b *ArrowButtonWidget) OnClick(onClick func()) *ArrowButtonWidget

OnClick adds callback called when button is clicked.

type BarHPlot added in v0.7.0

type BarHPlot struct {
	// contains filtered or unexported fields
}

BarHPlot represents a column chart on Y axis.

func BarH added in v0.7.0

func BarH(title string, data []float64) *BarHPlot

BarH adds plot bars on y axis.

func (*BarHPlot) Height added in v0.7.0

func (p *BarHPlot) Height(height float64) *BarHPlot

Height sets bar height (in fact bars' width).

func (*BarHPlot) Offset added in v0.7.0

func (p *BarHPlot) Offset(offset int) *BarHPlot

Offset sets offset.

func (*BarHPlot) Plot added in v0.7.0

func (p *BarHPlot) Plot()

Plot implements plot interface.

func (*BarHPlot) Shift added in v0.7.0

func (p *BarHPlot) Shift(shift float64) *BarHPlot

Shift sets shift.

type BarPlot added in v0.7.0

type BarPlot struct {
	// contains filtered or unexported fields
}

BarPlot adds bar plot (column chart) to the canvas.

func Bar added in v0.7.0

func Bar(title string, data []float64) *BarPlot

Bar adds plot bars to the canvas.

func (*BarPlot) Offset added in v0.7.0

func (p *BarPlot) Offset(offset int) *BarPlot

Offset sets bar's offset.

func (*BarPlot) Plot added in v0.7.0

func (p *BarPlot) Plot()

Plot implements Plot interface.

func (*BarPlot) Shift added in v0.7.0

func (p *BarPlot) Shift(shift float64) *BarPlot

Shift sets shift of the bar.

func (*BarPlot) Width added in v0.7.0

func (p *BarPlot) Width(width float64) *BarPlot

Width sets bar width.

type BulletTextWidget added in v0.4.2

type BulletTextWidget struct {
	// contains filtered or unexported fields
}

BulletTextWidget does similar to BulletWidget, but allows to add a text after a bullet. Very useful to create lists.

func BulletText added in v0.4.2

func BulletText(text string) *BulletTextWidget

BulletText creates bulletTextWidget.

func BulletTextf added in v0.6.0

func BulletTextf(format string, args ...any) *BulletTextWidget

BulletTextf is a formatting version of BulletText.

func (*BulletTextWidget) Build added in v0.4.2

func (bt *BulletTextWidget) Build()

Build implements Widget interface.

type BulletWidget added in v0.4.2

type BulletWidget struct{}

BulletWidget adds a small, white dot (bullet). useful in enumerations.

func Bullet added in v0.4.2

func Bullet() *BulletWidget

Bullet creates a bullet widget.

func (*BulletWidget) Build added in v0.4.2

func (b *BulletWidget) Build()

Build implements Widget interface.

type ButtonWidget

type ButtonWidget struct {
	// contains filtered or unexported fields
}

ButtonWidget represents a ImGui button widget.

func Button

func Button(label string) *ButtonWidget

Button creates a new button widget.

func Buttonf added in v0.6.0

func Buttonf(format string, args ...any) *ButtonWidget

Buttonf creates button with formatted label NOTE: works like fmt.Sprintf (see `go doc fmt`).

func (*ButtonWidget) Build

func (b *ButtonWidget) Build()

Build implements Widget interface.

func (*ButtonWidget) Disabled added in v0.5.5

func (b *ButtonWidget) Disabled(d bool) *ButtonWidget

Disabled sets button's disabled state NOTE: same effect as Style().SetDisabled.

func (*ButtonWidget) ID added in v0.7.0

func (b *ButtonWidget) ID(id ID) *ButtonWidget

ID allows to manually set widget's id.

func (*ButtonWidget) OnClick added in v0.5.0

func (b *ButtonWidget) OnClick(onClick func()) *ButtonWidget

OnClick sets callback called when button is clicked NOTE: to set double click, see EventHandler.go.

func (*ButtonWidget) Size added in v0.5.0

func (b *ButtonWidget) Size(width, height float32) *ButtonWidget

Size sets button's size.

type CSSTagWidget added in v0.7.0

type CSSTagWidget struct {
	// contains filtered or unexported fields
}

CSSTagWidget is a widget that allows to apply CSS style to a specified layout.

func CSSTag added in v0.7.0

func CSSTag(tag string) *CSSTagWidget

CSSTag creates CSSTagWidget.

func (*CSSTagWidget) Build added in v0.7.0

func (c *CSSTagWidget) Build()

Build implements Widget interface.

func (*CSSTagWidget) To added in v0.7.0

func (c *CSSTagWidget) To(layout ...Widget) *CSSTagWidget

To specifies a layout to which the style will be applied.

type Canvas

type Canvas struct {
	DrawList *imgui.DrawList
}

Canvas represents imgui.DrawList from imgui.h:

A single draw command list (generally one per window,
conceptually you may see this as a dynamic "mesh" builder)

for more details and use cases see examples/canvas. NOTE: GetCanvas() method returns a window-level canvas, however you can convert any imgui.DrawList into this type. The best example could be imgui.GetPlotDrawList()

c := &Canvas{imgui.GetXXXDrawList()}

func GetCanvas

func GetCanvas() *Canvas

GetCanvas returns current draw list (for current window). it will fail if called out of window's layout.

func (*Canvas) AddBezierCubic added in v0.5.1

func (c *Canvas) AddBezierCubic(pos0, cp0, cp1, pos1 image.Point, col color.Color, thickness float32, numSegments int32)

AddBezierCubic draws bezier cubic.

func (*Canvas) AddCircle

func (c *Canvas) AddCircle(center image.Point, radius float32, col color.Color, segments int32, thickness float32)

AddCircle draws a circle.

func (*Canvas) AddCircleFilled

func (c *Canvas) AddCircleFilled(center image.Point, radius float32, col color.Color)

AddCircleFilled draws a filled circle.

func (*Canvas) AddImage added in v0.4.1

func (c *Canvas) AddImage(texture *Texture, pMin, pMax image.Point)

AddImage draws a textured rectangle.

func (*Canvas) AddImageQuad added in v0.8.0

func (c *Canvas) AddImageQuad(texture *Texture, p1, p2, p3, p4, uv1, uv2, uv3, uv4 image.Point, col color.Color)

AddImageQuad draws a textured on quad.

func (*Canvas) AddImageV added in v0.4.1

func (c *Canvas) AddImageV(texture *Texture, pMin, pMax, uvMin, uvMax image.Point, col color.Color)

AddImageV is more flexible version of AddImage.

func (*Canvas) AddLine

func (c *Canvas) AddLine(p1, p2 image.Point, col color.Color, thickness float32)

AddLine draws a line (from p1 to p2).

func (*Canvas) AddQuad

func (c *Canvas) AddQuad(p1, p2, p3, p4 image.Point, col color.Color, thickness float32)

AddQuad draws a quad.

func (*Canvas) AddQuadFilled

func (c *Canvas) AddQuadFilled(p1, p2, p3, p4 image.Point, col color.Color)

AddQuadFilled draws a filled quad.

func (*Canvas) AddRect

func (c *Canvas) AddRect(pMin, pMax image.Point, col color.Color, rounding float32, roundingCorners DrawFlags, thickness float32)

AddRect draws a rectangle.

func (*Canvas) AddRectFilled

func (c *Canvas) AddRectFilled(pMin, pMax image.Point, col color.Color, rounding float32, roundingCorners DrawFlags)

AddRectFilled draws a rectangle filled with `col`.

func (*Canvas) AddText

func (c *Canvas) AddText(pos image.Point, col color.Color, text string)

AddText draws text.

func (*Canvas) AddTriangle

func (c *Canvas) AddTriangle(p1, p2, p3 image.Point, col color.Color, thickness float32)

AddTriangle draws a triangle.

func (*Canvas) AddTriangleFilled

func (c *Canvas) AddTriangleFilled(p1, p2, p3 image.Point, col color.Color)

AddTriangleFilled draws a filled triangle.

func (*Canvas) PathArcTo

func (c *Canvas) PathArcTo(center image.Point, radius, minV, maxV float32, numSegments int32)

PathArcTo adds a cubic bezier curve between the last point and the provided one.

func (*Canvas) PathArcToFast

func (c *Canvas) PathArcToFast(center image.Point, radius float32, min12, max12 int32)

PathArcToFast is a faster version of PathArcTo() but T=0 and T=1 will not exactly match the arc fast.

func (*Canvas) PathBezierCubicCurveTo added in v0.5.1

func (c *Canvas) PathBezierCubicCurveTo(p1, p2, p3 image.Point, numSegments int32)

PathBezierCubicCurveTo adds a cubic bezier curve.

func (*Canvas) PathClear

func (c *Canvas) PathClear()

PathClear clears the current path.

func (*Canvas) PathFillConvex

func (c *Canvas) PathFillConvex(col color.Color)

PathFillConvex fills the current path with the specified color.

func (*Canvas) PathLineTo

func (c *Canvas) PathLineTo(pos image.Point)

PathLineTo adds a line between the last point and the provided one.

func (*Canvas) PathLineToMergeDuplicate

func (c *Canvas) PathLineToMergeDuplicate(pos image.Point)

PathLineToMergeDuplicate merges with previous if the vertex if very close.

func (*Canvas) PathStroke

func (c *Canvas) PathStroke(col color.Color, flags DrawFlags, thickness float32)

PathStroke adds a line between the last point and the provided one.

type CheckboxWidget

type CheckboxWidget struct {
	// contains filtered or unexported fields
}

CheckboxWidget adds a checkbox.

func Checkbox

func Checkbox(text string, selected *bool) *CheckboxWidget

Checkbox creates a new CheckboxWidget.

func (*CheckboxWidget) Build

func (c *CheckboxWidget) Build()

Build implements Widget interface.

func (*CheckboxWidget) ID added in v0.12.0

func (c *CheckboxWidget) ID(id ID) *CheckboxWidget

ID sets widget's id (overrides text).

func (*CheckboxWidget) OnChange added in v0.5.0

func (c *CheckboxWidget) OnChange(onChange func()) *CheckboxWidget

OnChange adds callback called when checkbox's state was changed.

type ChildWidget

type ChildWidget struct {
	// contains filtered or unexported fields
}

ChildWidget is a container widget. It will have a separated scroll bar. Use Child if you want to create a layout of e specific size.

func Child

func Child() *ChildWidget

Child creates a new ChildWidget.

func (*ChildWidget) Border added in v0.5.0

func (c *ChildWidget) Border(border bool) *ChildWidget

Border sets whether child should have border You can use imgui.ChildFlagsBorders as well.

func (*ChildWidget) Build

func (c *ChildWidget) Build()

Build makes a Child.

func (*ChildWidget) Flags added in v0.5.0

func (c *ChildWidget) Flags(flags WindowFlags) *ChildWidget

Flags allows to specify Child flags.

func (*ChildWidget) ID added in v0.6.1

func (c *ChildWidget) ID(id ID) *ChildWidget

ID sets the interval id of child widgets.

func (*ChildWidget) Layout added in v0.5.0

func (c *ChildWidget) Layout(widgets ...Widget) *ChildWidget

Layout sets widgets that will be rendered inside of the Child.

func (*ChildWidget) Size added in v0.5.0

func (c *ChildWidget) Size(width, height float32) *ChildWidget

Size sets child size.

type CodeEditorWidget added in v0.5.5

type CodeEditorWidget struct {
	// contains filtered or unexported fields
}

CodeEditorWidget represents imgui.TextEditor.

func CodeEditor added in v0.5.5

func CodeEditor() *CodeEditorWidget

CodeEditor creates new code editor widget.

func (*CodeEditorWidget) Border added in v0.6.0

func (ce *CodeEditorWidget) Border(border bool) *CodeEditorWidget

Border sets editors borders.

func (*CodeEditorWidget) Build added in v0.6.0

func (ce *CodeEditorWidget) Build()

Build implements Widget interface.

func (*CodeEditorWidget) Copy added in v0.5.5

func (ce *CodeEditorWidget) Copy()

Copy copies selection.

func (*CodeEditorWidget) Cut added in v0.5.5

func (ce *CodeEditorWidget) Cut()

Cut cuts selection.

func (*CodeEditorWidget) Delete added in v0.5.5

func (ce *CodeEditorWidget) Delete()

Delete deletes the selection.

func (*CodeEditorWidget) GetCurrentLineText added in v0.5.5

func (ce *CodeEditorWidget) GetCurrentLineText() string

GetCurrentLineText returns current line.

func (*CodeEditorWidget) GetCursorPos added in v0.5.5

func (ce *CodeEditorWidget) GetCursorPos() (x, y int)

GetCursorPos returns cursor position. (in characters).

func (*CodeEditorWidget) GetScreenCursorPos added in v0.5.5

func (ce *CodeEditorWidget) GetScreenCursorPos() (x, y int)

GetScreenCursorPos returns cursor position on the screen. (in pixels).

func (*CodeEditorWidget) GetSelectedText added in v0.5.5

func (ce *CodeEditorWidget) GetSelectedText() string

GetSelectedText returns selected text.

func (*CodeEditorWidget) GetSelectionStart added in v0.5.5

func (ce *CodeEditorWidget) GetSelectionStart() (x, y int)

GetSelectionStart returns star pos of selection.

func (*CodeEditorWidget) GetText added in v0.5.5

func (ce *CodeEditorWidget) GetText() string

GetText returns whole text from editor.

func (*CodeEditorWidget) GetWordUnderCursor added in v0.5.5

func (ce *CodeEditorWidget) GetWordUnderCursor() string

GetWordUnderCursor returns the word under the cursor.

func (*CodeEditorWidget) HandleKeyboardInputs added in v0.6.0

func (ce *CodeEditorWidget) HandleKeyboardInputs(b bool) *CodeEditorWidget

HandleKeyboardInputs sets if editor should handle keyboard input.

func (*CodeEditorWidget) HasSelection added in v0.5.5

func (ce *CodeEditorWidget) HasSelection() bool

HasSelection returns true if some text is selected.

func (*CodeEditorWidget) ID added in v0.6.0

func (ce *CodeEditorWidget) ID(id ID) *CodeEditorWidget

ID allows to manually set editor's ID. It isn't necessary to use it in a normal conditions.

func (*CodeEditorWidget) InsertText added in v0.5.5

func (ce *CodeEditorWidget) InsertText(text string)

InsertText inserts the `text`.

func (*CodeEditorWidget) IsTextChanged added in v0.5.5

func (ce *CodeEditorWidget) IsTextChanged() bool

IsTextChanged returns true if the editable text was changed in the frame.

func (*CodeEditorWidget) LanguageDefinition added in v0.6.0

func (ce *CodeEditorWidget) LanguageDefinition(definition LanguageDefinition) *CodeEditorWidget

LanguageDefinition sets code editor language definition.

func (*CodeEditorWidget) Paste added in v0.5.5

func (ce *CodeEditorWidget) Paste()

Paste does the same as Ctrl+V.

func (*CodeEditorWidget) SelectWordUnderCursor added in v0.5.5

func (ce *CodeEditorWidget) SelectWordUnderCursor()

SelectWordUnderCursor selects the word under cursor.

func (*CodeEditorWidget) ShowWhitespaces added in v0.6.0

func (ce *CodeEditorWidget) ShowWhitespaces(s bool) *CodeEditorWidget

ShowWhitespaces sets if whitespace is shown in code editor.

func (*CodeEditorWidget) Size added in v0.6.0

func (ce *CodeEditorWidget) Size(w, h float32) *CodeEditorWidget

Size sets editor's size.

func (*CodeEditorWidget) TabSize added in v0.6.0

func (ce *CodeEditorWidget) TabSize(size int) *CodeEditorWidget

TabSize sets editor's tab size.

func (*CodeEditorWidget) Text added in v0.6.0

func (ce *CodeEditorWidget) Text(str string) *CodeEditorWidget

Text sets editor's text.

type ColorEditFlags added in v0.5.4

type ColorEditFlags int

ColorEditFlags for ColorEdit3V(), etc.

const (
	ColorEditFlagsNone ColorEditFlags = ColorEditFlags(imgui.ColorEditFlagsNone)
	//              // ColorEdit, ColorPicker, ColorButton: ignore Alpha component (will only read 3 components from the input pointer).
	ColorEditFlagsNoAlpha ColorEditFlags = ColorEditFlags(imgui.ColorEditFlagsNoAlpha)
	//              // ColorEdit: disable picker when clicking on color square.
	ColorEditFlagsNoPicker ColorEditFlags = ColorEditFlags(imgui.ColorEditFlagsNoPicker)
	//              // ColorEdit: disable toggling options menu when right-clicking on inputs/small preview.
	ColorEditFlagsNoOptions ColorEditFlags = ColorEditFlags(imgui.ColorEditFlagsNoOptions)
	//              // ColorEdit, ColorPicker: disable color square preview next to the inputs. (e.g. to show only the inputs)
	ColorEditFlagsNoSmallPreview ColorEditFlags = ColorEditFlags(imgui.ColorEditFlagsNoSmallPreview)
	//              // ColorEdit, ColorPicker: disable inputs sliders/text widgets (e.g. to show only the small preview color square).
	ColorEditFlagsNoInputs ColorEditFlags = ColorEditFlags(imgui.ColorEditFlagsNoInputs)
	//              // ColorEdit, ColorPicker, ColorButton: disable tooltip when hovering the preview.
	ColorEditFlagsNoTooltip ColorEditFlags = ColorEditFlags(imgui.ColorEditFlagsNoTooltip)
	//              // ColorEdit, ColorPicker: disable display of inline text label (the label is still forwarded to the tooltip and picker).
	ColorEditFlagsNoLabel ColorEditFlags = ColorEditFlags(imgui.ColorEditFlagsNoLabel)
	//              // ColorPicker: disable bigger color preview on right side of the picker, use small color square preview instead.
	ColorEditFlagsNoSidePreview ColorEditFlags = ColorEditFlags(imgui.ColorEditFlagsNoSidePreview)
	//              // ColorEdit: disable drag and drop target. ColorButton: disable drag and drop source.
	ColorEditFlagsNoDragDrop ColorEditFlags = ColorEditFlags(imgui.ColorEditFlagsNoDragDrop)
	//              // ColorButton: disable border (which is enforced by default)
	ColorEditFlagsNoBorder ColorEditFlags = ColorEditFlags(imgui.ColorEditFlagsNoBorder)
	//              // ColorEdit, ColorPicker: show vertical alpha bar/gradient in picker.
	ColorEditFlagsAlphaBar ColorEditFlags = ColorEditFlags(imgui.ColorEditFlagsAlphaBar)
	//              // ColorEdit, ColorPicker, ColorButton: display preview as a transparent color over a checkerboard, instead of opaque.
	ColorEditFlagsAlphaPreview ColorEditFlags = ColorEditFlags(imgui.ColorEditFlagsAlphaPreview)
	//              // ColorEdit, ColorPicker, ColorButton: display half opaque / half checkerboard, instead of opaque.
	ColorEditFlagsAlphaPreviewHalf ColorEditFlags = ColorEditFlags(imgui.ColorEditFlagsAlphaPreviewHalf)
	//              // (WIP) ColorEdit: Currently only disable 0.0f..1.0f limits in RGBA edition (note: you probably want to use ImGuiColorEditFlags_Float flag as well).
	ColorEditFlagsHDR ColorEditFlags = ColorEditFlags(imgui.ColorEditFlagsHDR)
	// [Display]    // ColorEdit: override _display_ type among RGB/HSV/Hex. ColorPicker: select any combination using one or more of RGB/HSV/Hex.
	ColorEditFlagsDisplayRGB ColorEditFlags = ColorEditFlags(imgui.ColorEditFlagsDisplayRGB)
	// [Display]    // ".
	ColorEditFlagsDisplayHSV ColorEditFlags = ColorEditFlags(imgui.ColorEditFlagsDisplayHSV)
	// [Display]    // ".
	ColorEditFlagsDisplayHex ColorEditFlags = ColorEditFlags(imgui.ColorEditFlagsDisplayHex)
	// [DataType]   // ColorEdit, ColorPicker, ColorButton: _display_ values formatted as 0..255.
	ColorEditFlagsUint8 ColorEditFlags = ColorEditFlags(imgui.ColorEditFlagsUint8)
	// [DataType]   // ColorEdit, ColorPicker, ColorButton: _display_ values formatted as 0.0f..1.0f floats instead of 0..255 integers. No round-trip of value via integers.
	ColorEditFlagsFloat ColorEditFlags = ColorEditFlags(imgui.ColorEditFlagsFloat)
	// [Picker]     // ColorPicker: bar for Hue, rectangle for Sat/Value.
	ColorEditFlagsPickerHueBar ColorEditFlags = ColorEditFlags(imgui.ColorEditFlagsPickerHueBar)
	// [Picker]     // ColorPicker: wheel for Hue, triangle for Sat/Value.
	ColorEditFlagsPickerHueWheel ColorEditFlags = ColorEditFlags(imgui.ColorEditFlagsPickerHueWheel)
	// [Input]      // ColorEdit, ColorPicker: input and output data in RGB format.
	ColorEditFlagsInputRGB ColorEditFlags = ColorEditFlags(imgui.ColorEditFlagsInputRGB)
	// [Input]      // ColorEdit, ColorPicker: input and output data in HSV format.
	ColorEditFlagsInputHSV       ColorEditFlags = ColorEditFlags(imgui.ColorEditFlagsInputHSV)
	ColorEditFlagsDefaultOptions ColorEditFlags = ColorEditFlags(imgui.ColorEditFlagsDefaultOptions)
	ColorEditFlagsDisplayMask    ColorEditFlags = ColorEditFlags(imgui.ColorEditFlagsDisplayMask)
	ColorEditFlagsDataTypeMask   ColorEditFlags = ColorEditFlags(imgui.ColorEditFlagsDataTypeMask)
	ColorEditFlagsPickerMask     ColorEditFlags = ColorEditFlags(imgui.ColorEditFlagsPickerMask)
	ColorEditFlagsInputMask      ColorEditFlags = ColorEditFlags(imgui.ColorEditFlagsInputMask)
)

list of color edit flags.

type ColorEditWidget added in v0.5.4

type ColorEditWidget struct {
	// contains filtered or unexported fields
}

ColorEditWidget is a widget that provides a color editor.

func ColorEdit added in v0.5.4

func ColorEdit(label string, c *color.RGBA) *ColorEditWidget

ColorEdit creates new ColorEditWidget.

func (*ColorEditWidget) Build added in v0.5.4

func (ce *ColorEditWidget) Build()

Build implements Widget interface.

func (*ColorEditWidget) Flags added in v0.5.4

Flags allows to set ColorEditFlags.

func (*ColorEditWidget) OnChange added in v0.5.4

func (ce *ColorEditWidget) OnChange(cb func()) *ColorEditWidget

OnChange sets callback that will be executed when color is changed.

func (*ColorEditWidget) Size added in v0.5.4

func (ce *ColorEditWidget) Size(width float32) *ColorEditWidget

Size sets width of the color editor.

type ColumnWidget added in v0.5.1

type ColumnWidget struct {
	// contains filtered or unexported fields
}

ColumnWidget will place all widgets one by one vertically.

func Column added in v0.5.1

func Column(widgets ...Widget) *ColumnWidget

Column creates a new ColumnWidget.

func (*ColumnWidget) Build added in v0.5.1

func (g *ColumnWidget) Build()

Build implements Widget interface.

type ComboCustomWidget

type ComboCustomWidget struct {
	// contains filtered or unexported fields
}

ComboCustomWidget represents a combo with custom layout when opened.

func ComboCustom

func ComboCustom(label, previewValue string) *ComboCustomWidget

ComboCustom creates a new combo custom widget.

func (*ComboCustomWidget) Build

func (cc *ComboCustomWidget) Build()

Build implements Widget interface.

func (*ComboCustomWidget) Flags added in v0.5.0

Flags allows to set combo flags (see Flags.go).

func (*ComboCustomWidget) Layout added in v0.5.0

func (cc *ComboCustomWidget) Layout(widgets ...Widget) *ComboCustomWidget

Layout add combo's layout.

func (*ComboCustomWidget) Size added in v0.5.0

func (cc *ComboCustomWidget) Size(width float32) *ComboCustomWidget

Size sets combo preview width.

type ComboFlags

type ComboFlags imgui.ComboFlags

ComboFlags represents imgui.ComboFlags.

type ComboWidget

type ComboWidget struct {
	// contains filtered or unexported fields
}

ComboWidget is a wrapper of ComboCustomWidget. It creates a combo of selectables. (it is the most frequently used).

func Combo

func Combo(label, previewValue string, items []string, selected *int32) *ComboWidget

Combo creates a new ComboWidget.

func (*ComboWidget) Build

func (c *ComboWidget) Build()

Build implements Widget interface.

func (*ComboWidget) Flags added in v0.5.0

func (c *ComboWidget) Flags(flags ComboFlags) *ComboWidget

Flags allows to set combo flags (see Flags.go).

func (*ComboWidget) ID added in v0.12.0

func (c *ComboWidget) ID(id ID) *ComboWidget

ID sets the interval id of combo. (overrides label).

func (*ComboWidget) OnChange added in v0.5.0

func (c *ComboWidget) OnChange(onChange func()) *ComboWidget

OnChange sets callback when combo value gets changed.

func (*ComboWidget) Size added in v0.5.0

func (c *ComboWidget) Size(width float32) *ComboWidget

Size sets combo's width.

type ConditionWidget

type ConditionWidget struct {
	// contains filtered or unexported fields
}

ConditionWidget allows to build if a condition is met it is like:

if condition {
   layoutIf.Build()
} else {

   layoutElse.Build()
}

func Condition

func Condition(cond bool, layoutIf, layoutElse Widget) *ConditionWidget

Condition creates new COnditionWidget.

func (*ConditionWidget) Build

func (c *ConditionWidget) Build()

Build implements Widget interface.

func (*ConditionWidget) Range added in v0.7.0

func (c *ConditionWidget) Range(rangeFunc func(w Widget))

Range implements extra abilities (see Splittablle).

type ContextMenuWidget

type ContextMenuWidget struct {
	// contains filtered or unexported fields
}

ContextMenuWidget is a context menu on another widget. (e.g. right-click menu on button).

func ContextMenu

func ContextMenu() *ContextMenuWidget

ContextMenu creates new ContextMenuWidget.

func (*ContextMenuWidget) Build

func (c *ContextMenuWidget) Build()

Build implements Widget interface.

func (*ContextMenuWidget) ID added in v0.5.5

ID sets the interval id of context menu.

func (*ContextMenuWidget) Layout added in v0.5.0

func (c *ContextMenuWidget) Layout(widgets ...Widget) *ContextMenuWidget

Layout sets layout of the context menu.

func (*ContextMenuWidget) MouseButton added in v0.5.0

func (c *ContextMenuWidget) MouseButton(mouseButton MouseButton) *ContextMenuWidget

MouseButton sets mouse button that will trigger the context menu.

type CubeGizmo added in v0.10.0

type CubeGizmo struct {
	// contains filtered or unexported fields
}

CubeGizmo draws a 3D cube in the gizmo area. View and Projection matrices are provided by GizmoWidget.

func Cube added in v0.10.0

func Cube(matrix *ViewMatrix) *CubeGizmo

Cube creates a new CubeGizmo.

func (*CubeGizmo) Gizmo added in v0.10.0

func (c *CubeGizmo) Gizmo(view *ViewMatrix, projection *ProjectionMatrix)

Gizmo implements GizmoI interface.

func (*CubeGizmo) Manipulate added in v0.10.0

func (c *CubeGizmo) Manipulate() *CubeGizmo

Manipulate adds ManipulateGizmo to the CubeGizmo.

type CustomWidget

type CustomWidget struct {
	// contains filtered or unexported fields
}

CustomWidget allows you to do whatever you want. This includes: - using functions from upstream imgui instead of thes from giu - build widgets in loop (see also RangeBuilder) - do any calculations needed in this part of rendering.

func Custom

func Custom(builder func()) *CustomWidget

Custom creates a new custom widget.

func (*CustomWidget) Build

func (c *CustomWidget) Build()

Build implements Widget interface.

func (*CustomWidget) Gizmo added in v0.10.0

func (c *CustomWidget) Gizmo(_ *ViewMatrix, _ *ProjectionMatrix)

Gizmo implements GizmoI interface.

func (*CustomWidget) Plot added in v0.7.0

func (c *CustomWidget) Plot()

Plot implements Plot interface.

type DatePickerLabels added in v0.8.0

type DatePickerLabels string

DatePickerLabels represents a label string in date picker.

const (
	DatePickerLabelMonth DatePickerLabels = "Month:"
	DatePickerLabelYear  DatePickerLabels = "    Year:"
)

These constants hold strings for translations of day/month/year.

type DatePickerWidget

type DatePickerWidget struct {
	// contains filtered or unexported fields
}

DatePickerWidget is a simple Calender widget. It allow user to select a day and convert it to time.Time go type. It consists of a Combo widget which (after opening) contains a calender-like table.

func DatePicker

func DatePicker(id string, date *time.Time) *DatePickerWidget

DatePicker creates new DatePickerWidget.

func (*DatePickerWidget) Build

func (d *DatePickerWidget) Build()

Build implements Widget interface.

func (*DatePickerWidget) Format added in v0.6.2

func (d *DatePickerWidget) Format(format string) *DatePickerWidget

Format sets date format of displayed (in combo) date. Compatible with (time.Time).Format(...) Default: "2006-01-02".

func (*DatePickerWidget) OnChange added in v0.5.0

func (d *DatePickerWidget) OnChange(onChange func()) *DatePickerWidget

OnChange sets callback called when date is changed.

func (*DatePickerWidget) Size added in v0.5.0

func (d *DatePickerWidget) Size(width float32) *DatePickerWidget

Size sets combo widget's size.

func (*DatePickerWidget) StartOfWeek added in v0.6.2

func (d *DatePickerWidget) StartOfWeek(weekday time.Weekday) *DatePickerWidget

StartOfWeek sets first day of the week Default: Sunday.

func (*DatePickerWidget) Translation added in v0.8.0

func (d *DatePickerWidget) Translation(label DatePickerLabels, value string) *DatePickerWidget

Translation sets a translation to specified label type.

type DialogResult

type DialogResult bool

DialogResult represents dialog result dialog result is bool. if OK/Yes it is true, else (Cancel/No) - false.

type DialogResultCallback

type DialogResultCallback func(DialogResult)

DialogResultCallback is a callback for dialogs.

type Direction

type Direction imgui.Dir

Direction represents a ArrowButton direction.

type Disposable

type Disposable interface {
	Dispose()
}

Disposable should be implemented by all states stored in context. Dispose method is called when state is removed from context.

type DragIntWidget

type DragIntWidget struct {
	// contains filtered or unexported fields
}

DragIntWidget is a widget that allows to drag an integer value.

func DragInt

func DragInt(label string, value *int32, minValue, maxValue int32) *DragIntWidget

DragInt creates new DragIntWidget.

func (*DragIntWidget) Build

func (d *DragIntWidget) Build()

Build implements Widget interface.

func (*DragIntWidget) Format added in v0.5.0

func (d *DragIntWidget) Format(format string) *DragIntWidget

Format sets format of the value.

func (*DragIntWidget) Speed added in v0.5.0

func (d *DragIntWidget) Speed(speed float32) *DragIntWidget

Speed sets speed of the dragging.

type DrawFlags added in v0.5.3

type DrawFlags imgui.DrawFlags

DrawFlags represents imgui.DrawFlags.

const (
	DrawFlagsNone DrawFlags = DrawFlags(imgui.DrawFlagsNone)
	// PathStroke(), AddPolyline(): specify that shape should be closed (note: this is always == 1 for legacy reasons).
	DrawFlagsClosed DrawFlags = DrawFlags(imgui.DrawFlagsClosed)
	// AddRect(), AddRectFilled(), PathRect(): enable rounding top-left corner only (when rounding > 0.0f, we default to all corners).
	// Was 0x01.
	DrawFlagsRoundCornersTopLeft DrawFlags = DrawFlags(imgui.DrawFlagsRoundCornersTopLeft)
	// AddRect(), AddRectFilled(), PathRect(): enable rounding top-right corner only (when rounding > 0.0f, we default to all corners).
	// Was 0x02.
	DrawFlagsRoundCornersTopRight DrawFlags = DrawFlags(imgui.DrawFlagsRoundCornersTopRight)
	// AddRect(), AddRectFilled(), PathRect(): enable rounding bottom-left corner only (when rounding > 0.0f, we default to all corners).
	// Was 0x04.
	DrawFlagsRoundCornersBottomLeft DrawFlags = DrawFlags(imgui.DrawFlagsRoundCornersBottomLeft)
	// AddRect(), AddRectFilled(), PathRect(): enable rounding bottom-right corner only (when rounding > 0.0f,
	// we default to all corners). Wax 0x08.
	DrawFlagsRoundCornersBottomRight DrawFlags = DrawFlags(imgui.DrawFlagsRoundCornersBottomRight)
	// AddRect(), AddRectFilled(), PathRect(): disable rounding on all corners (when rounding > 0.0f). This is NOT zero, NOT an implicit flag!
	DrawFlagsRoundCornersNone   DrawFlags = DrawFlags(imgui.DrawFlagsRoundCornersNone)
	DrawFlagsRoundCornersTop    DrawFlags = DrawFlags(imgui.DrawFlagsRoundCornersTop)
	DrawFlagsRoundCornersBottom DrawFlags = DrawFlags(imgui.DrawFlagsRoundCornersBottom)
	DrawFlagsRoundCornersLeft   DrawFlags = DrawFlags(imgui.DrawFlagsRoundCornersLeft)
	DrawFlagsRoundCornersRight  DrawFlags = DrawFlags(imgui.DrawFlagsRoundCornersRight)
	DrawFlagsRoundCornersAll    DrawFlags = DrawFlags(imgui.DrawFlagsRoundCornersAll)

	// Default to ALL corners if none of the RoundCornersXX flags are specified.
	DrawFlagsRoundCornersDefault DrawFlags = DrawFlags(imgui.DrawFlagsRoundCornersDefault)
	DrawFlagsRoundCornersMask    DrawFlags = DrawFlags(imgui.DrawFlagsRoundCornersMask)
)

draw flags enum:.

type DummyWidget

type DummyWidget struct {
	// contains filtered or unexported fields
}

DummyWidget creates an empty space (moves drawing cursor by width and height).

func Dummy

func Dummy(width, height float32) *DummyWidget

Dummy creates new DummyWidget.

func (*DummyWidget) Build

func (d *DummyWidget) Build()

Build implements Widget interface.

type ErrCSSParse added in v0.7.0

type ErrCSSParse struct {
	What   string // description of what we are parsing
	Value  string // the value which failed
	Detail error  // (optional) error to add extra detail (i.e. result of calling another function like strconv.ParseFloat)
}

ErrCSSParse represents a CSS parsing error and includes details about what is failing.

func (ErrCSSParse) Error added in v0.7.0

func (e ErrCSSParse) Error() string

type EventHandler added in v0.6.0

type EventHandler struct {
	// contains filtered or unexported fields
}

EventHandler is a universal event handler for giu widgets. put giu.Event()... after any widget to handle any event.

func Event added in v0.6.0

func Event() *EventHandler

Event adds a new event to widget above.

func (*EventHandler) Build added in v0.6.0

func (eh *EventHandler) Build()

Build implements Widget interface

func (*EventHandler) OnActivate added in v0.6.0

func (eh *EventHandler) OnActivate(cb func()) *EventHandler

OnActivate sets callback when item gets activated.

func (*EventHandler) OnActive added in v0.6.0

func (eh *EventHandler) OnActive(cb func()) *EventHandler

OnActive sets a callback when ite IS ACTIVE (not activated).

func (*EventHandler) OnClick added in v0.6.0

func (eh *EventHandler) OnClick(mouseButton MouseButton, callback func()) *EventHandler

OnClick sets callback when mouse button `mouseButton` is clicked.

func (*EventHandler) OnDClick added in v0.6.0

func (eh *EventHandler) OnDClick(mouseButton MouseButton, callback func()) *EventHandler

OnDClick sets callback when mouse button `mouseButton` is double-clicked.

func (*EventHandler) OnDeactivate added in v0.6.0

func (eh *EventHandler) OnDeactivate(cb func()) *EventHandler

OnDeactivate sets callback when item gets deactivated.

func (*EventHandler) OnHover added in v0.6.0

func (eh *EventHandler) OnHover(onHover func()) *EventHandler

OnHover sets callback when item gets hovered.

func (*EventHandler) OnKeyDown added in v0.6.0

func (eh *EventHandler) OnKeyDown(key Key, cb func()) *EventHandler

OnKeyDown sets callback when key `key` is down.

func (*EventHandler) OnKeyPressed added in v0.6.0

func (eh *EventHandler) OnKeyPressed(key Key, cb func()) *EventHandler

OnKeyPressed sets callback when key `key` is pressed.

func (*EventHandler) OnKeyReleased added in v0.6.0

func (eh *EventHandler) OnKeyReleased(key Key, cb func()) *EventHandler

OnKeyReleased sets callback when key `key` is released.

func (*EventHandler) OnMouseDown added in v0.6.0

func (eh *EventHandler) OnMouseDown(mouseButton MouseButton, callback func()) *EventHandler

OnMouseDown sets callback when mouse button `mouseButton` is down.

func (*EventHandler) OnMouseReleased added in v0.6.0

func (eh *EventHandler) OnMouseReleased(mouseButton MouseButton, callback func()) *EventHandler

OnMouseReleased sets callback when mouse button `mouseButton` is released.

type ExecCondition

type ExecCondition imgui.Cond

ExecCondition represents imgui.Cond.

imgui conditions.

type FileLoader added in v0.9.0

type FileLoader struct {
	// contains filtered or unexported fields
}

FileLoader is a struct that implements the SurfaceLoader interface for loading images from a file.

func NewFileLoader added in v0.9.0

func NewFileLoader(path string) *FileLoader

NewFileLoader creates a new SurfaceLoader that loads images from the specified file path.

Parameters:

  • path: The path to the file to load the image from.

Returns:

  • SurfaceLoader: A new SurfaceLoader for loading images from the specified file path.

func (*FileLoader) ServeRGBA added in v0.9.0

func (f *FileLoader) ServeRGBA() (*image.RGBA, error)

ServeRGBA loads an RGBA image from the file specified by the path in fileLoader.

Returns:

  • *image.RGBA: The loaded RGBA image.
  • error: An error if the image could not be loaded.

type FocusedFlags added in v0.4.1

type FocusedFlags imgui.FocusedFlags

FocusedFlags represents imgui.FocusedFlags.

type FontAtlas added in v0.7.0

type FontAtlas struct {
	// contains filtered or unexported fields
}

FontAtlas is a mechanism to automatically manage fonts in giu. When you add a string in your app, it is registered inside the FontAtlas. Then, font data are built based on the registered strings. for more details, see: https://github.com/ocornut/imgui/blob/master/docs/FONTS.md DefaultFont = font that is used for normal rendering. ExtraFont = font that can be set and then it'll be used for rendering things.

func (*FontAtlas) AddFont added in v0.7.0

func (a *FontAtlas) AddFont(fontName string, size float32) *FontInfo

AddFont adds font by name, if the font is found, return *FontInfo, otherwise return nil. To use added font, use giu.Style().SetFont(...).

func (*FontAtlas) AddFontFromBytes added in v0.7.0

func (a *FontAtlas) AddFontFromBytes(fontName string, fontBytes []byte, size float32) *FontInfo

AddFontFromBytes does similar to AddFont, but using data from memory.

func (*FontAtlas) GetDefaultFonts added in v0.7.0

func (a *FontAtlas) GetDefaultFonts() []FontInfo

GetDefaultFonts returns a list of currently loaded default fonts.

func (*FontAtlas) RegisterString added in v0.7.0

func (a *FontAtlas) RegisterString(str string) string

RegisterString register string to font atlas builder. Note only register strings that will be displayed on the UI.

func (*FontAtlas) RegisterStringPointer added in v0.7.0

func (a *FontAtlas) RegisterStringPointer(str *string) *string

RegisterStringPointer registers string pointer to font atlas builder. Note only register strings that will be displayed on the UI.

func (*FontAtlas) RegisterStringSlice added in v0.7.0

func (a *FontAtlas) RegisterStringSlice(str []string) []string

RegisterStringSlice calls RegisterString for each slice element.

func (*FontAtlas) SetDefaultFont added in v0.7.0

func (a *FontAtlas) SetDefaultFont(fontName string, size float32)

SetDefaultFont changes default font.

func (*FontAtlas) SetDefaultFontFromBytes added in v0.7.0

func (a *FontAtlas) SetDefaultFontFromBytes(fontBytes []byte, size float32)

SetDefaultFontFromBytes changes default font by bytes of the font file.

func (*FontAtlas) SetDefaultFontSize added in v0.7.0

func (a *FontAtlas) SetDefaultFontSize(size float32)

SetDefaultFontSize sets the default font size. Invoke this before MasterWindow.NewMasterWindow(..).

type FontInfo added in v0.5.5

type FontInfo struct {
	// contains filtered or unexported fields
}

FontInfo represents a giu implementation of imgui font.

func (*FontInfo) SetSize added in v0.6.0

func (f *FontInfo) SetSize(size float32) *FontInfo

SetSize sets the font size.

func (*FontInfo) String added in v0.5.5

func (f *FontInfo) String() string

String returns a string representation of the FontInfo. It is intended to be unique for each FontInfo.

type FsFileLoader added in v0.9.0

type FsFileLoader struct {
	// contains filtered or unexported fields
}

FsFileLoader is a struct that implements the SurfaceLoader interface for loading images from a file and embedded fs.

func NewFsFileLoader added in v0.9.0

func NewFsFileLoader(file fs.File) *FsFileLoader

NewFsFileLoader creates a new SurfaceLoader that loads images from the specified file interface.

Parameters:

  • file: the file interface representing the file

Returns:

  • SurfaceLoader: A new SurfaceLoader for loading images from the specified file path.

func (*FsFileLoader) ServeRGBA added in v0.9.0

func (f *FsFileLoader) ServeRGBA() (*image.RGBA, error)

ServeRGBA loads an RGBA image from the file specified by the path in fileLoader.

Returns:

  • *image.RGBA: The loaded RGBA image.
  • error: An error if the image could not be loaded.

type GIUBackend added in v0.12.0

type GIUBackend backend.Backend[MasterWindowFlags]

GIUBackend is an abstraction layer between cimgui-go's Backends.

type GIUContext added in v0.9.0

type GIUContext struct {
	InputHandler InputHandler
	FontAtlas    *FontAtlas
	// contains filtered or unexported fields
}

GIUContext represents a giu context. (Current context is giu.Context.

var Context *GIUContext

Context represents a giu context.

func CreateContext added in v0.7.0

func CreateContext(b GIUBackend) *GIUContext

CreateContext creates a new giu context.

func (*GIUContext) Backend added in v0.9.0

func (c *GIUContext) Backend() GIUBackend

Backend returns the imgui.backend used by the context.

func (*GIUContext) GetState added in v0.9.0

func (c *GIUContext) GetState(id ID) any

GetState returns previously stored state by id.

func (*GIUContext) IO added in v0.9.0

func (c *GIUContext) IO() *imgui.IO

IO returns the imgui.IO object.

func (*GIUContext) SetDirty added in v0.9.0

func (c *GIUContext) SetDirty()

SetDirty permits MasterWindow defering setting dirty states after it's render().

func (*GIUContext) SetState added in v0.9.0

func (c *GIUContext) SetState(id ID, data Disposable)

SetState stores data in context by id.

type GLFWBackend added in v0.12.0

type GLFWBackend struct {
	*glfwbackend.GLFWBackend
}

GLFWBackend is an implementation of glfbackend.GLFWBackend cimgui-go backend with respect to giu's MasterWIndowFlags.

func NewGLFWBackend added in v0.12.0

func NewGLFWBackend() *GLFWBackend

NewGLFWBackend creates a new instance of GLFWBackend.

func (*GLFWBackend) SetInputMode added in v0.12.0

func (b *GLFWBackend) SetInputMode(mode, _ MasterWindowFlags)

SetInputMode implements backend.Backend interface.

func (*GLFWBackend) SetSwapInterval added in v0.12.0

func (b *GLFWBackend) SetSwapInterval(interval MasterWindowFlags) error

SetSwapInterval implements backend.Backend interface.

func (*GLFWBackend) SetWindowFlags added in v0.12.0

func (b *GLFWBackend) SetWindowFlags(flags MasterWindowFlags, _ int)

SetWindowFlags implements backend.Backend interface.

type GizmoI added in v0.10.0

type GizmoI interface {
	Gizmo(view *ViewMatrix, projection *ProjectionMatrix)
}

GizmoI should be implemented by every sub-element of GizmoWidget.

type GizmoMode added in v0.10.0

type GizmoMode int

GizmoMode specifies the mode of Gizmo (used by manipulate).

const (
	ModeLocal GizmoMode = GizmoMode(imguizmo.LOCAL)
	ModeWorld GizmoMode = GizmoMode(imguizmo.WORLD)
)

values are not explained in source code.

type GizmoOperation added in v0.10.0

type GizmoOperation int

GizmoOperation specifies the operation of Gizmo (used by manipulate).

type GizmoWidget added in v0.10.0

type GizmoWidget struct {
	// contains filtered or unexported fields
}

GizmoWidget implements ImGuizmo features. It is designed just like PlotWidget. This structure provides an "area" where you can put Gizmos (see (*GizmoWidget).Gizmos). If you want to have more understanding about what is going on here, read this: https://www.opengl-tutorial.org/beginners-tutorials/tutorial-3-matrices/ (DISCLAIMER: giu authors are not responsible if you go mad or something!)

func Gizmo added in v0.10.0

func Gizmo(view *ViewMatrix, projection *ProjectionMatrix) *GizmoWidget

Gizmo creates a new GizmoWidget.

func (*GizmoWidget) Build added in v0.10.0

func (g *GizmoWidget) Build()

Build implements Widget interface.

func (*GizmoWidget) Disabled added in v0.10.0

func (g *GizmoWidget) Disabled(b bool) *GizmoWidget

Disabled sets GizmoWidget's disabled state.

func (*GizmoWidget) Gizmos added in v0.10.0

func (g *GizmoWidget) Gizmos(gizmos ...GizmoI) *GizmoWidget

Gizmos adds GizmoI elements to the GizmoWidget area.

func (*GizmoWidget) Global added in v0.10.0

func (g *GizmoWidget) Global()

Global works like Build() but does not attach the gizmo to the current window.

func (*GizmoWidget) ID added in v0.10.0

func (g *GizmoWidget) ID(id ID) *GizmoWidget

ID sets the ID of the GizmoWidget. (useful if you use multiple gizmo widgets. It is set by AutoID anyway).

func (*GizmoWidget) Orthographic added in v0.10.0

func (g *GizmoWidget) Orthographic(b bool) *GizmoWidget

Orthographic sets the projection matrix to orthographic.

type GridGizmo added in v0.10.0

type GridGizmo struct {
	// contains filtered or unexported fields
}

GridGizmo draws a grid in the gizmo area.

func Grid added in v0.10.0

func Grid() *GridGizmo

Grid creates a new GridGizmo.

func (*GridGizmo) Gizmo added in v0.10.0

func (g *GridGizmo) Gizmo(view *ViewMatrix, projection *ProjectionMatrix)

Gizmo implements GizmoI interface.

func (*GridGizmo) Matrix added in v0.10.0

func (g *GridGizmo) Matrix(matrix *ViewMatrix) *GridGizmo

Matrix allows to set grid matrix. Default to IdentityMatrix.

func (*GridGizmo) Thickness added in v0.10.0

func (g *GridGizmo) Thickness(t float32) *GridGizmo

Thickness sets a thickness of grid lines.

type HoveredFlags added in v0.4.1

type HoveredFlags imgui.HoveredFlags

HoveredFlags represents a hovered flags.

type ID added in v0.8.0

type ID string

ID is an alias type. If some method uses ID it means, that this string will NOT be proceeded anyhow and will be passed as-is to cimgui-go. This also means that it deffinitly needs to be unique because else it will cause strange UI behavior. see: https://github.com/AllenDang/giu/wiki#id

func GenAutoID added in v0.5.5

func GenAutoID(id string) ID

GenAutoID automatically generates widget's ID. It returns an unique value each time it is called.

func (ID) String added in v0.8.0

func (i ID) String() string

type ImPlotYAxis added in v0.5.1

type ImPlotYAxis int

ImPlotYAxis represents y axis settings.

const (
	ImPlotYAxisLeft          ImPlotYAxis = 0 // left (default)
	ImPlotYAxisFirstOnRight  ImPlotYAxis = 1 // first on right side
	ImPlotYAxisSecondOnRight ImPlotYAxis = 2 // second on right side
)

ImPlotYAxis enum:.

type ImageButtonWidget

type ImageButtonWidget struct {
	// contains filtered or unexported fields
}

ImageButtonWidget is similar to ButtonWidget but with image texture instead of text label.

func ImageButton

func ImageButton(texture *Texture) *ImageButtonWidget

ImageButton constructs image button widget.

func (*ImageButtonWidget) BgColor added in v0.5.0

func (b *ImageButtonWidget) BgColor(bgColor color.Color) *ImageButtonWidget

BgColor sets button's background color.

func (*ImageButtonWidget) Build

func (b *ImageButtonWidget) Build()

Build implements Widget interface.

func (*ImageButtonWidget) FramePadding added in v0.5.0

func (b *ImageButtonWidget) FramePadding(padding int) *ImageButtonWidget

FramePadding sets button's frame padding (set 0 to fit image to the frame).

func (*ImageButtonWidget) ID added in v0.12.0

ID allows to manually set widget's id.

func (*ImageButtonWidget) OnClick added in v0.5.0

func (b *ImageButtonWidget) OnClick(onClick func()) *ImageButtonWidget

OnClick sets click event.

func (*ImageButtonWidget) Size added in v0.5.0

func (b *ImageButtonWidget) Size(width, height float32) *ImageButtonWidget

Size sets BUTTONS size. NOTE: image size is button size - 2 * frame padding.

func (*ImageButtonWidget) TintColor added in v0.5.0

func (b *ImageButtonWidget) TintColor(tintColor color.Color) *ImageButtonWidget

TintColor sets tit color for image.

func (*ImageButtonWidget) UV added in v0.5.0

UV sets image's uv.

type ImageButtonWithRgbaWidget added in v0.5.5

type ImageButtonWithRgbaWidget struct {
	*ImageButtonWidget
	// contains filtered or unexported fields
}

ImageButtonWithRgbaWidget does similar to ImageButtonWidget, but implements image.Image instead of giu.Texture. It is probably more useful than the original ImageButtonWidget.

func ImageButtonWithRgba added in v0.5.5

func ImageButtonWithRgba(rgba image.Image) *ImageButtonWithRgbaWidget

ImageButtonWithRgba creates a new widget.

func (*ImageButtonWithRgbaWidget) BgColor added in v0.5.5

BgColor sets button's background color.

func (*ImageButtonWithRgbaWidget) Build added in v0.5.5

func (b *ImageButtonWithRgbaWidget) Build()

Build implements Widget interface.

func (*ImageButtonWithRgbaWidget) FramePadding added in v0.5.5

func (b *ImageButtonWithRgbaWidget) FramePadding(padding int) *ImageButtonWithRgbaWidget

FramePadding sets frame padding (see (*ImageButtonWidget).TintColor).

func (*ImageButtonWithRgbaWidget) OnClick added in v0.5.5

func (b *ImageButtonWithRgbaWidget) OnClick(onClick func()) *ImageButtonWithRgbaWidget

OnClick sets click events.

func (*ImageButtonWithRgbaWidget) Size added in v0.5.5

Size sets button's size.

func (*ImageButtonWithRgbaWidget) TintColor added in v0.5.5

TintColor sets image's tint color.

func (*ImageButtonWithRgbaWidget) UV added in v0.5.5

UV sets image's uv color.

type ImageWidget

type ImageWidget struct {
	// contains filtered or unexported fields
}

ImageWidget adds an image. The default size is the size of the image, to set a specific size, use .Size(width, height). NOTE: ImageWidget is going to be deprecated. ImageWithRGBAWidget should be used instead, however, because it is a native imgui's solution it is still there.

func Image

func Image(texture *Texture) *ImageWidget

Image adds an image from giu.Texture.

func (*ImageWidget) BorderCol added in v0.5.0

func (i *ImageWidget) BorderCol(borderColor color.Color) *ImageWidget

BorderCol sets color of the border.

func (*ImageWidget) Build

func (i *ImageWidget) Build()

Build implements Widget interface.

func (*ImageWidget) OnClick added in v0.5.5

func (i *ImageWidget) OnClick(cb func()) *ImageWidget

OnClick adds on-click-callback.

func (*ImageWidget) Scale added in v0.9.0

func (i *ImageWidget) Scale(scaleX, scaleY float32) *ImageWidget

Scale multiply dimensions after size.

func (*ImageWidget) Size added in v0.5.0

func (i *ImageWidget) Size(width, height float32) *ImageWidget

Size sets image size.

func (*ImageWidget) TintColor added in v0.5.0

func (i *ImageWidget) TintColor(tintColor color.Color) *ImageWidget

TintColor sets image's tint color.

func (*ImageWidget) Uv added in v0.5.0

func (i *ImageWidget) Uv(uv0X, uv0Y, uv1X, uv1Y float32) *ImageWidget

Uv allows to specify uv parameters.

type ImageWithFileWidget added in v0.4.1

type ImageWithFileWidget struct {
	// contains filtered or unexported fields
}

ImageWithFileWidget allows to display an image directly from .png file. NOTE: Be aware that project using this solution may not be portable because files are not included in executable binaries! You may want to use "embed" package and ImageWithRgba instead.

func ImageWithFile added in v0.4.1

func ImageWithFile(imgPath string) *ImageWithFileWidget

ImageWithFile constructs a new ImageWithFileWidget. The default size is the size of the image, to set a specific size, use .Size(width, height).

func (*ImageWithFileWidget) Build added in v0.4.1

func (i *ImageWithFileWidget) Build()

Build implements Widget interface.

func (*ImageWithFileWidget) ID added in v0.7.0

ID sets the interval id of ImageWithFile widgets.

func (*ImageWithFileWidget) OnClick added in v0.5.5

func (i *ImageWithFileWidget) OnClick(cb func()) *ImageWithFileWidget

OnClick sets click callback.

func (*ImageWithFileWidget) Size added in v0.5.0

func (i *ImageWithFileWidget) Size(width, height float32) *ImageWithFileWidget

Size sets image's size.

type ImageWithRgbaWidget added in v0.5.5

type ImageWithRgbaWidget struct {
	// contains filtered or unexported fields
}

ImageWithRgbaWidget wraps ImageWidget. It is more useful because it doesn't make you to care about imgui textures. You can just pass golang-native image.Image and display it in giu.

func ImageWithRgba added in v0.5.5

func ImageWithRgba(rgba image.Image) *ImageWithRgbaWidget

ImageWithRgba creates ImageWithRgbaWidget. The default size is the size of the image, to set a specific size, use .Size(width, height).

func (*ImageWithRgbaWidget) Build added in v0.5.5

func (i *ImageWithRgbaWidget) Build()

Build implements Widget interface.

func (*ImageWithRgbaWidget) ID added in v0.7.0

ID sets the interval id of ImageWithRgba widgets.

func (*ImageWithRgbaWidget) OnClick added in v0.5.5

func (i *ImageWithRgbaWidget) OnClick(cb func()) *ImageWithRgbaWidget

OnClick sets click callback.

func (*ImageWithRgbaWidget) Size added in v0.5.5

func (i *ImageWithRgbaWidget) Size(width, height float32) *ImageWithRgbaWidget

Size sets image's size.

type ImageWithURLWidget added in v0.6.0

type ImageWithURLWidget struct {
	// contains filtered or unexported fields
}

ImageWithURLWidget allows to display an image using an URL as image source.

func ImageWithURL added in v0.6.0

func ImageWithURL(url string) *ImageWithURLWidget

ImageWithURL creates ImageWithURLWidget. The default size is the size of the image, to set a specific size, use .Size(width, height).

func (*ImageWithURLWidget) Build added in v0.6.0

func (i *ImageWithURLWidget) Build()

Build implements Widget interface.

func (*ImageWithURLWidget) LayoutForFailure added in v0.6.0

func (i *ImageWithURLWidget) LayoutForFailure(widgets ...Widget) *ImageWithURLWidget

LayoutForFailure allows to specify layout when image failed to download.

func (*ImageWithURLWidget) LayoutForLoading added in v0.6.0

func (i *ImageWithURLWidget) LayoutForLoading(widgets ...Widget) *ImageWithURLWidget

LayoutForLoading allows to set layout rendered while loading an image.

func (*ImageWithURLWidget) OnClick added in v0.6.0

func (i *ImageWithURLWidget) OnClick(cb func()) *ImageWithURLWidget

OnClick sets click callback.

func (*ImageWithURLWidget) OnFailure added in v0.6.0

func (i *ImageWithURLWidget) OnFailure(onFailure func(error)) *ImageWithURLWidget

OnFailure sets event trigger when image failed to download/load.

func (*ImageWithURLWidget) OnReady added in v0.6.0

func (i *ImageWithURLWidget) OnReady(onReady func()) *ImageWithURLWidget

OnReady sets event trigger when image is downloaded and ready to display.

func (*ImageWithURLWidget) Size added in v0.6.0

func (i *ImageWithURLWidget) Size(width, height float32) *ImageWithURLWidget

Size sets image's size.

func (*ImageWithURLWidget) Timeout added in v0.6.0

func (i *ImageWithURLWidget) Timeout(downloadTimeout time.Duration) *ImageWithURLWidget

Timeout sets download timeout.

type ImguiImageVOptionStruct added in v0.9.0

type ImguiImageVOptionStruct struct {
	Uv0       imgui.Vec2 // The UV coordinate of the top-left corner of the image.
	Uv1       imgui.Vec2 // The UV coordinate of the bottom-right corner of the image.
	TintCol   imgui.Vec4 // The tint color to apply to the image.
	BorderCol imgui.Vec4 // The border color to apply to the image.
}

ImguiImageVOptionStruct represents the options for rendering an image in ImGui.

type InputFloatWidget

type InputFloatWidget struct {
	// contains filtered or unexported fields
}

InputFloatWidget does similar to InputIntWIdget, but accepts float numbers.

func InputFloat

func InputFloat(value *float32) *InputFloatWidget

InputFloat constructs InputFloatWidget.

func (*InputFloatWidget) Build

func (i *InputFloatWidget) Build()

Build implements Widget interface.

func (*InputFloatWidget) Flags added in v0.5.0

Flags sets flags.

func (*InputFloatWidget) Format added in v0.5.0

func (i *InputFloatWidget) Format(format string) *InputFloatWidget

Format sets data format (e.g. %.3f).

func (*InputFloatWidget) ID added in v0.8.0

ID sets widget's id.

func (*InputFloatWidget) Label added in v0.5.5

func (i *InputFloatWidget) Label(label string) *InputFloatWidget

Label sets label of input field.

func (*InputFloatWidget) Labelf added in v0.6.0

func (i *InputFloatWidget) Labelf(format string, args ...any) *InputFloatWidget

Labelf sets formatted label.

func (*InputFloatWidget) OnChange added in v0.6.0

func (i *InputFloatWidget) OnChange(onChange func()) *InputFloatWidget

OnChange sets callback called when text is changed.

func (*InputFloatWidget) Size added in v0.5.0

func (i *InputFloatWidget) Size(width float32) *InputFloatWidget

Size sets input field's width.

func (*InputFloatWidget) StepSize added in v0.7.0

func (i *InputFloatWidget) StepSize(step float32) *InputFloatWidget

StepSize sets the step size.

func (*InputFloatWidget) StepSizeFast added in v0.7.0

func (i *InputFloatWidget) StepSizeFast(stepFast float32) *InputFloatWidget

StepSizeFast sets the fast step size.

type InputHandler added in v0.6.0

type InputHandler interface {
	// RegisterKeyboardShortcuts adds a specified shortcuts into input handler
	RegisterKeyboardShortcuts(...Shortcut)
	// UnregisterKeyboardShortcuts removes window shortcuts from input handler
	UnregisterWindowShortcuts()
	// Handle handles a shortcut
	Handle(Key, Modifier, Action)
}

InputHandler is an interface which needs to be implemented by user-defined input handlers.

type InputHandlerHandleCallback added in v0.7.0

type InputHandlerHandleCallback func(Key, Modifier, Action)

InputHandlerHandleCallback is a callback which is called when a shortcut is triggered.

type InputIntWidget

type InputIntWidget struct {
	// contains filtered or unexported fields
}

InputIntWidget is an input text field accepting integer values only.

func InputInt

func InputInt(value *int32) *InputIntWidget

InputInt creates input int widget NOTE: value is int32, so its size is up to 10^32-1. to process greater values, you need to use InputTextWidget with InputTextFlagsCharsDecimal and strconv.ParseInt in OnChange callback.

func (*InputIntWidget) Build

func (i *InputIntWidget) Build()

Build implements Widget interface.

func (*InputIntWidget) Flags added in v0.5.0

func (i *InputIntWidget) Flags(flags InputTextFlags) *InputIntWidget

Flags sets flags.

func (*InputIntWidget) ID added in v0.8.0

func (i *InputIntWidget) ID(id ID) *InputIntWidget

ID sets widget's id.

func (*InputIntWidget) Label added in v0.5.5

func (i *InputIntWidget) Label(label string) *InputIntWidget

Label sets label (id).

func (*InputIntWidget) Labelf added in v0.6.0

func (i *InputIntWidget) Labelf(format string, args ...any) *InputIntWidget

Labelf sets formatted label.

func (*InputIntWidget) OnChange added in v0.5.0

func (i *InputIntWidget) OnChange(onChange func()) *InputIntWidget

OnChange adds on change callback.

func (*InputIntWidget) Size added in v0.5.0

func (i *InputIntWidget) Size(width float32) *InputIntWidget

Size sets input's width.

func (*InputIntWidget) StepSize added in v0.7.0

func (i *InputIntWidget) StepSize(step int) *InputIntWidget

StepSize sets the step size.

func (*InputIntWidget) StepSizeFast added in v0.7.0

func (i *InputIntWidget) StepSizeFast(stepFast int) *InputIntWidget

StepSizeFast sets the fast step size.

type InputTextFlags

type InputTextFlags imgui.InputTextFlags

InputTextFlags represents input text flags.

type InputTextMultilineWidget

type InputTextMultilineWidget struct {
	// contains filtered or unexported fields
}

InputTextMultilineWidget is a large (multiline) text input see examples/widgets/.

func InputTextMultiline

func InputTextMultiline(text *string) *InputTextMultilineWidget

InputTextMultiline creates InputTextMultilineWidget.

func (*InputTextMultilineWidget) AutoScrollToBottom added in v0.7.0

func (i *InputTextMultilineWidget) AutoScrollToBottom(b bool) *InputTextMultilineWidget

AutoScrollToBottom Enables/Disables auto scroll to bottom.

func (*InputTextMultilineWidget) Build

func (i *InputTextMultilineWidget) Build()

Build implements Widget interface.

func (*InputTextMultilineWidget) Callback added in v0.5.0

Callback sets imgui.InputTextCallback.

func (*InputTextMultilineWidget) Flags added in v0.5.0

Flags sets InputTextFlags (see Flags.go).

func (*InputTextMultilineWidget) ID added in v0.8.0

ID sets widget's id.

func (*InputTextMultilineWidget) Label added in v0.5.5

Label sets input field label.

func (*InputTextMultilineWidget) Labelf added in v0.6.0

func (i *InputTextMultilineWidget) Labelf(format string, args ...any) *InputTextMultilineWidget

Labelf is formatting version of Label.

func (*InputTextMultilineWidget) OnChange added in v0.5.0

func (i *InputTextMultilineWidget) OnChange(onChange func()) *InputTextMultilineWidget

OnChange set callback called when user action taken on input text field (when text was changed).

func (*InputTextMultilineWidget) Size added in v0.5.0

Size sets input field size.

type InputTextWidget

type InputTextWidget struct {
	// contains filtered or unexported fields
}

InputTextWidget is a single-line text input.

func InputText

func InputText(value *string) *InputTextWidget

InputText creates new input text widget.

func (*InputTextWidget) AutoComplete added in v0.5.5

func (i *InputTextWidget) AutoComplete(candidates []string) *InputTextWidget

AutoComplete enables auto complete popup by using fuzzy search of current value against candidates Press enter to confirm the first candidate.

func (*InputTextWidget) Build

func (i *InputTextWidget) Build()

Build implements Widget interface.

func (*InputTextWidget) Callback added in v0.5.0

Callback sets input text callback.

func (*InputTextWidget) Flags added in v0.5.0

Flags sets flags.

func (*InputTextWidget) Hint added in v0.5.4

func (i *InputTextWidget) Hint(hint string) *InputTextWidget

Hint sets hint text.

func (*InputTextWidget) ID added in v0.8.0

func (i *InputTextWidget) ID(id ID) *InputTextWidget

ID sets widget's id.

func (*InputTextWidget) Label added in v0.5.5

func (i *InputTextWidget) Label(label string) *InputTextWidget

Label adds label (alternatively you can use it to set widget's id).

func (*InputTextWidget) Labelf added in v0.6.0

func (i *InputTextWidget) Labelf(format string, args ...any) *InputTextWidget

Labelf adds formatted label.

func (*InputTextWidget) OnChange added in v0.5.0

func (i *InputTextWidget) OnChange(onChange func()) *InputTextWidget

OnChange sets callback when text was changed.

func (*InputTextWidget) Size added in v0.5.0

func (i *InputTextWidget) Size(width float32) *InputTextWidget

Size sets field's width.

type InvisibleButtonWidget

type InvisibleButtonWidget struct {
	// contains filtered or unexported fields
}

InvisibleButtonWidget is a clickable region. NOTE: you may want to display other widgets on this button. to do so, you may move drawing cursor back by Get/SetCursor(Screen)Pos.

func InvisibleButton

func InvisibleButton() *InvisibleButtonWidget

InvisibleButton constructs a new invisible button widget.

func (*InvisibleButtonWidget) Build

func (b *InvisibleButtonWidget) Build()

Build implements Widget interface.

func (*InvisibleButtonWidget) ID added in v0.6.0

ID allows to manually set widget's id (no need to use in normal conditions).

func (*InvisibleButtonWidget) OnClick added in v0.5.0

func (b *InvisibleButtonWidget) OnClick(onClick func()) *InvisibleButtonWidget

OnClick sets click event.

func (*InvisibleButtonWidget) Size added in v0.5.0

func (b *InvisibleButtonWidget) Size(width, height float32) *InvisibleButtonWidget

Size sets button's size.

type Key added in v0.4.2

type Key imgui.Key

Key represents a imgui key.

type LabelWidget

type LabelWidget struct {
	// contains filtered or unexported fields
}

LabelWidget is a plain text label.

func Label

func Label(label string) *LabelWidget

Label constructs label widget.

func Labelf added in v0.6.0

func Labelf(format string, args ...any) *LabelWidget

Labelf allows to add formatted label.

func (*LabelWidget) Build

func (l *LabelWidget) Build()

Build implements Widget interface.

func (*LabelWidget) Font added in v0.5.0

func (l *LabelWidget) Font(font *FontInfo) *LabelWidget

Font sets specific font (does like Style().SetFont).

func (*LabelWidget) Wrapped added in v0.5.0

func (l *LabelWidget) Wrapped(wrapped bool) *LabelWidget

Wrapped determines if label is wrapped.

type LanguageDefinition added in v0.6.0

type LanguageDefinition byte

LanguageDefinition represents code editor's language definition.

const (
	LanguageDefinitionNone        LanguageDefinition = LanguageDefinition(cte.None)
	LanguageDefinitionCPP         LanguageDefinition = LanguageDefinition(cte.Cpp)
	LanguageDefinitionC           LanguageDefinition = LanguageDefinition(cte.C)
	LanguageDefinitionCs          LanguageDefinition = LanguageDefinition(cte.Cs)
	LanguageDefinitionPython      LanguageDefinition = LanguageDefinition(cte.Python)
	LanguageDefinitionLua         LanguageDefinition = LanguageDefinition(cte.Lua)
	LanguageDefinitionJSON        LanguageDefinition = LanguageDefinition(cte.Json)
	LanguageDefinitionSQL         LanguageDefinition = LanguageDefinition(cte.Sql)
	LanguageDefinitionAngelScript LanguageDefinition = LanguageDefinition(cte.AngelScript)
	LanguageDefinitionGlsl        LanguageDefinition = LanguageDefinition(cte.Glsl)
	LanguageDefinitionHlsl        LanguageDefinition = LanguageDefinition(cte.Hlsl)
)

language definitions:.

type Layout

type Layout []Widget

Layout is a set of widgets. It implements Widget interface so Layout can be used as a widget.

func PrepareMsgbox

func PrepareMsgbox() Layout

PrepareMsgbox should be invoked in function in the same layout level where you call g.Msgbox. BUG: calling this more than 1 time per frame causes unexpected merging msgboxes layouts (see https://github.com/AllenDang/giu/issues/290)

func RangeBuilder

func RangeBuilder[S ~[]T, T any](id string, values S, builder func(int, T) Widget) Layout

RangeBuilder batch create widgets and render only which is visible.

func (Layout) Build

func (l Layout) Build()

Build implements Widget interface.

func (Layout) Range added in v0.6.0

func (l Layout) Range(rangeFunc func(Widget))

Range ranges over the Layout, calling rangeFunc on each loop iteration.

type LinePlot added in v0.7.0

type LinePlot struct {
	// contains filtered or unexported fields
}

LinePlot represents a plot line (linear chart).

func Line

func Line(title string, values []float64) *LinePlot

Line adds a new plot line to the canvas.

func (*LinePlot) Offset added in v0.7.0

func (p *LinePlot) Offset(offset int) *LinePlot

Offset sets chart offset.

func (*LinePlot) Plot added in v0.7.0

func (p *LinePlot) Plot()

Plot implements Plot interface.

func (*LinePlot) SetPlotYAxis added in v0.7.0

func (p *LinePlot) SetPlotYAxis(yAxis ImPlotYAxis) *LinePlot

SetPlotYAxis sets yAxis parameters.

func (*LinePlot) X0 added in v0.7.0

func (p *LinePlot) X0(x0 float64) *LinePlot

X0 sets a start position on x axis.

func (*LinePlot) XScale added in v0.7.0

func (p *LinePlot) XScale(scale float64) *LinePlot

XScale sets x-axis-scale.

type LineXYPlot added in v0.7.0

type LineXYPlot struct {
	// contains filtered or unexported fields
}

LineXYPlot adds XY plot line.

func LineXY added in v0.7.0

func LineXY(title string, xvalues, yvalues []float64) *LineXYPlot

LineXY adds XY plot line to canvas.

func (*LineXYPlot) Offset added in v0.7.0

func (p *LineXYPlot) Offset(offset int) *LineXYPlot

Offset sets chart's offset.

func (*LineXYPlot) Plot added in v0.7.0

func (p *LineXYPlot) Plot()

Plot implements Plot interface.

func (*LineXYPlot) SetPlotYAxis added in v0.7.0

func (p *LineXYPlot) SetPlotYAxis(yAxis ImPlotYAxis) *LineXYPlot

SetPlotYAxis sets yAxis parameters.

type ListBoxWidget

type ListBoxWidget struct {
	// contains filtered or unexported fields
}

ListBoxWidget is a field with selectable items (Child with Selectables).

func ListBox

func ListBox(items []string) *ListBoxWidget

ListBox creates new ListBoxWidget.

func (*ListBoxWidget) Border added in v0.5.0

func (l *ListBoxWidget) Border(b bool) *ListBoxWidget

Border sets whether box should have border (see Child().Border(...).

func (*ListBoxWidget) Build

func (l *ListBoxWidget) Build()

Build implements Widget interface

func (*ListBoxWidget) ContextMenu added in v0.5.0

func (l *ListBoxWidget) ContextMenu(menuItems []string) *ListBoxWidget

ContextMenu adds item in context menu which is opened when user right-click on item.

func (*ListBoxWidget) ID added in v0.8.0

func (l *ListBoxWidget) ID(id ID) *ListBoxWidget

ID assigns hardcoded ID (baypass GenAutoID mechanism).

func (*ListBoxWidget) OnChange added in v0.5.0

func (l *ListBoxWidget) OnChange(onChange func(selectedIndex int)) *ListBoxWidget

OnChange sets callback called when user changes their selection.

func (*ListBoxWidget) OnDClick added in v0.5.0

func (l *ListBoxWidget) OnDClick(onDClick func(selectedIndex int)) *ListBoxWidget

OnDClick sets callback on double click.

func (*ListBoxWidget) OnMenu added in v0.5.0

func (l *ListBoxWidget) OnMenu(onMenu func(selectedIndex int, menu string)) *ListBoxWidget

OnMenu sets callback called when context menu item clicked.

func (*ListBoxWidget) SelectedIndex added in v0.7.0

func (l *ListBoxWidget) SelectedIndex(i *int32) *ListBoxWidget

SelectedIndex sets a pointer where the selected index will be stored.

func (*ListBoxWidget) Size added in v0.5.0

func (l *ListBoxWidget) Size(width, height float32) *ListBoxWidget

Size sets size of the box.

type ListClipperWrapper added in v0.6.0

type ListClipperWrapper struct {
	// contains filtered or unexported fields
}

ListClipperWrapper is a ImGuiListClipper implementation. it can be used to display a large, vertical list of items and avoid rendering them.

func ListClipper added in v0.6.0

func ListClipper() *ListClipperWrapper

ListClipper creates list clipper.

func (*ListClipperWrapper) Build added in v0.6.0

func (l *ListClipperWrapper) Build()

Build implements widget interface.

func (*ListClipperWrapper) Layout added in v0.6.0

func (l *ListClipperWrapper) Layout(layout ...Widget) *ListClipperWrapper

Layout sets layout for list clipper.

type MainMenuBarWidget struct {
	// contains filtered or unexported fields
}

MainMenuBarWidget is a widget that creates a main menu bar. Main means that it will be docked to the MasterWindow. Do NOT use with SingleWindow (see MenuBarWidget).

func MainMenuBar() *MainMenuBarWidget

MainMenuBar creates new MainMenuBarWidget.

func (m *MainMenuBarWidget) Build()

Build implements Widget interface.

func (m *MainMenuBarWidget) Layout(widgets ...Widget) *MainMenuBarWidget

Layout sets layout of the menu bar. (See MenuWidget).

type ManipulateGizmo added in v0.10.0

type ManipulateGizmo struct {
	// contains filtered or unexported fields
}

ManipulateGizmo is a gizmo that allows you to "visually manipulate a matrix". It can be attached to another Gizmo (e.g. CubeGizmo) and will allow to move/rotate/scale it. See (*CubeGizmo).Manipulate() method.

func Manipulate added in v0.10.0

func Manipulate(matrix *ViewMatrix) *ManipulateGizmo

Manipulate creates a new ManipulateGizmo.

func (*ManipulateGizmo) Gizmo added in v0.10.0

func (m *ManipulateGizmo) Gizmo(view *ViewMatrix, projection *ProjectionMatrix)

Gizmo implements GizmoI interface.

type MarkdownWidget added in v0.6.0

type MarkdownWidget struct {
	// contains filtered or unexported fields
}

MarkdownWidget implements DearImGui markdown extension https://github.com/juliettef/imgui_markdown It is like LabelWidget but with md formatting.

func Markdown added in v0.6.0

func Markdown(md string) *MarkdownWidget

Markdown creates new markdown widget.

func (*MarkdownWidget) Build added in v0.6.0

func (m *MarkdownWidget) Build()

Build implements Widget interface.

func (*MarkdownWidget) Header added in v0.6.0

func (m *MarkdownWidget) Header(level int, font *FontInfo, separator bool) *MarkdownWidget

Header sets header formatting NOTE: level (counting from 0!) is header level. (for instance, header `# H1` will have level 0). NOTE: since cimgui-go there are only 3 levels (so level < 3 here). This will panic if level >= 3! TODO: it actually doesn't work.

func (m *MarkdownWidget) OnLink(cb func(url string)) *MarkdownWidget

OnLink sets another than default link callback. NOTE: due to cimgui-go's limitation https://github.com/AllenDang/cimgui-go?tab=readme-ov-file#callbacks we clear MarkdownLinkCallback pool every frame. No further action from you should be required (just feel informed). ref (*MasterWindow).beforeRender.

type MasterWindow

type MasterWindow struct {
	// contains filtered or unexported fields
}

MasterWindow represents a glfw master window It is a base for a windows (see Window.go).

func NewMasterWindow

func NewMasterWindow(title string, width, height int, flags MasterWindowFlags) *MasterWindow

NewMasterWindow creates a new master window and initializes GLFW. it should be called in main function. For more details and use cases, see examples/helloworld/.

func (*MasterWindow) Close added in v0.6.0

func (w *MasterWindow) Close()

Close will safely close the master window.

func (*MasterWindow) GetPos added in v0.4.2

func (w *MasterWindow) GetPos() (x, y int)

GetPos return position of master window.

func (*MasterWindow) GetSize

func (w *MasterWindow) GetSize() (width, height int)

GetSize return size of master window.

func (*MasterWindow) RegisterKeyboardShortcuts added in v0.5.5

func (w *MasterWindow) RegisterKeyboardShortcuts(s ...WindowShortcut) *MasterWindow

RegisterKeyboardShortcuts registers a global - master window - keyboard shortcuts.

func (*MasterWindow) Run added in v0.5.0

func (w *MasterWindow) Run(loopFunc func())

Run runs the main loop. loopFunc will be used to construct the ui. Run should be called at the end of main function, after setting up the master window.

func (*MasterWindow) SetAdditionalInputHandlerCallback added in v0.7.0

func (w *MasterWindow) SetAdditionalInputHandlerCallback(cb InputHandlerHandleCallback)

SetAdditionalInputHandlerCallback allows to set an input callback to handle more events (not only these from giu.inputHandler). See examples/issue-501.

func (*MasterWindow) SetBgColor

func (w *MasterWindow) SetBgColor(bgColor color.Color)

SetBgColor sets background color of master window.

func (*MasterWindow) SetCloseCallback added in v0.5.6

func (w *MasterWindow) SetCloseCallback(cb func() bool)

SetCloseCallback sets the close callback of the window, which is called when the user attempts to close the window, for example by clicking the close widget in the title bar.

The close flag is set before this callback is called, but you can modify it at any time with returned value of callback function.

Mac OS X: Selecting Quit from the application menu will trigger the close callback for all windows.

func (*MasterWindow) SetDropCallback

func (w *MasterWindow) SetDropCallback(cb func([]string))

SetDropCallback sets callback when file was dropped into the window.

func (*MasterWindow) SetIcon added in v0.5.6

func (w *MasterWindow) SetIcon(icons ...image.Image)

SetIcon sets the icon of the specified window. If passed an array of candidate images, those of or closest to the sizes desired by the system are selected. If no images are specified, the window reverts to its default icon.

The image is ideally provided in the form of *image.NRGBA. The pixels are 32-bit, little-endian, non-premultiplied RGBA, i.e. eight bits per channel with the red channel first. They are arranged canonically as packed sequential rows, starting from the top-left corner. If the image type is not *image.NRGBA, it will be converted to it.

The desired image sizes varies depending on platform and system settings. The selected images will be rescaled as needed. Good sizes include 16x16, 32x32 and 48x48.

func (*MasterWindow) SetInputHandler added in v0.6.0

func (w *MasterWindow) SetInputHandler(handler InputHandler)

SetInputHandler allows to change default input handler. see InputHandler.go.

func (*MasterWindow) SetPos added in v0.4.2

func (w *MasterWindow) SetPos(x, y int)

SetPos sets position of master window.

func (*MasterWindow) SetShouldClose added in v0.6.0

func (w *MasterWindow) SetShouldClose(v bool)

SetShouldClose sets whether master window should be closed.

func (*MasterWindow) SetSize added in v0.5.1

func (w *MasterWindow) SetSize(x, y int)

SetSize sets size of master window.

func (*MasterWindow) SetSizeLimits added in v0.6.0

func (w *MasterWindow) SetSizeLimits(minw, minh, maxw, maxh int)

SetSizeLimits sets the size limits of the client area of the specified window. If the window is full screen or not resizable, this function does nothing.

The size limits are applied immediately and may cause the window to be resized. To specify only a minimum size or only a maximum one, set the other pair to giu.DontCare. To disable size limits for a window, set them all to giu.DontCare.

func (*MasterWindow) SetTargetFPS added in v0.8.0

func (w *MasterWindow) SetTargetFPS(fps uint)

SetTargetFPS sets target FPS of master window. Default for GLFW is 30.

func (*MasterWindow) SetTitle added in v0.6.0

func (w *MasterWindow) SetTitle(title string)

SetTitle updates master window's title.

type MasterWindowFlags

type MasterWindowFlags int

MasterWindowFlags implements BackendWindowFlags.

const (
	// Specifies the window will be fixed size.
	MasterWindowFlagsNotResizable MasterWindowFlags = 1 << iota
	// Specifies whether the window is maximized.
	MasterWindowFlagsMaximized
	// Specifies whether the window will be always-on-top.
	MasterWindowFlagsFloating
	// Specifies whether the window will be frameless.
	MasterWindowFlagsFrameless
	// Specifies whether the window will be transparent.
	MasterWindowFlagsTransparent
	// Specifies whether the window will be hidden (for use with multiple windows).
	MasterWindowFlagsHidden
)

master window flags.

type MenuBarWidget struct {
	// contains filtered or unexported fields
}

MenuBarWidget is a widget that creates a menu bar for a window. Use it e.g. with SingleWindowWithMenuBar.

func MenuBar() *MenuBarWidget

MenuBar creates new MenuBarWidget.

func (m *MenuBarWidget) Build()

Build implements Widget interface.

func (m *MenuBarWidget) Layout(widgets ...Widget) *MenuBarWidget

Layout sets layout of the menu bar. (See MenuWidget).

type MenuItemWidget struct {
	// contains filtered or unexported fields
}

MenuItemWidget is a menu node. Commonly used inside of MenuWidget.

func MenuItem(label string) *MenuItemWidget

MenuItem creates new MenuItemWidget.

func MenuItemf(format string, args ...any) *MenuItemWidget

MenuItemf creates MenuItem with formated label.

func (m *MenuItemWidget) Build()

Build implements Widget interface.

func (m *MenuItemWidget) Enabled(e bool) *MenuItemWidget

Enabled sets whether the item is enabled.

func (m *MenuItemWidget) OnClick(onClick func()) *MenuItemWidget

OnClick sets callback that will be executed when item is clicked.

func (m *MenuItemWidget) Selected(s bool) *MenuItemWidget

Selected sets whether the item is selected.

func (m *MenuItemWidget) Shortcut(s string) *MenuItemWidget

Shortcut sets shortcut of the item (grayed, right-aligned text). Used for presenting e.g. keyboard shortcuts (e.g. "Ctrl+S") NOTE: this is only a visual effect. It has nothing to do with keyboard shortcuts.

type MenuWidget struct {
	// contains filtered or unexported fields
}

MenuWidget is a node of (Main)MenuBarWidget. See also: MenuItemWidget, MenuBarWidget, MainMenuBarWidget.

func Menu(label string) *MenuWidget

Menu creates new MenuWidget.

func Menuf(format string, args ...any) *MenuWidget

Menuf is alias to Menu(fmt.Sprintf(format, args...)).

func (m *MenuWidget) Build()

Build implements Widget interface.

func (m *MenuWidget) Enabled(e bool) *MenuWidget

Enabled sets whether the menu is enabled.

func (m *MenuWidget) Layout(widgets ...Widget) *MenuWidget

Layout sets layout of the menu. (See MenuItemWidget).

type Modifier added in v0.5.5

type Modifier imgui.Key

Modifier represents imgui.Modifier.

type MouseButton

type MouseButton imgui.MouseButton

MouseButton represents imgui.MouseButton.

mouse buttons.

type MouseCursorType

type MouseCursorType imgui.MouseCursor

MouseCursorType represents a type (layout) of mouse cursor.

type MsgboxButtons

type MsgboxButtons uint8

MsgboxButtons determines which buttons are in the dialog.

const (
	// Yes-No question.
	MsgboxButtonsYesNo MsgboxButtons = 1 << iota
	// Ok / Cancel dialog.
	MsgboxButtonsOkCancel
	// info.
	MsgboxButtonsOk
)

button sets.

type MsgboxWidget added in v0.6.0

type MsgboxWidget struct{}

MsgboxWidget represents message dialog.

func Msgbox

func Msgbox(title, content string) *MsgboxWidget

Msgbox opens message box. call it whenever you want to open popup with question / info.

func (*MsgboxWidget) Buttons added in v0.6.0

func (m *MsgboxWidget) Buttons(buttons MsgboxButtons) *MsgboxWidget

Buttons sets which buttons should be possible.

func (*MsgboxWidget) ResultCallback added in v0.6.0

func (m *MsgboxWidget) ResultCallback(cb DialogResultCallback) *MsgboxWidget

ResultCallback sets result callback.

type PieChartPlot added in v0.7.0

type PieChartPlot struct {
	// contains filtered or unexported fields
}

PieChartPlot represents a pie chart. TODO: support PlotPieChartFlags.

func PieChart added in v0.7.0

func PieChart(labels []string, values []float64, x, y, radius float64) *PieChartPlot

PieChart adds pie chart to the canvas.

func (*PieChartPlot) Angle0 added in v0.7.0

func (p *PieChartPlot) Angle0(a float64) *PieChartPlot

Angle0 sets start angle.

func (*PieChartPlot) LabelFormat added in v0.7.0

func (p *PieChartPlot) LabelFormat(fmtStr string) *PieChartPlot

LabelFormat sets format of labels.

func (*PieChartPlot) Normalize added in v0.7.0

func (p *PieChartPlot) Normalize(n bool) *PieChartPlot

Normalize sets normalize flag.

func (*PieChartPlot) Plot added in v0.7.0

func (p *PieChartPlot) Plot()

Plot implements Plot interface.

type PlotAxisFlags added in v0.5.5

type PlotAxisFlags implot.AxisFlags

PlotAxisFlags represents implot.AxisFlags.

const (
	PlotAxisFlagsNone         PlotAxisFlags = PlotAxisFlags(implot.AxisFlagsNone)
	PlotAxisFlagsNoLabel      PlotAxisFlags = PlotAxisFlags(implot.AxisFlagsNoLabel)
	PlotAxisFlagsNoGridLines  PlotAxisFlags = PlotAxisFlags(implot.AxisFlagsNoGridLines)
	PlotAxisFlagsNoTickMarks  PlotAxisFlags = PlotAxisFlags(implot.AxisFlagsNoTickMarks)
	PlotAxisFlagsNoTickLabels PlotAxisFlags = PlotAxisFlags(implot.AxisFlagsNoTickLabels)
	PlotAxisFlagsForeground   PlotAxisFlags = PlotAxisFlags(implot.AxisFlagsForeground)
	//	PlotAxisFlagsLogScale      PlotAxisFlags = PlotAxisFlags(implot.AxisFlagsLogScale)
	//	PlotAxisFlagsTime          PlotAxisFlags = PlotAxisFlags(implot.AxisFlagsTime)
	PlotAxisFlagsInvert        PlotAxisFlags = PlotAxisFlags(implot.AxisFlagsInvert)
	PlotAxisFlagsNoInitialFit  PlotAxisFlags = PlotAxisFlags(implot.AxisFlagsNoInitialFit)
	PlotAxisFlagsAutoFit       PlotAxisFlags = PlotAxisFlags(implot.AxisFlagsAutoFit)
	PlotAxisFlagsRangeFit      PlotAxisFlags = PlotAxisFlags(implot.AxisFlagsRangeFit)
	PlotAxisFlagsLockMin       PlotAxisFlags = PlotAxisFlags(implot.AxisFlagsLockMin)
	PlotAxisFlagsLockMax       PlotAxisFlags = PlotAxisFlags(implot.AxisFlagsLockMax)
	PlotAxisFlagsLock          PlotAxisFlags = PlotAxisFlags(implot.AxisFlagsLock)
	PlotAxisFlagsNoDecorations PlotAxisFlags = PlotAxisFlags(implot.AxisFlagsNoDecorations)
)

plot axis flags.

type PlotCanvasWidget added in v0.5.1

type PlotCanvasWidget struct {
	// contains filtered or unexported fields
}

PlotCanvasWidget represents a giu plot widget.

func Plot added in v0.5.1

func Plot(title string) *PlotCanvasWidget

Plot adds creates a new plot widget.

func (*PlotCanvasWidget) AxisLimits added in v0.5.1

func (p *PlotCanvasWidget) AxisLimits(xmin, xmax, ymin, ymax float64, cond ExecCondition) *PlotCanvasWidget

AxisLimits sets X and Y axis limits.

func (*PlotCanvasWidget) Build added in v0.5.1

func (p *PlotCanvasWidget) Build()

Build implements Widget interface.

func (*PlotCanvasWidget) Flags added in v0.5.1

func (p *PlotCanvasWidget) Flags(flags PlotFlags) *PlotCanvasWidget

Flags sets plot canvas flags.

func (*PlotCanvasWidget) Plots added in v0.5.1

func (p *PlotCanvasWidget) Plots(plots ...PlotWidget) *PlotCanvasWidget

Plots adds plots to plot canvas.

func (*PlotCanvasWidget) SetXAxisLabel added in v0.8.0

func (p *PlotCanvasWidget) SetXAxisLabel(axis PlotXAxis, label string) *PlotCanvasWidget

SetXAxisLabel sets x axis label.

func (*PlotCanvasWidget) SetYAxisLabel added in v0.8.0

func (p *PlotCanvasWidget) SetYAxisLabel(axis PlotYAxis, label string) *PlotCanvasWidget

SetYAxisLabel sets y axis label.

func (*PlotCanvasWidget) Size added in v0.5.1

func (p *PlotCanvasWidget) Size(width, height int) *PlotCanvasWidget

Size set canvas size.

func (*PlotCanvasWidget) XAxeFlags added in v0.5.1

func (p *PlotCanvasWidget) XAxeFlags(flags PlotAxisFlags) *PlotCanvasWidget

XAxeFlags sets x axis fags.

func (*PlotCanvasWidget) XTicks added in v0.5.1

func (p *PlotCanvasWidget) XTicks(ticks []PlotTicker, showDefault bool) *PlotCanvasWidget

XTicks sets x axis ticks.

func (*PlotCanvasWidget) YAxeFlags added in v0.5.1

func (p *PlotCanvasWidget) YAxeFlags(yFlags, y2Flags, y3Flags PlotAxisFlags) *PlotCanvasWidget

YAxeFlags sets y axis flags.

func (*PlotCanvasWidget) YTicks added in v0.5.1

func (p *PlotCanvasWidget) YTicks(ticks []PlotTicker, showDefault bool, yAxis ImPlotYAxis) *PlotCanvasWidget

YTicks sets y axis ticks.

type PlotFlags added in v0.5.5

type PlotFlags implot.Flags

PlotFlags represents implot.Flags.

type PlotTicker added in v0.5.1

type PlotTicker struct {
	Position float64
	Label    string
}

PlotTicker represents axis ticks.

type PlotWidget added in v0.5.1

type PlotWidget interface {
	Plot()
}

PlotWidget is implemented by all the particular plots, which can be used in (*PlotCanvasWidget).Plots.

func SwitchPlotAxes added in v0.8.0

func SwitchPlotAxes(x PlotXAxis, y PlotYAxis) PlotWidget

SwitchPlotAxes switches plot axes.

type PlotXAxis added in v0.8.0

type PlotXAxis = implot.AxisEnum

PlotXAxis allows to chose X axis.

type PlotYAxis added in v0.8.0

type PlotYAxis = implot.AxisEnum

PlotYAxis allows to chose Y axis.

type PopupModalWidget added in v0.4.2

type PopupModalWidget struct {
	// contains filtered or unexported fields
}

PopupModalWidget is a popup window that block every interactions behind it, cannot be closed by user, adds a dimming background, has a title bar.

func PopupModal

func PopupModal(name string) *PopupModalWidget

PopupModal creates new popup modal widget.

func (*PopupModalWidget) Build added in v0.4.2

func (p *PopupModalWidget) Build()

Build implements Widget interface.

func (*PopupModalWidget) Flags added in v0.5.0

Flags allows to specify popup's flags.

func (*PopupModalWidget) IsOpen added in v0.5.0

func (p *PopupModalWidget) IsOpen(open *bool) *PopupModalWidget

IsOpen allows to control popup's state NOTE: changing opens' value will not result in changing popup's state if OpenPopup(...) wasn't called!

func (*PopupModalWidget) Layout added in v0.5.0

func (p *PopupModalWidget) Layout(widgets ...Widget) *PopupModalWidget

Layout sets layout.

type PopupWidget

type PopupWidget struct {
	// contains filtered or unexported fields
}

PopupWidget is a window which appears next to the mouse cursor. For instance it is used to display color palette in ColorSelectWidget.

func Popup(name string) *PopupWidget

Popup creates new popup widget.

func (*PopupWidget) Build

func (p *PopupWidget) Build()

Build implements Widget interface.

func (*PopupWidget) Flags added in v0.5.0

func (p *PopupWidget) Flags(flags WindowFlags) *PopupWidget

Flags sets popup's flags.

func (*PopupWidget) Layout added in v0.5.0

func (p *PopupWidget) Layout(widgets ...Widget) *PopupWidget

Layout sets popup's layout.

type ProgressBarWidget

type ProgressBarWidget struct {
	// contains filtered or unexported fields
}

ProgressBarWidget is a progress bar (like in windows' copy-file dialog). It is a perfect solution to indicate percentage progress of some action.

func ProgressBar

func ProgressBar(fraction float32) *ProgressBarWidget

ProgressBar creates new ProgressBar.

func (*ProgressBarWidget) Build

func (p *ProgressBarWidget) Build()

Build implements Widget interface.

func (*ProgressBarWidget) Overlay added in v0.5.0

func (p *ProgressBarWidget) Overlay(overlay string) *ProgressBarWidget

Overlay sets custom overlay displayed on the bar.

func (*ProgressBarWidget) Overlayf added in v0.6.0

func (p *ProgressBarWidget) Overlayf(format string, args ...any) *ProgressBarWidget

Overlayf is alias to Overlay(fmt.Sprintf(format, args...)).

func (*ProgressBarWidget) Size added in v0.5.0

func (p *ProgressBarWidget) Size(width, height float32) *ProgressBarWidget

Size sets size of the bar.

type ProgressIndicatorWidget

type ProgressIndicatorWidget struct {
	// contains filtered or unexported fields
}

ProgressIndicatorWidget represents progress indicator widget see examples/extrawidgets/.

func ProgressIndicator

func ProgressIndicator(label string, width, height, radius float32) *ProgressIndicatorWidget

ProgressIndicator creates a new ProgressIndicatorWidget.

func (*ProgressIndicatorWidget) Build

func (p *ProgressIndicatorWidget) Build()

Build implements Widget interface.

type ProjectionMatrix added in v0.10.0

type ProjectionMatrix struct {
	// contains filtered or unexported fields
}

ProjectionMatrix represents a matrix for Gizmo projection. ref: https://www.opengl-tutorial.org/beginners-tutorials/tutorial-3-matrices/#the-projection-matrix

func NewProjectionMatrix added in v0.10.0

func NewProjectionMatrix() *ProjectionMatrix

NewProjectionMatrix creates a new ProjectionMatrix.

func (*ProjectionMatrix) Aspect added in v0.10.0

func (p *ProjectionMatrix) Aspect(aspect float32) *ProjectionMatrix

Aspect sets the Aspect Ratio.

func (*ProjectionMatrix) Copy added in v0.10.0

Copy returns a copy of the matrix.

func (*ProjectionMatrix) FOV added in v0.10.0

FOV sets the Field of View.

func (*ProjectionMatrix) FarClipping added in v0.10.0

func (p *ProjectionMatrix) FarClipping(far float32) *ProjectionMatrix

FarClipping sets the Far Clipping plane.

func (*ProjectionMatrix) NearClipping added in v0.10.0

func (p *ProjectionMatrix) NearClipping(near float32) *ProjectionMatrix

NearClipping sets the Near Clipping plane.

type RadioButtonWidget

type RadioButtonWidget struct {
	// contains filtered or unexported fields
}

RadioButtonWidget is a small, round button. It is common to use it for single-choice questions. see examples/widgets.

func RadioButton

func RadioButton(text string, active bool) *RadioButtonWidget

RadioButton creates a radio button.

func (*RadioButtonWidget) Build

func (r *RadioButtonWidget) Build()

Build implements Widget interface.

func (*RadioButtonWidget) OnChange added in v0.5.0

func (r *RadioButtonWidget) OnChange(onChange func()) *RadioButtonWidget

OnChange adds callback when button's state gets changed.

type ReflectiveBoundTexture added in v0.9.0

type ReflectiveBoundTexture struct {
	Surface *image.RGBA // Surface is the RGBA image data for the texture.
	// contains filtered or unexported fields
}

ReflectiveBoundTexture represents a texture that can be dynamically updated and bound to a GPU.

func (*ReflectiveBoundTexture) ForceCommit added in v0.9.0

func (i *ReflectiveBoundTexture) ForceCommit() (*ReflectiveBoundTexture, bool)

ForceCommit forces committing.

func (*ReflectiveBoundTexture) ForceRelease added in v0.9.0

func (i *ReflectiveBoundTexture) ForceRelease()

ForceRelease forces releasing resources against all finalizers, effectively losing the object but ensuring both RAM and VRAM are freed.

func (*ReflectiveBoundTexture) GetFSRoot added in v0.9.0

func (i *ReflectiveBoundTexture) GetFSRoot() string

GetFSRoot returns the root directory for file:// URLs.

Returns:

  • string: The root directory.

func (*ReflectiveBoundTexture) GetImGuiImageVDefaultOptionsStruct added in v0.9.0

func (i *ReflectiveBoundTexture) GetImGuiImageVDefaultOptionsStruct() ImguiImageVOptionStruct

GetImGuiImageVDefaultOptionsStruct returns the default options for rendering an image in ImGui.

Returns:

  • ImguiImageVOptionStruct: The default options for rendering an image.

func (*ReflectiveBoundTexture) GetRGBA added in v0.9.0

func (i *ReflectiveBoundTexture) GetRGBA(commit bool) *image.RGBA

GetRGBA returns the RGBA surface of the ReflectiveBoundTexture. If the commit parameter is true, it commits any pending changes before returning the surface.

Parameters:

  • commit: A boolean indicating whether to commit any pending changes.

Returns:

  • *image.RGBA: The RGBA surface of the ReflectiveBoundTexture.

func (*ReflectiveBoundTexture) GetSurfaceHeight added in v0.9.0

func (i *ReflectiveBoundTexture) GetSurfaceHeight() int

GetSurfaceHeight returns the height of the RGBA surface.

func (*ReflectiveBoundTexture) GetSurfaceSize added in v0.9.0

func (i *ReflectiveBoundTexture) GetSurfaceSize() image.Point

GetSurfaceSize returns the size of the RGBA surface as an image.Point.

func (*ReflectiveBoundTexture) GetSurfaceWidth added in v0.9.0

func (i *ReflectiveBoundTexture) GetSurfaceWidth() int

GetSurfaceWidth returns the width of the RGBA surface.

func (*ReflectiveBoundTexture) ImguiImage added in v0.9.0

func (i *ReflectiveBoundTexture) ImguiImage(width, height float32)

ImguiImage renders the ReflectiveBoundTexture as an image in ImGui.

Parameters:

  • width: The width of the image. If set to -1, it will use the available content region width.
  • height: The height of the image. If set to -1, it will use the available content region height.
  • options: The options for rendering the image.

func (*ReflectiveBoundTexture) ImguiImageButtonV added in v0.9.0

func (i *ReflectiveBoundTexture) ImguiImageButtonV(id string, width, height float32, options ImguiImageVOptionStruct)

ImguiImageButtonV renders the ReflectiveBoundTexture as an image button in ImGui with additional options.

Parameters:

  • id: The ID of the image button.
  • width: The width of the image button. If set to -1, it will use the available content region width.
  • height: The height of the image button. If set to -1, it will use the available content region height.
  • options: The options for rendering the image button, including UV coordinates, tint color, and border color.

func (*ReflectiveBoundTexture) ImguiImageV added in v0.9.0

func (i *ReflectiveBoundTexture) ImguiImageV(width, height float32, options ImguiImageVOptionStruct)

ImguiImageV renders the ReflectiveBoundTexture as an image in ImGui with additional options.

Parameters:

  • width: The width of the image. If set to -1, it will use the available content region width.
  • height: The height of the image. If set to -1, it will use the available content region height.
  • options: The options for rendering the image, including UV coordinates, tint color, and border color.

func (*ReflectiveBoundTexture) LoadSurface added in v0.9.0

func (i *ReflectiveBoundTexture) LoadSurface(loader SurfaceLoader, commit bool) error

LoadSurface loads a surface using a SurfaceLoader.

Parameters:

  • loader: The SurfaceLoader to use for loading the surface.
  • commit: A boolean flag indicating whether to commit the changes.

Returns:

  • error: An error if the surface could not be loaded.

func (*ReflectiveBoundTexture) LoadSurfaceFunc added in v0.9.0

func (i *ReflectiveBoundTexture) LoadSurfaceFunc(fn SurfaceLoaderFunc, commit bool) error

LoadSurfaceFunc loads a surface using a SurfaceLoaderFunc.

Parameters:

  • fn: The SurfaceLoaderFunc to use for loading the surface.
  • commit: A boolean flag indicating whether to commit the changes.

Returns:

  • error: An error if the surface could not be loaded.

func (*ReflectiveBoundTexture) SetFSRoot added in v0.9.0

func (i *ReflectiveBoundTexture) SetFSRoot(root string)

SetFSRoot sets the root directory for file:// URLs.

Parameters:

  • root: The root directory to set.

func (*ReflectiveBoundTexture) SetSurfaceFromFile added in v0.9.0

func (i *ReflectiveBoundTexture) SetSurfaceFromFile(path string, commit bool) error

SetSurfaceFromFile loads an image from the specified file path and sets it as the surface of the ReflectiveBoundTexture.

Parameters:

  • path: The path to the file to load the image from.
  • commit: A boolean flag indicating whether to commit the changes.

Returns:

  • error: An error if the image could not be loaded or set as the surface.

func (*ReflectiveBoundTexture) SetSurfaceFromFsFile added in v0.9.0

func (i *ReflectiveBoundTexture) SetSurfaceFromFsFile(file fs.File, commit bool) error

SetSurfaceFromFsFile loads an image from the specified file interface and sets it as the surface of the ReflectiveBoundTexture.

Parameters:

  • file: the file interface representing the file
  • commit: A boolean flag indicating whether to commit the changes.

Returns:

  • error: An error if the image could not be loaded or set as the surface.

func (*ReflectiveBoundTexture) SetSurfaceFromRGBA added in v0.9.0

func (i *ReflectiveBoundTexture) SetSurfaceFromRGBA(img *image.RGBA, commit bool) error

SetSurfaceFromRGBA sets the surface of the ReflectiveBoundTexture from the provided RGBA image. If the provided image is nil, it returns an error. If the commit flag is true, it commits the changes.

Parameters:

  • img: The RGBA image to set as the surface.
  • commit: A boolean flag indicating whether to commit the changes.

Returns:

  • error: An error if the provided image is nil, otherwise nil.

func (*ReflectiveBoundTexture) SetSurfaceFromURL added in v0.9.0

func (i *ReflectiveBoundTexture) SetSurfaceFromURL(url string, timeout time.Duration, commit bool) error

SetSurfaceFromURL loads an image from the specified URL and sets it as the surface of the ReflectiveBoundTexture.

Parameters:

  • url: The URL to load the image from.
  • timeout: The timeout duration for the HTTP request.
  • commit: A boolean flag indicating whether to commit the changes.

Returns:

  • error: An error if the image could not be loaded or set as the surface.

func (*ReflectiveBoundTexture) SetSurfaceUniform added in v0.9.0

func (i *ReflectiveBoundTexture) SetSurfaceUniform(width, height int, c color.Color, commit bool) error

SetSurfaceUniform creates a uniform color image and sets it as the surface of the ReflectiveBoundTexture.

Parameters:

  • width: The width of the image.
  • height: The height of the image.
  • c: The color of the image.
  • commit: A boolean flag indicating whether to commit the changes.

Returns:

  • error: An error if the image could not be created or set as the surface.

func (*ReflectiveBoundTexture) Texture added in v0.9.0

func (i *ReflectiveBoundTexture) Texture() *Texture

Texture commits any pending changes to the RGBA surface and returns the associated texture.

func (*ReflectiveBoundTexture) TextureID added in v0.9.0

func (i *ReflectiveBoundTexture) TextureID() imgui.TextureID

TextureID commits any pending changes and returns the ImGui TextureID of the associated texture.

func (*ReflectiveBoundTexture) ToImageWidget added in v0.9.0

func (i *ReflectiveBoundTexture) ToImageWidget() *ImageWidget

ToImageWidget converts the ReflectiveBoundTexture to an ImageWidget.

Returns:

  • *ImageWidget: The ImageWidget representation of the ReflectiveBoundTexture.

type RowWidget

type RowWidget struct {
	// contains filtered or unexported fields
}

RowWidget joins a layout into one line calls imgui.SameLine().

func Row

func Row(widgets ...Widget) *RowWidget

Row creates RowWidget.

func (*RowWidget) Build

func (l *RowWidget) Build()

Build implements Widget interface.

type ScatterPlot added in v0.7.0

type ScatterPlot struct {
	// contains filtered or unexported fields
}

ScatterPlot represents a scatter plot.

func Scatter added in v0.7.0

func Scatter(label string, values []float64) *ScatterPlot

Scatter adds scatter plot to the canvas.

func (*ScatterPlot) Offset added in v0.7.0

func (p *ScatterPlot) Offset(offset int) *ScatterPlot

Offset sets chart offset.

func (*ScatterPlot) Plot added in v0.7.0

func (p *ScatterPlot) Plot()

Plot implements Plot interface.

func (*ScatterPlot) X0 added in v0.7.0

func (p *ScatterPlot) X0(x float64) *ScatterPlot

X0 sets start position on x axis.

func (*ScatterPlot) XScale added in v0.7.0

func (p *ScatterPlot) XScale(s float64) *ScatterPlot

XScale sets x-axis scale.

type ScatterXYPlot added in v0.7.0

type ScatterXYPlot struct {
	// contains filtered or unexported fields
}

ScatterXYPlot represents a scatter plot with possibility to set x and y values.

func ScatterXY added in v0.7.0

func ScatterXY(label string, xs, ys []float64) *ScatterXYPlot

ScatterXY adds scatter plot with x and y values.

func (*ScatterXYPlot) Offset added in v0.7.0

func (p *ScatterXYPlot) Offset(offset int) *ScatterXYPlot

Offset sets chart offset.

func (*ScatterXYPlot) Plot added in v0.7.0

func (p *ScatterXYPlot) Plot()

Plot implements Plot interface.

type SelectableFlags

type SelectableFlags imgui.SelectableFlags

SelectableFlags represents imgui.SelectableFlags.

type SelectableWidget

type SelectableWidget struct {
	// contains filtered or unexported fields
}

SelectableWidget is a window-width button with a label which can get selected (highlighted). useful for certain lists.

func Selectable

func Selectable(label string) *SelectableWidget

Selectable constructs a selectable widget.

func Selectablef added in v0.6.0

func Selectablef(format string, args ...any) *SelectableWidget

Selectablef creates a selectable widget with formatted label.

func (*SelectableWidget) Build

func (s *SelectableWidget) Build()

Build implements Widget interface.

func (*SelectableWidget) Flags added in v0.5.0

Flags add flags.

func (*SelectableWidget) OnClick added in v0.5.0

func (s *SelectableWidget) OnClick(onClick func()) *SelectableWidget

OnClick sets on click event.

func (*SelectableWidget) OnDClick added in v0.5.6

func (s *SelectableWidget) OnDClick(onDClick func()) *SelectableWidget

OnDClick handles mouse left button's double click event. SelectableFlagsAllowDoubleClick will set once tonDClick callback is notnull. NOTE: IT IS DEPRECATED and could be removed. Use EventHandler instead.

func (*SelectableWidget) Selected added in v0.5.0

func (s *SelectableWidget) Selected(selected bool) *SelectableWidget

Selected sets if selectable widget is selected.

func (*SelectableWidget) Size added in v0.5.0

func (s *SelectableWidget) Size(width, height float32) *SelectableWidget

Size sets selectable's size.

type SeparatorWidget

type SeparatorWidget struct{}

SeparatorWidget is like <hr> in HTML. Creates a layout-wide line.

func Separator

func Separator() *SeparatorWidget

Separator creates new SeparatorWidget.

func (*SeparatorWidget) Build

func (s *SeparatorWidget) Build()

Build implements Widget interface.

type Shortcut added in v0.5.5

type Shortcut struct {
	Key      Key
	Modifier Modifier
	Callback func()
	IsGlobal ShortcutType
}

Shortcut represents a keyboard shortcut.

type ShortcutType added in v0.5.5

type ShortcutType bool

ShortcutType represents a type of shortcut (global or local).

const (
	// GlobalShortcut is registered for all the app.
	GlobalShortcut ShortcutType = true

	// LocalShortcut is registered for current window only.
	LocalShortcut ShortcutType = false
)

type SliderFlags added in v0.5.4

type SliderFlags imgui.SliderFlags

SliderFlags represents imgui.SliderFlags.

type SliderFloatWidget

type SliderFloatWidget struct {
	// contains filtered or unexported fields
}

SliderFloatWidget does similar to SliderIntWidget but slides around float32 values.

func SliderFloat

func SliderFloat(value *float32, minValue, maxValue float32) *SliderFloatWidget

SliderFloat creates new slider float widget.

func (*SliderFloatWidget) Build

func (sf *SliderFloatWidget) Build()

Build implements Widget interface.

func (*SliderFloatWidget) Format added in v0.5.0

func (sf *SliderFloatWidget) Format(format string) *SliderFloatWidget

Format sets format of text displayed on the slider. default is %.3f.

func (*SliderFloatWidget) ID added in v0.8.0

ID manually sets widget id.

func (*SliderFloatWidget) Label added in v0.6.0

func (sf *SliderFloatWidget) Label(label string) *SliderFloatWidget

Label sets slider's label (id).

func (*SliderFloatWidget) Labelf added in v0.6.0

func (sf *SliderFloatWidget) Labelf(format string, args ...any) *SliderFloatWidget

Labelf sets formatted label.

func (*SliderFloatWidget) OnChange added in v0.5.3

func (sf *SliderFloatWidget) OnChange(onChange func()) *SliderFloatWidget

OnChange is callback called when slider's position gets changed.

func (*SliderFloatWidget) Size added in v0.5.3

func (sf *SliderFloatWidget) Size(width float32) *SliderFloatWidget

Size sets slider's width.

type SliderIntWidget

type SliderIntWidget struct {
	// contains filtered or unexported fields
}

SliderIntWidget is a slider around int32 values.

func SliderInt

func SliderInt(value *int32, minValue, maxValue int32) *SliderIntWidget

SliderInt constructs new SliderIntWidget.

func (*SliderIntWidget) Build

func (s *SliderIntWidget) Build()

Build implements Widget interface.

func (*SliderIntWidget) Format added in v0.5.0

func (s *SliderIntWidget) Format(format string) *SliderIntWidget

Format sets data format displayed on the slider NOTE: on C side of imgui, it will be processed like: fmt.Sprintf(format, currentValue) so you can do e.g. SLiderInt(...).Format("My age is %d") and %d will be replaced with current value.

func (*SliderIntWidget) ID added in v0.8.0

func (s *SliderIntWidget) ID(id ID) *SliderIntWidget

ID manually sets widget id.

func (*SliderIntWidget) Label added in v0.6.0

func (s *SliderIntWidget) Label(label string) *SliderIntWidget

Label sets slider label (id).

func (*SliderIntWidget) Labelf added in v0.6.0

func (s *SliderIntWidget) Labelf(format string, args ...any) *SliderIntWidget

Labelf sets formatted label.

func (*SliderIntWidget) OnChange added in v0.5.3

func (s *SliderIntWidget) OnChange(onChange func()) *SliderIntWidget

OnChange sets callback when slider's position gets changed.

func (*SliderIntWidget) Size added in v0.5.3

func (s *SliderIntWidget) Size(width float32) *SliderIntWidget

Size sets slider's width.

type SmallButtonWidget added in v0.4.2

type SmallButtonWidget struct {
	// contains filtered or unexported fields
}

SmallButtonWidget is like a button but without frame padding.

func SmallButton added in v0.4.2

func SmallButton(id string) *SmallButtonWidget

SmallButton constructs a new small button widget.

func SmallButtonf added in v0.6.0

func SmallButtonf(format string, args ...any) *SmallButtonWidget

SmallButtonf allows to set formatted label for small button. It calls SmallButton(fmt.Sprintf(label, args...)).

func (*SmallButtonWidget) Build added in v0.4.2

func (b *SmallButtonWidget) Build()

Build implements Widget interface.

func (*SmallButtonWidget) OnClick added in v0.5.0

func (b *SmallButtonWidget) OnClick(onClick func()) *SmallButtonWidget

OnClick adds OnClick event.

type SpacingWidget

type SpacingWidget struct{}

SpacingWidget increases a spacing between two widgets a bit.

func Spacing

func Spacing() *SpacingWidget

Spacing creates new SpacingWidget.

func (*SpacingWidget) Build

func (s *SpacingWidget) Build()

Build implements Widget interface.

type SplitDirection added in v0.4.2

type SplitDirection uint8

SplitDirection represents a direction (vertical/horizontal) of splitting layout.

const (
	// DirectionHorizontal is a horizontal line.
	DirectionHorizontal SplitDirection = 1 << iota
	// DirectionVertical is a vertical line.
	DirectionVertical
)

type SplitLayoutWidget

type SplitLayoutWidget struct {
	// contains filtered or unexported fields
}

SplitLayoutWidget creates two children with a line between them. This line can be moved by the user to adjust child sizes.

func SplitLayout

func SplitLayout(direction SplitDirection, sashPos *float32, layout1, layout2 Widget) *SplitLayoutWidget

SplitLayout creates split layout widget.

func (*SplitLayoutWidget) Border added in v0.6.0

Border sets if children should have borders.

func (*SplitLayoutWidget) Build

func (s *SplitLayoutWidget) Build()

Build implements widget interface.

func (*SplitLayoutWidget) ID added in v0.6.0

ID allows to manually set splitter's id.

func (*SplitLayoutWidget) SplitRefType added in v0.12.0

func (s *SplitLayoutWidget) SplitRefType(refType SplitRefType) *SplitLayoutWidget

SplitRefType allows to set how sashPos should be interpreted. Default is counting from left/top layout's edge in px.

type SplitRefType added in v0.12.0

type SplitRefType byte

SplitRefType describes how sashPos argument to the SplitLayout should be interpreted.

const (
	// SplitRefLeft is the default. Splitter placed counting from left/top layout's edge.
	SplitRefLeft SplitRefType = iota
	// SplitRefRight splitter placed counting from right/bottom layout's edge.
	SplitRefRight
	// SplitRefProc sashPos will be clamped in range [0, 1]. Then the position is considered a percent of GetAvailableRegion.
	SplitRefProc
)

type Splitable added in v0.6.0

type Splitable interface {
	Range(func(w Widget))
}

Splitable is implemented by widgets, which can be split (ranged) Layout implements Splitable.

type SplitterWidget added in v0.7.0

type SplitterWidget struct {
	// contains filtered or unexported fields
}

SplitterWidget is a line (vertical or horizontal) that splits layout (child) Int two pieces. It has a tiny button in the middle of that line and its creator takes float pointer so that you can read user's movement of this rect. Generally used by SplitLayoutWidget.

func Splitter added in v0.7.0

func Splitter(direction SplitDirection, delta *float32) *SplitterWidget

Splitter creates new SplitterWidget.

func (*SplitterWidget) Build added in v0.7.0

func (h *SplitterWidget) Build()

Build implements Widget interface.

func (*SplitterWidget) ID added in v0.7.0

func (h *SplitterWidget) ID(id ID) *SplitterWidget

ID allows to set widget's ID manually.

func (*SplitterWidget) Size added in v0.7.0

func (h *SplitterWidget) Size(width, height float32) *SplitterWidget

Size sets size of the button aray.

type StackWidget added in v0.6.0

type StackWidget struct {
	// contains filtered or unexported fields
}

StackWidget is used to ensure, that the build methods of all the widgets (layouts field) was called, but only the selected (visible field) layout is rendered (visible) in app.

func Stack added in v0.6.0

func Stack(visible int32, layouts ...Widget) *StackWidget

Stack creates a new StackWidget.

func (*StackWidget) Build added in v0.6.0

func (s *StackWidget) Build()

Build implements widget interface.

type StatefulReflectiveBoundTexture added in v0.9.0

type StatefulReflectiveBoundTexture struct {
	ReflectiveBoundTexture
	// contains filtered or unexported fields
}

StatefulReflectiveBoundTexture is a ReflectiveBoundTexture with added async, states, and event callbacks.

func (*StatefulReflectiveBoundTexture) GetLastError added in v0.9.0

func (s *StatefulReflectiveBoundTexture) GetLastError() error

GetLastError returns the last error that occurred during surface loading.

Returns:

  • error: The last error that occurred, or nil if no error occurred.

func (*StatefulReflectiveBoundTexture) GetState added in v0.9.0

GetState returns the current state of the surface.

Returns:

  • SurfaceState: The current state of the surface.

func (*StatefulReflectiveBoundTexture) LoadSurface added in v0.9.0

func (s *StatefulReflectiveBoundTexture) LoadSurface(loader SurfaceLoader, commit bool) error

LoadSurface loads a surface asynchronously using a SurfaceLoader.

Parameters:

  • loader: The SurfaceLoader to use for loading the surface.
  • commit: A boolean flag indicating whether to commit the changes.

Returns:

  • error: An error if the surface could not be loaded.

func (*StatefulReflectiveBoundTexture) LoadSurfaceAsync added in v0.9.0

func (s *StatefulReflectiveBoundTexture) LoadSurfaceAsync(loader SurfaceLoader, commit bool) error

LoadSurfaceAsync loads the surface asynchronously using the provided SurfaceLoader. It sets the state to loading, and upon completion, updates the state to success or failure based on the result. It also triggers the appropriate callback functions.

Parameters:

  • loader: The SurfaceLoader to use for loading the surface.
  • commit: A boolean flag indicating whether to commit the changes.

Returns:

  • error: An error if the state is not SsNone, otherwise nil.

func (*StatefulReflectiveBoundTexture) OnFailure added in v0.9.0

OnFailure sets the callback function to be called when the surface loading fails.

Parameters:

  • fn: The callback function to be called on failure, with the error as a parameter.

Returns:

  • *StatefulReflectiveBoundTexture: The current instance of StatefulReflectiveBoundTexture.

func (*StatefulReflectiveBoundTexture) OnLoading added in v0.9.0

OnLoading sets the callback function to be called when the surface is loading.

Parameters:

  • fn: The callback function to be called on loading.

Returns:

  • *StatefulReflectiveBoundTexture: The current instance of StatefulReflectiveBoundTexture.

func (*StatefulReflectiveBoundTexture) OnReset added in v0.9.0

OnReset sets the callback function to be called when the surface state is reset.

Parameters:

  • fn: The callback function to be called on reset.

Returns:

  • *StatefulReflectiveBoundTexture: The current instance of StatefulReflectiveBoundTexture.

func (*StatefulReflectiveBoundTexture) OnSuccess added in v0.9.0

OnSuccess sets the callback function to be called when the surface loading is successful.

Parameters:

  • fn: The callback function to be called on success.

Returns:

  • *StatefulReflectiveBoundTexture: The current instance of StatefulReflectiveBoundTexture.

func (*StatefulReflectiveBoundTexture) ResetState added in v0.9.0

func (s *StatefulReflectiveBoundTexture) ResetState() error

ResetState resets the state of the StatefulReflectiveBoundTexture.

Returns:

  • error: An error if the state is currently loading, otherwise nil.

func (*StatefulReflectiveBoundTexture) SetSurfaceFromFile added in v0.9.0

func (s *StatefulReflectiveBoundTexture) SetSurfaceFromFile(path string, commit bool) error

SetSurfaceFromFile loads an image from the specified file path and sets it as the surface of the StatefulReflectiveBoundTexture.

Parameters:

  • path: The path to the file to load the image from.
  • commit: A boolean flag indicating whether to commit the changes.

Returns:

  • error: An error if the image could not be loaded or set as the surface.

func (*StatefulReflectiveBoundTexture) SetSurfaceFromFsFile added in v0.9.0

func (s *StatefulReflectiveBoundTexture) SetSurfaceFromFsFile(file fs.File, commit bool) error

SetSurfaceFromFsFile loads an image from the specified file interface and sets it as the surface of the StatefulReflectiveBoundTexture.

Parameters:

  • file: the file interface representing the file
  • commit: A boolean flag indicating whether to commit the changes.

Returns:

  • error: An error if the image could not be loaded or set as the surface.

func (*StatefulReflectiveBoundTexture) SetSurfaceFromURL added in v0.9.0

func (s *StatefulReflectiveBoundTexture) SetSurfaceFromURL(url string, timeout time.Duration, commit bool) error

SetSurfaceFromURL loads an image from the specified URL and sets it as the surface of the StatefulReflectiveBoundTexture.

Parameters:

  • url: The URL to load the image from.
  • timeout: The timeout duration for the HTTP request.
  • commit: A boolean flag indicating whether to commit the changes.

Returns:

  • error: An error if the image could not be loaded or set as the surface.

func (*StatefulReflectiveBoundTexture) SetSurfaceUniform added in v0.9.0

func (s *StatefulReflectiveBoundTexture) SetSurfaceUniform(width, height int, c color.Color, commit bool) error

SetSurfaceUniform creates a uniform color image and sets it as the surface of the StatefulReflectiveBoundTexture.

Parameters:

  • width: The width of the image.
  • height: The height of the image.
  • c: The color of the image.
  • commit: A boolean flag indicating whether to commit the changes.

Returns:

  • error: An error if the image could not be created or set as the surface.

type StyleColorID added in v0.5.5

type StyleColorID imgui.Col

StyleColorID identifies a color in the UI style.

const (
	StyleColorText                  StyleColorID = StyleColorID(imgui.ColText)                  // color
	StyleColorTextDisabled          StyleColorID = StyleColorID(imgui.ColTextDisabled)          // disabled-color
	StyleColorWindowBg              StyleColorID = StyleColorID(imgui.ColWindowBg)              // background-color
	StyleColorChildBg               StyleColorID = StyleColorID(imgui.ColChildBg)               // child-background-color
	StyleColorPopupBg               StyleColorID = StyleColorID(imgui.ColPopupBg)               // popup-background-color
	StyleColorBorder                StyleColorID = StyleColorID(imgui.ColBorder)                // border-color
	StyleColorBorderShadow          StyleColorID = StyleColorID(imgui.ColBorderShadow)          // border-shadow-color
	StyleColorFrameBg               StyleColorID = StyleColorID(imgui.ColFrameBg)               // frame-background-color
	StyleColorFrameBgHovered        StyleColorID = StyleColorID(imgui.ColFrameBgHovered)        // frame-background-hovered-color
	StyleColorFrameBgActive         StyleColorID = StyleColorID(imgui.ColFrameBgActive)         // frame-background-active-color
	StyleColorTitleBg               StyleColorID = StyleColorID(imgui.ColTitleBg)               // title-background-color
	StyleColorTitleBgActive         StyleColorID = StyleColorID(imgui.ColTitleBgActive)         // title-background-active-color
	StyleColorTitleBgCollapsed      StyleColorID = StyleColorID(imgui.ColTitleBgCollapsed)      // title-background-collapsed-color
	StyleColorMenuBarBg             StyleColorID = StyleColorID(imgui.ColMenuBarBg)             // menu-bar-background-color
	StyleColorScrollbarBg           StyleColorID = StyleColorID(imgui.ColScrollbarBg)           // scrollbar-background-color
	StyleColorScrollbarGrab         StyleColorID = StyleColorID(imgui.ColScrollbarGrab)         // scrollbar-grab-color
	StyleColorScrollbarGrabHovered  StyleColorID = StyleColorID(imgui.ColScrollbarGrabHovered)  // scrollbar-grab-hovered-color
	StyleColorScrollbarGrabActive   StyleColorID = StyleColorID(imgui.ColScrollbarGrabActive)   // scrollbar-grab-active-color
	StyleColorCheckMark             StyleColorID = StyleColorID(imgui.ColCheckMark)             // checkmark-color
	StyleColorSliderGrab            StyleColorID = StyleColorID(imgui.ColSliderGrab)            // slider-grab-color
	StyleColorSliderGrabActive      StyleColorID = StyleColorID(imgui.ColSliderGrabActive)      // slider-grab-active-color
	StyleColorButton                StyleColorID = StyleColorID(imgui.ColButton)                // button-color
	StyleColorButtonHovered         StyleColorID = StyleColorID(imgui.ColButtonHovered)         // button-hovered-color
	StyleColorButtonActive          StyleColorID = StyleColorID(imgui.ColButtonActive)          // button-active-color
	StyleColorHeader                StyleColorID = StyleColorID(imgui.ColHeader)                // header-color
	StyleColorHeaderHovered         StyleColorID = StyleColorID(imgui.ColHeaderHovered)         // header-hovered-color
	StyleColorHeaderActive          StyleColorID = StyleColorID(imgui.ColHeaderActive)          // header-active-color
	StyleColorSeparator             StyleColorID = StyleColorID(imgui.ColSeparator)             // separator-color
	StyleColorSeparatorHovered      StyleColorID = StyleColorID(imgui.ColSeparatorHovered)      // separator-hovered-color
	StyleColorSeparatorActive       StyleColorID = StyleColorID(imgui.ColSeparatorActive)       // separator-active-color
	StyleColorResizeGrip            StyleColorID = StyleColorID(imgui.ColResizeGrip)            // resize-grip-color
	StyleColorResizeGripHovered     StyleColorID = StyleColorID(imgui.ColResizeGripHovered)     // resize-grip-hovered-color
	StyleColorResizeGripActive      StyleColorID = StyleColorID(imgui.ColResizeGripActive)      // resize-grip-active-color
	StyleColorTab                   StyleColorID = StyleColorID(imgui.ColTab)                   // tab-color
	StyleColorTabHovered            StyleColorID = StyleColorID(imgui.ColTabHovered)            // tab-hovered-color
	StyleColorTabActive             StyleColorID = StyleColorID(imgui.ColTabSelected)           // tab-active-color
	StyleColorTabUnfocused          StyleColorID = StyleColorID(imgui.ColTabDimmed)             // tab-unfocused-color
	StyleColorTabUnfocusedActive    StyleColorID = StyleColorID(imgui.ColTabDimmedSelected)     // tab-unfocused-active-color
	StyleColorPlotLines             StyleColorID = StyleColorID(imgui.ColPlotLines)             // plot-lines-color
	StyleColorPlotLinesHovered      StyleColorID = StyleColorID(imgui.ColPlotLinesHovered)      // plot-lines-hovered-color
	StyleColorProgressBarActive     StyleColorID = StyleColorPlotLinesHovered                   // progress-bar-active-color
	StyleColorPlotHistogram         StyleColorID = StyleColorID(imgui.ColPlotHistogram)         // plot-histogram-color
	StyleColorPlotHistogramHovered  StyleColorID = StyleColorID(imgui.ColPlotHistogramHovered)  // plot-histogram-hovered-color
	StyleColorTableHeaderBg         StyleColorID = StyleColorID(imgui.ColTableHeaderBg)         // table-header-background-color
	StyleColorTableBorderStrong     StyleColorID = StyleColorID(imgui.ColTableBorderStrong)     // table-border-strong-color
	StyleColorTableBorderLight      StyleColorID = StyleColorID(imgui.ColTableBorderLight)      // table-border-light-color
	StyleColorTableRowBg            StyleColorID = StyleColorID(imgui.ColTableRowBg)            // table-row-background-color
	StyleColorTableRowBgAlt         StyleColorID = StyleColorID(imgui.ColTableRowBgAlt)         // table-row-alternate-background-color
	StyleColorTextSelectedBg        StyleColorID = StyleColorID(imgui.ColTextSelectedBg)        // text-selected-background-color
	StyleColorDragDropTarget        StyleColorID = StyleColorID(imgui.ColDragDropTarget)        // drag-drop-target-color
	StyleColorNavHighlight          StyleColorID = StyleColorID(imgui.ColNavWindowingHighlight) // navigation-highlight-color
	StyleColorNavWindowingHighlight StyleColorID = StyleColorID(imgui.ColNavWindowingHighlight) // windowing-highlight-color
	StyleColorNavWindowingDimBg     StyleColorID = StyleColorID(imgui.ColNavWindowingDimBg)     // windowing-dim-background-color
	StyleColorModalWindowDimBg      StyleColorID = StyleColorID(imgui.ColModalWindowDimBg)      // modal-window-dim-background-color
)

StyleColor identifier. NOTE: comments are used for CSS conversion and are generated by stringer and string2enum.

func StyleColorIDString added in v0.10.0

func StyleColorIDString(s string) (StyleColorID, error)

StyleColorIDString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.

func StyleColorIDValues added in v0.10.0

func StyleColorIDValues() []StyleColorID

StyleColorIDValues returns all values of the enum

func (StyleColorID) IsAStyleColorID added in v0.10.0

func (i StyleColorID) IsAStyleColorID() bool

IsAStyleColorID returns "true" if the value is listed in the enum definition. "false" otherwise

func (StyleColorID) String added in v0.7.0

func (i StyleColorID) String() string

type StylePlotColorID added in v0.10.0

type StylePlotColorID int

StylePlotColorID represents an ID of plot color.

const (
	StylePlotColorLine          StylePlotColorID = StylePlotColorID(implot.ColLine)          // plot-line
	StylePlotColorFill          StylePlotColorID = StylePlotColorID(implot.ColFill)          // plot-fill
	StylePlotColorMarkerOutline StylePlotColorID = StylePlotColorID(implot.ColMarkerOutline) // plot-marker-outline
	StylePlotColorMarkerFill    StylePlotColorID = StylePlotColorID(implot.ColMarkerFill)    // plot-Marker-Fill
	StylePlotColorErrorBar      StylePlotColorID = StylePlotColorID(implot.ColErrorBar)      // plot-error-bar
	StylePlotColorFrameBg       StylePlotColorID = StylePlotColorID(implot.ColFrameBg)       // plot-frame-bg
	StylePlotColorPlotBg        StylePlotColorID = StylePlotColorID(implot.ColPlotBg)        // plot-plot-bg
	StylePlotColorPlotBorder    StylePlotColorID = StylePlotColorID(implot.ColPlotBorder)    // plot-plot-border
	StylePlotColorLegendBg      StylePlotColorID = StylePlotColorID(implot.ColLegendBg)      // plot-legend-bg
	StylePlotColorLegendBorder  StylePlotColorID = StylePlotColorID(implot.ColLegendBorder)  // plot-legend-border
	StylePlotColorLegendText    StylePlotColorID = StylePlotColorID(implot.ColLegendText)    // plot-legend-text
	StylePlotColorTitleText     StylePlotColorID = StylePlotColorID(implot.ColTitleText)     // plot-title-text
	StylePlotColorInlayText     StylePlotColorID = StylePlotColorID(implot.ColInlayText)     // plot-inlay-text
	StylePlotColorAxisText      StylePlotColorID = StylePlotColorID(implot.ColAxisText)      // plot-axis-text
	StylePlotColorAxisGrid      StylePlotColorID = StylePlotColorID(implot.ColAxisGrid)      // plot-axis-grid
	StylePlotColorAxisTick      StylePlotColorID = StylePlotColorID(implot.ColAxisTick)      // plot-axis-tick
	StylePlotColorAxisBg        StylePlotColorID = StylePlotColorID(implot.ColAxisBg)        // plot-axis-bg
	StylePlotColorAxisBgHovered StylePlotColorID = StylePlotColorID(implot.ColAxisBgHovered) // plot-axis-bg-hovered
	StylePlotColorAxisBgActive  StylePlotColorID = StylePlotColorID(implot.ColAxisBgActive)  // plot-axis-bg-active
	StylePlotColorSelection     StylePlotColorID = StylePlotColorID(implot.ColSelection)     // plot-selection
	StylePlotColorCrosshairs    StylePlotColorID = StylePlotColorID(implot.ColCrosshairs)    // plot-crosshairs
)

List of plot color IDs.

func StylePlotColorIDString added in v0.10.0

func StylePlotColorIDString(s string) (StylePlotColorID, error)

StylePlotColorIDString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.

func StylePlotColorIDValues added in v0.10.0

func StylePlotColorIDValues() []StylePlotColorID

StylePlotColorIDValues returns all values of the enum

func (StylePlotColorID) IsAStylePlotColorID added in v0.10.0

func (i StylePlotColorID) IsAStylePlotColorID() bool

IsAStylePlotColorID returns "true" if the value is listed in the enum definition. "false" otherwise

func (StylePlotColorID) String added in v0.10.0

func (i StylePlotColorID) String() string

type StylePlotVarID added in v0.10.0

type StylePlotVarID imgui.StyleVar

StylePlotVarID represents an ID of plot style variable.

const (
	StylePlotVarLineWeight         StylePlotVarID = StylePlotVarID(implot.StyleVarLineWeight)         // plot-line-weight
	StylePlotVarMarker             StylePlotVarID = StylePlotVarID(implot.StyleVarMarker)             // plot-marker
	StylePlotVarMarkerSize         StylePlotVarID = StylePlotVarID(implot.StyleVarMarkerSize)         // plot-marker-size
	StylePlotVarMarkerWeight       StylePlotVarID = StylePlotVarID(implot.StyleVarMarkerWeight)       // plot-marker-weight
	StylePlotVarFillAlpha          StylePlotVarID = StylePlotVarID(implot.StyleVarFillAlpha)          // plot-fill-alpha
	StylePlotVarErrorBarSize       StylePlotVarID = StylePlotVarID(implot.StyleVarErrorBarSize)       // plot-error-bar-size
	StylePlotVarErrorBarWeight     StylePlotVarID = StylePlotVarID(implot.StyleVarErrorBarWeight)     // plot-error-bar-weight
	StylePlotVarDigitalBitHeight   StylePlotVarID = StylePlotVarID(implot.StyleVarDigitalBitHeight)   // plot-digital-bit-height
	StylePlotVarDigitalBitGap      StylePlotVarID = StylePlotVarID(implot.StyleVarDigitalBitGap)      // plot-digital-bit-gap
	StylePlotVarPlotBorderSize     StylePlotVarID = StylePlotVarID(implot.StyleVarPlotBorderSize)     // plot-border-size
	StylePlotVarMinorAlpha         StylePlotVarID = StylePlotVarID(implot.StyleVarMinorAlpha)         // plot-minor-alpha
	StylePlotVarMajorTickLen       StylePlotVarID = StylePlotVarID(implot.StyleVarMajorTickLen)       // plot-major-tick-len
	StylePlotVarMinorTickLen       StylePlotVarID = StylePlotVarID(implot.StyleVarMinorTickLen)       // plot-minor-tick-len
	StylePlotVarMajorTickSize      StylePlotVarID = StylePlotVarID(implot.StyleVarMajorTickSize)      // plot-major-tick-size
	StylePlotVarMinorTickSize      StylePlotVarID = StylePlotVarID(implot.StyleVarMinorTickSize)      // plot-minor-tick-size
	StylePlotVarMajorGridSize      StylePlotVarID = StylePlotVarID(implot.StyleVarMajorGridSize)      // plot-major-grid-size
	StylePlotVarMinorGridSize      StylePlotVarID = StylePlotVarID(implot.StyleVarMinorGridSize)      // plot-minor-grid-size
	StylePlotVarPlotPadding        StylePlotVarID = StylePlotVarID(implot.StyleVarPlotPadding)        // plot-padding
	StylePlotVarLabelPadding       StylePlotVarID = StylePlotVarID(implot.StyleVarLabelPadding)       // plot-label-padding
	StylePlotVarLegendPadding      StylePlotVarID = StylePlotVarID(implot.StyleVarLegendPadding)      // plot-legend-padding
	StylePlotVarLegendInnerPadding StylePlotVarID = StylePlotVarID(implot.StyleVarLegendInnerPadding) // plot-legend-inner-padding
	StylePlotVarLegendSpacing      StylePlotVarID = StylePlotVarID(implot.StyleVarLegendSpacing)      // plot-legend-spacing
	StylePlotVarMousePosPadding    StylePlotVarID = StylePlotVarID(implot.StyleVarMousePosPadding)    // plot-mouse-pos-padding
	StylePlotVarAnnotationPadding  StylePlotVarID = StylePlotVarID(implot.StyleVarAnnotationPadding)  // plot-annotation-padding
	StylePlotVarFitPadding         StylePlotVarID = StylePlotVarID(implot.StyleVarFitPadding)         // plot-fit-padding
	StylePlotVarPlotDefaultSize    StylePlotVarID = StylePlotVarID(implot.StyleVarPlotDefaultSize)    // plot-default-size
	StylePlotVarPlotMinSize        StylePlotVarID = StylePlotVarID(implot.StyleVarPlotMinSize)        // plot-min-size
	StylePlotVarCOUNT              StylePlotVarID = StylePlotVarID(implot.StyleVarCOUNT)
)

List of plot style variable IDs.

func StylePlotVarIDString added in v0.10.0

func StylePlotVarIDString(s string) (StylePlotVarID, error)

StylePlotVarIDString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.

func StylePlotVarIDValues added in v0.10.0

func StylePlotVarIDValues() []StylePlotVarID

StylePlotVarIDValues returns all values of the enum

func (StylePlotVarID) IsAStylePlotVarID added in v0.10.0

func (i StylePlotVarID) IsAStylePlotVarID() bool

IsAStylePlotVarID returns "true" if the value is listed in the enum definition. "false" otherwise

func (StylePlotVarID) IsVec2 added in v0.10.0

func (i StylePlotVarID) IsVec2() bool

IsVec2 returns true if the style plot var id should be processed as imgui.Vec2 if not, it is interpreted as float32.

func (StylePlotVarID) String added in v0.10.0

func (i StylePlotVarID) String() string

type StyleSetter added in v0.5.4

type StyleSetter struct {
	// contains filtered or unexported fields
}

StyleSetter is a user-friendly way to manage imgui styles. For style IDs see StyleIDs.go, for detailed instruction of using styles, see Styles.go.

func Style added in v0.5.4

func Style() *StyleSetter

Style initializes a style setter (see examples/setstyle).

func (*StyleSetter) Build added in v0.5.4

func (ss *StyleSetter) Build()

Build implements Widget.

func (*StyleSetter) Plot added in v0.10.0

func (ss *StyleSetter) Plot()

Plot implements PlotWidget.

func (*StyleSetter) Plots added in v0.10.0

func (ss *StyleSetter) Plots(widgets ...PlotWidget) *StyleSetter

Plots allows to set plots to apply style for.

func (*StyleSetter) Pop added in v0.7.0

func (ss *StyleSetter) Pop()

Pop allows to manually pop the whole StyleSetter (use after Push!)

func (*StyleSetter) Push added in v0.7.0

func (ss *StyleSetter) Push()

Push allows to manually activate Styles written inside of StyleSetter it works like imgui.PushXXX() stuff, but for group of style variables, just like StyleSetter. NOTE: DO NOT ORGET to call ss.Pop() at the end of styled layout, because else you'll get ImGui exception!

func (*StyleSetter) Range added in v0.7.0

func (ss *StyleSetter) Range(rangeFunc func(w Widget))

Range implements Splitable interface.

func (*StyleSetter) SetColor added in v0.5.4

func (ss *StyleSetter) SetColor(colorID StyleColorID, col color.Color) *StyleSetter

SetColor sets colorID's color.

func (*StyleSetter) SetDisabled added in v0.5.5

func (ss *StyleSetter) SetDisabled(d bool) *StyleSetter

SetDisabled sets if items are disabled.

func (*StyleSetter) SetFont added in v0.5.5

func (ss *StyleSetter) SetFont(font *FontInfo) *StyleSetter

SetFont sets font.

func (*StyleSetter) SetFontSize added in v0.6.0

func (ss *StyleSetter) SetFontSize(size float32) *StyleSetter

SetFontSize sets size of the font. NOTE: Be aware, that StyleSetter needs to add a new font to font atlas for each font's size.

func (*StyleSetter) SetPlotColor added in v0.10.0

func (ss *StyleSetter) SetPlotColor(colorID StylePlotColorID, col color.Color) *StyleSetter

SetPlotColor sets colorID's color.

func (*StyleSetter) SetPlotStyle added in v0.10.0

func (ss *StyleSetter) SetPlotStyle(varID StylePlotVarID, width, height float32) *StyleSetter

SetPlotStyle sets stylePlotVarID to width and height.

func (*StyleSetter) SetPlotStyleFloat added in v0.10.0

func (ss *StyleSetter) SetPlotStyleFloat(varID StylePlotVarID, value float32) *StyleSetter

SetPlotStyleFloat sets StylePlotVarID to float value. NOTE: for float typed values see above in comments over StyleVarID's comments.

func (*StyleSetter) SetStyle added in v0.5.4

func (ss *StyleSetter) SetStyle(varID StyleVarID, width, height float32) *StyleSetter

SetStyle sets styleVarID to width and height.

func (*StyleSetter) SetStyleFloat added in v0.6.0

func (ss *StyleSetter) SetStyleFloat(varID StyleVarID, value float32) *StyleSetter

SetStyleFloat sets styleVarID to float value. NOTE: for float typed values see above in comments over StyleVarID's comments.

func (*StyleSetter) To added in v0.5.4

func (ss *StyleSetter) To(widgets ...Widget) *StyleSetter

To allows to specify a layout, StyleSetter should apply style for.

type StyleVarID added in v0.5.5

type StyleVarID imgui.StyleVar

StyleVarID identifies a style variable in the UI style.

const (
	// StyleVarAlpha is a float.
	StyleVarAlpha StyleVarID = StyleVarID(imgui.StyleVarAlpha) // alpha
	// StyleVarDisabledAlpha is a float.
	StyleVarDisabledAlpha StyleVarID = StyleVarID(imgui.StyleVarDisabledAlpha) // disabled-alpha
	// StyleVarWindowPadding is a Vec2.
	StyleVarWindowPadding StyleVarID = StyleVarID(imgui.StyleVarWindowPadding) // window-padding
	// StyleVarWindowRounding is a float.
	StyleVarWindowRounding StyleVarID = StyleVarID(imgui.StyleVarWindowRounding) // window-rounding
	// StyleVarWindowBorderSize is a float.
	StyleVarWindowBorderSize StyleVarID = StyleVarID(imgui.StyleVarWindowBorderSize) // window-border-size
	// StyleVarWindowMinSize is a Vec2.
	StyleVarWindowMinSize StyleVarID = StyleVarID(imgui.StyleVarWindowMinSize) // window-minValue-size
	// StyleVarWindowTitleAlign is a Vec2.
	StyleVarWindowTitleAlign StyleVarID = StyleVarID(imgui.StyleVarWindowTitleAlign) // window-title-align
	// StyleVarChildRounding is a float.
	StyleVarChildRounding StyleVarID = StyleVarID(imgui.StyleVarChildRounding) // child-rounding
	// StyleVarChildBorderSize is a float.
	StyleVarChildBorderSize StyleVarID = StyleVarID(imgui.StyleVarChildBorderSize) // child-border-size
	// StyleVarPopupRounding is a float.
	StyleVarPopupRounding StyleVarID = StyleVarID(imgui.StyleVarPopupRounding) // popup-rounding
	// StyleVarPopupBorderSize is a float.
	StyleVarPopupBorderSize StyleVarID = StyleVarID(imgui.StyleVarPopupBorderSize) // popup-border-size
	// StyleVarFramePadding is a Vec2.
	StyleVarFramePadding StyleVarID = StyleVarID(imgui.StyleVarFramePadding) // frame-padding
	// StyleVarFrameRounding is a float.
	StyleVarFrameRounding StyleVarID = StyleVarID(imgui.StyleVarFrameRounding) // frame-rounding
	// StyleVarFrameBorderSize is a float.
	StyleVarFrameBorderSize StyleVarID = StyleVarID(imgui.StyleVarFrameBorderSize) // frame-border-size
	// StyleVarItemSpacing is a Vec2.
	StyleVarItemSpacing StyleVarID = StyleVarID(imgui.StyleVarItemSpacing) // item-spacing
	// StyleVarItemInnerSpacing is a Vec2.
	StyleVarItemInnerSpacing StyleVarID = StyleVarID(imgui.StyleVarItemInnerSpacing) // item-inner-spacing
	// StyleVarIndentSpacing is a float.
	StyleVarIndentSpacing StyleVarID = StyleVarID(imgui.StyleVarIndentSpacing) // indent-spacing
	// StyleVarCellPadding is a Vec2.
	StyleVarCellPadding StyleVarID = StyleVarID(imgui.StyleVarCellPadding)
	// StyleVarScrollbarSize is a float.
	StyleVarScrollbarSize StyleVarID = StyleVarID(imgui.StyleVarScrollbarSize) // scrollbar-size
	// StyleVarScrollbarRounding is a float.
	StyleVarScrollbarRounding StyleVarID = StyleVarID(imgui.StyleVarScrollbarRounding) // scrollbar-rounding
	// StyleVarGrabMinSize is a float.
	StyleVarGrabMinSize StyleVarID = StyleVarID(imgui.StyleVarGrabMinSize) // grab-minValue-size
	// StyleVarGrabRounding is a float.
	StyleVarGrabRounding StyleVarID = StyleVarID(imgui.StyleVarGrabRounding) // grab-rounding
	// StyleVarTabRounding is a float.
	StyleVarTabRounding StyleVarID = StyleVarID(imgui.StyleVarTabRounding) // tab-rounding
	// StyleVarTabBarBorderSize is a float.
	StyleVarTabBarBorderSize StyleVarID = StyleVarID(imgui.StyleVarTabBarBorderSize)
	// StyleVarButtonTextAlign is a Vec2.
	StyleVarButtonTextAlign StyleVarID = StyleVarID(imgui.StyleVarButtonTextAlign) // button-text-align
	// StyleVarSelectableTextAlign is a Vec2.
	StyleVarSelectableTextAlign StyleVarID = StyleVarID(imgui.StyleVarSelectableTextAlign) // selectable-text-align
	// StyleVarSeparatorTextBorderSize is a float.
	StyleVarSeparatorTextBorderSize StyleVarID = StyleVarID(imgui.StyleVarSeparatorTextBorderSize)
	// SeparatorTextAlign is an ImVec2.
	StyleVarSeparatorTextAlign StyleVarID = StyleVarID(imgui.StyleVarSeparatorTextAlign)
	// SeparatorTextPadding is an ImVec2.
	StyleVarSeparatorTextPadding StyleVarID = StyleVarID(imgui.StyleVarSeparatorTextPadding)
	// DockingSeparatorSize is a float.
	StyleVarDockingSeparatorSize StyleVarID = StyleVarID(imgui.StyleVarDockingSeparatorSize)
)

Style IDs. comments at same line is a CSS name.

func StyleVarIDString added in v0.10.0

func StyleVarIDString(s string) (StyleVarID, error)

StyleVarIDString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.

func StyleVarIDValues added in v0.10.0

func StyleVarIDValues() []StyleVarID

StyleVarIDValues returns all values of the enum

func (StyleVarID) IsAStyleVarID added in v0.10.0

func (i StyleVarID) IsAStyleVarID() bool

IsAStyleVarID returns "true" if the value is listed in the enum definition. "false" otherwise

func (StyleVarID) IsVec2 added in v0.6.0

func (i StyleVarID) IsVec2() bool

IsVec2 returns true if the style var id should be processed as imgui.Vec2 if not, it is interpreted as float32.

func (StyleVarID) String added in v0.7.0

func (i StyleVarID) String() string

type SurfaceLoader added in v0.9.0

type SurfaceLoader interface {
	// ServeRGBA serves an RGBA image.
	//
	// Returns:
	//   - *image.RGBA: The RGBA image.
	//   - error: An error if the image could not be served.
	ServeRGBA() (*image.RGBA, error)
}

SurfaceLoader is an interface that defines a method to serve an RGBA image.

type SurfaceLoaderFunc added in v0.9.0

type SurfaceLoaderFunc func() (*image.RGBA, error)

SurfaceLoaderFunc is a function type that serves an RGBA image.

type SurfaceState added in v0.9.0

type SurfaceState int

SurfaceState represents the state of the surface.

const (
	// SurfaceStateNone indicates that the surface state is none.
	SurfaceStateNone SurfaceState = iota
	// SurfaceStateLoading indicates that the surface is currently loading.
	SurfaceStateLoading
	// SurfaceStateFailure indicates that the surface loading has failed.
	SurfaceStateFailure
	// SurfaceStateSuccess indicates that the surface loading was successful.
	SurfaceStateSuccess
)

func (SurfaceState) String added in v0.9.0

func (i SurfaceState) String() string

type TabBarFlags

type TabBarFlags imgui.TabBarFlags

TabBarFlags represents imgui.TabBarFlags.

type TabBarWidget

type TabBarWidget struct {
	// contains filtered or unexported fields
}

TabBarWidget is a bar of TabItemWidgets.

func TabBar

func TabBar() *TabBarWidget

TabBar creates new TabBarWidget.

func (*TabBarWidget) Build

func (t *TabBarWidget) Build()

Build implements Widget interface.

func (*TabBarWidget) Flags added in v0.5.0

func (t *TabBarWidget) Flags(flags TabBarFlags) *TabBarWidget

Flags allows to set TabBArFlags.

func (*TabBarWidget) ID added in v0.6.0

func (t *TabBarWidget) ID(id ID) *TabBarWidget

ID manually sets widget's ID.

func (*TabBarWidget) TabItems added in v0.5.5

func (t *TabBarWidget) TabItems(items ...*TabItemWidget) *TabBarWidget

TabItems sets list of TabItemWidgets in the bar.

type TabItemFlags

type TabItemFlags imgui.TabItemFlags

TabItemFlags represents tab item flags.

type TabItemWidget

type TabItemWidget struct {
	// contains filtered or unexported fields
}

TabItemWidget is an item in TabBarWidget.

func TabItem

func TabItem(label string) *TabItemWidget

TabItem creates new TabItem.

func TabItemf added in v0.6.0

func TabItemf(format string, args ...any) *TabItemWidget

TabItemf creates tab item with formated label.

func (*TabItemWidget) BuildTabItem added in v0.6.0

func (t *TabItemWidget) BuildTabItem()

BuildTabItem executes tab item build steps.

func (*TabItemWidget) Flags added in v0.5.0

func (t *TabItemWidget) Flags(flags TabItemFlags) *TabItemWidget

Flags allows to set item's flags.

func (*TabItemWidget) IsOpen added in v0.5.0

func (t *TabItemWidget) IsOpen(open *bool) *TabItemWidget

IsOpen takes a pointer to a boolean. Value of this pointer indicated whether TabItem is currently selected. NOTE: The item will NOT be opened/closed if this value is changed. It has only one-side effect.

func (*TabItemWidget) Layout added in v0.5.0

func (t *TabItemWidget) Layout(widgets ...Widget) *TabItemWidget

Layout is a layout displayed when item is opened.

type TableColumnFlags added in v0.5.5

type TableColumnFlags imgui.TableColumnFlags

TableColumnFlags represents a flags for table column (see (*TableColumnWidget).Flags()).

const (
	// Input configuration flags.
	TableColumnFlagsNone                 TableColumnFlags = TableColumnFlags(imgui.TableColumnFlagsNone)
	TableColumnFlagsDefaultHide          TableColumnFlags = TableColumnFlags(imgui.TableColumnFlagsDefaultHide)
	TableColumnFlagsDefaultSort          TableColumnFlags = TableColumnFlags(imgui.TableColumnFlagsDefaultSort)
	TableColumnFlagsWidthStretch         TableColumnFlags = TableColumnFlags(imgui.TableColumnFlagsWidthStretch)
	TableColumnFlagsWidthFixed           TableColumnFlags = TableColumnFlags(imgui.TableColumnFlagsWidthFixed)
	TableColumnFlagsNoResize             TableColumnFlags = TableColumnFlags(imgui.TableColumnFlagsNoResize)
	TableColumnFlagsNoReorder            TableColumnFlags = TableColumnFlags(imgui.TableColumnFlagsNoReorder)
	TableColumnFlagsNoHide               TableColumnFlags = TableColumnFlags(imgui.TableColumnFlagsNoHide)
	TableColumnFlagsNoClip               TableColumnFlags = TableColumnFlags(imgui.TableColumnFlagsNoClip)
	TableColumnFlagsNoSort               TableColumnFlags = TableColumnFlags(imgui.TableColumnFlagsNoSort)
	TableColumnFlagsNoSortAscending      TableColumnFlags = TableColumnFlags(imgui.TableColumnFlagsNoSortAscending)
	TableColumnFlagsNoSortDescending     TableColumnFlags = TableColumnFlags(imgui.TableColumnFlagsNoSortDescending)
	TableColumnFlagsNoHeaderWidth        TableColumnFlags = TableColumnFlags(imgui.TableColumnFlagsNoHeaderWidth)
	TableColumnFlagsPreferSortAscending  TableColumnFlags = TableColumnFlags(imgui.TableColumnFlagsPreferSortAscending)
	TableColumnFlagsPreferSortDescending TableColumnFlags = TableColumnFlags(imgui.TableColumnFlagsPreferSortDescending)
	TableColumnFlagsIndentEnable         TableColumnFlags = TableColumnFlags(imgui.TableColumnFlagsIndentEnable)
	TableColumnFlagsIndentDisable        TableColumnFlags = TableColumnFlags(imgui.TableColumnFlagsIndentDisable)

	// Output status flags read-only via TableGetColumnFlags().
	TableColumnFlagsIsEnabled TableColumnFlags = TableColumnFlags(imgui.TableColumnFlagsIsEnabled)
	TableColumnFlagsIsVisible TableColumnFlags = TableColumnFlags(imgui.TableColumnFlagsIsVisible)
	TableColumnFlagsIsSorted  TableColumnFlags = TableColumnFlags(imgui.TableColumnFlagsIsSorted)
	TableColumnFlagsIsHovered TableColumnFlags = TableColumnFlags(imgui.TableColumnFlagsIsHovered)

	// [Internal] Combinations and masks.
	TableColumnFlagsWidthMask      TableColumnFlags = TableColumnFlags(imgui.TableColumnFlagsWidthMask)
	TableColumnFlagsIndentMask     TableColumnFlags = TableColumnFlags(imgui.TableColumnFlagsIndentMask)
	TableColumnFlagsStatusMask     TableColumnFlags = TableColumnFlags(imgui.TableColumnFlagsStatusMask)
	TableColumnFlagsNoDirectResize TableColumnFlags = TableColumnFlags(imgui.TableColumnFlagsNoDirectResize)
)

table column flags list.

type TableColumnWidget added in v0.5.4

type TableColumnWidget struct {
	// contains filtered or unexported fields
}

TableColumnWidget allows to configure table columns headers.

func TableColumn added in v0.5.4

func TableColumn(label string) *TableColumnWidget

TableColumn creates a new TableColumnWidget.

func (*TableColumnWidget) BuildTableColumn added in v0.6.0

func (c *TableColumnWidget) BuildTableColumn()

BuildTableColumn executes table column build steps.

func (*TableColumnWidget) Flags added in v0.5.4

Flags sets the flags of the column.

func (*TableColumnWidget) InnerWidthOrWeight added in v0.5.4

func (c *TableColumnWidget) InnerWidthOrWeight(w float32) *TableColumnWidget

InnerWidthOrWeight sets the inner width or weight of the column.

func (*TableColumnWidget) UserID added in v0.6.0

UserID sets the user id of the column.

type TableFlags added in v0.5.5

type TableFlags imgui.TableFlags

TableFlags represents table flags.

const (
	TableFlagsNone                       TableFlags = TableFlags(imgui.TableFlagsNone)
	TableFlagsResizable                  TableFlags = TableFlags(imgui.TableFlagsResizable)
	TableFlagsReorderable                TableFlags = TableFlags(imgui.TableFlagsReorderable)
	TableFlagsHideable                   TableFlags = TableFlags(imgui.TableFlagsHideable)
	TableFlagsSortable                   TableFlags = TableFlags(imgui.TableFlagsSortable)
	TableFlagsNoSavedSettings            TableFlags = TableFlags(imgui.TableFlagsNoSavedSettings)
	TableFlagsContextMenuInBody          TableFlags = TableFlags(imgui.TableFlagsContextMenuInBody)
	TableFlagsRowBg                      TableFlags = TableFlags(imgui.TableFlagsRowBg)
	TableFlagsBordersInnerH              TableFlags = TableFlags(imgui.TableFlagsBordersInnerH)
	TableFlagsBordersOuterH              TableFlags = TableFlags(imgui.TableFlagsBordersOuterH)
	TableFlagsBordersInnerV              TableFlags = TableFlags(imgui.TableFlagsBordersInnerV)
	TableFlagsBordersOuterV              TableFlags = TableFlags(imgui.TableFlagsBordersOuterV)
	TableFlagsBordersH                   TableFlags = TableFlags(imgui.TableFlagsBordersH)
	TableFlagsBordersV                   TableFlags = TableFlags(imgui.TableFlagsBordersV)
	TableFlagsBordersInner               TableFlags = TableFlags(imgui.TableFlagsBordersInner)
	TableFlagsBordersOuter               TableFlags = TableFlags(imgui.TableFlagsBordersOuter)
	TableFlagsBorders                    TableFlags = TableFlags(imgui.TableFlagsBorders)
	TableFlagsNoBordersInBody            TableFlags = TableFlags(imgui.TableFlagsNoBordersInBody)
	TableFlagsNoBordersInBodyUntilResize TableFlags = TableFlags(imgui.TableFlagsNoBordersInBodyUntilResize)
	TableFlagsSizingFixedFit             TableFlags = TableFlags(imgui.TableFlagsSizingFixedFit)
	TableFlagsSizingFixedSame            TableFlags = TableFlags(imgui.TableFlagsSizingFixedSame)
	TableFlagsSizingStretchProp          TableFlags = TableFlags(imgui.TableFlagsSizingStretchProp)
	TableFlagsSizingStretchSame          TableFlags = TableFlags(imgui.TableFlagsSizingStretchSame)
	TableFlagsNoHostExtendX              TableFlags = TableFlags(imgui.TableFlagsNoHostExtendX)
	TableFlagsNoHostExtendY              TableFlags = TableFlags(imgui.TableFlagsNoHostExtendY)
	TableFlagsNoKeepColumnsVisible       TableFlags = TableFlags(imgui.TableFlagsNoKeepColumnsVisible)
	TableFlagsPreciseWidths              TableFlags = TableFlags(imgui.TableFlagsPreciseWidths)
	TableFlagsNoClip                     TableFlags = TableFlags(imgui.TableFlagsNoClip)
	TableFlagsPadOuterX                  TableFlags = TableFlags(imgui.TableFlagsPadOuterX)
	TableFlagsNoPadOuterX                TableFlags = TableFlags(imgui.TableFlagsNoPadOuterX)
	TableFlagsNoPadInnerX                TableFlags = TableFlags(imgui.TableFlagsNoPadInnerX)
	TableFlagsScrollX                    TableFlags = TableFlags(imgui.TableFlagsScrollX)
	TableFlagsScrollY                    TableFlags = TableFlags(imgui.TableFlagsScrollY)
	TableFlagsSortMulti                  TableFlags = TableFlags(imgui.TableFlagsSortMulti)
	TableFlagsSortTristate               TableFlags = TableFlags(imgui.TableFlagsSortTristate)
	TableFlagsSizingMask                 TableFlags = TableFlags(imgui.TableFlagsSizingMask)
)

Table flags enum:.

type TableRowFlags added in v0.5.5

type TableRowFlags imgui.TableRowFlags

TableRowFlags represents table row flags.

const (
	TableRowFlagsNone TableRowFlags = TableRowFlags(imgui.TableRowFlagsNone)
	// Identify header row (set default background color + width of its contents accounted different for auto column width).
	TableRowFlagsHeaders TableRowFlags = TableRowFlags(imgui.TableRowFlagsHeaders)
)

table row flags:.

type TableRowWidget added in v0.5.4

type TableRowWidget struct {
	// contains filtered or unexported fields
}

TableRowWidget represents a row in a table.

func TableRow added in v0.5.4

func TableRow(widgets ...Widget) *TableRowWidget

TableRow creates a TbleRowWidget. Each widget will be rendered in a separated column. NOTE: if you want to put multiple widgets in one cell, enclose them in Layout{}.

func (*TableRowWidget) BgColor added in v0.5.4

func (r *TableRowWidget) BgColor(c color.Color) *TableRowWidget

BgColor sets the background color of the row.

func (*TableRowWidget) BuildTableRow added in v0.6.0

func (r *TableRowWidget) BuildTableRow()

BuildTableRow executes table row build steps.

func (*TableRowWidget) Flags added in v0.5.4

func (r *TableRowWidget) Flags(flags TableRowFlags) *TableRowWidget

Flags sets the flags of the row.

func (*TableRowWidget) MinHeight added in v0.5.4

func (r *TableRowWidget) MinHeight(height float64) *TableRowWidget

MinHeight sets the minimum height of the row.

type TableWidget added in v0.5.1

type TableWidget struct {
	// contains filtered or unexported fields
}

TableWidget is a table widget. - Call Table to create new - Then use Rows method to add content - Use Columns method to configure columns (optional).

func Table

func Table() *TableWidget

Table creates new TableWidget.

func (*TableWidget) Build added in v0.5.1

func (t *TableWidget) Build()

Build implements Widget interface.

func (*TableWidget) Columns added in v0.5.1

func (t *TableWidget) Columns(cols ...*TableColumnWidget) *TableWidget

Columns adds a list of column widgets to be used in the table. Columns added with this function will cause the table header to be shown. If the table header is not required then the NoHeader() function can be used.

func (*TableWidget) FastMode added in v0.5.1

func (t *TableWidget) FastMode(b bool) *TableWidget

FastMode Displays visible rows only to boost performance.

func (*TableWidget) Flags added in v0.5.1

func (t *TableWidget) Flags(flags TableFlags) *TableWidget

Flags sets the flags of the table.

func (*TableWidget) Freeze added in v0.5.1

func (t *TableWidget) Freeze(col, row int) *TableWidget

Freeze columns/rows so they stay visible when scrolled.

func (*TableWidget) ID added in v0.6.1

func (t *TableWidget) ID(id ID) *TableWidget

ID sets the internal id of table widget.

func (*TableWidget) InnerWidth added in v0.5.1

func (t *TableWidget) InnerWidth(width float64) *TableWidget

InnerWidth sets the inner width of the table.

func (*TableWidget) NoHeader added in v0.9.0

func (t *TableWidget) NoHeader(b bool) *TableWidget

NoHeader indicates that the column header should not be shown. This allows the use of the Columns() function to configure table columns (eg. column width) but without showing the table header.

func (*TableWidget) Rows added in v0.5.1

func (t *TableWidget) Rows(rows ...*TableRowWidget) *TableWidget

Rows sets the rows of the table.

func (*TableWidget) Size added in v0.5.1

func (t *TableWidget) Size(width, height float32) *TableWidget

Size sets the size of the table.

type Texture

type Texture struct {
	// contains filtered or unexported fields
}

Texture represents imgui.TextureID. It is base unit of images in imgui.

func ToTexture added in v0.5.0

func ToTexture(texture *backend.Texture) *Texture

ToTexture converts backend.Texture to Texture.

func (*Texture) ID added in v0.8.0

func (t *Texture) ID() imgui.TextureID

ID returns imgui.TextureID of the texture.

type TooltipWidget

type TooltipWidget struct {
	// contains filtered or unexported fields
}

TooltipWidget sets a tooltip on the previous widget. The tooltip can be anything.

func Tooltip

func Tooltip(tip string) *TooltipWidget

Tooltip creates new tooltip with given label NOTE: you can set the empty label and use Layout() method.

func Tooltipf added in v0.6.0

func Tooltipf(format string, args ...any) *TooltipWidget

Tooltipf sets formated label.

func (*TooltipWidget) Build

func (t *TooltipWidget) Build()

Build implements Widget interface.

func (*TooltipWidget) Layout added in v0.5.0

func (t *TooltipWidget) Layout(widgets ...Widget) *TooltipWidget

Layout sets a custom layout of tooltip.

func (*TooltipWidget) To added in v0.9.0

func (t *TooltipWidget) To(layout ...Widget) *TooltipWidget

To sets layout to which the tooltip should be attached. NOTE: This is an optional approach. By default tooltip is attached to the previous widget.

type TreeNodeFlags

type TreeNodeFlags imgui.TreeNodeFlags

TreeNodeFlags represents tree node widget flags.

type TreeNodeWidget

type TreeNodeWidget struct {
	// contains filtered or unexported fields
}

TreeNodeWidget is a a wide button with open/close state. if is opened, the `layout` is displayed below the widget. It can be used to create certain lists, advanced settings sections e.t.c.

func TreeNode

func TreeNode(label string) *TreeNodeWidget

TreeNode creates a new tree node widget.

func TreeNodef added in v0.6.0

func TreeNodef(format string, args ...any) *TreeNodeWidget

TreeNodef adds TreeNode with formatted label.

func (*TreeNodeWidget) Build

func (t *TreeNodeWidget) Build()

Build implements Widget interface.

func (*TreeNodeWidget) Event added in v0.5.0

func (t *TreeNodeWidget) Event(handler func()) *TreeNodeWidget

Event create TreeNode with event handling function. You could detect events (e.g. IsItemClicked IsMouseDoubleClicked etc...) and handle them for TreeNode inside eventHandler. Deprecated: Use (*TreeNodeWidget).EventHandler instead!

func (*TreeNodeWidget) EventHandler added in v0.12.0

func (t *TreeNodeWidget) EventHandler(handler *EventHandler) *TreeNodeWidget

EventHandler allows to set *EventHandler instance for the actual TreeNode.

func (*TreeNodeWidget) Flags added in v0.5.0

func (t *TreeNodeWidget) Flags(flags TreeNodeFlags) *TreeNodeWidget

Flags sets flags.

func (*TreeNodeWidget) Layout added in v0.5.0

func (t *TreeNodeWidget) Layout(widgets ...Widget) *TreeNodeWidget

Layout sets layout to be displayed when tree node is opened.

type TreeTableRowWidget added in v0.5.6

type TreeTableRowWidget struct {
	// contains filtered or unexported fields
}

TreeTableRowWidget is a row in TreeTableWidget.

func TreeTableRow added in v0.5.6

func TreeTableRow(label string, widgets ...Widget) *TreeTableRowWidget

TreeTableRow creates new TreeTableRowWidget.

func (*TreeTableRowWidget) BuildTreeTableRow added in v0.6.0

func (ttr *TreeTableRowWidget) BuildTreeTableRow()

BuildTreeTableRow executes table row building steps.

func (*TreeTableRowWidget) Children added in v0.5.6

func (ttr *TreeTableRowWidget) Children(rows ...*TreeTableRowWidget) *TreeTableRowWidget

Children sets child rows of tree row.

func (*TreeTableRowWidget) Flags added in v0.5.6

Flags sets row's flags.

type TreeTableWidget added in v0.5.6

type TreeTableWidget struct {
	// contains filtered or unexported fields
}

TreeTableWidget is a table that consists of TreeNodeWidgets.

func TreeTable added in v0.5.6

func TreeTable() *TreeTableWidget

TreeTable creates new TreeTableWidget.

func (*TreeTableWidget) Build added in v0.5.6

func (tt *TreeTableWidget) Build()

Build implements Widget interface.

func (*TreeTableWidget) Columns added in v0.5.6

func (tt *TreeTableWidget) Columns(cols ...*TableColumnWidget) *TreeTableWidget

Columns sets table's columns.

func (*TreeTableWidget) Flags added in v0.5.6

func (tt *TreeTableWidget) Flags(flags TableFlags) *TreeTableWidget

Flags sets table flags.

func (*TreeTableWidget) Freeze added in v0.5.6

func (tt *TreeTableWidget) Freeze(col, row int) *TreeTableWidget

Freeze columns/rows so they stay visible when scrolled.

func (*TreeTableWidget) Rows added in v0.5.6

Rows sets TreeTable rows.

func (*TreeTableWidget) Size added in v0.5.6

func (tt *TreeTableWidget) Size(width, height float32) *TreeTableWidget

Size sets size of the table.

type URLLoader added in v0.9.0

type URLLoader struct {
	// contains filtered or unexported fields
}

URLLoader is a SurfaceLoader that loads images from a specified URL.

func NewURLLoader added in v0.9.0

func NewURLLoader(url, httpdir string, timeout time.Duration) *URLLoader

NewURLLoader creates a new SurfaceLoader that loads images from the specified URL.

Parameters:

  • url: The URL to load the image from.
  • httpdir: The root directory for file:// URLs.
  • timeout: The timeout duration for the HTTP request.

Returns:

  • SurfaceLoader: A new SurfaceLoader for loading images from the specified URL.

func (*URLLoader) ServeRGBA added in v0.9.0

func (u *URLLoader) ServeRGBA() (*image.RGBA, error)

ServeRGBA loads an image from the URL and returns it as an RGBA image.

Returns:

  • *image.RGBA: The loaded RGBA image.
  • error: An error if the image could not be loaded.

type UniformLoader added in v0.9.0

type UniformLoader struct {
	// contains filtered or unexported fields
}

UniformLoader is a SurfaceLoader that creates a uniform color image.

func NewUniformLoader added in v0.9.0

func NewUniformLoader(width, height int, c color.Color) *UniformLoader

NewUniformLoader creates a new SurfaceLoader that creates a uniform color image.

Parameters:

  • width: The width of the image.
  • height: The height of the image.
  • c: The color of the image.

Returns:

  • SurfaceLoader: A new SurfaceLoader for creating a uniform color image.

func (*UniformLoader) ServeRGBA added in v0.9.0

func (u *UniformLoader) ServeRGBA() (*image.RGBA, error)

ServeRGBA creates a uniform color image and returns it as an RGBA image.

Returns:

  • *image.RGBA: The created RGBA image.
  • error: An error if the image could not be created.

type VSliderIntWidget added in v0.5.4

type VSliderIntWidget struct {
	// contains filtered or unexported fields
}

VSliderIntWidget stands from Vertical SliderIntWidget.

func VSliderInt added in v0.5.4

func VSliderInt(value *int32, minValue, maxValue int32) *VSliderIntWidget

VSliderInt creates new vslider int.

func (*VSliderIntWidget) Build added in v0.5.4

func (vs *VSliderIntWidget) Build()

Build implements Widget interface.

func (*VSliderIntWidget) Flags added in v0.5.4

func (vs *VSliderIntWidget) Flags(flags SliderFlags) *VSliderIntWidget

Flags sets flags.

func (*VSliderIntWidget) Format added in v0.5.4

func (vs *VSliderIntWidget) Format(format string) *VSliderIntWidget

Format sets format (see comment on (*SliderIntWidget).Format).

func (*VSliderIntWidget) ID added in v0.8.0

func (vs *VSliderIntWidget) ID(id ID) *VSliderIntWidget

ID manually sets widget id.

func (*VSliderIntWidget) Label added in v0.6.0

func (vs *VSliderIntWidget) Label(label string) *VSliderIntWidget

Label sets slider's label (id).

func (*VSliderIntWidget) Labelf added in v0.6.0

func (vs *VSliderIntWidget) Labelf(format string, args ...any) *VSliderIntWidget

Labelf sets formatted label.

func (*VSliderIntWidget) OnChange added in v0.5.4

func (vs *VSliderIntWidget) OnChange(onChange func()) *VSliderIntWidget

OnChange sets callback called when slider's position gets changed.

func (*VSliderIntWidget) Size added in v0.5.4

func (vs *VSliderIntWidget) Size(width, height float32) *VSliderIntWidget

Size sets slider's size.

type ViewManipulateGizmo added in v0.10.0

type ViewManipulateGizmo struct {
	// contains filtered or unexported fields
}

ViewManipulateGizmo is a gizmo that allows you to manipulate world rotation visualy.

func ViewManipulate added in v0.10.0

func ViewManipulate() *ViewManipulateGizmo

ViewManipulate creates a new ViewManipulateGizmo.

func (*ViewManipulateGizmo) Color added in v0.10.0

Color sets the color of the gizmo.

func (*ViewManipulateGizmo) Gizmo added in v0.10.0

func (v *ViewManipulateGizmo) Gizmo(view *ViewMatrix, _ *ProjectionMatrix)

Gizmo implements GizmoI interface.

func (*ViewManipulateGizmo) Position added in v0.10.0

func (v *ViewManipulateGizmo) Position(x, y float32) *ViewManipulateGizmo

Position sets the position of the gizmo.

func (*ViewManipulateGizmo) Size added in v0.10.0

Size sets the size of the gizmo.

type ViewMatrix added in v0.10.0

type ViewMatrix struct {
	// contains filtered or unexported fields
}

ViewMatrix allows to generate a "view" matrix: - position - rotation - scale NOTE: You are supposed to allocate this with NewViewMatrix (do not use zero value)!!!

func IdentityMatrix added in v0.10.0

func IdentityMatrix() *ViewMatrix

IdentityMatrix creates a new ViewMatrix with identity matrix.

func NewViewMatrix added in v0.10.0

func NewViewMatrix() *ViewMatrix

NewViewMatrix creates a new ViewMatrix.

func (*ViewMatrix) Copy added in v0.10.0

func (m *ViewMatrix) Copy() *ViewMatrix

Copy copies returns a copy of the matrix. Useful e.g. in exaples/ to duplicate the matrix.

func (*ViewMatrix) MatrixSlice added in v0.10.0

func (m *ViewMatrix) MatrixSlice() []float32

MatrixSlice returns ViewMatrix as a slice (for debugging purposes).

func (*ViewMatrix) Rotation added in v0.10.0

func (m *ViewMatrix) Rotation(x, y, z float32) *ViewMatrix

Rotation sets the rotation of the matrix.

func (*ViewMatrix) Scale added in v0.10.0

func (m *ViewMatrix) Scale(x, y, z float32) *ViewMatrix

Scale sets the scale of the matrix.

func (*ViewMatrix) SetMatrix added in v0.10.0

func (m *ViewMatrix) SetMatrix(f []float32) *ViewMatrix

SetMatrix allows you to set the matrix directly. NOTE: f is supposed to be 16 elements long. NOTE: it is not recommended - use components functions.

func (*ViewMatrix) Transform added in v0.10.0

func (m *ViewMatrix) Transform(x, y, z float32) *ViewMatrix

Transform sets the position of the matrix.

type Widget

type Widget interface {
	Build()
}

Widget is a base unit of giu rendering system. each widget just needs to implement Build method which is called, when widget needs to be rendered.

func AlignManually added in v0.6.2

func AlignManually(alignmentType AlignmentType, widget Widget, widgetWidth float32, forceApplyWidth bool) Widget

AlignManually allows to apply alignment manually. As long as AlignSetter is really EXPERIMENTAL feature and may fail randomly, the following method is supposed to always work, as long as you set it up correctly. To use it just pass a single widget with its exact width. be sure to apply widget's size by using "Size" method! forceApplyWidth argument allows you to ask giu to force-set width of `widget` NOTE that forcing width doesn't work for each widget type! For example Button won't work because its size is set by argument to imgui call not PushWidth api.

type WindowFlags

type WindowFlags glfwbackend.GLFWWindowFlags

WindowFlags represents a window flags (see (*WindowWidget).Flags.

const (
	// WindowFlagsNone default = 0.
	WindowFlagsNone WindowFlags = WindowFlags(imgui.WindowFlagsNone)
	// WindowFlagsNoTitleBar disables title-bar.
	WindowFlagsNoTitleBar WindowFlags = WindowFlags(imgui.WindowFlagsNoTitleBar)
	// WindowFlagsNoResize disables user resizing with the lower-right grip.
	WindowFlagsNoResize WindowFlags = WindowFlags(imgui.WindowFlagsNoResize)
	// WindowFlagsNoMove disables user moving the window.
	WindowFlagsNoMove WindowFlags = WindowFlags(imgui.WindowFlagsNoMove)
	// WindowFlagsNoScrollbar disables scrollbars. Window can still scroll with mouse or programmatically.
	WindowFlagsNoScrollbar WindowFlags = WindowFlags(imgui.WindowFlagsNoScrollbar)
	// WindowFlagsNoScrollWithMouse disables user vertically scrolling with mouse wheel. On child window, mouse wheel
	// will be forwarded to the parent unless NoScrollbar is also set.
	WindowFlagsNoScrollWithMouse WindowFlags = WindowFlags(imgui.WindowFlagsNoScrollWithMouse)
	// WindowFlagsNoCollapse disables user collapsing window by double-clicking on it.
	WindowFlagsNoCollapse WindowFlags = WindowFlags(imgui.WindowFlagsNoCollapse)
	// WindowFlagsAlwaysAutoResize resizes every window to its content every frame.
	WindowFlagsAlwaysAutoResize WindowFlags = WindowFlags(imgui.WindowFlagsAlwaysAutoResize)
	// WindowFlagsNoBackground disables drawing background color (WindowBg, etc.) and outside border. Similar as using
	// SetNextWindowBgAlpha(0.0f).
	WindowFlagsNoBackground WindowFlags = WindowFlags(imgui.WindowFlagsNoBackground)
	// WindowFlagsNoSavedSettings will never load/save settings in .ini file.
	WindowFlagsNoSavedSettings WindowFlags = WindowFlags(imgui.WindowFlagsNoSavedSettings)
	// WindowFlagsNoMouseInputs disables catching mouse, hovering test with pass through.
	WindowFlagsNoMouseInputs WindowFlags = WindowFlags(imgui.WindowFlagsNoMouseInputs)
	// WindowFlagsMenuBar has a menu-bar.
	WindowFlagsMenuBar WindowFlags = WindowFlags(imgui.WindowFlagsMenuBar)
	// WindowFlagsHorizontalScrollbar allows horizontal scrollbar to appear (off by default). You may use
	// SetNextWindowContentSize(ImVec2(width,0.0f)); prior to calling Begin() to specify width. Read code in imgui_demo
	// in the "Horizontal Scrolling" section.
	WindowFlagsHorizontalScrollbar WindowFlags = WindowFlags(imgui.WindowFlagsHorizontalScrollbar)
	// WindowFlagsNoFocusOnAppearing disables taking focus when transitioning from hidden to visible state.
	WindowFlagsNoFocusOnAppearing WindowFlags = WindowFlags(imgui.WindowFlagsNoFocusOnAppearing)
	// WindowFlagsNoBringToFrontOnFocus disables bringing window to front when taking focus. e.g. clicking on it or
	// programmatically giving it focus.
	WindowFlagsNoBringToFrontOnFocus WindowFlags = WindowFlags(imgui.WindowFlagsNoBringToFrontOnFocus)
	// WindowFlagsAlwaysVerticalScrollbar always shows vertical scrollbar, even if ContentSize.y < Size.y .
	WindowFlagsAlwaysVerticalScrollbar WindowFlags = WindowFlags(imgui.WindowFlagsAlwaysVerticalScrollbar)
	// WindowFlagsAlwaysHorizontalScrollbar always shows horizontal scrollbar, even if ContentSize.x < Size.x .
	WindowFlagsAlwaysHorizontalScrollbar WindowFlags = WindowFlags(imgui.WindowFlagsAlwaysHorizontalScrollbar)
	// WindowFlagsNoNavInputs has no gamepad/keyboard navigation within the window.
	WindowFlagsNoNavInputs WindowFlags = WindowFlags(imgui.WindowFlagsNoNavInputs)
	// WindowFlagsNoNavFocus has no focusing toward this window with gamepad/keyboard navigation
	// (e.g. skipped by CTRL+TAB).
	WindowFlagsNoNavFocus WindowFlags = WindowFlags(imgui.WindowFlagsNoNavFocus)
	// WindowFlagsUnsavedDocument appends '*' to title without affecting the ID, as a convenience to avoid using the
	// ### operator. When used in a tab/docking context, tab is selected on closure and closure is deferred by one
	// frame to allow code to cancel the closure (with a confirmation popup, etc.) without flicker.
	WindowFlagsUnsavedDocument WindowFlags = WindowFlags(imgui.WindowFlagsUnsavedDocument)

	// WindowFlagsNoNav combines WindowFlagsNoNavInputs and WindowFlagsNoNavFocus.
	WindowFlagsNoNav WindowFlags = WindowFlags(imgui.WindowFlagsNoNav)

	// WindowFlagsNoDocking Disable docking of this window.
	WindowFlagsNoDocking WindowFlags = WindowFlags(imgui.WindowFlagsNoDocking)

	// WindowFlagsNoDecoration combines WindowFlagsNoTitleBar, WindowFlagsNoResize, WindowFlagsNoScrollbar and
	// WindowFlagsNoCollapse.
	WindowFlagsNoDecoration WindowFlags = WindowFlags(imgui.WindowFlagsNoDecoration)
	// WindowFlagsNoInputs combines WindowFlagsNoMouseInputs, WindowFlagsNoNavInputs and WindowFlagsNoNavFocus.
	WindowFlagsNoInputs WindowFlags = WindowFlags(imgui.WindowFlagsNoInputs)
)

window flags.

type WindowShortcut added in v0.5.5

type WindowShortcut struct {
	Key      Key
	Modifier Modifier
	Callback func()
}

WindowShortcut represents a window-level shortcut could be used as an argument to (*Window).RegisterKeyboardShortcuts.

type WindowWidget added in v0.5.0

type WindowWidget struct {
	// contains filtered or unexported fields
}

WindowWidget represents imgui.Window Windows are used to display ui widgets. They are in second place in the giu hierarchy (after the MasterWindow) NOTE: to disable multiple window, use SingleWindow.

func SingleWindow

func SingleWindow() *WindowWidget

SingleWindow creates one window filling all available space in MasterWindow. If SingleWindow is set up, no other windows may be defined.

func SingleWindowWithMenuBar

func SingleWindowWithMenuBar() *WindowWidget

SingleWindowWithMenuBar creates a SingleWindow and allows to add menubar on its top.

func Window

func Window(title string) *WindowWidget

Window creates a WindowWidget.

func (*WindowWidget) BringToFront added in v0.5.5

func (w *WindowWidget) BringToFront()

BringToFront sets window focused.

func (*WindowWidget) CurrentPosition added in v0.5.5

func (w *WindowWidget) CurrentPosition() (x, y float32)

CurrentPosition returns a current position of the window.

func (*WindowWidget) CurrentSize added in v0.5.5

func (w *WindowWidget) CurrentSize() (width, height float32)

CurrentSize returns current size of the window.

func (*WindowWidget) Flags added in v0.5.0

func (w *WindowWidget) Flags(flags WindowFlags) *WindowWidget

Flags sets window flags.

func (*WindowWidget) HasFocus added in v0.5.5

func (w *WindowWidget) HasFocus() bool

HasFocus returns true if window is focused.

func (*WindowWidget) IsOpen added in v0.5.0

func (w *WindowWidget) IsOpen(open *bool) *WindowWidget

IsOpen sets if window widget is `opened` (minimized).

func (*WindowWidget) Layout added in v0.5.0

func (w *WindowWidget) Layout(widgets ...Widget)

Layout is a final step of the window setup. it should be called to add a layout to the window and build it.

func (*WindowWidget) Pos added in v0.5.0

func (w *WindowWidget) Pos(x, y float32) *WindowWidget

Pos sets the window start position NOTE: The position could be changed by user later. To prevent user from changing window position use WIndowFlagsNoMove.

func (*WindowWidget) RegisterKeyboardShortcuts added in v0.5.5

func (w *WindowWidget) RegisterKeyboardShortcuts(s ...WindowShortcut) *WindowWidget

RegisterKeyboardShortcuts adds local (window-level) keyboard shortcuts see InputHandler.go.

func (*WindowWidget) Size added in v0.5.0

func (w *WindowWidget) Size(width, height float32) *WindowWidget

Size sets window size NOTE: size can be changed by user, if you want to prevent user from changing window size, use NoResize flag.

Directories

Path Synopsis
cmd
gmdeploy
Package main could be used to deploy a giu application.
Package main could be used to deploy a giu application.
examples
CSS-styling
Package main shows how to use giu CSS implementation to set style on your app.
Package main shows how to use giu CSS implementation to set style on your app.
align
Package main shows how to use giu Alignment system.
Package main shows how to use giu Alignment system.
asyncimage
Package main shows how to handle image async with state and events
Package main shows how to handle image async with state and events
autofocus
Package main shows how to set auto-focus on an input field.
Package main shows how to set auto-focus on an input field.
canvas
Package main presents usage of giu.Canvas.
Package main presents usage of giu.Canvas.
codeeditor
Package main demonstrates how to use the Code Editor widget.
Package main demonstrates how to use the Code Editor widget.
customwidget
Package main presents how to write your own widget that will be compatible with giu.Widget.
Package main presents how to write your own widget that will be compatible with giu.Widget.
dragdrop
Package main shows usage of drag and drop feature (uses imgui).
Package main shows usage of drag and drop feature (uses imgui).
extrawidgets
Package main presents giu extra widgets (Widgets created in giu, not native to imgui).
Package main presents giu extra widgets (Widgets created in giu, not native to imgui).
footer
Package main presents how to create a footer in giu.
Package main presents how to create a footer in giu.
fps
Package main shows a simple FPS counter.
Package main shows a simple FPS counter.
gifdecode
Package main shows a simple example of how to read, decode, convert to Textures and present gif image in giu.
Package main shows a simple example of how to read, decode, convert to Textures and present gif image in giu.
gizmo
Package main shows usage of GizmoWidget.
Package main shows usage of GizmoWidget.
helloworld
Package main presents the simpliest giu hello-world app.
Package main presents the simpliest giu hello-world app.
hugelist
Package main presents how to implement large, procedurally-generated table.
Package main presents how to implement large, procedurally-generated table.
imguidemo
Package main shows imgui demo window.
Package main shows imgui demo window.
keyboardShortcuts
Package main presents how to use keyboard shortcuts system in giu.
Package main presents how to use keyboard shortcuts system in giu.
loadimage
Package main provides examples of loading and presenting images.
Package main provides examples of loading and presenting images.
loadimageAdvanced
Package main provides examples of loading and presenting images in advanced ways
Package main provides examples of loading and presenting images in advanced ways
markdown
Package main shows how to use the Markdown widget.
Package main shows how to use the Markdown widget.
msgbox
Package main presents usage of giu Message Box.
Package main presents usage of giu Message Box.
multiplefonts
Package main shows how to use multiple fonts in giu.
Package main shows how to use multiple fonts in giu.
multiwindow
Package main presents how to create multiple windows in the same application.
Package main presents how to create multiple windows in the same application.
ondrop
Package main shows how to handle dropped file.
Package main shows how to handle dropped file.
paint
Package main demonstrate use of advanced image object via paint clone
Package main demonstrate use of advanced image object via paint clone
plot
Package main presents usage of Plots in giu.
Package main presents usage of Plots in giu.
rangebuilder
Package main presents usage of giu.RangeBuilder.
Package main presents usage of giu.RangeBuilder.
setstyle
Package main shows how to setyle your app by using giu.StyleSetter.
Package main shows how to setyle your app by using giu.StyleSetter.
splitter
Package main shows usage of SplitLayout.
Package main shows usage of SplitLayout.
transparent
Package main shows how to create a transparent window with custom drawing.
Package main shows how to create a transparent window with custom drawing.
update
Package main shows how to split FPS from TPS in giu.
Package main shows how to split FPS from TPS in giu.
widgets
Package main presents most of available giu widgets.
Package main presents most of available giu widgets.
windows
Package main presents operations on windows (focus, size, position).
Package main presents operations on windows (focus, size, position).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳