/usr/include/hippo-canvas-1/hippo/hippo-canvas-box.h is in libhippocanvas-dev 0.3.1-1.2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 | /* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*- */
#ifndef __HIPPO_CANVAS_BOX_H__
#define __HIPPO_CANVAS_BOX_H__
#include <hippo/hippo-canvas-item.h>
#include <hippo/hippo-canvas-container.h>
#include <hippo/hippo-canvas-style.h>
#include <hippo/hippo-canvas-theme.h>
G_BEGIN_DECLS
typedef enum /*< flags >*/
{
HIPPO_PACK_EXPAND = 1, /**< This is equivalent to both EXPAND and FILL for GtkBox,
* the way you'd get FILL=false is to set the alignment
* on the child item
*/
HIPPO_PACK_END = 2,
HIPPO_PACK_FIXED = 4, /**< Like position: absolute or GtkFixed */
HIPPO_PACK_IF_FITS = 8, /**< Can hide this child to make space if allocation is too small
* for the child's width request.
* Include child width in box's natural width but not box's request.
* (doesn't work in vertical boxes for now)
*/
/* Floated children: only works with vertical box, and cannot be used in combination
* with HIPPO_PACK_EXPAND or HIPPO_PACK_END
*/
HIPPO_PACK_FLOAT_LEFT = 16, /* Float to the left */
HIPPO_PACK_FLOAT_RIGHT = 32, /* Float to the right */
HIPPO_PACK_CLEAR_LEFT = 64, /* Pack below left-floated children */
HIPPO_PACK_CLEAR_RIGHT = 128, /* Pack below right-floated children */
HIPPO_PACK_CLEAR_BOTH = 192 /* Pack below left-and right floated children */
} HippoPackFlags;
typedef int (* HippoCanvasCompareChildFunc) (HippoCanvasItem *child_a,
HippoCanvasItem *child_b,
void *data);
typedef void (* HippoCanvasForeachChildFunc) (HippoCanvasItem *child,
void *data);
typedef struct _HippoCanvasBox HippoCanvasBox;
typedef struct _HippoCanvasBoxClass HippoCanvasBoxClass;
typedef struct _HippoCanvasBoxChild HippoCanvasBoxChild;
/* Declare here to avoid circular header file dependency */
typedef struct _HippoCanvasLayout HippoCanvasLayout;
#define HIPPO_TYPE_CANVAS_BOX (hippo_canvas_box_get_type ())
#define HIPPO_CANVAS_BOX(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), HIPPO_TYPE_CANVAS_BOX, HippoCanvasBox))
#define HIPPO_CANVAS_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), HIPPO_TYPE_CANVAS_BOX, HippoCanvasBoxClass))
#define HIPPO_IS_CANVAS_BOX(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), HIPPO_TYPE_CANVAS_BOX))
#define HIPPO_IS_CANVAS_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), HIPPO_TYPE_CANVAS_BOX))
#define HIPPO_CANVAS_BOX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), HIPPO_TYPE_CANVAS_BOX, HippoCanvasBoxClass))
struct _HippoCanvasBox {
GObject base;
HippoCanvasContainer *parent;
HippoCanvasContext *context;
HippoCanvasStyle *style; /* may be NULL if no relevant props set */
HippoCanvasTheme *theme;
GSList *children;
char *element_id;
char *element_class;
HippoCanvasLayout *layout;
char *tooltip;
/* If set, we debug-spew about size allocation prefixed with this name */
char *debug_name;
/* Cache of last requested sizes of content. This largely duplicates the caching
* in HippoCanvasBoxChild; removing the caching in HippoCanvasBoxChild would
* save 20 bytes per item at the expense of having to continually call into
* the child and have the child add back on the padding border */
int content_min_width; /* -1 if invalid */
int content_natural_width; /* always valid and >= 0 when min_width is valid */
int content_min_height; /* -1 if invalid */
int content_natural_height; /* always valid and >= 0 when min_height is valid */
int content_height_request_for_width; /* width the height_request is valid for */
int allocated_width;
int allocated_height;
/* these are -1 if unset, which means use natural size request */
int box_width;
int box_height;
PangoFontDescription *font_desc;
guint32 color_rgba;
guint32 background_color_rgba;
guint32 border_color_rgba;
/* padding is empty space around all children with the
* background color
*/
guint8 padding_top;
guint8 padding_bottom;
guint8 padding_left;
guint8 padding_right;
/* padding is empty space around the padding, with
* the border color
*/
guint8 border_top;
guint8 border_bottom;
guint8 border_left;
guint8 border_right;
guint8 spacing;
guint needs_width_request : 1;
guint needs_height_request : 1;
guint needs_allocate : 1;
guint orientation : 2; /* enum only has 2 values so it fits with extra */
guint x_align : 3; /* enum only has 4 values so it fits with extra */
guint y_align : 3; /* enum only has 4 values so it fits with extra */
guint clickable : 1; /* show a hand pointer and emit activated signal */
guint link_type : 2; /* enum only has 3 values so it fits with extra */
guint hovering : 1; /* the box or some child contains the pointer (have gotten enter without leave) */
guint color_set : 1;
guint background_color_set : 1;
guint border_color_set : 1;
guint border_top_set : 1;
guint border_bottom_set : 1;
guint border_left_set : 1;
guint border_right_set : 1;
guint padding_top_set : 1;
guint padding_bottom_set : 1;
guint padding_left_set : 1;
guint padding_right_set : 1;
};
struct _HippoCanvasBoxClass {
GObjectClass base_class;
void (* paint_background) (HippoCanvasBox *box,
cairo_t *cr,
GdkRegion *damaged_region);
void (* paint_children) (HippoCanvasBox *box,
cairo_t *cr,
GdkRegion *damaged_region);
void (* paint_below_children) (HippoCanvasBox *box,
cairo_t *cr,
GdkRegion *damaged_region);
void (* paint_above_children) (HippoCanvasBox *box,
cairo_t *cr,
GdkRegion *damaged_region);
void (* get_content_width_request) (HippoCanvasBox *box,
int *min_width_p,
int *natural_width_p);
void (* get_content_height_request) (HippoCanvasBox *box,
int for_width,
int *min_height_p,
int *natural_height_p);
void (* hovering_changed) (HippoCanvasBox *box,
gboolean hovering);
};
GType hippo_canvas_box_get_type (void) G_GNUC_CONST;
HippoCanvasItem* hippo_canvas_box_new (void);
void hippo_canvas_box_prepend (HippoCanvasBox *box,
HippoCanvasItem *child,
HippoPackFlags flags);
void hippo_canvas_box_append (HippoCanvasBox *box,
HippoCanvasItem *child,
HippoPackFlags flags);
void hippo_canvas_box_move (HippoCanvasBox *box,
HippoCanvasItem *child,
HippoGravity gravity,
int x,
int y);
void hippo_canvas_box_set_position (HippoCanvasBox *box,
HippoCanvasItem *child,
int x,
int y);
void hippo_canvas_box_get_position (HippoCanvasBox *box,
HippoCanvasItem *child,
int *x,
int *y);
void hippo_canvas_box_clear (HippoCanvasBox *box);
void hippo_canvas_box_remove (HippoCanvasBox *box,
HippoCanvasItem *child);
void hippo_canvas_box_remove_all (HippoCanvasBox *box);
GList* hippo_canvas_box_get_children (HippoCanvasBox *box);
gboolean hippo_canvas_box_is_empty (HippoCanvasBox *box);
void hippo_canvas_box_foreach (HippoCanvasBox *box,
HippoCanvasForeachChildFunc func,
void *data);
void hippo_canvas_box_reverse (HippoCanvasBox *box);
void hippo_canvas_box_sort (HippoCanvasBox *box,
HippoCanvasCompareChildFunc compare_func,
void *data);
void hippo_canvas_box_insert_after (HippoCanvasBox *box,
HippoCanvasItem *child,
HippoCanvasItem *ref_child,
HippoPackFlags flags);
void hippo_canvas_box_insert_before (HippoCanvasBox *box,
HippoCanvasItem *child,
HippoCanvasItem *ref_child,
HippoPackFlags flags);
void hippo_canvas_box_insert_sorted (HippoCanvasBox *box,
HippoCanvasItem *child,
HippoPackFlags flags,
HippoCanvasCompareChildFunc compare_func,
void *data);
void hippo_canvas_box_set_child_packing (HippoCanvasBox *box,
HippoCanvasItem *child,
HippoPackFlags flags);
void hippo_canvas_box_set_theme (HippoCanvasBox *box,
HippoCanvasTheme *theme);
void hippo_canvas_box_set_layout(HippoCanvasBox *box,
HippoCanvasLayout *layout);
/* Protected accessors for subclasses */
void hippo_canvas_box_get_background_area (HippoCanvasBox *box,
HippoRectangle *area);
void hippo_canvas_box_align (HippoCanvasBox *box,
int content_width,
int content_height,
int *x_p,
int *y_p,
int *width_p,
int *height_p);
void hippo_canvas_box_set_clickable (HippoCanvasBox *box,
gboolean clickable);
gboolean hippo_canvas_box_is_clickable (HippoCanvasBox *box);
void hippo_canvas_box_set_link_type (HippoCanvasBox *box,
HippoCanvasLinkType link_type);
/* API for layout managers */
HippoCanvasBoxChild *hippo_canvas_box_find_box_child (HippoCanvasBox *box,
HippoCanvasItem *item);
GList *hippo_canvas_box_get_layout_children (HippoCanvasBox *box);
#define HIPPO_TYPE_CANVAS_BOX_CHILD (hippo_canvas_box_child_get_type ())
#define HIPPO_CANVAS_BOX_CHILD(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), HIPPO_TYPE_CANVAS_BOX_CHILD, HippoCanvasBoxChild))
/**
* HippoCanvasBoxChild:
*
* #HippoCanvasBoxChild holds data associated with an item that has been
* added to a canvas box. It is used by implementations of #HippoCanvasLayout
* when implementing methods like get_width_request and size_allocate.
*
* The life-cycle of a #HippoCanvasBoxChild is effectively until the item
* is removed from its parent. If a reference is held beyond that point, calling
* methods on the box child is safe, but the methods will have no effect,
* and defaults results will be returned.
*/
struct _HippoCanvasBoxChild {
HippoCanvasItem *item;
/* If this is false, layout managers should ignore this item */
guint in_layout : 1;
guint expand : 1;
guint end : 1;
guint fixed : 1;
guint if_fits : 1;
guint float_left : 1;
guint float_right : 1;
guint clear_left : 1;
guint clear_right : 1;
guint visible : 1;
};
GType hippo_canvas_box_child_get_type (void);
HippoCanvasBoxChild *hippo_canvas_box_child_ref (HippoCanvasBoxChild *child);
void hippo_canvas_box_child_unref (HippoCanvasBoxChild *child);
void hippo_canvas_box_child_set_qdata (HippoCanvasBoxChild *child,
GQuark key,
gpointer data,
GDestroyNotify notify);
gpointer hippo_canvas_box_child_get_qdata (HippoCanvasBoxChild *child,
GQuark key);
void hippo_canvas_box_child_get_width_request (HippoCanvasBoxChild *child,
int *min_width_p,
int *natural_width_p);
void hippo_canvas_box_child_get_height_request (HippoCanvasBoxChild *child,
int for_width,
int *min_height_p,
int *natural_height_p);
void hippo_canvas_box_child_allocate (HippoCanvasBoxChild *child,
int x,
int y,
int width,
int height,
gboolean origin_changed);
G_END_DECLS
#endif /* __HIPPO_CANVAS_BOX_H__ */
|