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

Bar1d

  (subclass of 9.1.3.12 Group)

Bar1d is an abstract superclass which implements common functionality of Ruler, Slider, Scrollbar, Function_Bar1d, Function_Ruler and Function_Slider. You cannot create a single Bar1d instance (since the class is abstract), but only instances of the listed subclasses. Methods for things like bounding the edited value, scaling the ruler, slider coloring and fixing of the 0 position are documented here.

The Bar1d validates the min-max-values for the variable that is seen in the input field.

typedef enum declaration_format{
  dfInt,
  dfFloat,
  dfDouble,
  dfString,
  dfRegexp
} DECLARATION_FORMAT;

typedef enum orientations {
  orHorizontal,
  orVertical
} ORIENTATIONS;

/* Internal use only. */
typedef enum bartypes {
  btRuler,
  btSlider,
  btBoundedRuler, 
  btFunctionRuler,
  btScrollBar
} BARTYPES;

   GRAPE(bar1d, "fix-min-max")(fix_min, fix_max)
BAR1D *bar1d
int fix_min, fix_max
If one of fix_min and fix_max is ON, the corresponding value bound of the Bar1d cannot be edited by the user in the configuration layer. If only one of them is ON and the other is OFF, it remains possible to set min < max to remove all bounds.

This option is turned off by default to allow later changing of wrong values. It should only be used in very special cases.

   GRAPE(bar1d, "set-bar-color")(rgb)
BAR1D *bar1d
VEC3 rgb
Set the color of the moving bar to the RGB color rgb.

   GRAPE(bar1d, "set-bar-color-index")(color_index)
BAR1D *bar1d
int color_index
Set the color of the moving bar to the indexed color color_index.

   GRAPE(bar1d, "set-eval-fn")(eval, inv_eval)
BAR1D *bar1d
double (*eval) double
double (*inv_eval) double
Set the evaluation functions. Every time the variable is read or written the according function is applied, eval before writing and inv_eval after reading.

As you see the functions are double (double), the type conversion (int, double ...) is done automatically.

   GRAPE(bar1d, "set-min-max")(min, max)
BAR1D *bar1d
double min, max
Set bounds for the edited value, if the value is out of bounds it will be corrected to the nearest one. min > max means no bounds.

   GRAPE(bar1d, "set-offset")(offset)
BAR1D *bar1d
double offset
Set the value represented by the left or top position of the ruler, for example: for a ruler, which has min = 3.0, max = 4.0 and a scale of 0.5, you should set an offset of 3.0 or 3.5 to use the ruler optimally. If you set the offset to a value, which will cause the position of the ruler to be out of the possible range, the offset-value will be corrected automatically.

   GRAPE(bar1d, "set-print-format")(format)
BAR1D *bar1d
char *format
Set the input field's print-format (see 9.1.3.13 Input).
   GRAPE(bar1d, "set-scale")(scale)
BAR1D *bar1d
double scale
Set the ruler scaling. scale means the difference between the value represented by the handle being at the most left position and being on the most right position.

   GRAPE(bar1d, "set-step-size")(stepsize)
BAR1D *bar1d
double stepsize
You can step the Bar1d by clicking on one of the arrow Buttons. Set the size of this steps here.

   GRAPE(bar1d, "set-type")(type)
BAR1D *bar1d
DECLARATION_FORMAT type
Set a new type for the variable. You can do this together with setting the new variable (with the new type) by "set-var-and-type".

   GRAPE(bar1d, "set-value-changed")(value_changed)
BAR1D *bar1d
char *value_changed
Set a method the Bar1d sends to itself every time its variable's value has changed.

   GRAPE(bar1d, "set-var-and-type")(var, type)
BAR1D *bar1d
void *var
DECLARATION_FORMAT type
Set a new variable to manipulate interactively with the Bar1d together with its type. Setting both at the same time avoids several problems.

   GRAPE(bar1d, "set-variable")(var)
BAR1D *bar1d
void *var
Set a new variable to be interactively manipulated by the Ruler/Slider/Scrollbar.

   GRAPE(bar1d, "update")()
BAR1D *bar1d
Overloading inherited method of class 9.1.3.14 Interactive. This method will will fetch the actual value of the variable the bar1d controls and will show the correct value. You must call this method, if you change the value of a variable, which is also controlled by a bar1d.


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

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.