static void 
hildon_vvolumebar_init                          (HildonVVolumebar *vvolumebar)
{
    HildonVolumebarPrivate *priv;

    priv = HILDON_VOLUMEBAR_GET_PRIVATE (vvolumebar);
    g_assert (priv);

    priv->volumebar = HILDON_VOLUMEBAR_RANGE (hildon_volumebar_range_new
            (GTK_ORIENTATION_VERTICAL));

    gtk_widget_set_parent (GTK_WIDGET (priv->tbutton), GTK_WIDGET (vvolumebar));
    gtk_widget_set_parent (GTK_WIDGET (priv->volumebar), GTK_WIDGET (vvolumebar));

    gtk_scale_set_draw_value (GTK_SCALE (priv->volumebar), FALSE);

    /* Signals */
    g_signal_connect_swapped(G_OBJECT(priv->volumebar), "value-changed",
            G_CALLBACK(hildon_volumebar_level_change),
            vvolumebar);

    g_signal_connect_swapped(priv->tbutton, "toggled",
            G_CALLBACK(hildon_volumebar_mute_toggled), vvolumebar);

    /* FIXME Not sure why this is here */
    gtk_widget_show (GTK_WIDGET (priv->volumebar));
}
static void
gdl_dock_item_grip_instance_init (GdlDockItemGrip *grip)
{
    GtkWidget *image;

    GTK_WIDGET_SET_FLAGS (grip, GTK_NO_WINDOW);
    
    grip->_priv = g_new0 (GdlDockItemGripPrivate, 1);
    grip->_priv->icon_pixbuf_valid = FALSE;
    grip->_priv->icon_pixbuf = NULL;
    grip->_priv->title_layout = NULL;

    gtk_widget_push_composite_child ();
    grip->_priv->close_button = gtk_button_new ();
    gtk_widget_pop_composite_child ();
    
    GTK_WIDGET_UNSET_FLAGS (grip->_priv->close_button, GTK_CAN_FOCUS);
    gtk_widget_set_parent (grip->_priv->close_button, GTK_WIDGET (grip));
    gtk_button_set_relief (GTK_BUTTON (grip->_priv->close_button), GTK_RELIEF_NONE);
    gtk_widget_show (grip->_priv->close_button);

    image = gtk_image_new_from_stock (GDL_STOCK_CLOSE, GTK_ICON_SIZE_MENU);
    gtk_container_add (GTK_CONTAINER (grip->_priv->close_button), image);
    gtk_widget_show (image);

    g_signal_connect (G_OBJECT (grip->_priv->close_button), "clicked",
                      G_CALLBACK (gdl_dock_item_grip_close_clicked), grip);

    gtk_widget_push_composite_child ();
    grip->_priv->iconify_button = gtk_button_new ();
    gtk_widget_pop_composite_child ();
    
    GTK_WIDGET_UNSET_FLAGS (grip->_priv->iconify_button, GTK_CAN_FOCUS);
    gtk_widget_set_parent (grip->_priv->iconify_button, GTK_WIDGET (grip));
    gtk_button_set_relief (GTK_BUTTON (grip->_priv->iconify_button), GTK_RELIEF_NONE);
    gtk_widget_show (grip->_priv->iconify_button);

    image = gtk_image_new_from_stock (GDL_STOCK_MENU_RIGHT, GTK_ICON_SIZE_MENU);
    gtk_container_add (GTK_CONTAINER (grip->_priv->iconify_button), image);
    gtk_widget_show (image);

    g_signal_connect (G_OBJECT (grip->_priv->iconify_button), "clicked",
                      G_CALLBACK (gdl_dock_item_grip_iconify_clicked), grip);

    grip->_priv->tooltips = gtk_tooltips_new ();
    g_object_ref (grip->_priv->tooltips);
    gtk_object_sink (GTK_OBJECT (grip->_priv->tooltips));
    gtk_tooltips_set_tip (grip->_priv->tooltips, grip->_priv->iconify_button,
                          _("Iconify"), _("Iconify this dock"));
    gtk_tooltips_set_tip (grip->_priv->tooltips, grip->_priv->close_button,
                          _("Close"), _("Close this dock"));
}
Ejemplo n.º 3
0
static GObject *
hildon_home_window_constructor (GType                  gtype,
                                guint                  n_params,
                                GObjectConstructParam *params)
{
  GObject *retval;
  HildonHomeWindow *window;
  HildonHomeWindowPrivate *priv;
  GtkWidget *widget;

  retval =
      G_OBJECT_CLASS (hildon_home_window_parent_class)->constructor (gtype,
                                                                     n_params,
                                                                     params);
  widget = GTK_WIDGET (retval);
  window = HILDON_HOME_WINDOW (retval);
  priv = window->priv;

  gtk_widget_push_composite_child ();

  priv->titlebar = hildon_home_titlebar_new ();
  g_object_ref (priv->titlebar);
  gtk_object_sink (GTK_OBJECT (priv->titlebar));
  gtk_widget_set_parent (priv->titlebar, widget);
  gtk_widget_show (priv->titlebar);

  gtk_widget_pop_composite_child ();

  return retval;
}
Ejemplo n.º 4
0
GimpOverlayChild *
gimp_overlay_child_new (GimpOverlayBox *box,
                        GtkWidget      *widget,
                        gdouble         xalign,
                        gdouble         yalign,
                        gdouble         angle,
                        gdouble         opacity)
{
  GimpOverlayChild *child;

  g_return_val_if_fail (GIMP_IS_OVERLAY_BOX (box), NULL);
  g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);

  child = g_slice_new0 (GimpOverlayChild);

  child->widget       = widget;
  child->xalign       = CLAMP (xalign, 0.0, 1.0);
  child->yalign       = CLAMP (yalign, 0.0, 1.0);
  child->x            = 0.0;
  child->y            = 0.0;
  child->has_position = FALSE;
  child->angle        = angle;
  child->opacity      = CLAMP (opacity, 0.0, 1.0);

  cairo_matrix_init_identity (&child->matrix);

  if (gtk_widget_get_realized (GTK_WIDGET (box)))
    gimp_overlay_child_realize (box, child);

  gtk_widget_set_parent (widget, GTK_WIDGET (box));

  return child;
}
Ejemplo n.º 5
0
void columns_add(Columns *cols, GtkWidget *child,
                 gint colstart, gint colspan)
{
    ColumnsChild *childdata;

    g_return_if_fail(cols != NULL);
    g_return_if_fail(IS_COLUMNS(cols));
    g_return_if_fail(child != NULL);
    g_return_if_fail(child->parent == NULL);

    childdata = g_new(ColumnsChild, 1);
    childdata->widget = child;
    childdata->colstart = colstart;
    childdata->colspan = colspan;
    childdata->force_left = FALSE;

    cols->children = g_list_append(cols->children, childdata);
    cols->taborder = g_list_append(cols->taborder, child);

    gtk_widget_set_parent(child, GTK_WIDGET(cols));

    if (GTK_WIDGET_REALIZED(cols))
        gtk_widget_realize(child);

    if (GTK_WIDGET_VISIBLE(cols) && GTK_WIDGET_VISIBLE(child)) {
        if (GTK_WIDGET_MAPPED(cols))
            gtk_widget_map(child);
        gtk_widget_queue_resize(child);
    }
}
Ejemplo n.º 6
0
/**
 * gtk_image_menu_item_set_image:
 * @image_menu_item: a #GtkImageMenuItem.
 * @image: (allow-none): a widget to set as the image for the menu item.
 *
 * Sets the image of @image_menu_item to the given widget.
 * Note that it depends on the show-menu-images setting whether
 * the image will be displayed or not.
 *
 * Deprecated: 3.10
 */
void
gtk_image_menu_item_set_image (GtkImageMenuItem *image_menu_item,
                               GtkWidget        *image)
{
    GtkImageMenuItemPrivate *priv;

    g_return_if_fail (GTK_IS_IMAGE_MENU_ITEM (image_menu_item));

    priv = image_menu_item->priv;

    if (image == priv->image)
        return;

    if (priv->image)
        gtk_container_remove (GTK_CONTAINER (image_menu_item),
                              priv->image);

    priv->image = image;

    if (image == NULL)
        return;

    gtk_widget_set_parent (image, GTK_WIDGET (image_menu_item));
    g_object_set (image,
                  "visible", show_image (image_menu_item),
                  "no-show-all", TRUE,
                  NULL);
    gtk_image_set_pixel_size (GTK_IMAGE (image), 16);

    g_object_notify (G_OBJECT (image_menu_item), "image");
}
Ejemplo n.º 7
0
static void
cb_reply_indicator_init (CbReplyIndicator *self)
{
  GtkWidget *box;
  GtkWidget *w;

  gtk_widget_set_has_surface (GTK_WIDGET (self), FALSE);

  box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);

  w = gtk_image_new_from_icon_name ("go-up-symbolic");
  gtk_widget_set_hexpand (w, TRUE);
  gtk_widget_set_halign (w, GTK_ALIGN_END);
  gtk_container_add (GTK_CONTAINER (box), w);
  gtk_container_add (GTK_CONTAINER (box), gtk_label_new (_("Show Conversation")));
  w = gtk_image_new_from_icon_name ("go-up-symbolic");
  gtk_widget_set_hexpand (w, TRUE);
  gtk_widget_set_halign (w, GTK_ALIGN_START);
  gtk_container_add (GTK_CONTAINER (box), w);

  gtk_style_context_add_class (gtk_widget_get_style_context (box), "dim-label");

  self->button = gtk_button_new ();
  gtk_container_add (GTK_CONTAINER (self->button), box);
  self->revealer = gtk_revealer_new ();

  gtk_container_add (GTK_CONTAINER (self->revealer), self->button);
  gtk_widget_set_parent (self->revealer, GTK_WIDGET (self));

  g_signal_connect (self->button, "clicked", G_CALLBACK (button_clicked_cb), self);
}
Ejemplo n.º 8
0
void
gtk_pizza_put (GtkPizza   *pizza,
               GtkWidget  *widget,
               gint        x,
               gint        y,
               gint        width,
               gint        height)
{
    GtkPizzaChild *child_info;

    g_return_if_fail (pizza != NULL);
    g_return_if_fail (GTK_IS_PIZZA (pizza));
    g_return_if_fail (widget != NULL);

    child_info = g_new (GtkPizzaChild, 1);

    child_info->widget = widget;
    child_info->x = x;
    child_info->y = y;
    child_info->width = width;
    child_info->height = height;

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

    if (GTK_WIDGET_REALIZED (pizza))
      gtk_widget_set_parent_window (widget, pizza->bin_window);

    gtk_widget_set_parent (widget, GTK_WIDGET (pizza));

    if (!IS_ONSCREEN (x, y))
       GTK_PRIVATE_SET_FLAG (widget, GTK_IS_OFFSCREEN);

    gtk_widget_set_usize (widget, width, height);
}
Ejemplo n.º 9
0
void columns_add(Columns *cols, GtkWidget *child, gint colstart, gint colspan)
{
  ColumnsChild *childdata;

  g_return_if_fail(cols != NULL);
  g_return_if_fail(IS_COLUMNS(cols));
  g_return_if_fail(child != NULL);
  g_return_if_fail(gtk_widget_get_parent(child) == NULL);

  childdata = g_new(ColumnsChild, 1);
  childdata->widget = child;
  childdata->colstart = colstart;
  childdata->colspan = colspan;
  childdata->force_left = FALSE;
  childdata->same_height_as = NULL;

  cols->children = g_list_append(cols->children, childdata);
  cols->taborder = g_list_append(cols->taborder, child);

  gtk_widget_set_parent(child, GTK_WIDGET(cols));

#if GTK_CHECK_VERSION(2, 0, 0)
  gtk_container_set_focus_chain(GTK_CONTAINER(cols), cols->taborder);
#endif

  if (gtk_widget_get_realized(GTK_WIDGET(cols)))
    gtk_widget_realize(child);

  if (gtk_widget_get_visible(GTK_WIDGET(cols)) &&
      gtk_widget_get_visible(child)) {
    if (gtk_widget_get_mapped(GTK_WIDGET(cols)))
      gtk_widget_map(child);
    gtk_widget_queue_resize(child);
  }
}
Ejemplo n.º 10
0
static void
gcal_month_view_add (GtkContainer *container,
                     GtkWidget    *widget)
{
  GcalMonthViewPrivate *priv;
  GList *l;
  gint day;
  icaltimetype *date;

  g_return_if_fail (GCAL_IS_MONTH_VIEW (container));
  g_return_if_fail (GCAL_IS_EVENT_WIDGET (widget));
  g_return_if_fail (gtk_widget_get_parent (widget) == NULL);
  priv = GCAL_MONTH_VIEW (container)->priv;

  /* Check if it's already added for date */
  date = gcal_event_widget_get_date (GCAL_EVENT_WIDGET (widget));
  day = date->day + ( - priv->days_delay);
  g_free (date);

  for (l = priv->days[day]; l != NULL; l = l->next)
    {
      if (g_strcmp0 (
            gcal_event_widget_peek_uuid (GCAL_EVENT_WIDGET (widget)),
            gcal_event_widget_peek_uuid (GCAL_EVENT_WIDGET (l->data))) == 0)
        {
          g_warning ("Trying to add an event with the same uuid to the view");
          return;
        }
    }
  priv->days[day] = g_list_append (priv->days[day], widget);
  gtk_widget_set_parent (widget, GTK_WIDGET (container));
}
Ejemplo n.º 11
0
static GObject *
gimp_message_box_constructor (GType                  type,
                              guint                  n_params,
                              GObjectConstructParam *params)
{
  GObject        *object;
  GimpMessageBox *box;

  object = G_OBJECT_CLASS (parent_class)->constructor (type, n_params, params);

  box = GIMP_MESSAGE_BOX (object);

  if (box->stock_id)
    {
      gtk_widget_push_composite_child ();
      box->image = gtk_image_new_from_stock (box->stock_id,
                                             GTK_ICON_SIZE_DIALOG);
      gtk_widget_pop_composite_child ();

      gtk_misc_set_alignment (GTK_MISC (box->image), 0.0, 0.0);
      gtk_widget_set_parent (box->image, GTK_WIDGET (box));
      gtk_widget_show (box->image);
    }

  return object;
}
Ejemplo n.º 12
0
static void
exo_wrap_table_add (GtkContainer *container,
                    GtkWidget    *widget)
{
  ExoWrapTable *table = EXO_WRAP_TABLE (container);

  /* take over ownership */
  gtk_widget_set_parent (widget, GTK_WIDGET (table));

  /* add the child to our internal list */
  table->priv->children = g_list_append (table->priv->children, widget);

  /* realize the widget if required */
  if (gtk_widget_get_realized (GTK_WIDGET (container)))
    gtk_widget_realize (widget);

  /* map the widget if required */
  if (gtk_widget_get_visible (GTK_WIDGET (container)) && gtk_widget_get_visible (widget))
    {
      if (gtk_widget_get_mapped (GTK_WIDGET (container)))
        gtk_widget_map (widget);
    }

  /* queue a resize on the table */
  gtk_widget_queue_resize (GTK_WIDGET (container));
}
Ejemplo n.º 13
0
static void
widget_overlay_add (GtkContainer *container, GtkWidget *widget)
{
	WidgetOverlay *ovl = WIDGET_OVERLAY (container);
	ChildData *cd;

	cd = g_new0 (ChildData, 1);
	gtk_widget_set_parent (widget, GTK_WIDGET (ovl));
	cd->ovl = ovl;
	cd->child = widget;
	cd->halign = WIDGET_OVERLAY_ALIGN_CENTER;
	cd->valign = WIDGET_OVERLAY_ALIGN_END;
	cd->alpha = 1.;
	cd->scale = 1.;
	cd->ignore_events = FALSE;
	cd->is_tooltip = FALSE;
	
	ovl->priv->children = g_list_append (ovl->priv->children, cd);

	if (ovl->priv->scale_child) {
		ChildData *fcd;
		fcd = get_first_child (ovl);
		if (cd == fcd)
			gtk_range_set_value (ovl->priv->scale_range, cd->scale);

		ovl->priv->children = g_list_remove (ovl->priv->children, ovl->priv->scale_child);
		ovl->priv->children = g_list_append (ovl->priv->children, ovl->priv->scale_child);
	}
}
Ejemplo n.º 14
0
/**
 * gtk_layout_put:
 * @layout: a #GtkLayout
 * @child_widget: child widget
 * @x: X position of child widget
 * @y: Y position of child widget
 *
 * Adds @child_widget to @layout, at position (@x,@y).
 * @layout becomes the new parent container of @child_widget.
 * 
 **/
void           
gtk_layout_put (GtkLayout     *layout, 
		GtkWidget     *child_widget, 
		gint           x, 
		gint           y)
{
  GtkLayoutPrivate *priv;
  GtkLayoutChild *child;

  g_return_if_fail (GTK_IS_LAYOUT (layout));
  g_return_if_fail (GTK_IS_WIDGET (child_widget));

  priv = layout->priv;

  child = g_new (GtkLayoutChild, 1);

  child->widget = child_widget;
  child->x = x;
  child->y = y;

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

  if (gtk_widget_get_realized (GTK_WIDGET (layout)))
    gtk_widget_set_parent_window (child->widget, priv->bin_window);

  gtk_widget_set_parent (child_widget, GTK_WIDGET (layout));
}
Ejemplo n.º 15
0
static void
awt_gtk_panel_add (GtkContainer *container, GtkWidget *widget)
{
       AWTGtkPanel *panel = AWT_GTK_PANEL(container);

       g_return_if_fail (panel != NULL);
       g_return_if_fail (widget != NULL);

       gtk_widget_set_parent (widget, GTK_WIDGET (panel));

       /* Add at start of list using g_list_prepend to ensure widgets are added behind
          other widgets if they are added later. */

       panel->children = g_list_prepend (panel->children, widget);

       if (GTK_WIDGET_REALIZED (panel))
               gtk_widget_realize (widget);

       if (GTK_WIDGET_VISIBLE (panel) && GTK_WIDGET_VISIBLE (widget))
       {
               if (GTK_WIDGET_MAPPED (panel))
                       gtk_widget_map (widget);

               gtk_widget_queue_resize (GTK_WIDGET (panel));
       }
}
Ejemplo n.º 16
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));
}
/**
 * eel_gtk_container_child_add:
 *
 * @container: A GtkContainer widget.
 * @child: A non NULL unparented child.
 *
 * Add a @child to a @container.  The @child is realized, mapped
 * and resized if needed.  This is usually called from the "GtkContainer::add"
 * method of the @container.  The @child cannot be NULL.
 */
void
eel_gtk_container_child_add (GtkContainer *container,
                             GtkWidget *child)
{
    GtkWidget *widget;

    g_return_if_fail (GTK_IS_CONTAINER (container));
    g_return_if_fail (GTK_IS_WIDGET (child));

    widget = GTK_WIDGET (container);

    gtk_widget_set_parent (child, widget);

    if (gtk_widget_get_realized (widget))
    {
        gtk_widget_realize (child);
    }

    if (gtk_widget_get_mapped (widget)
            && gtk_widget_get_visible (child))
    {
        if (gtk_widget_get_mapped (widget))
        {
            gtk_widget_map (child);
        }

        gtk_widget_queue_resize (child);
    }
}
Ejemplo n.º 18
0
void
cb_compose_images_load_image (CbComposeImages *self,
                              const char      *image_path)
{
  GFile *file;
  GError *error = NULL;
  GdkTexture *texture;
  Image *image;

#if DEBUG
  g_assert (!cb_compose_images_is_full (self));
#endif

  file = g_file_new_for_path (image_path);
  texture = gdk_texture_new_from_file (file, &error);

  if (error != NULL)
    {
      g_warning (G_STRLOC ": Couldn't load image %s: %s",
                 image_path, error->message);
      g_object_unref (file);
      return;
    }

  g_array_set_size (self->images, self->images->len + 1);
  image = &g_array_index (self->images, Image, self->images->len - 1);
  image->path = g_strdup (image_path);
  image->fraction = 0.0;
  image->deleted = FALSE;

  image->image = gtk_image_new_from_paintable (GDK_PAINTABLE (g_steal_pointer (&texture)));
  gtk_image_set_can_shrink (GTK_IMAGE (image->image), TRUE);
  gtk_widget_set_size_request (image->image, -1, MIN_IMAGE_HEIGHT);
  gtk_widget_set_parent (image->image, GTK_WIDGET (self));

  image->delete_button = gtk_button_new_from_icon_name ("window-close-symbolic");
  gtk_style_context_add_class (gtk_widget_get_style_context (image->delete_button), "close-button");
  g_signal_connect (image->delete_button, "clicked", G_CALLBACK (delete_button_clicked_cb), self);
  gtk_widget_set_parent (image->delete_button, GTK_WIDGET (self));

  image->progressbar = gtk_progress_bar_new ();
  gtk_widget_hide (image->progressbar);
  gtk_widget_set_parent (image->progressbar, GTK_WIDGET (self));

  g_object_unref (file);
}
Ejemplo n.º 19
0
 virtual bool set_parent(widget_attached_t to) {
     widget_attached_t detached = 0;
     if ((detached = this->attached_to())) {
         gtk_widget_set_parent(detached, to);
         return true;
     }
     return false;
 }
Ejemplo n.º 20
0
static void
add (GtkContainer* container,
     GtkWidget   * child)
{
  /* TODO: consider using a GQueue or GSequence for the children */
  PRIV (container)->children = g_list_append (PRIV (container)->children, g_object_ref_sink (child));

  gtk_widget_set_parent (child, GTK_WIDGET (container));
}
Ejemplo n.º 21
0
static void ygtk_fixed_add (GtkContainer *container, GtkWidget *widget)
{
	YGtkFixed *fixed = YGTK_FIXED (container);
	YGtkFixedChild *child = g_new0 (YGtkFixedChild, 1);
	child->widget = widget;
	child->width = child->height = 50;
	fixed->children = g_slist_append (fixed->children, child);
	gtk_widget_set_parent (widget, GTK_WIDGET (fixed));
}
Ejemplo n.º 22
0
gboolean mw_tooltip_timeout(GtkWidget *tv)
{
	GtkAllocation allocation;
	int scr_w,scr_h, w, h, x, y;
	char *tooltiptext = NULL;

	tooltiptext = get_tooltip_text();

	tipwindow = gtk_window_new(GTK_WINDOW_POPUP);
	gtk_widget_set_parent(tipwindow, tv);
	gtk_widget_set_app_paintable(tipwindow, TRUE);
	gtk_window_set_resizable(GTK_WINDOW(tipwindow), FALSE);
	gtk_widget_set_name(tipwindow, "gtk-tooltips");
	g_signal_connect(G_OBJECT(tipwindow), "expose_event",
			G_CALLBACK(mw_paint_tip), NULL);
	gtk_widget_ensure_style (tipwindow);

	layout = gtk_widget_create_pango_layout (tipwindow, NULL);
	pango_layout_set_wrap(layout, PANGO_WRAP_WORD);
	pango_layout_set_width(layout, 300000);
	pango_layout_set_markup(layout, tooltiptext, strlen(tooltiptext));
	scr_w = gdk_screen_width();
	scr_h = gdk_screen_height();
	pango_layout_get_size (layout, &w, &h);
	w = PANGO_PIXELS(w) + 8;
	h = PANGO_PIXELS(h) + 8;

	gdk_window_get_pointer(NULL, &x, &y, NULL);
	if (!gtk_widget_get_has_window (mw.vbox))
	{
		gtk_widget_get_allocation (mw.vbox, &allocation);
		y += allocation.y;
	}

	x -= ((w >> 1) + 4);

	if ((x + w) > scr_w)
		x -= (x + w) - scr_w;
	else if (x < 0)
		x = 0;

	if ((y + h + 4) > scr_h)
		y = y - h;
	else
		y = y + 6;
	/*
	   g_object_unref(layout);
	   */
	g_free(tooltiptext);
	gtk_widget_set_size_request(tipwindow, w, h);
	gtk_window_move(GTK_WINDOW(tipwindow), x, y);
	gtk_widget_show(tipwindow);

	return FALSE;
}
Ejemplo n.º 23
0
/* Add an icon grid element and establish its initial visibility. */
static void panel_icon_grid_add(GtkContainer *container, GtkWidget *widget)
{
    PanelIconGrid *ig = PANEL_ICON_GRID(container);

    /* Insert at the tail of the child list.  This keeps the graphics in the order they were added. */
    ig->children = g_list_append(ig->children, widget);

    /* Add the widget to the layout container. */
    gtk_widget_set_parent(widget, GTK_WIDGET(container));
//    gtk_widget_queue_resize(GTK_WIDGET(container));
}
Ejemplo n.º 24
0
static void
gtk_check_button_add (GtkContainer *container,
                      GtkWidget    *widget)
{
  _gtk_bin_set_child (GTK_BIN (container), widget);

  if (gtk_widget_get_direction (GTK_WIDGET (container)) == GTK_TEXT_DIR_RTL)
    gtk_widget_insert_after (widget, GTK_WIDGET (container), NULL);
  else
    gtk_widget_set_parent (widget, GTK_WIDGET (container));
}
Ejemplo n.º 25
0
int
clip_GTK_WIDGETSETPARENT(ClipMachine * cm)
{
	C_widget *cwid = _fetch_cw_arg(cm);
	C_widget *cpar = _fetch_cwidget(cm,_clip_spar(cm,2));
	CHECKCWID(cwid,GTK_IS_WIDGET);
	CHECKARG2(2,MAP_t,NUMERIC_t); CHECKCWID(cwid,GTK_IS_WIDGET);
	gtk_widget_set_parent(cwid->widget, cpar->widget);
	return 0;
err:
	return 1;
}
Ejemplo n.º 26
0
static void
hildon_home_window_set_property (GObject      *gobject,
                                 guint         prop_id,
                                 const GValue *value,
                                 GParamSpec   *pspec)
{
  HildonHomeWindowPrivate      *priv = HILDON_HOME_WINDOW_GET_PRIVATE (gobject);
  switch (prop_id)
    {
      case PROP_MENU:
          hildon_home_window_set_menu (HILDON_HOME_WINDOW (gobject),
                                       GTK_MENU (g_value_get_object (value)));
          break;
      case PROP_WORK_AREA:
          hildon_home_window_set_work_area (HILDON_HOME_WINDOW (gobject),
                                            (GdkRectangle *)
                                              g_value_get_pointer (value));
          break;
      case PROP_TITLE:
          g_object_set (priv->titlebar,
                        "title", g_value_get_string (value),
                        NULL);
          break;
      case PROP_TITLEBAR:
            {
              GtkWidget *titlebar = GTK_WIDGET (g_value_get_object (value));

              if (GTK_IS_WIDGET (titlebar))
                {
                  if (priv->titlebar)
                    g_object_unref (priv->titlebar);

                  priv->titlebar = titlebar;

                  gtk_widget_push_composite_child ();

                  g_object_ref (priv->titlebar);
                  gtk_object_sink (GTK_OBJECT (priv->titlebar));
                  gtk_widget_set_parent (priv->titlebar,
                                         GTK_WIDGET (gobject));
                  gtk_widget_show (priv->titlebar);

                  gtk_widget_pop_composite_child ();
                }
            }
          break;

      default:
          G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
          break;
    }
}
Ejemplo n.º 27
0
void ygtk_ratio_box_pack (YGtkRatioBox *box, GtkWidget *child, gfloat ratio)
{
	YGtkRatioBoxChild* child_info;
	child_info = g_new (YGtkRatioBoxChild, 1);
	child_info->widget = child;
	child_info->ratio = ratio;

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

	gtk_widget_freeze_child_notify (child);
	gtk_widget_set_parent (child, GTK_WIDGET (box));
	gtk_widget_thaw_child_notify (child);
}
Ejemplo n.º 28
0
void
gtk_offscreen_box_add2 (GtkOffscreenBox  *offscreen_box,
			GtkWidget    *child)
{
  g_return_if_fail (GTK_IS_OFFSCREEN_BOX (offscreen_box));
  g_return_if_fail (GTK_IS_WIDGET (child));

  if (offscreen_box->child2 == NULL)
    {
      gtk_widget_set_parent_window (child, offscreen_box->offscreen_window2);
      gtk_widget_set_parent (child, GTK_WIDGET (offscreen_box));
      offscreen_box->child2 = child;
    }
}
Ejemplo n.º 29
0
static void
gtk_rotated_bin_add (GtkContainer *container,
                     GtkWidget    *widget)
{
  GtkRotatedBin *bin = GTK_ROTATED_BIN (container);

  if (!bin->child)
    {
      gtk_widget_set_parent_window (widget, bin->offscreen_window);
      gtk_widget_set_parent (widget, GTK_WIDGET (bin));
      bin->child = widget;
    }
  else
    g_warning ("GtkRotatedBin cannot have more than one child\n");
}
Ejemplo n.º 30
0
void wxNotebook::AddChildGTK(wxWindowGTK* child)
{
    // Hack Alert! (Part I): This sets the notebook as the parent of the child
    // widget, and takes care of some details such as updating the state and
    // style of the child to reflect its new location.  We do this early
    // because without it GetBestSize (which is used to set the initial size
    // of controls if an explicit size is not given) will often report
    // incorrect sizes since the widget's style context is not fully known.
    // See bug #901694 for details
    // (http://sourceforge.net/tracker/?func=detail&aid=901694&group_id=9863&atid=109863)
    gtk_widget_set_parent(child->m_widget, m_widget);

    // NOTE: This should be considered a temporary workaround until we can
    // work out the details and implement delaying the setting of the initial
    // size of widgets until the size is really needed.
}