GEOS SDK TechDocs
|
|
2.1 General Geometry Rules
|
2.3 Justifying and Centering Children
HINT_ORIENT_CHILDREN_HORIZONTALLY, HINT_ORIENT_CHILDREN_VERTICALLY, HINT_ORIENT_CHILDREN_ALONG_LARGER_DIMENSION, HINT_SAME_ORIENTATION_AS_PARENT
The two hints
HINT_ORIENT_CHILDREN_HORIZONTALLY
and
HINT_ORIENT_CHILDREN_VERTICALLY
, when used in a composite object, determine the orientation of the composite's children. A composite object can orient its children either horizontally or vertically. The geometry manager will determine the combined size of the children and any margins or spacing set up (none by default) and will size the composite to the minimum required by its children.
Children oriented horizontally will typically be top-justified, and children oriented vertically will be left-justified. (This is default behavior changeable either with the use of hints or by the specific UI.) The vertical composite will size to the width of the widest child; the horizontal composite will size to the height of the tallest child.
Code Display 12-1 Orienting a Composite
/* Composite oriented horizontally */
@object GenInteractionClass MyInteraction = {
GI_comp = @ApplyTrigger, @ResetTrigger, @CancelTrigger;
HINT_ORIENT_CHILDREN_HORIZONTALLY;
}
/* Composite oriented vertically */
@object GenInteractionClass MyOtherInteraction = {
GI_comp = @ApplyTrigger, @ResetTrigger, @CancelTrigger;
HINT_ORIENT_CHILDREN_VERTICALLY;
}
A large example of a complex dialog box is shown in the figure below. This dialog box uses nested GenInteraction objects to achieve a complex grouping of children. Using the many justification, spacing, and orientation hints described throughout the chapter, you can change and fine-tune the appearance of the dialog box. The code that implements this dialog box is shown in A Complex Dialog Box
.
Two other hints may be useful for arranging children, especially in toolboxes. These two hints are not shown in the examples, though they are used prominently with tool groups.
HINT_SAME_ORIENTATION_AS_PARENT
is used by one windowed object (GenInteraction) when it should orient its children in the same way its parent does. This, too, is useful for toolboxes because you can set an orientation in the toolbox, then set
HINT_SAME_ORIENTATION_AS_PARENT
in the tool group.
HINT_ORIENT_CHILDREN_ALONG_LARGER_DIMENSION
allows you to orient a composite's children along the screen's larger dimension. The hint will work like
HINT_ORIENT_CHILDREN_HORIZONTALLY
if the screen is wider than it is tall; it will work like
HINT_ORIENT_CHILDREN_VERTICALLY
if the screen is taller than it is wide.
Code Display 12-2 A Complex Dialog Box
/* This code display shows the basic Goc code that will get the configuration * shown in the above figure. */
/* The topmost interaction. It groups the two large interactions vertically. */
@object GenInteractionClass TopInteraction = {
GI_comp = @ParaInteraction, @ReplyInteraction;
HINT_ORIENT_CHILDREN_VERTICALLY;
}
/* The top of the two large interactions. It groups the three smaller interactions
* on the top, horizontally. */
@object GenInteractionClass ParaInteraction = {
GI_comp = @FontInteraction, @JustInteraction, @StyleInteraction;
HINT_ORIENT_CHILDREN_HORIZONTALLY;
}
/* The interaction containing the Apply, Reset, and Cancel triggers. The
* triggers are oriented horizontally. */
@object GenInteractionClass ReplyInteraction = {
GI_comp = @ApplyTrigger, @ResetTrigger, @CancelTrigger;
HINT_ORIENT_CHILDREN_HORIZONTALLY;
}
/* The three vertically-oriented interactions at the top are similar. Each
* contains several triggers. All three are defined below. */
@object GenInteractionClass FontInteraction = {
GI_comp = @RomanTrigger, @SansTrigger, @MonoTrigger;
HINT_ORIENT_CHILDREN_VERTICALLY;
}
@object GenInteractionClass JustInteraction = {
GI_comp = @LeftTrigger, @RightTrigger, @CenterTrigger, @FullTrigger;
HINT_ORIENT_CHILDREN_VERTICALLY;
}
@object GenInteractionClass StyleInteraction = {
GI_comp = @PlainTrigger, @BoldTrigger, @SuperTrigger, @SubTrigger;
HINT_ORIENT_CHILDREN_VERTICALLY;
}
/* Triggers. All the triggers are essentially the same. Each is named as it * appears in the GI_comp fields above, and each has the corresponding * GI_visMoniker field. The RomanTrigger object is shown as an example. */
@object GenTriggerClass RomanTrigger = {
GI_visMoniker = "Roman";
}
GEOS SDK TechDocs
|
|
2.1 General Geometry Rules
|
2.3 Justifying and Centering Children