next up previous contents index
Next: Layer Up: Classes and Methods Previous: Interactive

Item

  (subclass of Root)

Abstract superclass of all visible and interactive objects in the control window. Implements basic functionality for redraw management, positioning and sizing.

Every Item can have a list of associated Layers, one possible application is to hide a Layer when the Item is invisible, to reduce the number of layers. See 9.1.3.14 Interactive for the methods.

   (GROUP * ) GRAPE(item, "get-group")()
ITEM *item
Returns the Group which contains the Item. If the Item has not been added to a group the method will return NULL.
   (char * ) GRAPE(item, "get-item-path")()
ITEM *item
Return the path through Layers an Groups to item. The return value is allocated via g_strdup so you have to free it after use, e.g. using g_strfree.

One example for an item path is the exit Button: "/main/top-row/exit"

   (ITEM * ) GRAPE(item, "is-visible")()
ITEM *item
Will return a value unequal to NULL, if the item is not part of the manager at that moment. An item is also called visible if it is partial or totally hidden behind a layer.
   GRAPE(Item, "new-instance")(name)
CLASS *Item
char *name
Creates a new item.
   (ITEM * ) GRAPE(item, "path-to-item")(path)
ITEM *item
char * path
Return the first Item that matches the path path. This is trivial for single Items, normally one sends this method to a Group or to the manager, which tries to find the Item in all of its layers.
   GRAPE(item, "print-item-path-send")()
Item * item
Print the item path of item. Designed for use by one's .graperc.
   GRAPE(item, "set-add-action")(add, remove)
ITEM *item
char *add, remove
Change the method the item will call when its visibility-state is changed, which means that it has been added to or removed from the manager. If the item becomes visible it will call the method add, if it becomes invisible it will call remove. This mechanism is used to add and remove item dependent layers.See also 9.1.3.14
   GRAPE(item, "set-color")(rgb)
ITEM *item
VEC3 rgb
Changes the backgroundcolor of an item to a special RGB-value. You should use this method only if it is really necessary, because the colors in the X11-device are stored as indexed-colors and there are only few color indexes available. You should better use "set-color-index" to use a default color index.
   GRAPE(item, "set-color-index")(color_index)
ITEM *item
int color_index
Change the background color of an item to the color with the index color_index. There are predefined index constants like RED_COLOR, LINE_COLOR, BACKGROUND_COLOR a.o.
   GRAPE(item, "set-fill-mode")(mode)
ITEM *item
int mode
Changes the mode for the autopositioning of the item. If mode == MENU_FILL_TOP the item will try to find a place as near to the upper left corner of the group as possible. If MENU_FILL_BOTTOM it will try to find a place as near to the lower right corner of the group as possible
   GRAPE(item, "set-help-text")(help_text)
ITEM *item
char * help_text
Set the help text of item. This is the text that is displayed when you click Control-MiddleMouseButton on it.
   GRAPE(item, "set-label")(label)
ITEM *item
char *label
Set the label of an Item. The label is the displayed text.
   GRAPE(item, "set-pref-pos")(px, py)
ITEM *item
double px, py
Set the preferred position of an item to px and py. The position is the position of the left lower corner of the item. Alternative you can use the magical const MENU_AUTO_POSITION to position the item automatically. See also 9.1.1.2.
   GRAPE(item, "set-pref-size")(sx, sy)
ITEM *item
double sx, sy
Set the preferred size of an item to sx and sy. Alternative you can use the magical const MENU_MAX_SIZE. If the item doesn't fit in the group (and all possible replacement groups) it will be added, but is invisible. If you want to change the size of an item, which is still added to a group, you need to send the method "calc-inter" to the group. If you don't know the group the method "get-group" will return it. See also 9.1.1.2.

   GRAPE(item, "set-refresh")(on_off)
ITEM *item
int on_off
on_off == ON: draw the Item the next time the Manager checks its refresh state.
   GRAPE(item, "set-rel-size-mode")(on_off, on_off)
ITEM *item
int on_off
   GRAPE(item, "update")()
ITEM *item
Update the internal state. If a pointed to variable was changed by hand "update" tells the Item to update its appearance.


next up previous contents index
Next: Layer Up: Classes and Methods Previous: Interactive

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.