GEOS SDK TechDocs
|
|
3 Using VisCompClass
|
3.2 Managing Graphic Windows
MSG_VIS_COMP_GET_CHILD_SPACING, MSG_VIS_COMP_GET_MINIMUM_SIZE, MSG_VIS_COMP_GET_MARGINS, MSG_VIS_COMP_GET_WRAP_COUNT
A special feature of
VisCompClass
, and one that can be used in many ways, is its ability to automatically manage its children. By setting various flags in the composite's instance fields, you can have it control its children's sizing and position without additional code in your application.
Most of the flags you can set in
VCI_geoAttrs
and
VCI_geoDimensionAttrs
are explained fully in VisCompClass Instance Data
. You should especially be aware that if you do not want to use the geometry management capabilities of
VisCompClass
, you should set VCGA_CUSTOM_MANAGE_CHILDREN in
VCI_geoAttrs
.
In addition to the messages provided in
VisClass
for geometry management,
VisCompClass
has four that return information about its current geometry. These are necessary because composites may be children of other composites, and therefore they may be managed. These messages are detailed below.
Most of the issues of geometry management are discussed in the VisClass chapter.
word DWORD_CHILD_SPACING(val);
SpacingAsDWord val;
This macro extracts the child spacing from the given
SpacingAsDWord
value. Use it with
MSG_VIS_COMP_GET_CHILD_SPACING
.
word DWORD_WRAP_SPACING(val);
SpacingAsDWord val;
This macro extracts the wrap spacing from the given
SpacingAsDWord
value. Use it with
MSG_VIS_COMP_GET_CHILD_SPACING
.
SpacingAsDWord MAKE_SPACING_DWORD(child, wrap);
word child;
word wrap;
This macro creates a
SpacingAsDWord
dword from the two given arguments. The
child
argument is the child spacing, and the
wrap
argument is the wrap spacing. Use this macro in your handler (if any) for the message
MSG_VIS_COMP_GET_CHILD_SPACING
.
SpacingAsDWord MSG_VIS_COMP_GET_CHILD_SPACING();
This message returns the child spacing used by the composite. The high word of the return value is the spacing between lines of wrapped children; the low word is the horizontal spacing between children.
Source: Unrestricted.
Destination: Any visible composite object--typically sent by a composite to itself during geometry calculations.
Parameters: None.
Return: A dword containing the child spacing used by the composite. The dword contains two values: The child spacing--the amount of spacing placed between the composite's children--can be extracted from the return value with the macro
DWORD_CHILD_SPACING
. The wrap spacing--the amount of space placed between lines of wrapped children--can be extracted from the return value with the macro
DWORD_WRAP_SPACING
.
Interception: If a composite wants special child or wrap spacing other than the default, it should subclass this message and return the desired values. There is no need to call the superclass in the method.
Tips: In your handler, you can use the macro
MAKE_SPACING_DWORD
to form the return value from the two spacing values.
SizeAsDWord MSG_VIS_COMP_GET_MINIMUM_SIZE();
This message returns the minimum size of the composite. It is used by the geometry manager if the composite has VCGDA_HAS_MINIMUM_SIZE set. This message does not invalidate or update the object's geometry.
Source: Unrestricted.
Destination: Any visible composite object--typically sent by a composite to itself during geometry calculations.
Parameters: None.
Return: A dword containing the minimum size of the composite. The high word is the width, and the low word is the height. Use the macros
DWORD_WIDTH
and
DWORD_HEIGHT
to extract the individual values from the
SizeAsDWord
structure.
Interception: Any composite that wants a minimum size should subclass this message and return its desired size. There is no need to call the superclass in your handler.
Tips: In your handler, use the macro
MAKE_SIZE_DWORD
to create the
SizeAsDWord
return value from the width and height. This macro has the same format as
MAKE_SPACING_DWORD
.
void MSG_VIS_COMP_GET_MARGINS(
Rectangle *retValue);
This message returns the margins the composite should use when recalculating its child spacing. If you want a special left, top, right, or bottom margin around the composite's children, intercept this message and return the margin(s) in the appropriate field(s) of the
Rectangle
structure.
Source: Unrestricted.
Destination: Any visible composite object--typically sent by a composite to itself during geometry calculations.
Parameters:
retValue
A pointer to an empty
Rectangle
structure that will be filled with the composite's desired margins.
Return: The pointer to the filled Rectangle structure is preserved. The structure contains the four margins desired by the object outside of its bounds (e.g. if
retValue->R_top
is 100 upon return, the composite is requesting 100 points of extra "margin" spacing below its top bound before its children are placed).
Interception: Any composite that wants extra margin space added to its bounds when geometry is calculated should subclass this message and return its desired margins. There is no need to call the superclass in your handler.
word MSG_VIS_COMP_GET_WRAP_COUNT();
This message returns the number of children to be counted before wrapping if the composite has VCGA_WRAP_AFTER_CHILD_COUNT set.
Source: Unrestricted.
Destination: Any visible composite object--typically sent by a composite to itself during geometry calculations.
Parameters: None.
Return: The number of children that will be allowed before the composite wraps additional children to a new line.
Interception: Any composite that wants to wrap after a certain number of children should subclass this message and return the proper number of children. There is no need to call the superclass in your handler .
GEOS SDK TechDocs
|
|
3 Using VisCompClass
|
3.2 Managing Graphic Windows