Set a member of a style
int PtSetStyleMember( PtWidgetClassStyle_t *style, int manifest, void *value );
ph
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:
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.
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.
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).
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.
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.
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.
PtSetStyleMember (neon_style, Pt_STYLE_DRAW, neon_draw); PtSetStyleMember (neon_style, Pt_STYLE_SIZING, neon_sizing);
Photon
Safety: | |
---|---|
Interrupt handler | No |
Signal handler | No |
Thread | No |
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