示例#1
0
static void
gtk_layout_move_internal (GtkLayout       *layout,
                          GtkWidget       *widget,
                          gboolean         change_x,
                          gint             x,
                          gboolean         change_y,
                          gint             y)
{
  GtkLayoutChild *child;

  child = get_child (layout, widget);

  g_assert (child);

  gtk_widget_freeze_child_notify (widget);
  
  if (change_x)
    {
      child->x = x;
      gtk_widget_child_notify (widget, "x");
    }

  if (change_y)
    {
      child->y = y;
      gtk_widget_child_notify (widget, "y");
    }

  gtk_widget_thaw_child_notify (widget);
  
  if (gtk_widget_get_visible (widget) &&
      gtk_widget_get_visible (GTK_WIDGET (layout)))
    gtk_widget_queue_resize (widget);
}
/**
 * hildon_caption_set_child_expand:
 * @caption: a #HildonCaption
 * @expand: whether the child is expandable.
 *
 * Sets child expandability.
 */
void 
hildon_caption_set_child_expand                 (HildonCaption *caption, 
                                                 gboolean expand)
{
    HildonCaptionPrivate *priv = NULL;
    GtkWidget *child = NULL;
    g_return_if_fail (HILDON_IS_CAPTION (caption));

    priv = HILDON_CAPTION_GET_PRIVATE (caption);

    /* Did the setting really change? */
    if (priv->expand == expand)
        return;

    priv->expand = expand;
    child = GTK_BIN (caption)->child;

    /* We do not have a child, nothing to do */
    if (! GTK_IS_WIDGET (child))
        return;

    if (GTK_WIDGET_VISIBLE (child) && GTK_WIDGET_VISIBLE (caption))
        gtk_widget_queue_resize (child);

    gtk_widget_child_notify (child, "expand");
}
示例#3
0
static void
gd_stack_add (GtkContainer *container,
	      GtkWidget *child)
{
  GdStack *stack = GD_STACK (container);
  GdStackPrivate *priv = stack->priv;
  GdStackChildInfo *child_info;

  g_return_if_fail (child != NULL);

  child_info = g_slice_new (GdStackChildInfo);
  child_info->widget = child;
  child_info->name = NULL;
  child_info->title = NULL;
  child_info->symbolic_icon_name = NULL;

  priv->children = g_list_append (priv->children, child_info);

  gtk_widget_set_parent_window (child, priv->bin_window);
  gtk_widget_set_parent (child, GTK_WIDGET (stack));

  g_signal_connect (child, "notify::visible",
                    G_CALLBACK (stack_child_visibility_notify_cb), stack);

  gtk_widget_child_notify (child, "position");

  if (priv->visible_child == NULL &&
      gtk_widget_get_visible (child))
    set_visible_child (stack, child_info);
  else
    gtk_widget_set_child_visible (child, FALSE);

  if (priv->homogeneous || priv->visible_child == child_info)
    gtk_widget_queue_resize (GTK_WIDGET (stack));
}
示例#4
0
static void
reorder_child (GdStack   *stack,
               GtkWidget *child,
               gint       position)
{
  GdStackPrivate *priv;
  GList *l;
  GList *old_link = NULL;
  GList *new_link = NULL;
  GdStackChildInfo *child_info;
  gint num = 0;

  priv = stack->priv;

  l = priv->children;

  /* Loop to find the old position and link of child, new link of child and
   * total number of children. new_link will be NULL if the child should be
   * moved to the end (in case of position being < 0 || >= num)
   */
  while (l && (new_link == NULL || old_link == NULL))
    {
      /* Record the new position if found */
      if (position == num)
        new_link = l;

      if (old_link == NULL)
        {
          GdStackChildInfo *info;
          info = l->data;

          /* Keep trying to find the current position and link location of the
             child */
          if (info->widget == child)
            {
              old_link = l;
              child_info = info;
            }
        }

      l = g_list_next (l);
      num++;
    }

  g_return_if_fail (old_link != NULL);

  if (old_link == new_link || (g_list_next (old_link) == NULL && new_link == NULL))
    return;

  priv->children = g_list_delete_link (priv->children, old_link);
  priv->children = g_list_insert_before (priv->children, new_link, child_info);

  gtk_widget_child_notify (child, "position");
}
示例#5
0
文件: gtktoolitem.c 项目: jjardon/gtk
/**
 * gtk_tool_item_set_homogeneous:
 * @tool_item: a #GtkToolItem
 * @homogeneous: whether @tool_item is the same size as other homogeneous items
 *
 * Sets whether @tool_item is to be allocated the same size as other
 * homogeneous items. The effect is that all homogeneous items will have
 * the same width as the widest of the items.
 *
 * Since: 2.4
 **/
void
gtk_tool_item_set_homogeneous (GtkToolItem *tool_item,
                               gboolean     homogeneous)
{
    g_return_if_fail (GTK_IS_TOOL_ITEM (tool_item));

    homogeneous = homogeneous != FALSE;

    if (tool_item->priv->homogeneous != homogeneous)
    {
        tool_item->priv->homogeneous = homogeneous;
        gtk_widget_child_notify (GTK_WIDGET (tool_item), "homogeneous");
        gtk_widget_queue_resize (GTK_WIDGET (tool_item));
    }
}
示例#6
0
文件: gtktoolitem.c 项目: jjardon/gtk
/**
 * gtk_tool_item_set_expand:
 * @tool_item: a #GtkToolItem
 * @expand: Whether @tool_item is allocated extra space
 *
 * Sets whether @tool_item is allocated extra space when there
 * is more room on the toolbar then needed for the items. The
 * effect is that the item gets bigger when the toolbar gets bigger
 * and smaller when the toolbar gets smaller.
 *
 * Since: 2.4
 */
void
gtk_tool_item_set_expand (GtkToolItem *tool_item,
                          gboolean     expand)
{
    g_return_if_fail (GTK_IS_TOOL_ITEM (tool_item));

    expand = expand != FALSE;

    if (tool_item->priv->expand != expand)
    {
        tool_item->priv->expand = expand;
        gtk_widget_child_notify (GTK_WIDGET (tool_item), "expand");
        gtk_widget_queue_resize (GTK_WIDGET (tool_item));
    }
}
示例#7
0
static VALUE
rg_child_notify(VALUE self, VALUE child_property)
{
    gtk_widget_child_notify(_SELF(self), RVAL2CSTR(child_property));
    return self;
}