Chromumll v1.0 Documentation Reference - Classes contents   |    glossary   |    chroma   |    classes

Notice: These are preliminary specifications and are subject to change.

 Glyph

Object
  +---Glyph
 Description:
The base class for all objects that have a visual representation. Glyphs know how to draw themselves on the display. Glyph is an abstract class; you can not instantiate it. All visual elements on the screen (Bitmaps, Shapes etc.) are sub-classes of Glyph and hence inherit its properties.
 Super-class:
Object
 Sub-classes:
Bitmap, Group, Label, Shape, Widget


 Intrinsic Properties:
 combine_child_shapes (Boolean)
 combine_shape (Boolean)
 desired_height (Integer)
 desired_width (Integer)
 double_buffer (Boolean)
 ignore_alpha (Boolean)
 visible (Boolean)
 width, height (Integer)
 x (Integer)
 y (Integer)
 Notes:
 Size
 Examples:
 Simple Example
 Advanced Example

 Intrinsic Properties

 combine_child_shapes (Boolean)
When true, recursively combine all the regions of the children of this glyph. combine_shape does not have to be true for this flag to take effect.
Default: true


 combine_shape (Boolean)
When true, use the shape of this glyph when applying a shape to a top level window frame. When false, this glyph's shape is ignored.
Default: true


 desired_height (Integer)
The height in pixels, of the Glyph's contents. If a Bitmap Glyph uses a 25x50pixel image file, desired_height will be 50 and desired_width will be 25. These properties are valid in objects of class Bitmap or Label, but are undefined in all other sub-classes of Glyph. Common usage:
*Bitmap { width = desired_width; height = desired_height; filename = "foo.bmp"; }


 desired_width (Integer)
The width in pixels, of the Glyph's contents. See desired_height.


 double_buffer (Boolean)
Whether this glyph is "double buffered". When true, this glyph (and all its child glyphs) are first rendered to an off-screen buffer, which is then copied to the screen. This will result in much smoother interaction and animation. A double-buffered Glyph will use slightly more system resources than a non-double-buffered Glyph, for this reason, it is recommended that you only double-buffer Glyphs which are updated often over short periods of time (e.g. parts of ScrollBars).
Default: false


 ignore_alpha (Boolean)
When true, the Glyph's alpha channel will be ignored when drawing. That is, the Glyph will occupy an entire rectangular region, with previously transparent areas filled with the Glyph's background color. Note: Currently, this only applies to Bitmap and its subclasses.

Parts of alpha channels for Bitmaps which determine WindowBorder shapes are still used as Bit-Masks. It is recommended that all shapes combined to form WindowBorders have the ingore_alpha property set to true.
Default: false


 visible (Boolean)
Determines whether or not the Glyph can be seen. Glyph's are visible when visible is true and all its ancestors (parents and parents' parents and parents' parents' parents etc.) are visible. Invisible Widgets cannot receive user input.
Default: false


 width, height (Integer)
The size of the glyph in pixels.
Note: For Chroma version 1.0Beta PushButton, ScrollBar, and WindowBorder.content should all have width = 0; height = 0;, which ensures that Windows will shape the Glyphs properly. (see greydient.cll)
Default: undefined


 x (Integer)
The horizontal location of the glyph, in pixels. Coordinates are relative to the parent glyph origin (it's top left corner).
Default: undefined


 y (Integer)
The vertical location of the glyph, in pixels. Coordinates are relative to the parent glyph origin (it's top left corner).
Default: undefined



 Notes

 Size
Glyphs with a width or height < 0 (ie. not at least 1x1 pixels in size) will NOT draw. Actually, their behaviour as far as appearance goes is undefined if they do not have any area. However, when you set (e.g.) width to -10, when you refer this property it will be -10, despite it being invalid. In other words, the coordinates properties are not clipped when set.

In addition, if a glyph nested in a parent glyph extends beyond the parent, the visual representation of the child will be clipped. In other words, a child cannot draw outside the boundaries of its parent.

 Examples

  Simple Example
You will probably want to put this in every .widget file. It sets default values to all subsequent instances Glyphs and its subclasses. The nested Glyph indicates that all Glyphs parented by a Glyph take on its values.
*Glyph
{
  x = 0;
  y = 0;
  visible = true;

  Glyph
  {
    width = parent.width;
    height = parent.height;
  }
}
  Advanced Example
All objects are sub-classes of Glyph, and so take on its properties as defined in the first few lines. Hence, unless otherwise specified, width = parent.width; etc..
*Glyph
{
  x = 0; y = 0;
  visible = true;
  Glyph { width = parent.width; height = parent.height; }
}
*WindowFrame
{
  properties = "border : EdgeBitmap,
                caption : Mouseable";

  combine_shape = false;
  combine_child_shapes = true;
  shaped = true;

  caption
  {
    properties = "background : PatternBitmap,
                  title : Label,
		  button : PushButton";

    combine_shape = true;
    combine_child_region = true;
    double_buffer = true;

    background.filename = parent.parent.active ? "caption_background_active.png"
      : "caption_background_inactive.png";

    button
    {
      properties = "image : Bitmap";

      x = parent.width - width;
      width = image.desired_width;
      image.filename = parent.armed ? "caption_button_armed.bmp"
        : "caption_button_normal.bmp";
    }
  }
  border
  {
    combine_shape = true;
    filename = parent.parent.active ? "border_active.bmp"
      : "border_inactive.bmp";
    left_edge = parent.client.x;
    right_edge = left_edge;
    top_edge = left_edge;
    bottom_edge = left_edge;
  }
}

Chromumll v1.0 Documentation Reference - Classes contents   |    glossary   |    chroma   |    classes
Please address any questions, comments, queries or concerns to bugs@thematic.com, subject=Documentation

Copyright(c) 1999, Thematic Software