Centralize computations of border and padding into StThemeNode
Rather than repeating the computation of borders in many different widget subclasses, add helper functions: st_theme_node_adjust_for_height() st_theme_node_adjust_preferred_width() st_theme_node_adjust_for_width() st_theme_node_adjust_preferred_height() st_theme_node_get_content_box() That are used in get_preferred_width()/get_preferred_height() and allocate() methods to consistently apply the necessary adjustments. This allows removing the StPadding type. Queueing a relayout when the borders/padding change is moved from st_widget_real_style_changed() to the invoking code to allow access to the old StThemeNode for comparison. (Should this be added as a parameter to the signal?) Borders are included in the geometry adjustments, but borders are not yet drawn. https://bugzilla.gnome.org/show_bug.cgi?id=595993
This commit is contained in:
@@ -131,6 +131,26 @@ const PangoFontDescription *st_theme_node_get_font (StThemeNode *node);
|
||||
*/
|
||||
StThemeImage *st_theme_node_get_background_theme_image (StThemeNode *node);
|
||||
|
||||
/* Helpers for get_preferred_width()/get_preferred_height() ClutterActor vfuncs */
|
||||
void st_theme_node_adjust_for_height (StThemeNode *node,
|
||||
float *for_height);
|
||||
void st_theme_node_adjust_preferred_width (StThemeNode *node,
|
||||
float *min_width_p,
|
||||
float *natural_width_p);
|
||||
void st_theme_node_adjust_for_width (StThemeNode *node,
|
||||
float *for_width);
|
||||
void st_theme_node_adjust_preferred_height (StThemeNode *node,
|
||||
float *min_height_p,
|
||||
float *natural_height_p);
|
||||
|
||||
/* Helper for allocate() ClutterActor vfunc */
|
||||
void st_theme_node_get_content_box (StThemeNode *node,
|
||||
const ClutterActorBox *actor_box,
|
||||
ClutterActorBox *content_box);
|
||||
|
||||
gboolean st_theme_node_geometry_equal (StThemeNode *node,
|
||||
StThemeNode *other);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __ST_THEME_NODE_H__ */
|
||||
|
Reference in New Issue
Block a user