Labels

FUNCTIONS

  Control * new_label(Window *w, Rect r, char *text, int alignment);
  Control * add_label(Control *c, Rect r, char *text, int alignment);

CONSTANTS

  enum {
    ALIGN_LEFT     = 1,
    ALIGN_RIGHT    = 2,
    ALIGN_JUSTIFY  = 3,
    ALIGN_CENTER   = 4,
    ALIGN_CENTRE   = 4,
    VALIGN_TOP     = 8,
    VALIGN_BOTTOM  = 16,
    VALIGN_JUSTIFY = 24,
    VALIGN_CENTER  = 32,
    VALIGN_CENTRE  = 32
  };

NOTES

The new_label function creates on the specified window a text label which cannot be edited by the user. The text string is aligned within the rectangle according to the value of the alignment parameter. Values such as ALIGN_LEFT, ALIGN_RIGHT or ALIGN_CENTER can be specified. A value of zero corresponds to ALIGN_LEFT+VALIGN_TOP.

The add_label function works in the same way as new_label, except that it attaches the label to a control rather than directly to a window.

A label does not respond to mouse or keyboard events; in fact, these events pass straight through a label to the underlying parent control or window. The initial background colour of a label is transparent, so that only the text of the label is drawn against the background of the window.

It can be seen from the list of possible text alignments above, both American and British spellings of the the word 'centre' are legal.

The horizontal alignments are:

The vertical alignments are explained below: Either a vertical, or a horizontal alignment can be specified, or a combination of the two, using the plus or bitwise-or operators to combine the alignments.

EXAMPLES