/** * clutter_bin_layout_add: * @self: a #ClutterBinLayout * @child: a #ClutterActor * @x_align: horizontal alignment policy for @child * @y_align: vertical alignment policy for @child * * Adds a #ClutterActor to the container using @self and * sets the alignment policies for it * * This function is equivalent to clutter_container_add_actor() * and clutter_layout_manager_child_set_property() but it does not * require a pointer to the #ClutterContainer associated to the * #ClutterBinLayout * * Since: 1.2 */ void clutter_bin_layout_add (ClutterBinLayout *self, ClutterActor *child, ClutterBinAlignment x_align, ClutterBinAlignment y_align) { ClutterBinLayoutPrivate *priv; ClutterLayoutManager *manager; ClutterLayoutMeta *meta; g_return_if_fail (CLUTTER_IS_BIN_LAYOUT (self)); g_return_if_fail (CLUTTER_IS_ACTOR (child)); priv = self->priv; if (priv->container == NULL) { g_warning ("The layout of type '%s' must be associated to " "a ClutterContainer before adding children", G_OBJECT_TYPE_NAME (self)); return; } clutter_container_add_actor (priv->container, child); manager = CLUTTER_LAYOUT_MANAGER (self); meta = clutter_layout_manager_get_child_meta (manager, priv->container, child); g_assert (CLUTTER_IS_BIN_LAYER (meta)); set_layer_x_align (CLUTTER_BIN_LAYER (meta), x_align); set_layer_y_align (CLUTTER_BIN_LAYER (meta), y_align); }
static void update_row_col (ClutterTableLayout *layout, ClutterContainer *container) { ClutterTableLayoutPrivate *priv = layout->priv; ClutterLayoutManager *manager = CLUTTER_LAYOUT_MANAGER (layout); ClutterActor *actor, *child; gint n_cols, n_rows; n_cols = n_rows = 0; if (container == NULL) goto out; actor = CLUTTER_ACTOR (container); for (child = clutter_actor_get_first_child (actor); child != NULL; child = clutter_actor_get_next_sibling (child)) { ClutterTableChild *meta; meta = CLUTTER_TABLE_CHILD (clutter_layout_manager_get_child_meta (manager, container, child)); n_cols = MAX (n_cols, meta->col + meta->col_span); n_rows = MAX (n_rows, meta->row + meta->row_span); } out: priv->n_cols = n_cols; priv->n_rows = n_rows; }
static VALUE rbclt_layout_manager_end_animation (VALUE self) { ClutterLayoutManager *manager = CLUTTER_LAYOUT_MANAGER (RVAL2GOBJ (self)); clutter_layout_manager_end_animation (manager); return Qnil; }
static VALUE rbclt_layout_manager_set_container (VALUE self, VALUE container) { ClutterLayoutManager *manager = CLUTTER_LAYOUT_MANAGER (RVAL2GOBJ (self)); ClutterContainer *g_container = CLUTTER_CONTAINER (RVAL2GOBJ (container)); clutter_layout_manager_set_container (manager, g_container); return Qnil; }
static VALUE rbclt_layout_manager_get_child_meta (VALUE self, VALUE container, VALUE actor) { ClutterLayoutManager *manager = CLUTTER_LAYOUT_MANAGER (RVAL2GOBJ (self)); ClutterContainer *g_container = CLUTTER_CONTAINER (RVAL2GOBJ (container)); ClutterActor *g_actor = CLUTTER_ACTOR (RVAL2GOBJ (actor)); ClutterLayoutMeta *layout_meta = CLUTTER_LAYOUT_META (clutter_layout_manager_get_child_meta (manager, g_container, g_actor)); return GOBJ2RVAL (layout_meta); }
static VALUE rbclt_layout_manager_allocate (VALUE self, VALUE container, VALUE actorbox, VALUE flags) { ClutterLayoutManager *manager = CLUTTER_LAYOUT_MANAGER (RVAL2GOBJ (self)); ClutterContainer *g_container = CLUTTER_CONTAINER (RVAL2GOBJ (container)); ClutterActorBox g_actorbox = *(ClutterActorBox *) RVAL2BOXED (actorbox, CLUTTER_TYPE_ACTOR_BOX); ClutterAllocationFlags g_flags = RVAL2GENUM (flags, CLUTTER_TYPE_ALLOCATION_FLAGS); clutter_layout_manager_allocate (manager, g_container, &g_actorbox, g_flags); return Qnil; }
static VALUE rbclt_layout_manager_get_preferred_height (VALUE self, VALUE container, VALUE for_width) { ClutterLayoutManager *manager = CLUTTER_LAYOUT_MANAGER (RVAL2GOBJ (self)); ClutterContainer *g_container = CLUTTER_CONTAINER (RVAL2GOBJ (container)); gfloat min_height, nat_height; VALUE answer = rb_hash_new (); clutter_layout_manager_get_preferred_height (manager, g_container, NUM2INT (for_width), &min_height, &nat_height); rb_hash_aset (answer, rb_intern("min"), rb_float_new (min_height)); rb_hash_aset (answer, rb_intern("nat"), rb_float_new (nat_height)); return answer; }
static VALUE rbclt_layout_manager_child_set_property (VALUE self, VALUE container, VALUE actor, VALUE property, VALUE value) { ClutterLayoutManager *manager = CLUTTER_LAYOUT_MANAGER (RVAL2GOBJ (self)); ClutterContainer *g_container = CLUTTER_CONTAINER (RVAL2GOBJ (container)); ClutterActor *g_actor = CLUTTER_ACTOR (RVAL2GOBJ (actor)); GValue g_value; g_value_init (&g_value, RVAL2GTYPE (value)); rbgobj_rvalue_to_gvalue (value, &g_value); clutter_layout_manager_child_set_property (manager, g_container, g_actor, RVAL2CSTR (property), &g_value); g_value_unset (&g_value); return Qnil; }
/** * clutter_bin_layout_get_alignment: * @self: a #ClutterBinLayout * @child: (allow-none): a child of @container * @x_align: (out) (allow-none): return location for the horizontal * alignment policy * @y_align: (out) (allow-none): return location for the vertical * alignment policy * * Retrieves the horizontal and vertical alignment policies for * a child of @self * * If @child is %NULL the default alignment policies will be returned * instead * * Since: 1.2 */ void clutter_bin_layout_get_alignment (ClutterBinLayout *self, ClutterActor *child, ClutterBinAlignment *x_align, ClutterBinAlignment *y_align) { ClutterBinLayoutPrivate *priv; ClutterLayoutManager *manager; ClutterLayoutMeta *meta; ClutterBinLayer *layer; g_return_if_fail (CLUTTER_IS_BIN_LAYOUT (self)); priv = self->priv; if (priv->container == NULL) { if (child == NULL) { if (x_align) *x_align = priv->x_align; if (y_align) *y_align = priv->y_align; } else g_warning ("The layout of type '%s' must be associated to " "a ClutterContainer before getting the alignment " "of its children", G_OBJECT_TYPE_NAME (self)); return; } manager = CLUTTER_LAYOUT_MANAGER (self); meta = clutter_layout_manager_get_child_meta (manager, priv->container, child); g_assert (CLUTTER_IS_BIN_LAYER (meta)); layer = CLUTTER_BIN_LAYER (meta); if (x_align) *x_align = layer->x_align; if (y_align) *y_align = layer->y_align; }
static VALUE rbclt_layout_manager_child_get_property (VALUE self, VALUE container, VALUE actor, VALUE property) { ClutterLayoutManager *manager = CLUTTER_LAYOUT_MANAGER (RVAL2GOBJ (self)); ClutterContainer *g_container = CLUTTER_CONTAINER (RVAL2GOBJ (container)); ClutterActor *g_actor = CLUTTER_ACTOR (RVAL2GOBJ (actor)); GValue answer; clutter_layout_manager_child_get_property (manager, g_container, g_actor, RVAL2CSTR (property), &answer); VALUE r_answer = GVAL2RVAL (&answer); g_value_unset (&answer); return r_answer; }
/** * clutter_flow_layout_set_column_width: * @layout: a #ClutterFlowLayout * @min_width: minimum width of a column * @max_width: maximum width of a column * * Sets the minimum and maximum widths that a column can have * * Since: 1.2 */ void clutter_flow_layout_set_column_width (ClutterFlowLayout *layout, gfloat min_width, gfloat max_width) { ClutterFlowLayoutPrivate *priv; gboolean notify_min = FALSE, notify_max = FALSE; g_return_if_fail (CLUTTER_IS_FLOW_LAYOUT (layout)); priv = layout->priv; if (priv->min_col_width != min_width) { priv->min_col_width = min_width; notify_min = TRUE; } if (priv->max_col_width != max_width) { priv->max_col_width = max_width; notify_max = TRUE; } g_object_freeze_notify (G_OBJECT (layout)); if (notify_min || notify_max) { ClutterLayoutManager *manager = CLUTTER_LAYOUT_MANAGER (layout); clutter_layout_manager_layout_changed (manager); } if (notify_min) g_object_notify_by_pspec (G_OBJECT (layout), flow_properties[PROP_MIN_COLUMN_WIDTH]); if (notify_max) g_object_notify_by_pspec (G_OBJECT (layout), flow_properties[PROP_MAX_COLUMN_WIDTH]); g_object_thaw_notify (G_OBJECT (layout)); }
/** * clutter_table_layout_get_span: * @layout: a #ClutterTableLayout * @actor: a #ClutterActor child of @layout * @column_span: (out): return location for the col span * @row_span: (out): return location for the row span * * Retrieves the row and column span for @actor as set using * clutter_table_layout_pack() or clutter_table_layout_set_span() * * */ void clutter_table_layout_get_span (ClutterTableLayout *layout, ClutterActor *actor, gint *column_span, gint *row_span) { ClutterTableLayoutPrivate *priv; ClutterLayoutManager *manager; ClutterLayoutMeta *meta; g_return_if_fail (CLUTTER_IS_TABLE_LAYOUT (layout)); g_return_if_fail (CLUTTER_IS_ACTOR (actor)); priv = layout->priv; if (priv->container == NULL) { g_warning ("The layout of type '%s' must be associated to " "a ClutterContainer before querying layout " "properties", G_OBJECT_TYPE_NAME (layout)); return; } manager = CLUTTER_LAYOUT_MANAGER (layout); meta = clutter_layout_manager_get_child_meta (manager, priv->container, actor); if (meta == NULL) { g_warning ("No layout meta found for the child of type '%s' " "inside the layout manager of type '%s'", G_OBJECT_TYPE_NAME (actor), G_OBJECT_TYPE_NAME (manager)); return; } g_assert (CLUTTER_IS_TABLE_CHILD (meta)); if (column_span) *column_span = CLUTTER_TABLE_CHILD (meta)->col_span; if (row_span) *row_span = CLUTTER_TABLE_CHILD (meta)->row_span; }
/** * clutter_flow_layout_set_row_height: * @layout: a #ClutterFlowLayout * @min_height: the minimum height of a row * @max_height: the maximum height of a row * * Sets the minimum and maximum heights that a row can have * * Since: 1.2 */ void clutter_flow_layout_set_row_height (ClutterFlowLayout *layout, gfloat min_height, gfloat max_height) { ClutterFlowLayoutPrivate *priv; gboolean notify_min = FALSE, notify_max = FALSE; g_return_if_fail (CLUTTER_IS_FLOW_LAYOUT (layout)); priv = layout->priv; if (priv->min_row_height != min_height) { priv->min_row_height = min_height; notify_min = TRUE; } if (priv->max_row_height != max_height) { priv->max_row_height = max_height; notify_max = TRUE; } g_object_freeze_notify (G_OBJECT (layout)); if (notify_min || notify_max) { ClutterLayoutManager *manager = CLUTTER_LAYOUT_MANAGER (layout); clutter_layout_manager_layout_changed (manager); } if (notify_min) g_object_notify_by_pspec (G_OBJECT (layout), flow_properties[PROP_MIN_ROW_HEGHT]); if (notify_max) g_object_notify_by_pspec (G_OBJECT (layout), flow_properties[PROP_MAX_ROW_HEIGHT]); g_object_thaw_notify (G_OBJECT (layout)); }
static void set_y_align (ClutterBinLayout *self, ClutterBinAlignment alignment) { ClutterBinLayoutPrivate *priv = self->priv; if (priv->y_align != alignment) { ClutterLayoutManager *manager; priv->y_align = alignment; manager = CLUTTER_LAYOUT_MANAGER (self); clutter_layout_manager_layout_changed (manager); _clutter_notify_by_pspec (G_OBJECT (self), bin_props[PROP_Y_ALIGN]); } }
void xfdashboard_fill_box_layout_set_keep_aspect(XfdashboardFillBoxLayout *self, gboolean inKeepAspect) { XfdashboardFillBoxLayoutPrivate *priv; g_return_if_fail(XFDASHBOARD_IS_FILL_BOX_LAYOUT(self)); priv=self->priv; /* Set new values if changed */ if(priv->keepAspect!=inKeepAspect) { /* Set new values and notify about properties changes */ priv->keepAspect=inKeepAspect; g_object_notify_by_pspec(G_OBJECT(self), XfdashboardFillBoxLayoutProperties[PROP_KEEP_ASPECT]); /* Notify for upcoming layout changes */ clutter_layout_manager_layout_changed(CLUTTER_LAYOUT_MANAGER(self)); } }
void xfdashboard_fill_box_layout_set_homogeneous(XfdashboardFillBoxLayout *self, gboolean inIsHomogeneous) { XfdashboardFillBoxLayoutPrivate *priv; g_return_if_fail(XFDASHBOARD_IS_FILL_BOX_LAYOUT(self)); priv=self->priv; /* Set new values if changed */ if(priv->isHomogeneous!=inIsHomogeneous) { /* Set new values and notify about properties changes */ priv->isHomogeneous=inIsHomogeneous; g_object_notify_by_pspec(G_OBJECT(self), XfdashboardFillBoxLayoutProperties[PROP_HOMOGENEOUS]); /* Notify for upcoming layout changes */ clutter_layout_manager_layout_changed(CLUTTER_LAYOUT_MANAGER(self)); } }
void xfdashboard_scaled_table_layout_set_prevent_upscaling(XfdashboardScaledTableLayout *self, gboolean inPreventUpscaling) { XfdashboardScaledTableLayoutPrivate *priv; g_return_if_fail(XFDASHBOARD_IS_SCALED_TABLE_LAYOUT(self)); priv=self->priv; /* Set new value if changed */ if(priv->preventUpscaling!=inPreventUpscaling) { /* Set new value and notify about property change */ priv->preventUpscaling=inPreventUpscaling; g_object_notify_by_pspec(G_OBJECT(self), XfdashboardScaledTableLayoutProperties[PROP_PREVENT_UPSCALING]); /* Notify for upcoming layout changes */ clutter_layout_manager_layout_changed(CLUTTER_LAYOUT_MANAGER(self)); } }
void xfdashboard_scaled_table_layout_set_column_spacing(XfdashboardScaledTableLayout *self, gfloat inSpacing) { XfdashboardScaledTableLayoutPrivate *priv; g_return_if_fail(XFDASHBOARD_IS_SCALED_TABLE_LAYOUT(self)); g_return_if_fail(inSpacing>=0.0f); priv=self->priv; /* Set new value if changed */ if(priv->columnSpacing!=inSpacing) { /* Set new value and notify about property change */ priv->columnSpacing=inSpacing; g_object_notify_by_pspec(G_OBJECT(self), XfdashboardScaledTableLayoutProperties[PROP_COLUMN_SPACING]); /* Notify for upcoming layout changes */ clutter_layout_manager_layout_changed(CLUTTER_LAYOUT_MANAGER(self)); } }
/** * clutter_flow_layout_set_snap_to_grid: * @layout: a #ClutterFlowLayout * @snap_to_grid: %TRUE if @layout should place its children on a grid * * Whether the @layout should place its children on a grid. * * Since: 1.16 */ void clutter_flow_layout_set_snap_to_grid (ClutterFlowLayout *layout, gboolean snap_to_grid) { ClutterFlowLayoutPrivate *priv; g_return_if_fail (CLUTTER_IS_FLOW_LAYOUT (layout)); priv = layout->priv; if (priv->snap_to_grid != snap_to_grid) { priv->snap_to_grid = snap_to_grid; clutter_layout_manager_layout_changed (CLUTTER_LAYOUT_MANAGER (layout)); g_object_notify_by_pspec (G_OBJECT (layout), flow_properties[PROP_SNAP_TO_GRID]); } }
void xfdashboard_fill_box_layout_set_spacing(XfdashboardFillBoxLayout *self, gfloat inSpacing) { XfdashboardFillBoxLayoutPrivate *priv; g_return_if_fail(XFDASHBOARD_IS_FILL_BOX_LAYOUT(self)); g_return_if_fail(inSpacing>=0.0f); priv=self->priv; /* Set new values if changed */ if(priv->spacing!=inSpacing) { /* Set new values and notify about properties changes */ priv->spacing=inSpacing; g_object_notify_by_pspec(G_OBJECT(self), XfdashboardFillBoxLayoutProperties[PROP_SPACING]); /* Notify for upcoming layout changes */ clutter_layout_manager_layout_changed(CLUTTER_LAYOUT_MANAGER(self)); } }
/** * clutter_table_layout_pack: * @layout: a #ClutterTableLayout * @actor: a #ClutterActor * @column: the column the @actor should be put, or -1 to append * @row: the row the @actor should be put, or -1 to append * * Packs @actor inside the #ClutterContainer associated to @layout * at the given row and column. * * */ void clutter_table_layout_pack (ClutterTableLayout *layout, ClutterActor *actor, gint column, gint row) { ClutterTableLayoutPrivate *priv; ClutterLayoutManager *manager; ClutterLayoutMeta *meta; g_return_if_fail (CLUTTER_IS_TABLE_LAYOUT (layout)); g_return_if_fail (CLUTTER_IS_ACTOR (actor)); priv = layout->priv; if (priv->container == NULL) { g_warning ("The layout of type '%s' must be associated to " "a ClutterContainer before adding children", G_OBJECT_TYPE_NAME (layout)); return; } update_row_col (CLUTTER_TABLE_LAYOUT (layout), priv->container); clutter_actor_add_child (CLUTTER_ACTOR (priv->container), actor); manager = CLUTTER_LAYOUT_MANAGER (layout); meta = clutter_layout_manager_get_child_meta (manager, priv->container, actor); g_assert (CLUTTER_IS_TABLE_CHILD (meta)); if (row < 0) row = priv->n_rows; if (column < 0) column = priv->n_cols; table_child_set_position (CLUTTER_TABLE_CHILD (meta), column, row); }
void xfdashboard_fill_box_layout_set_orientation(XfdashboardFillBoxLayout *self, ClutterOrientation inOrientation) { XfdashboardFillBoxLayoutPrivate *priv; g_return_if_fail(XFDASHBOARD_IS_FILL_BOX_LAYOUT(self)); g_return_if_fail(inOrientation==CLUTTER_ORIENTATION_HORIZONTAL || inOrientation==CLUTTER_ORIENTATION_VERTICAL); priv=self->priv; /* Set new values if changed */ if(priv->orientation!=inOrientation) { /* Set new values and notify about properties changes */ priv->orientation=inOrientation; g_object_notify_by_pspec(G_OBJECT(self), XfdashboardFillBoxLayoutProperties[PROP_ORIENTATION]); /* Notify for upcoming layout changes */ clutter_layout_manager_layout_changed(CLUTTER_LAYOUT_MANAGER(self)); } }
/** * clutter_flow_layout_set_homogeneous: * @layout: a #ClutterFlowLayout * @homogeneous: whether the layout should be homogeneous or not * * Sets whether the @layout should allocate the same space for * each child * * Since: 1.2 */ void clutter_flow_layout_set_homogeneous (ClutterFlowLayout *layout, gboolean homogeneous) { ClutterFlowLayoutPrivate *priv; g_return_if_fail (CLUTTER_IS_FLOW_LAYOUT (layout)); priv = layout->priv; if (priv->is_homogeneous != homogeneous) { ClutterLayoutManager *manager; priv->is_homogeneous = homogeneous; manager = CLUTTER_LAYOUT_MANAGER (layout); clutter_layout_manager_layout_changed (manager); g_object_notify (G_OBJECT (layout), "homogeneous"); } }
/** * clutter_flow_layout_set_row_spacing: * @layout: a #ClutterFlowLayout * @spacing: the space between rows * * Sets the spacing between rows, in pixels * * Since: 1.2 */ void clutter_flow_layout_set_row_spacing (ClutterFlowLayout *layout, gfloat spacing) { ClutterFlowLayoutPrivate *priv; g_return_if_fail (CLUTTER_IS_FLOW_LAYOUT (layout)); priv = layout->priv; if (priv->row_spacing != spacing) { ClutterLayoutManager *manager; priv->row_spacing = spacing; manager = CLUTTER_LAYOUT_MANAGER (layout); clutter_layout_manager_layout_changed (manager); g_object_notify (G_OBJECT (layout), "row-spacing"); } }
/** * clutter_table_layout_set_column_spacing: * @layout: a #ClutterTableLayout * @spacing: the spacing between columns of the layout, in pixels * * Sets the spacing between columns of @layout * * */ void clutter_table_layout_set_column_spacing (ClutterTableLayout *layout, guint spacing) { ClutterTableLayoutPrivate *priv; g_return_if_fail (CLUTTER_IS_TABLE_LAYOUT (layout)); priv = layout->priv; if (priv->col_spacing != spacing) { ClutterLayoutManager *manager; priv->col_spacing = spacing; manager = CLUTTER_LAYOUT_MANAGER (layout); clutter_layout_manager_layout_changed (manager); g_object_notify (G_OBJECT (layout), "column-spacing"); } }
/** * clutter_flow_layout_set_column_spacing: * @layout: a #ClutterFlowLayout * @spacing: the space between columns * * Sets the space between columns, in pixels * * Since: 1.2 */ void clutter_flow_layout_set_column_spacing (ClutterFlowLayout *layout, gfloat spacing) { ClutterFlowLayoutPrivate *priv; g_return_if_fail (CLUTTER_IS_FLOW_LAYOUT (layout)); priv = layout->priv; if (priv->col_spacing != spacing) { ClutterLayoutManager *manager; priv->col_spacing = spacing; manager = CLUTTER_LAYOUT_MANAGER (layout); clutter_layout_manager_layout_changed (manager); g_object_notify_by_pspec (G_OBJECT (layout), flow_properties[PROP_COLUMN_SPACING]); } }
/** * clutter_flow_layout_set_orientation: * @layout: a #ClutterFlowLayout * @orientation: the orientation of the layout * * Sets the orientation of the flow layout * * The orientation controls the direction used to allocate * the children: either horizontally or vertically. The * orientation also controls the direction of the overflowing * * Since: 1.2 */ void clutter_flow_layout_set_orientation (ClutterFlowLayout *layout, ClutterFlowOrientation orientation) { ClutterFlowLayoutPrivate *priv; g_return_if_fail (CLUTTER_IS_FLOW_LAYOUT (layout)); priv = layout->priv; if (priv->orientation != orientation) { ClutterLayoutManager *manager; priv->orientation = orientation; if (priv->container != NULL) { ClutterRequestMode request_mode; /* we need to change the :request-mode of the container * to match the orientation */ request_mode = (priv->orientation == CLUTTER_FLOW_HORIZONTAL) ? CLUTTER_REQUEST_HEIGHT_FOR_WIDTH : CLUTTER_REQUEST_WIDTH_FOR_HEIGHT; clutter_actor_set_request_mode (CLUTTER_ACTOR (priv->container), request_mode); } manager = CLUTTER_LAYOUT_MANAGER (layout); clutter_layout_manager_layout_changed (manager); g_object_notify_by_pspec (G_OBJECT (layout), flow_properties[PROP_ORIENTATION]); } }
/* Create new instance */ ClutterLayoutManager* xfdashboard_fill_box_layout_new(void) { return(CLUTTER_LAYOUT_MANAGER(g_object_new(XFDASHBOARD_TYPE_FILL_BOX_LAYOUT, NULL))); }
ClutterLayoutManager* xfdashboard_fill_box_layout_new_with_orientation(ClutterOrientation inOrientation) { return(CLUTTER_LAYOUT_MANAGER(g_object_new(XFDASHBOARD_TYPE_FILL_BOX_LAYOUT, "orientation", inOrientation, NULL))); }
/* Create new instance */ ClutterLayoutManager* xfdashboard_scaled_table_layout_new(void) { return(CLUTTER_LAYOUT_MANAGER(g_object_new(XFDASHBOARD_TYPE_SCALED_TABLE_LAYOUT, NULL))); }