Next: , Previous: Windows, Up: GUI

7.3 The Command Structure

Files: gui/cmdmgr.h, gui/cmdmgr.c

The Command Structure defines the structure of all menus and toolbars, generates and maintains menus and toolbars and for each command it controls and evaluates the conditions under which it can be activated. Each menu or toolbar instance is generated according to one common template and a specified location which defines what commands should the instance contain. For example, the “File/Save” command is located in the View menu and Universe Browser menu, not in the Main Window menu; but all these are generated from the same template.

The command structure template has a stamp and each instance has a stamp, too. The stamp is incremented after every command structure change (not including changes of command states). When a menu or toolbar instance needs to be refreshed, the stamps are compared and in case that they differ, the instance is rebuilt. Otherwise, all the items inside are updated – enabled/disabled, (un)checked – only.