diff options
author | René 'Necoro' Neumann <necoro@necoro.eu> | 2022-02-02 23:49:05 +0100 |
---|---|---|
committer | René 'Necoro' Neumann <necoro@necoro.eu> | 2022-02-02 23:49:05 +0100 |
commit | 14d5d88df1e380bb78340952aa55780bbcb620e5 (patch) | |
tree | 708a9d0753439283488b12144b12c186bc84defc /gui.go | |
parent | 80faa52aaf2e48092f8d8e0b1d9da59e6b47b098 (diff) | |
download | engarde-importer-14d5d88df1e380bb78340952aa55780bbcb620e5.tar.gz engarde-importer-14d5d88df1e380bb78340952aa55780bbcb620e5.tar.bz2 engarde-importer-14d5d88df1e380bb78340952aa55780bbcb620e5.zip |
Diffstat (limited to '')
-rw-r--r-- | gui.go | 34 |
1 files changed, 28 insertions, 6 deletions
@@ -18,6 +18,10 @@ import ( //go:generate goversioninfo -64 -o resource_amd64.syso res/versioninfo.json +/* + * Embedded Resources + */ + //go:embed res/monitor_48.png var icon []byte @@ -25,6 +29,10 @@ var icon []byte var icomoon []byte var icomoonFI *g.FontInfo +/* + * Data / State + */ + type entryCfg struct { inputFile string target string @@ -59,6 +67,11 @@ var ( entries []entryCfg ) +/* + * Grid Layout + */ +// GridLayout is used to calculate the maximum width for labels, +// so that the following widgets all start at the same offset. type GridLayout struct { widgets []g.Widget labels []*g.LabelWidget @@ -103,6 +116,10 @@ func (grid *GridLayout) Build() { } } +/* + * Further additions to Giu + */ + func Layout(widgets ...g.Widget) g.Layout { return widgets } @@ -115,8 +132,17 @@ func PopID() g.Widget { return g.Custom(imgui.PopID) } -const comboSize = 120 -const chooseStr = "Wähle..." +func shouldQuit() { + g.Context.GetPlatform().SetShouldStop(true) +} + +/* + * Putting together the GUI + */ +const ( + comboSize = 120 + chooseStr = "Wähle..." +) func buildEntry(idx int) g.Widget { entry := &entries[idx] @@ -183,10 +209,6 @@ func entryBuilder() g.Widget { }) } -func shouldQuit() { - g.Context.GetPlatform().SetShouldStop(true) -} - func loop() { g.SingleWindow().Layout( g.Align(g.AlignCenter).To(g.Label("Engarde Importer")), |