Anchoring, layout, and geometry management for all container widgets
PtWidget --> PtBasic --> PtContainer
For more information, see the diagram of the widget hierarchy.
None - not normally instantiated.
<photon/PtContainer.h>
The PtContainer superclass provides anchoring, layout, and geometry management for all container widgets. It also redirects certain events-such as button press, release, repeat, and keys-to the child that has focus.
Resource | C type | Pt type | Default |
---|---|---|---|
Pt_ARG_ANCHOR_FLAGS | unsigned | Flag | 0 |
Pt_ARG_ANCHOR_OFFSETS | PhRect_t | Struct | 0, 0, 0, 0 |
Pt_ARG_CONTAINER_FLAGS | long | Flag | Pt_ENABLE_CUA |
Pt_CB_BALLOONS | PtBalloonCallback_t * | Link | NULL |
Pt_CB_FILTER | PtRawCallback_t * | Link | NULL |
Pt_CB_RESIZE | PtCallback_t * | Link | NULL |
C type | Pt type | Default |
---|---|---|
unsigned | Flag | 0 |
This resource specifies how the container is anchored to its parent. The possible values are:
Anchors override any Pt_ARG_RESIZE_FLAGS settings that conflict with Pt_ARG_ANCHOR_OFFSETS or Pt_ARG_ANCHOR_FLAGS settings. If there is no conflict, the Pt_ARG_RESIZE_FLAGS settings will be honored. |
C type | Pt type | Default |
---|---|---|
PhRect_t | Struct | 0, 0, 0, 0 |
The four values in this structure determine the anchor offsets of each of the container's sides. (An anchor offset is the distance between the anchoring side of the parent and corresponding side of the child.) Depending on the anchor flags you specify, the offsets will be either absolute or relative.
The Pt_ARG_ANCHOR_OFFSETS resource isn't displayed in PhAB because PhAB sets it automatically. |
If a side is anchored, its anchor offsets, if explicitly specified, will override the Pt_ARG_AREA and Pt_ARG_DIM resources.
Only offsets that have a corresponding bit set in the Pt_ARG_ANCHOR_FLAGS resource are applied. For example, let's say you have a Pt_ARG_ANCHOR_OFFSETS resource of (5,10,20,25) with absolute anchoring and a Pt_ARG_ANCHOR_FLAGS resource of Pt_LEFT_ANCHORED_LEFT | Pt_RIGHT_ANCHORED_RIGHT | Pt_TOP_ANCHORED_TOP | Pt_BOTTOM_ANCHORED_BOTTOM. In that case, the pane's extent will be:
This will remain true even as the parent is resized.
Anchors override any Pt_ARG_RESIZE_FLAGS settings that conflict with Pt_ARG_ANCHOR_OFFSETS or Pt_ARG_ANCHOR_FLAGS settings. If there is no conflict, the Pt_ARG_RESIZE_FLAGS settings will be honored. |
C type | Pt type | Default |
---|---|---|
long | Flag | Pt_ENABLE_CUA |
This resource controls the look and behavior of the container. Valid bits include:
C type | Pt type | Default |
---|---|---|
PtBalloonCallback_t * | Link | NULL |
A list of balloon callbacks that the container invokes if the pointer remains motionless for 1.25 seconds over the widget specified in the callback structure.
Each callback is passed a PtCallbackInfo_t structure that contains at least the following members:
These callbacks should return Pt_CONTINUE.
By default, this callback list invokes the indicated widget's inflate function, which is specified by the following resources:
When a container has balloons registered, it becomes sensitive to Ph_EV_BOUNDARY events. When the container sees an enter event, it enables the balloon mechanism for that container. When a boundary event with a subtype of Ph_EV_PTR_STEADY is received and it's over a widget that has registered a balloon, the balloons are flagged as active and the widget's inflate function is called.
While the balloons are active, Ph_EV_PTR_MOTION_NOBUTTON events are used to determine when the cursor leaves a widget with an inflated balloon (its inflate function is called with a Pt_POP_BALLOON subtype). While the balloons are active, any widget that has a balloon that intersects with a Ph_EV_PTR_MOTION_NOBUTTON event has its balloon inflated.
Key events and pointer button events deactivate the balloons. Another Ph_EV_PTR_STEADY event over a widget with a balloon is required to reactivate the balloons.
If your application has a widget that obscures the container, the
widget must have a region that consumes Ph_EV_BOUNDARY
events to prevent the balloon mechanism for the container
from becoming enabled and activated.
This can be done by giving the overlapping widget a raw callback that's sensitive to Ph_EV_BOUNDARY, or by giving the overlapping widget a cursor (which automatically sets Ph_FORCE_BOUNDARY in the flags for the widget's region, which means it's opaque to boundary events. |
C type | Pt type | Default |
---|---|---|
PtRawCallback_t * | Link | NULL |
A list of raw callbacks invoked when an event that matches the provided event mask is to be passed to a child of the container.
These callbacks are invoked before the event is passed to the child. Contrast this resource with the Pt_CB_RAW resource defined for PtWidget. |
Each callback is passed a PtCallbackInfo_t structure that contains at least the following members:
These callbacks should return:
Or
Here's some sample code that adds a Pt_CB_FILTER callback to a widget:
PtRawCallback_t cb; PtArg_t arg; cb.event_mask = Ph_EV_KEY; cb.event_f = my_callback_function; cb.data = whatever; PtSetArg( &arg, Pt_CB_FILTER, &cb, 1 ); PtSetResources( widget, 1, &arg );
C type | Pt type | Default |
---|---|---|
PtCallback_t * | Link | NULL |
A list of callbacks that the container invokes when its size changes. Each callback is passed a PtCallbackInfo_t structure that contains at least the following members:
These callbacks should return Pt_CONTINUE.
If the widget modifies an inherited resource, the "Default override" column indicates the new value. This modification affects any subclasses of the widget.