4,400
edits
m (Update forum links) |
m (Use Nasal highlighter) |
||
| Line 156: | Line 156: | ||
* We also need a function which parses existing dialog xml files (reimplementing http://gitorious.org/fg/flightgear/blobs/next/src/GUI/FGPUIDialog.cxx#line708 FGPUIDialog.cxx/FGPUIDialog::makeObject]) and maps them to the new canvas widgets. Each widgets sits in is own Nasal file (eg. inside $FG_DATA/gui/widgets) and has to be implemented using a hash with several required functions, implementing the abstract interface of a widget: | * We also need a function which parses existing dialog xml files (reimplementing http://gitorious.org/fg/flightgear/blobs/next/src/GUI/FGPUIDialog.cxx#line708 FGPUIDialog.cxx/FGPUIDialog::makeObject]) and maps them to the new canvas widgets. Each widgets sits in is own Nasal file (eg. inside $FG_DATA/gui/widgets) and has to be implemented using a hash with several required functions, implementing the abstract interface of a widget: | ||
<syntaxhighlight lang=" | <syntaxhighlight lang="nasal"> | ||
var SampleWidget = { | var SampleWidget = { | ||
# Add the widget to the parent | # Add the widget to the parent | ||
| Line 205: | Line 205: | ||
The GUI builder (currently CanvasWidget.cxx) would then merely need to instantiate a new Nasal object by calling the widget constructor: | The GUI builder (currently CanvasWidget.cxx) would then merely need to instantiate a new Nasal object by calling the widget constructor: | ||
<syntaxhighlight lang=" | <syntaxhighlight lang="nasal"> | ||
var is_hash = func(t) typeof(t)=='hash'; | var is_hash = func(t) typeof(t)=='hash'; | ||
var is_func = func(f) typeof(f)=='func'; | var is_func = func(f) typeof(f)=='func'; | ||