All platform-specific functionality is isolated in a mega-type sysData
that stores OS toolkit handles and provides methods that do the work for the frontend API. The file sysdata.go
defines a type cSysData
that contains everything all platforms have in common and dummy definitions of the sysData
functions that panic.
The key sysData
function is sysData.make()
. It takes two arguments: the initial text of the control (if any), and a pointer to a sysData
that represents the window that holds the control. If this pointer is nil
, we are creating a window instead, so any window-specific actions are taken here.
cSysData
contains the control type as a number, an event
channel where the object's standard event (close button for Window
, click for Button
, etc.) is stored, and a resize()
function variable that is called to resize child controls on window resize.
Controls need only two functions: a make()
function that builds the control, and a `setRe