PtGetStyleMember()

Get a member of a style

Synopsis:

void *PtGetStyleMember(
         PtWidgetClassStyle_t *style,
         int manifest );

Library:

ph

Description:

This function retrieves the value of the given style associated with the given manifest.

For a description of the possible manifests, see PtSetStyleMember().

Returns:

The provided manifest determines the type of the pointer returned:

Pt_STYLE_DRAW
A pointer to the style's draw function:
void (*draw_f)( PtWidget_t *widget,
                PhTile_t const *damage );
  
Pt_STYLE_EXTENT or Pt_STYLE_SIZING
A pointer to the style's extent function:
void (*sizing_f)( PtWidget_t *widget );
  
Pt_STYLE_ACTIVATE
A pointer to the style's activate function:
void (*activate_f)( PtWidget_t *widget,
                    PtWidgetClassStyle_t *old_style );
  

Note: This isn't the same as the widget's Pt_CB_ACTIVATE callback.

Pt_STYLE_CALC_BORDER
A pointer to the function that calculates the style's borders:
void (*calc_border_f)( PtWidget_t const *widget,
                       PhRect_t *border );
  

The style's borders are the distances from the widget's extent (i.e. the widget's outermost borders) to the widget's canvas (i.e. the content area of the widget). For example, if the style's border.ul.x is 5, there are five pixels between the widget's left extent and the left side of the widget's canvas. This space is typically used to render outlines, bevels, and so on.

Pt_STYLE_CALC_OPAQUE
A pointer to the function that calculates the style's opacity:
void (*calc_opaque_f)( PtWidget_t *widget );
  
Pt_STYLE_DEACTIVATE
A pointer to the style's deactivation function:
void (*deactivate_f)( PtWidget_t *widget,
                      PtWidgetClassStyle_t *new_style );
  
Pt_STYLE_NAME
A pointer to a string.
Pt_STYLE_DATA
A pointer to a block of data associated with the style.

PtGetStyleMember() returns NULL if the member specified isn't set or the manifest is invalid.

Examples:

void display_style_name( PtWidgetClassStyle_t *style )
{
  char *name = PtGetStyleMember( style, Pt_STYLE_NAME );

  printf( "Style: %s\n", name ? name : "Default");
}

Classification:

Photon

Safety:
Interrupt handler No
Signal handler No
Thread No

See also:

PtAddClassStyle(), PtCreateClassStyle(), PtDupClassStyle(), PtFindClassStyle(), PtGetWidgetStyle(), PtSetClassStyleMethods(), PtSetStyleMember(), 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