示例#1
0
void
rut_bin_set_child (RutBin *bin,
                   RutObject *child_widget)
{
    if (child_widget)
        rut_refable_ref (child_widget);

    if (bin->child)
    {
        rut_graphable_remove_child (bin->child);
        rut_closure_disconnect (bin->child_preferred_size_closure);
        bin->child_preferred_size_closure = NULL;
        rut_refable_unref (bin->child);
    }

    bin->child = child_widget;

    if (child_widget)
    {
        rut_graphable_add_child (bin->child_transform, child_widget);
        bin->child_preferred_size_closure =
            rut_sizable_add_preferred_size_callback (child_widget,
                    child_preferred_size_cb,
                    bin,
                    NULL /* destroy */);
        queue_allocation (bin);
    }

    preferred_size_changed (bin);
}
示例#2
0
static void
child_preferred_size_cb (RutObject *sizable,
                         void *user_data)
{
    RutBin *bin = user_data;

    preferred_size_changed (bin);
    queue_allocation (bin);
}
示例#3
0
void
rut_bin_set_right_padding (RutObject *obj,
                           float right_padding)
{
    RutBin *bin = RUT_BIN (obj);

    bin->right_padding = right_padding;
    preferred_size_changed (bin);
    queue_allocation (bin);
}
示例#4
0
文件: rut-shim.c 项目: cee1/rig
void
rut_shim_set_shim_axis (RutShim *shim, RutShimAxis axis)
{
  if (shim->axis == axis)
    return;

  shim->axis = axis;

  preferred_size_changed (shim);
}
示例#5
0
文件: rut-bin.c 项目: cee1/rig
void
rut_bin_set_left_padding (RutObject *obj,
                          float left_padding)
{
  RutBin *bin = obj;

  bin->left_padding = left_padding;
  preferred_size_changed (bin);
  queue_allocation (bin);
}
示例#6
0
文件: rut-shim.c 项目: cee1/rig
static void
child_preferred_size_cb (RutObject *sizable,
                         void *user_data)
{
  RutShim *shim = user_data;

  if (shim->axis == RUT_SHIM_AXIS_XY)
    return;

  preferred_size_changed (shim);
  queue_allocation (shim);
}
示例#7
0
文件: rut-shim.c 项目: cee1/rig
void
rut_shim_set_size (RutObject *self,
                   float width,
                   float height)
{
  RutShim *shim = self;

  if (shim->width == width && shim->height == height)
    return;

  shim->width = width;
  shim->height = height;

  preferred_size_changed (shim);
}
示例#8
0
文件: rut-bin.c 项目: cee1/rig
void
rut_bin_set_child (RutBin *bin,
                   RutObject *child_widget)
{
  g_return_if_fail (rut_object_get_type (bin) == &rut_bin_type);

  if (bin->child == child_widget)
    return;

  if (child_widget)
    rut_refable_claim (child_widget, bin);

  if (bin->child)
    {
      rut_graphable_remove_child (bin->child);
      rut_closure_disconnect (bin->child_preferred_size_closure);
      bin->child_preferred_size_closure = NULL;
      rut_refable_release (bin->child, bin);
    }

  bin->child = child_widget;

  if (child_widget)
    {
      rut_graphable_add_child (bin->child_transform, child_widget);
      bin->child_preferred_size_closure =
        rut_sizable_add_preferred_size_callback (child_widget,
                                                 child_preferred_size_cb,
                                                 bin,
                                                 NULL /* destroy */);
      queue_allocation (bin);
    }

  preferred_size_changed (bin);
  rut_shell_queue_redraw (bin->context->shell);
}