Layout and geometry management for all container widgets
PtWidget → PtBasic → PtContainer
Immediate subclasses:
For more information, see the diagram of the widget hierarchy.
<photon/PtContainer.h>
The PtContainer superclass provides layout and geometry management for all container widgets. It also redirects certain events—such as button presses, releases, repeats, and keys—to the child that has focus.
Resource | C type | Pt type | Default |
---|---|---|---|
Pt_ARG_CONTAINER_FLAGS | long | Flag | Pt_ENABLE_CUA | Pt_ENABLE_CUA_ARROWS |
Pt_ARG_CURSOR_OVERRIDE | int | Boolean | Pt_FALSE |
Pt_ARG_FILL_LAYOUT_INFO | PtFillLayoutInfo_t * | Struct | NULL |
Pt_ARG_GRID_LAYOUT_INFO | PtGridLayoutInfo_t * | Struct | NULL |
Pt_ARG_LAYOUT | PtLayoutDefinition_t * | Struct | NULL |
Pt_ARG_LAYOUT_INFO | void * | Struct | NULL |
Pt_ARG_LAYOUT_TYPE | int | Scalar | NULL |
Pt_ARG_ROW_LAYOUT_INFO | PtRowLayoutInfo_t * | Struct | NULL |
Pt_ARG_TITLE | char * | String | NULL |
Pt_ARG_TITLE_FONT | char * | String | "TextFont09" |
Pt_CB_BALLOONS | PtBalloonCallback_t * | Link | NULL |
Pt_CB_CHILD_ADDED_REMOVED | PtCallback_t * | Link | NULL |
Pt_CB_CHILD_GETTING_FOCUS | PtCallback_t * | Link | NULL |
Pt_CB_CHILD_LOSING_FOCUS | PtCallback_t * | Link | NULL |
Pt_CB_LAYOUT | PtCallback_t * | Link | NULL |
Pt_CB_RESIZE | PtCallback_t * | Link | NULL |
C type | Pt type | Default |
---|---|---|
long | Flag | Pt_ENABLE_CUA | Pt_ENABLE_CUA_ARROWS |
Flags that control the look and behavior of the container:
C type | Pt type | Default |
---|---|---|
int | Boolean | Pt_FALSE |
Let the container's cursor override its children's cursors.
C type | Pt type | Default |
---|---|---|
PtLayoutDefinition_t * | Struct | NULL |
A generic resource that lets you set the active layout for the container, and the layout info structure at the same time. This is an alternative to setting Pt_ARG_LAYOUT_TYPE and Pt_ARG_*_LAYOUT_INFO separately.
This resource can be one of:
When you set this resource using PtSetResource() or PtSetArg(), you can optionally also set the Pt_ARG_*_LAYOUT_INFO resource for the appropriate layout type using the len argument. To do this, pass a pointer to layout information structure appropriate to the layout type as len. It can be one of:
For more information about using layouts and layout resources, see Using Layouts in Geometry Management in the Photon Programmer's Guide.
C type | Pt type | Default |
---|---|---|
void * | Struct | NULL |
A generic resource that lets you set the information structure for layouts. When you set this resource, you must set the len argument of PtSetResource() or PtSetArg() to the layout type, which is one of:
For more information about using layouts and layout resources, see Using Layouts in Geometry Management in the Photon Programmer's Guide.
C type | Pt type | Default |
---|---|---|
int | Scalar | NULL |
An alternative way of setting or getting the active layout and layout information.
When you set this resource, the value argument of PtSetResource() or PtSetArg() can be one of:
You can optionally also set the information structure with this resource. To do this, set the len argument of PtSetResource() or PtSetArg() to the layout information structure, Pt*LayoutInfo_t. If you set len to NULL, the information structure for the current layout is set. In this case, make sure that the layout information structure you set matches the current layout type, or your application may crash.
For more information about using layouts and layout resources, see Using Layouts in Geometry Management in the Photon Programmer's Guide.
C type | Pt type | Default |
---|---|---|
PtFillLayoutInfo_t | Struct | NULL |
The information structure for the PtFillLayout layout type. You can set this resource directly, or via Pt_ARG_LAYOUT_INFO.
The PtFillLayoutInfo_t contains at least these members:
Direction of layout:
Distance between children, in pixels
There is no layout data for children for this layout type.
For more information about using layouts and layout resources, see Using Layouts in Geometry Management in the Photon Programmer's Guide.
C type | Pt type | Default |
---|---|---|
PtRowLayoutInfo_t | Struct | NULL |
The information structure for the PtRowLayout layout type. You can set this resource directly, or via Pt_ARG_LAYOUT_INFO.
PtRowLayoutInfo_t contains at least these members:
Direction of layout:
A combination of the following flags:
You can use PtRowLayoutInfoDflts to initialize your copy of PtRowLayoutInfo_t. It has the following values: type = Pt_LAYOUT_HORIZONTAL flags = Pt_ROW_PACK | Pt_ROW_WRAP margin.ul.x = margin.ul.y = margin.lr.x = margin.lr.y = 3 h_spacing = v_spacing = 3 |
For more information about using layouts and layout resources, see Using Layouts in Geometry Management in the Photon Programmer's Guide.
C type | Pt type | Default |
---|---|---|
PtGridLayoutInfo_t | Struct | NULL |
The information structure for the PtGridLayout layout type. You can set this resource directly, or via Pt_ARG_LAYOUT_INFO.
PtGridLayoutInfo_t contains at least these members:
You can use PtGridLayoutInfoDflts to initialize your copy of PtGridLayoutInfo_t. It has the following values:
|
For more information about using layouts and layout resources, see Using Layouts in Geometry Management in the Photon Programmer's Guide.
C type | Pt type | Default |
---|---|---|
char * | String | NULL |
The title to be displayed if Pt_SHOW_TITLE is set in Pt_ARG_CONTAINER_FLAGS.
C type | Pt type | Default |
---|---|---|
char * | String | "TextFont09" |
The font to use for the label's text string; see PgSetFont() in the Photon Library Reference.
C type | Pt type | Default |
---|---|---|
PtBalloonCallback_t * | Link | NULL |
A list of PtBalloonCallback_t structures that define 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 (unlike other callbacks) return nothing. |
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 Pt_CB_RAW callback (see PtWidget) that's sensitive to Ph_EV_BOUNDARY events, 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 |
---|---|---|
PtCallback_t * | Link | NULL |
A list of PtCallback_t structures that define the callbacks that are invoked when a widget is added or removed from a container:
These callbacks are invoked only if:
|
Each callback is passed a PtCallbackInfo_t structure that contains at least the following:
C type | Pt type | Default |
---|---|---|
PtCallback_t * | Link | NULL |
A list of PtCallback_t structures that define the callbacks invoked when a child widget (or child of a child and so on) is getting focus. You can call PtIsFocused() to find the current focus state of any widget.
Each callback is passed a PtCallbackInfo_t structure that contains at least the following members:
These callbacks should return:
Or:
C type | Pt type | Default |
---|---|---|
PtCallback_t * | Link | NULL |
A list of PtCallback_t structures that define the callbacks invoked when a child widget (or child of a child and so on) is losing focus. You can call PtIsFocused() to find the current focus state of any widget.
Each callback is passed a PtCallbackInfo_t structure that contains at least the following members:
These callbacks should return:
Or:
C type | Pt type | Default |
---|---|---|
PtCallback_t * | Link | NULL |
A list of PtCallback_t structures that define the callbacks invoked when the widget is about to start laying out children, and when the widget is finished laying out children.
Each callback is passed a PtCallbackInfo_t structure that contains at least the following members:
These callbacks should return Pt_CONTINUE.
C type | Pt type | Default |
---|---|---|
PtCallback_t * | Link | NULL |
A list of PtCallback_t structures that define the 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.