(subclass of 9.1.3.12 Group)
A movable overlay Group.
A layer must be added to the manager using the method "add-layer" to add it to the manager. To remove it from the manager use the function "remove-layer". If the layer depends upon an item, it may be removed or added automatically using this methods. It is also possible to add display method dependent layer using it as a each other normal item.
This example generates a layer, which contains a checkbox, a ruler and a button, which will hide and delete the layer.
LAYER *layer; MANAGER *mgr; BUTTON *butt; CHECKBOX *checkbox; RULER *ruler; double sizex, sizey; int my_flag; static double my_double; /* Get the standard Manager. If none existed it will be created.*/ mgr = (MANAGER *)GRAPE (Manager, "get-stdmgr")(); /* Create a new layer. */ layer = (LAYER *)GRAPE (Layer, "new-instance")("my third layer"); /* Set size of layer */ GRAPE (layer, "set-pref-size")(10.0, 10.0); /* Add it to the manager. It will be drawn at the next Redraw. */ GRAPE (mgr, "add-layer")(layer); /* Get the layer's inner size, e.g. without the border.*/ GRAPE (layer, "get-size")(&sizex, &sizey); /* Create a dismiss button with removes the layer by sending "remove" if pressed.*/ butt = (BUTTON *) GRAPE (Button, "new-instance")("remove", layer, "dismiss"); GRAPE (butt, "set-pref-size")(sizex / 2, 1.0); /* Button will be positioned at the very bottom of the layer. */ GRAPE (butt, "set-fill-mode")(MENU_FILL_BOTTOM); /* Put button into layer. */ GRAPE (layer, "add-inter")(butt); /* Create a new ruler which points to a double Variable. */ ruler = (RULER *) GRAPE (Ruler, "new-instance") (&my_double, "my ruler", dfDouble); /* The ruler will fill the layer even if it is resized. */ GRAPE (ruler, "set-pref-size")(MENU_MAX_SIZE, 1.0); GRAPE (ruler, "set-fill-mode")(MENU_FILL_TOP); GRAPE (layer, "add-inter")(ruler); checkbox = (CHECKBOX *) GRAPE (Checkbox, "new-instance")("my checkbox", &my_flag); GRAPE (checkbox, "set-fill-mode")(MENU_FILL_TOP); GRAPE (layer, "add-inter")(checkbox);
Copyright © by the Sonderforschungsbereich 256 at the Institut für Angewandte Mathematik, Universität Bonn.