next up previous contents index
Next: Display Methods Using Items Up: Interactive Elements Previous: The new_item Tags

Adding Items to the Manager

An item has to be added to the control window of the manager before it can be used, therefore you first have to get the pointer to the GRAPE manager by sending the message "get-stdmgr" to the class Manager:

MANAGER *mgr = (MANAGER *)GRAPE(Manager, "get-stdmgr")();

This method will create the manager if it does not exist, otherwise the pointer to the existing manager is returned. This method can fail if the windows cannot be opened therefore it is wise to check the return value at least when the method is called for the first time (for the Rot2d example this is done in the "get-editor" method).

User defined items are always placed in one of the option menus. With

GRAPE(mgr, "add-inter")(inter);
it is placed in the first option menu, with
GRAPE(mgr, "add-inter-for-opt")(inter, opt_number);
it will be added to the option menu with number opt_number ("add-inter" is just a shortcut for "add-inter-for-opt" with zero opt_number as parameter).

Where the item is placed depends on its attributes like for example the position (default or set with "set-pref-pos"/I_Pos) and/or fill-mode (default or set with "set-fill-mode"/I_FillMode) and the other items that are already present in the option menus. First the manager tries to place it in the option menu and at the position the user wanted. If this fails another position in the same menu will be tried, if this is also impossible the next option menu is used instead. If the item cannot be added to one of the option menus the methods return NULL.

Items can be added to a group or layer instead of the manager itself, in this case the "add-inter" method has to be send to the group:

GRAPE(group, "add-inter")(item);
Of course now the group has to be added to the manager.

We won't go into details about the concepts of the GRAPE manager now, again we refer to chapter 9.1.


next up previous contents index
Next: Display Methods Using Items Up: Interactive Elements Previous: The new_item Tags

SFB 256 Universität Bonn and IAM Universität Freiburg

Copyright © by the Sonderforschungsbereich 256 at the Institut für Angewandte Mathematik, Universität Bonn.