From 14d5d88df1e380bb78340952aa55780bbcb620e5 Mon Sep 17 00:00:00 2001 From: René 'Necoro' Neumann Date: Wed, 2 Feb 2022 23:49:05 +0100 Subject: Slight restructuring / some comments --- gui.go | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) (limited to 'gui.go') diff --git a/gui.go b/gui.go index ea26fbc..2c19e03 100644 --- a/gui.go +++ b/gui.go @@ -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")), -- cgit v1.2.3-54-g00ecf