summaryrefslogtreecommitdiff
path: root/grid.go
diff options
context:
space:
mode:
Diffstat (limited to 'grid.go')
-rw-r--r--grid.go41
1 files changed, 41 insertions, 0 deletions
diff --git a/grid.go b/grid.go
new file mode 100644
index 0000000..0adedff
--- /dev/null
+++ b/grid.go
@@ -0,0 +1,41 @@
+package widget
+
+// This is how grids are handled. On the application side,
+// things are mostly handled this way. Web browsers, etc
+//
+// On the toolkit side, this must be translated into the display
+// code. This is particularly complicated with ncurses but once
+// done in the toolkits, bears fruit in the application code simplicity
+
+// NOTE: X numbers horizontally, Y is numbered down. Like in mathematics, EXCEPT Y IS DOWN
+// this is the only sensible way. It's way too confusing to use negative numbers for Y.
+// This is an attempt to make it simple for people to program against this code,
+// then we hide these implementation details in the toolkit plugins
+
+// Grid numbering examples (H) or (W,H)
+// -----------------------
+// -- (1) -- (2) -- (3) -- (X)
+// -----------------------
+//
+// (Y)
+// ---------
+// -- (1) --
+// -- (2) --
+// ---------
+//
+// (X,Y)
+// --------------------------------------
+// -- (1,1) -- (2,1) -- (3,1) -- (4,1) --
+// -- (1,2) -- (2,2) -- (3,2) -- --
+// -- (1,3) -- -- (3,3) -- (4,3) --
+// --------------------------------------
+
+type GridSize struct {
+ Width int
+ Height int
+}
+
+type GridOffset struct {
+ X int
+ Y int
+}