Caution: This version of this document is no longer maintained. For the latest documentation, see http://www.qnx.com/developers/docs.

PtSetStyleMember()

Set a member of a style

Synopsis:

int PtSetStyleMember( PtWidgetClassStyle_t *style,
                      int manifest,
                      void *value );

Library:

ph

Description:

This function sets the member of the given style associated with the given manifest to the provided value.

The type of value is dictated by the manifest as follows:

Pt_STYLE_DRAW
The address of a function of the following form:
void (*draw_f)( PtWidget_t *widget,
                PhTile_t const *damage );
  

This function is called whenever any widget that's using this style needs to draw. The widget argument is a pointer to the widget currently rendering, and the damage argument is a list of tiles (see PhTile_t) that describes the damaged areas (the areas the widget must redraw/repair). The damage list is relative to the window.

Pt_STYLE_EXTENT or Pt_STYLE_SIZING
The address of a function of the following form:
void (*sizing_f)( PtWidget_t *widget );
  

This function is called whenever a widget that's using this style is moved, resized, or modified in some fashion that may require the widget to move or resize (change in widget data). This function is responsible for setting the widget's dimension to the appropriate values.

Pt_STYLE_ACTIVATE
The address of a function of the following form:
void (*activate_f)( PtWidget_t *widget,
                    PtWidgetClassStyle_t *old_style );
  

This function is called whenever a widget is created that defaults to this style, and whenever a widget's style is changed from some other style to this one. This function is the place to put manipulation of a widget's control surfaces, the addition of callbacks, or the setting of resources (to override widget's defaults).

Pt_STYLE_CALC_BORDER
The address of a function of the following form:
void (*calc_border_f)( PtWidget_t const *widget,
                       PhRect_t *border );
  

This function is responsible for reporting how much space is required to render the widget's edge decorations and margins. The border rectangle represents the distances to be reserved on each edge for this purpose. These amounts are subtracted from the widget's extent to determine the widget's canvas. For example, a border of {5,5,5,5} has a border of 5 pixels all the way around.

Pt_STYLE_CALC_OPAQUE
The address of a function of the following form:
void (*calc_opaque_f)( PtWidget_t *widget );
  

This function is responsible for calculating the list of tiles that represents the opaque areas of a widget. This list is used to determine what needs to be damaged below this widget when it's modified.

Pt_STYLE_DEACTIVATE
The address of a function of the following form:
void (*deactivate_f)( PtWidget_t *widget,
                      PtWidgetClassStyle_t *new_style );
  

This method is called whenever a widget using this style is either being destroyed or is switching to a different style. If switching to a different style, the style being switched to is defined by new_style. If new_style isn't NULL, this function must remove any callbacks that were added in the Pt_STYLE_ACTIVATE method.

Pt_STYLE_NAME
A char *. This is the name of the style.
Pt_STYLE_DATA
A pointer to an arbitrary data block for the style's use.

Returns:

0
Success.
-1
The manifest wasn't valid.

Examples:

PtSetStyleMember (neon_style, Pt_STYLE_DRAW, neon_draw);
PtSetStyleMember (neon_style, Pt_STYLE_SIZING, neon_sizing);

Classification:

Photon

Safety:
Interrupt handler No
Signal handler No
Thread No

See also:

PtAddClassStyle(), PtCreateClassStyle(), PtDupClassStyle(), PtFindClassStyle(), PtGetStyleMember(), PtGetWidgetStyle(), PtSetClassStyleMethods(), PtSetStyleMembers(), PtSetWidgetStyle()

Pt_ARG_STYLE resource of PtBasic in the Photon Widget Reference

Widget Styles in the Managing Widgets in Application Code chapter of the Photon Programmer's Guide