widget/grid.go

42 lines
1.1 KiB
Go
Raw Permalink Normal View History

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
}