summaryrefslogtreecommitdiff
path: root/gui.go
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.eu>2022-02-02 23:49:05 +0100
committerRené 'Necoro' Neumann <necoro@necoro.eu>2022-02-02 23:49:05 +0100
commit14d5d88df1e380bb78340952aa55780bbcb620e5 (patch)
tree708a9d0753439283488b12144b12c186bc84defc /gui.go
parent80faa52aaf2e48092f8d8e0b1d9da59e6b47b098 (diff)
downloadengarde-importer-master.tar.gz
engarde-importer-master.tar.bz2
engarde-importer-master.zip
Slight restructuring / some commentsHEADmaster
Diffstat (limited to 'gui.go')
-rw-r--r--gui.go34
1 files changed, 28 insertions, 6 deletions
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")),