Gadgets Attachments
The gadget holder provides an attachment model that manages the geometry of the gadgets when the holder is resized. This attachment model is defined by the
IlvGraphicHolder interface.
You can get a pointer to the IlvGraphicHolder interface using the getHolder member function.
To attach a gadget to its gadget holder, you have to define guides.
This section covers the following topics:
Introducing Guides and Sections
Guides split gadget holders into several sections, either horizontally or vertically:
Guides are not numbered, whereas the sections they delimit are. When a new guide is added, sections are renumbered to include the resulting new sections.
By default, there are no guides, except those alongside the window borders.
When the holder is resized, each of its sections are resized according to their weight. The weight of a section is the portion of the window that is allocated to it (delimited by the guide) relative to other sections, when the window is resized. The following formula is applied to each section when the window is resized:
where Delta equals the new size of the window minus its initial size.
It is possible to manipulate guides using the
IlvGraphicHolder member functions listed below:
addGuide removeGuide getGuideCardinal getGuidePosition getGuideSize getGuideWeight getGuideLimit Attaching a Gadget to Guides
Once guides have been defined, it is possible to attach a gadget to them using the member function
attach:
holder->attach(object);
This code attaches gadgets to the guides as shown in the following diagram:
In this example, we use the default guides located along the window borders. However, you can use the last three parameters of the attach member function to specify other guides.
holder->attach(obj1, IlvHorizontal, 0, 1, 0, 1, 1);
holder->attach(obj2, IlvHorizontal, 0, 1, 0, 1, 2);
This will produce the following result:
Setting the Weight of a Gadget
The third, fourth, and fifth parameters of the attach member function define the weight before the gadget, the gadget weight, and the weight after the gadget, respectively. These weights are used in the same manner as the guides weight, using the same formula. For example, the following call:
holder->attach(object, IlvHorizontal, 1, 0, 0);
will result in the following attachments:
Version 6.3
Copyright © 2018, Rogue Wave Software, Inc. All Rights Reserved.