static void
hildon_vvolumebar_size_allocate                 (GtkWidget *widget,
                                                 GtkAllocation *allocation)
{
    HildonVolumebarPrivate *priv;

    GtkAllocation range_allocation, button_allocation;

    priv = HILDON_VOLUMEBAR_GET_PRIVATE(widget);
    g_assert (priv);

    /* Center the widget horizontally */
    if (allocation->width > DEFAULT_BAR_WIDTH) {
        allocation->x +=
            (allocation->width - DEFAULT_BAR_WIDTH) / 2;
        allocation->width = DEFAULT_BAR_WIDTH;
    }

    GTK_WIDGET_CLASS (parent_class)->size_allocate (widget, allocation);

    if (priv->volumebar && GTK_WIDGET_VISIBLE (priv->volumebar)) {
        /* Allocate space for the slider */
        range_allocation.x = allocation->x;
        range_allocation.y = allocation->y + DEFAULT_ENDING_SIZE;

        range_allocation.width = DEFAULT_BAR_WIDTH;

        if (priv->tbutton && GTK_WIDGET_VISIBLE (priv->tbutton))
        {
            /* Leave room for the mute button */
            range_allocation.height = MAX (0,
                    allocation->height
                    - 2 * DEFAULT_ENDING_SIZE
                    - DEFAULT_VERTICAL_TBUTTON_HEIGHT
                    - VERTICAL_MUTE_GAP);
        }

        else
        {
            range_allocation.height = MAX (0,
                    allocation->height
                    - 2 * DEFAULT_ENDING_SIZE);
        }

        gtk_widget_size_allocate (GTK_WIDGET (priv->volumebar),
                &range_allocation);
    }

    if (priv->tbutton && GTK_WIDGET_VISIBLE (priv->tbutton)) {
        /* Allocate space for the mute button */
        button_allocation.x = allocation->x + HORIZONTAL_MUTE_GAP;
        button_allocation.y = allocation->y + allocation->height -
            DEFAULT_VERTICAL_TBUTTON_HEIGHT -
            VERTICAL_MUTE_GAP - 2 * DEFAULT_ENDING_SIZE;
        button_allocation.width = DEFAULT_VERTICAL_TBUTTON_WIDTH;
        button_allocation.height = DEFAULT_VERTICAL_TBUTTON_HEIGHT;
        gtk_widget_size_allocate (GTK_WIDGET (priv->tbutton),
                &button_allocation);
    }
}
Exemple #2
0
static void
gtk_combo_button_size_allocate (GtkWidget     *widget,
			 GtkAllocation *allocation)
{
  GtkComboButton *combo_button;
  GtkAllocation button_allocation;

  g_return_if_fail (widget != NULL);
  g_return_if_fail (GTK_IS_COMBO_BUTTON (widget));
  g_return_if_fail (allocation != NULL);

  GTK_WIDGET_CLASS (parent_class)->size_allocate (widget, allocation);

  combo_button = GTK_COMBO_BUTTON (widget);

  button_allocation = combo_button->button->allocation;
/*
  button_allocation.width = MIN(button_allocation.width, 
                                combo_button->button->requisition.width);
  button_allocation.height = MIN(button_allocation.height, 
                               combo_button->button->requisition.height);
  button_allocation.x += (combo_button->button->allocation.width-
                        button_allocation.width) / 2;
  button_allocation.y += (combo_button->button->allocation.height-
                        button_allocation.height) / 2;
*/

  gtk_widget_size_allocate (combo_button->button, &button_allocation);

  button_allocation.x=combo_button->button->allocation.x +
                      combo_button->button->allocation.width;
  button_allocation.width=combo_button->arrow->requisition.width;
  gtk_widget_size_allocate (combo_button->arrow, &button_allocation);

}
static void
gtk_application_window_real_size_allocate (GtkWidget     *widget,
                                           GtkAllocation *allocation)
{
  GtkApplicationWindow *window = GTK_APPLICATION_WINDOW (widget);

  if (window->priv->menubar != NULL)
    {
      GtkAllocation menubar_allocation;
      GtkAllocation child_allocation;
      gint menubar_height;
      GtkWidget *child;

      _gtk_window_set_allocation (GTK_WINDOW (widget), allocation, &child_allocation);
      menubar_allocation = child_allocation;

      gtk_widget_get_preferred_height_for_width (window->priv->menubar,
                                                 menubar_allocation.width,
                                                 &menubar_height, NULL);

      menubar_allocation.height = menubar_height;
      gtk_widget_size_allocate (window->priv->menubar, &menubar_allocation);

      child_allocation.y += menubar_height;
      child_allocation.height -= menubar_height;
      child = gtk_bin_get_child (GTK_BIN (window));
      if (child != NULL && gtk_widget_get_visible (child))
        gtk_widget_size_allocate (child, &child_allocation);
    }
  else
    GTK_WIDGET_CLASS (gtk_application_window_parent_class)
      ->size_allocate (widget, allocation);
}
Exemple #4
0
static void
gimp_frame_size_allocate (GtkWidget     *widget,
                          GtkAllocation *allocation)
{
  GtkFrame      *frame        = GTK_FRAME (widget);
  GtkWidget     *label_widget = gtk_frame_get_label_widget (frame);
  GtkWidget     *child        = gtk_bin_get_child (GTK_BIN (widget));
  GtkAllocation  child_allocation;

  gtk_widget_set_allocation (widget, allocation);

  gimp_frame_child_allocate (frame, &child_allocation);

  if (child && gtk_widget_get_visible (child))
    gtk_widget_size_allocate (child, &child_allocation);

  if (label_widget && gtk_widget_get_visible (label_widget))
    {
      GtkAllocation   label_allocation;
      GtkRequisition  label_requisition;
      gint            border_width;

      border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));

      gtk_widget_get_child_requisition (label_widget, &label_requisition);

      label_allocation.x      = allocation->x + border_width;
      label_allocation.y      = allocation->y + border_width;
      label_allocation.width  = MAX (label_requisition.width,
                                     allocation->width - 2 * border_width);
      label_allocation.height = label_requisition.height;

      gtk_widget_size_allocate (label_widget, &label_allocation);
    }
}
Exemple #5
0
static void
gd_stack_size_allocate (GtkWidget *widget,
			GtkAllocation *allocation)
{
  GdStack *stack = GD_STACK (widget);
  GdStackPrivate *priv = stack->priv;
  GtkAllocation child_allocation;

  g_return_if_fail (allocation != NULL);

  gtk_widget_set_allocation (widget, allocation);

  child_allocation = *allocation;
  child_allocation.x = 0;
  child_allocation.y = 0;

  if (priv->last_visible_child)
    gtk_widget_size_allocate (priv->last_visible_child->widget, &child_allocation);

  if (priv->visible_child)
    gtk_widget_size_allocate (priv->visible_child->widget, &child_allocation);

   if (gtk_widget_get_realized (widget))
    {
      gdk_window_move_resize (priv->view_window,
                              allocation->x, allocation->y,
                              allocation->width, allocation->height);
      gdk_window_move_resize (priv->bin_window,
                              get_bin_window_x (stack, allocation), 0,
                              allocation->width, allocation->height);
    }
}
Exemple #6
0
static void
ViewOvBoxSizeAllocate(GtkWidget *widget,         // IN
                      GtkAllocation *allocation) // IN
{
   ViewOvBox *that;
   ViewOvBoxPrivate *priv;
   GtkAllocation under;
   GtkAllocation over;

   gtk_widget_set_allocation (widget, allocation);

   that = VIEW_OV_BOX(widget);
   priv = that->priv;

   ViewOvBoxGetUnderGeometry(that, &under.x, &under.y, &under.width,
                             &under.height);
   ViewOvBoxGetOverGeometry(that, &over.x, &over.y, &over.width, &over.height);

   if (gtk_widget_get_realized(widget)) {
      gdk_window_move_resize(gtk_widget_get_window(widget),
                             allocation->x, allocation->y,
                             allocation->width, allocation->height);
      gdk_window_move_resize(priv->underWin, under.x, under.y, under.width,
                             under.height);
      gdk_window_move_resize(priv->overWin, over.x, over.y, over.width,
                             over.height);
   }

   under.x = 0;
   under.y = 0;
   gtk_widget_size_allocate(priv->under, &under);
   over.x = 0;
   over.y = 0;
   gtk_widget_size_allocate(priv->over, &over);
}
static void
gtk_notification_size_allocate (GtkWidget *widget,
                                GtkAllocation *allocation)
{
  GtkNotification *notification = GTK_NOTIFICATION (widget);
  GtkNotificationPrivate *priv = notification->priv;
  GtkBin *bin = GTK_BIN (widget);
  GtkAllocation child_allocation;
  GtkBorder padding;
  GtkWidget *child;
  int button_width;

  gtk_widget_set_allocation (widget, allocation);

  /* If somehow the notification changes while not hidden
     and we're not animating, immediately follow the resize */
  if (priv->animate_y > 0 &&
      !priv->animate_timeout)
    priv->animate_y = allocation->height;

  get_padding_and_border (notification, &padding);

  if (gtk_widget_get_realized (widget))
    {
      gdk_window_move_resize (gtk_widget_get_window (widget),
                              allocation->x,
                              allocation->y,
                              allocation->width,
                              allocation->height);
      gdk_window_move_resize (priv->bin_window,
                              0,
                              -allocation->height + priv->animate_y,
                              allocation->width,
                              allocation->height);
    }

  child_allocation.x = SHADOW_OFFSET_X + padding.left;
  child_allocation.y = padding.top;
  child_allocation.height = MAX (1, allocation->height - SHADOW_OFFSET_Y - padding.top - padding.bottom);
  gtk_widget_get_preferred_width_for_height (priv->close_button, child_allocation.height,
                                             NULL, &button_width);

  child_allocation.width = MAX (1, allocation->width - 2 * SHADOW_OFFSET_X - padding.left - padding.right - button_width);

  child = gtk_bin_get_child (bin);
  if (child && gtk_widget_get_visible (child))
    gtk_widget_size_allocate (child, &child_allocation);

  child_allocation.x += child_allocation.width;
  child_allocation.width = button_width;

  gtk_widget_size_allocate (priv->close_button, &child_allocation);
}
static void
hildon_home_window_size_allocate (GtkWidget *widget,
                                  GtkAllocation *allocation)
{
  HildonHomeWindow             *window;
  HildonHomeWindowPrivate      *priv;
  GtkRequisition                child_req;
  GtkAllocation                 child_allocation = {0};
  GtkWidget                    *child;

  window = HILDON_HOME_WINDOW (widget);
  priv = window->priv;
  child = GTK_BIN (widget)->child;

  widget->allocation = *allocation;

  if (!priv->work_area)
    return;

  if (GTK_IS_WIDGET (priv->titlebar))
    {
      gtk_widget_size_request (priv->titlebar, &child_req);
      child_allocation.x = priv->work_area->x;
      child_allocation.y = priv->work_area->y;
      child_allocation.width = priv->work_area->width;
      child_allocation.height = MIN (priv->work_area->height, child_req.height);

      gtk_widget_size_allocate (priv->titlebar, &child_allocation);
    }

  if (GTK_IS_WIDGET (child))
    {
      gint padding_left, padding_bottom, padding_right, padding_top;

      g_object_get (G_OBJECT (widget),
                    "padding-left",         &padding_left,
                    "padding-right",        &padding_right,
                    "padding-top",          &padding_top,
                    "padding_bottom",       &padding_bottom,
                    NULL);

      child_allocation.y += child_allocation.height + padding_top;
      child_allocation.height = priv->work_area->height -
                                child_allocation.height - padding_bottom
                                - padding_top;

      child_allocation.x = priv->work_area->x + padding_left;
      child_allocation.width =  priv->work_area->width - padding_right
                               - padding_left;

      gtk_widget_size_allocate (child, &child_allocation);
    }
}
/**
 * eel_gtk_container_child_size_allocate:
 *
 * @container: A GtkContainer widget.
 * @child: A child of @container or NULL;
 *
 * Invoke the "GtkWidget::size_allocate" method of @child.
 * This function is usually called from the "GtkWidget::size_allocate"
 * method of @container.  The child can be NULL, in which case this
 * function is a noop.
 */
void
eel_gtk_container_child_size_allocate (GtkContainer *container,
                                       GtkWidget *child,
                                       EelIRect child_geometry)
{
    GtkAllocation child_allocation;

    g_return_if_fail (GTK_IS_CONTAINER (container));

    if (child == NULL)
    {
        return;
    }

    g_return_if_fail (GTK_IS_WIDGET (child));
    g_return_if_fail (gtk_widget_get_parent (child) == GTK_WIDGET (container));

    if (eel_irect_is_empty (&child_geometry))
    {
        return;
    }

    child_allocation.x = child_geometry.x0;
    child_allocation.y = child_geometry.y0;
    child_allocation.width = eel_irect_get_width (child_geometry);
    child_allocation.height = eel_irect_get_height (child_geometry);

    gtk_widget_size_allocate (child, &child_allocation);
}
Exemple #10
0
static void columns_size_allocate(GtkWidget *widget, GtkAllocation *alloc)
{
  Columns *cols;
  ColumnsChild *child;
  GList *children;
  gint border;

  g_return_if_fail(widget != NULL);
  g_return_if_fail(IS_COLUMNS(widget));
  g_return_if_fail(alloc != NULL);

  cols = COLUMNS(widget);
  gtk_widget_set_allocation(widget, alloc);

  border = gtk_container_get_border_width(GTK_CONTAINER(cols));

  columns_alloc_horiz(cols, alloc->width, columns_gtk2_get_width);
  columns_alloc_vert(cols, alloc->height, columns_gtk2_get_height);

  for (children = cols->children; children && (child = children->data);
       children = children->next) {
    if (child->widget && gtk_widget_get_visible(child->widget)) {
      GtkAllocation call;
      call.x = alloc->x + border + child->x;
      call.y = alloc->y + border + child->y;
      call.width = child->w;
      call.height = child->h;
      gtk_widget_size_allocate(child->widget, &call);
    }
  }
}
void
_shell_embedded_window_allocate (ShellEmbeddedWindow *window,
                                 int                  x,
                                 int                  y,
                                 int                  width,
                                 int                  height)
{
  GtkAllocation allocation;

  g_return_if_fail (SHELL_IS_EMBEDDED_WINDOW (window));

  if (window->priv->position.x == x &&
      window->priv->position.y == y &&
      window->priv->position.width == width &&
      window->priv->position.height == height)
    return;

  window->priv->position.x = x;
  window->priv->position.y = y;
  window->priv->position.width = width;
  window->priv->position.height = height;

  if (gtk_widget_get_realized (GTK_WIDGET (window)))
    gdk_window_move_resize (gtk_widget_get_window (GTK_WIDGET (window)),
                            x, y, width, height);

  allocation.x = 0;
  allocation.y = 0;
  allocation.width = width;
  allocation.height = height;

  gtk_widget_size_allocate (GTK_WIDGET (window), &allocation);
}
Exemple #12
0
static void testWebkitAtkGetTextInTable(void)
{
    WebKitWebView* webView;
    AtkObject* obj;
    GMainLoop* loop;

    webView = WEBKIT_WEB_VIEW(webkit_web_view_new());
    g_object_ref_sink(webView);
    GtkAllocation alloc = { 0, 0, 800, 600 };
    gtk_widget_size_allocate(GTK_WIDGET(webView), &alloc);
    webkit_web_view_load_string(webView, contentsInTable, NULL, NULL, NULL);
    loop = g_main_loop_new(NULL, TRUE);

    g_timeout_add(100, (GSourceFunc)bail_out, loop);
    g_main_loop_run(loop);

    obj = gtk_widget_get_accessible(GTK_WIDGET(webView));
    g_assert(obj);
    obj = atk_object_ref_accessible_child(obj, 0);
    g_assert(obj);

    /* Tables should not implement AtkText */
    g_assert(G_TYPE_INSTANCE_GET_INTERFACE(obj, ATK_TYPE_TEXT, AtkTextIface) == NULL);

    g_object_unref(obj);
    g_object_unref(webView);
}
Exemple #13
0
static void list_stack_real_size_allocate (GtkWidget* base, GtkAllocation* allocation) {
    ListStack * self;
    GtkAllocation _tmp0_;
    GList* _tmp1_ = NULL;
    GList* children;
    GList* _tmp2_;
    self = (ListStack*) base;
    g_return_if_fail (allocation != NULL);
    _tmp0_ = *allocation;
    GTK_WIDGET_CLASS (list_stack_parent_class)->size_allocate ((GtkWidget*) G_TYPE_CHECK_INSTANCE_CAST (self, GTK_TYPE_FIXED, GtkFixed), &_tmp0_);
    _tmp1_ = gtk_container_get_children ((GtkContainer*) self);
    children = _tmp1_;
    _tmp2_ = children;
    {
        GList* child_collection = NULL;
        GList* child_it = NULL;
        child_collection = _tmp2_;
        for (child_it = child_collection; child_it != NULL; child_it = child_it->next) {
            GtkWidget* child = NULL;
            child = (GtkWidget*) child_it->data;
            {
                GtkWidget* _tmp3_;
                GtkAllocation _tmp4_;
                _tmp3_ = child;
                _tmp4_ = *allocation;
                gtk_widget_size_allocate (_tmp3_, &_tmp4_);
            }
        }
    }
    _g_list_free0 (children);
}
static void 
hildon_desktop_item_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
{
  GtkBin         *bin;
  GtkAllocation   alloc;
  GtkRequisition  req;

  g_return_if_fail (GTK_IS_BIN (widget));

  bin = GTK_BIN (widget);
    
  widget->allocation = *allocation;

  if (bin->child && GTK_WIDGET_VISIBLE (bin->child)) 
  {
    gtk_widget_size_request (bin->child,&req);

    alloc.x      = allocation->x;
    alloc.y      = allocation->y;
    alloc.width  = req.width;
    alloc.height = req.height;

    gtk_widget_size_allocate (bin->child,&alloc);
  }
}
static void
gtk_label_layoutable_size_allocate (GtkLayoutable        *layoutable,
                                    GtkAllocation        *allocation)
{
  GtkLabel *label = GTK_LABEL (layoutable);

  if (gtk_label_get_line_wrap (label))
    {
      PangoLayout *layout;
      PangoRectangle rect;

      /* Make it span the entire line.  */
      layout = gtk_label_get_layout (label);
      pango_layout_set_width (layout, allocation->width * PANGO_SCALE);
      pango_layout_get_extents (layout, NULL, &rect);

      allocation->width = rect.width / PANGO_SCALE + label->misc.xpad * 2;
      allocation->height = rect.height / PANGO_SCALE + label->misc.ypad * 2;

      gtk_misc_set_alignment (&label->misc, 0.0, 0.0);
      gtk_widget_size_allocate (GTK_WIDGET (label), allocation);
    }

  else
    (gtk_label_parent_layoutable_iface->size_allocate) (layoutable, allocation);
}
static void
hd_status_plugin_item_size_allocate (GtkWidget     *widget,
                                     GtkAllocation *allocation)
{
  GtkWidget *child;

  GTK_WIDGET_CLASS (hd_status_plugin_item_parent_class)->size_allocate (widget,
                                                                        allocation);

  child = gtk_bin_get_child (GTK_BIN (widget));

  if (child)
    {
      GtkAllocation child_allocation;
      guint border_width;

      border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));

      child_allocation.x = allocation->x + border_width;
      child_allocation.y = allocation->y + border_width;
      child_allocation.width = allocation->width - 2 * border_width;
      child_allocation.height = allocation->height - 2 * border_width;

      gtk_widget_size_allocate (child, &child_allocation);
    }
}
void AcceleratedCompositingContext::resizeRootLayer(const IntSize& newSize)
{
    if (!m_rootLayerEmbedder)
        return;

    if (m_rootLayer->size() == newSize)
        return;

    GtkAllocation allocation;
    allocation.x = 0;
    allocation.y = 0;
    allocation.width = newSize.width();
    allocation.height = newSize.height();
    gtk_widget_size_allocate(GTK_WIDGET(m_rootLayerEmbedder), &allocation);

    m_rootLayer->setSize(newSize);

    // If the newSize exposes new areas of the non-composited content a setNeedsDisplay is needed
    // for those newly exposed areas.
    FloatSize oldSize = m_nonCompositedContentLayer->size();
    m_nonCompositedContentLayer->setSize(newSize);

    if (newSize.width() > oldSize.width()) {
        float height = std::min(static_cast<float>(newSize.height()), oldSize.height());
        m_nonCompositedContentLayer->setNeedsDisplayInRect(FloatRect(oldSize.width(), 0, newSize.width() - oldSize.width(), height));
    }

    if (newSize.height() > oldSize.height())
        m_nonCompositedContentLayer->setNeedsDisplayInRect(FloatRect(0, oldSize.height(), newSize.width(), newSize.height() - oldSize.height()));

    m_nonCompositedContentLayer->setNeedsDisplayInRect(IntRect(IntPoint(), newSize));
    scheduleLayerFlush();
}
Exemple #18
0
static void gtk_page_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* alloc, wxWindow *win )
{
    if (g_isIdle)
        wxapp_install_idle_handler();

    // wxWindowGTK::SetSize() ignores position if parent does not have
    // m_wxwindow, and infinite sizing loop can result if position is part
    // of this check. See patch 1907189.
    if ((win->m_width == alloc->width) &&
        (win->m_height == alloc->height))
    {
        return;
    }

    win->SetSize( alloc->x, alloc->y, alloc->width, alloc->height );

    /* GTK 1.2 up to version 1.2.5 is broken so that we have to call allocate
       here in order to make repositioning after resizing to take effect. */
    if ((gtk_major_version == 1) &&
        (gtk_minor_version == 2) &&
        (gtk_micro_version < 6) &&
        (win->m_wxwindow) &&
        (GTK_WIDGET_REALIZED(win->m_wxwindow)))
    {
        gtk_widget_size_allocate( win->m_wxwindow, alloc );
    }
}
Exemple #19
0
static void test_webkit_atk_get_text_at_offset_text_input(void)
{
    WebKitWebView* webView;
    AtkObject* obj;
    GMainLoop* loop;
    AtkText* text_obj;

    webView = WEBKIT_WEB_VIEW(webkit_web_view_new());
    g_object_ref_sink(webView);
    GtkAllocation alloc = { 0, 0, 800, 600 };
    gtk_widget_size_allocate(GTK_WIDGET(webView), &alloc);
    webkit_web_view_load_string(webView, contentsInTextInput, NULL, NULL, NULL);
    loop = g_main_loop_new(NULL, TRUE);

    g_timeout_add(100, (GSourceFunc)bail_out, loop);
    g_main_loop_run(loop);

    /* Get to the inner AtkText object */
    obj = gtk_widget_get_accessible(GTK_WIDGET(webView));
    g_assert(obj);
    obj = atk_object_ref_accessible_child(obj, 0);
    g_assert(obj);
    obj = atk_object_ref_accessible_child(obj, 0);
    g_assert(obj);

    text_obj = ATK_TEXT(obj);
    g_assert(ATK_IS_TEXT(text_obj));

    run_get_text_tests(text_obj);

    g_object_unref(webView);
}
static void
awt_gtk_panel_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
{
	AWTGtkPanel *panel = AWT_GTK_PANEL(widget);
	GtkWidget *child;
	GList *children;
	GtkAllocation childAllocation;
	
	g_return_if_fail (widget != NULL);
	
  	widget->allocation = *allocation;
  
  	if (GTK_WIDGET_REALIZED (widget))
    	gdk_window_move_resize (widget->window,
			    allocation->x,
			    allocation->y,
			    allocation->width,
			    allocation->height);

	children = panel->children;
	
	/* It is a requiremnt in Gtk that when a container is allocated a size it must call
	   gtk_widget_size_allocate for all its children. As we don't want to do layout of widgets
	   in this custom container we simply ask the child to allocate its size and position using
	   its current size and position (thus not affecting the layout). */
	
	while (children)
	{
		child = children->data;
		childAllocation = child->allocation;
		gtk_widget_size_allocate (child, &childAllocation);
		
		children = children->next;
	}
}
static void
image_table_size_allocate (GtkWidget *image_table,
			   GtkAllocation *allocation,
			   gpointer callback_data)
{
	static int recursion_count = 0;
	GtkAllocation w_allocation;

	g_return_if_fail (EEL_IS_IMAGE_TABLE (image_table));
	g_return_if_fail (allocation != NULL);
	g_return_if_fail (GTK_IS_WINDOW (callback_data));

	recursion_count++;

	if (0) g_timeout_add (0, foo_timeout, callback_data);

	/*gtk_widget_queue_resize (GTK_WIDGET (callback_data));*/

	gtk_widget_get_allocation (GTK_WIDGET (image_table), &w_allocation);
	if (0) gtk_widget_size_allocate (GTK_WIDGET (image_table),
					 &w_allocation);
	
	g_print ("%s(%d)\n", G_STRFUNC, recursion_count);

	recursion_count--;
}
Exemple #22
0
static void panels_size_allocate(GtkWidget *widget, GtkAllocation *alloc)
{
    Panels *panels;
    GtkWidget *child;
    GList *children;
    gint border;

    g_return_if_fail(widget != NULL);
    g_return_if_fail(IS_PANELS(widget));
    g_return_if_fail(alloc != NULL);

    panels = PANELS(widget);
    widget->allocation = *alloc;
    border = GTK_CONTAINER(panels)->border_width;

    for (children = panels->children;
         children && (child = children->data);
         children = children->next) {
        GtkAllocation call;

        call.x = alloc->x + border;
        call.width = alloc->width - 2*border;
        call.y = alloc->y + border;
        call.height = alloc->height - 2*border;

        gtk_widget_size_allocate(child, &call);
    }
}
Exemple #23
0
static void
gtk_combo_size_allocate (GtkWidget     *widget,
			 GtkAllocation *allocation)
{
  GtkCombo *combo;

  g_return_if_fail (widget != NULL);
  g_return_if_fail (GTK_IS_COMBO (widget));
  g_return_if_fail (allocation != NULL);

  GTK_WIDGET_CLASS (parent_class)->size_allocate (widget, allocation);
  
  combo = GTK_COMBO (widget);

  if (combo->entry->allocation.height > combo->entry->requisition.height)
    {
      GtkAllocation button_allocation;

      button_allocation = combo->button->allocation;
      button_allocation.height = combo->entry->requisition.height;
      button_allocation.y = combo->entry->allocation.y + 
	(combo->entry->allocation.height - combo->entry->requisition.height) 
	/ 2;
      gtk_widget_size_allocate (combo->button, &button_allocation);
    }
}
Exemple #24
0
static void
gdl_dock_size_allocate (GtkWidget     *widget,
                        GtkAllocation *allocation)
{
    GdlDock       *dock;
    GtkContainer  *container;
    guint          border_width;

    g_return_if_fail (widget != NULL);
    g_return_if_fail (GDL_IS_DOCK (widget));
    
    dock = GDL_DOCK (widget);
    container = GTK_CONTAINER (widget);
    border_width = container->border_width;

    widget->allocation = *allocation;

    /* reduce allocation by border width */
    allocation->x += border_width;
    allocation->y += border_width;
    allocation->width = MAX (1, allocation->width - 2 * border_width);
    allocation->height = MAX (1, allocation->height - 2 * border_width);

    if (dock->root && GTK_WIDGET_VISIBLE (dock->root))
        gtk_widget_size_allocate (GTK_WIDGET (dock->root), allocation);
}
static void
size_allocate (GtkWidget *widget,
    GtkAllocation *allocation)
{
  GtkBin *bin = GTK_BIN (widget);
  GtkAllocation child_allocation;
  GtkWidget *child;

  gtk_widget_set_allocation (widget, allocation);

  child = gtk_bin_get_child (bin);

  if (child && gtk_widget_get_visible (child))
    {
      child_allocation.x = allocation->x +
          gtk_container_get_border_width (GTK_CONTAINER (widget));
      child_allocation.y = allocation->y +
          gtk_container_get_border_width (GTK_CONTAINER (widget));
      child_allocation.width = MAX (allocation->width -
          gtk_container_get_border_width (GTK_CONTAINER (widget)) * 2, 0);
      child_allocation.height = MAX (allocation->height -
          gtk_container_get_border_width (GTK_CONTAINER (widget)) * 2, 0);

      gtk_widget_size_allocate (child, &child_allocation);
    }
}
static void
gstyle_color_widget_size_allocate (GtkWidget     *widget,
                                   GtkAllocation *allocation)
{
  GstyleColorWidget *self = (GstyleColorWidget *)widget;
  GtkAllocation child_allocation;

  g_assert (GSTYLE_IS_COLOR_WIDGET (self));

  gtk_widget_set_allocation (widget, allocation);

  if (self->label && gtk_widget_get_visible (GTK_WIDGET (self->label)))
  {
    child_allocation.x = 0;
    child_allocation.y = 0;
    child_allocation.width = allocation->width;
    child_allocation.height = allocation->height;

    gtk_widget_size_allocate (GTK_WIDGET (self->label), &child_allocation);
  }

  if (gtk_widget_get_realized (widget))
    gdk_window_move_resize (gtk_widget_get_window (widget),
                            allocation->x,
                            allocation->y,
                            allocation->width,
                            allocation->height);
}
Exemple #27
0
static void
gtk_tool_item_size_allocate (GtkWidget     *widget,
                             GtkAllocation *allocation)
{
    GtkToolItem *toolitem = GTK_TOOL_ITEM (widget);
    GtkAllocation child_allocation;
    gint border_width;
    GtkWidget *child = GTK_BIN (widget)->child;

    widget->allocation = *allocation;
    border_width = GTK_CONTAINER (widget)->border_width;

    if (toolitem->priv->drag_window)
        gdk_window_move_resize (toolitem->priv->drag_window,
                                widget->allocation.x + border_width,
                                widget->allocation.y + border_width,
                                widget->allocation.width - border_width * 2,
                                widget->allocation.height - border_width * 2);

    if (child && gtk_widget_get_visible (child))
    {
        child_allocation.x = allocation->x + border_width;
        child_allocation.y = allocation->y + border_width;
        child_allocation.width = allocation->width - 2 * border_width;
        child_allocation.height = allocation->height - 2 * border_width;

        gtk_widget_size_allocate (child, &child_allocation);
    }
}
Exemple #28
0
static void gtk_page_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* alloc, wxWindow *win )
{
    if (g_isIdle)
        wxapp_install_idle_handler();

    if ((win->m_x == alloc->x) &&
        (win->m_y == alloc->y) &&
        (win->m_width == alloc->width) &&
        (win->m_height == alloc->height))
    {
        return;
    }

    win->SetSize( alloc->x, alloc->y, alloc->width, alloc->height );

    /* GTK 1.2 up to version 1.2.5 is broken so that we have to call allocate
       here in order to make repositioning after resizing to take effect. */
    if ((gtk_major_version == 1) &&
        (gtk_minor_version == 2) &&
        (gtk_micro_version < 6) &&
        (win->m_wxwindow) &&
        (GTK_WIDGET_REALIZED(win->m_wxwindow)))
    {
        gtk_widget_size_allocate( win->m_wxwindow, alloc );
    }
}
Exemple #29
0
void
gtk_xtbin_resize (GtkWidget *widget,
                  gint       width,
                  gint       height)
{
  Arg args[2];
  GtkXtBin *xtbin = GTK_XTBIN (widget);
  GtkAllocation allocation;

#ifdef DEBUG_XTBIN
  printf("gtk_xtbin_resize %p %d %d\n", (void *)widget, width, height);
#endif

  XtSetArg(args[0], XtNheight, height);
  XtSetArg(args[1], XtNwidth,  width);
  XtSetValues(xtbin->xtclient.top_widget, args, 2);
  xtbin->height = height;
  xtbin->width  = width;

  /* we need to send a size allocate so the socket knows about the
     size changes */
  allocation.x = xtbin->x;
  allocation.y = xtbin->y;
  allocation.width = xtbin->width;
  allocation.height = xtbin->height;

  gtk_widget_size_allocate(widget, &allocation);
}
Exemple #30
0
static void
gtk_bubble_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
{
	GtkWidget *child = gtk_bin_get_child (GTK_BIN (widget));
	GtkAllocation child_allocation;

	gtk_widget_set_allocation (widget, allocation);

	if (child && gtk_widget_get_visible (child))
	{
		child_allocation.x = allocation->x + MIN (25.0,
					allocation->width / 2.0);
		child_allocation.y = allocation->y + MIN (25.0,
					allocation->height / 2.0);
		child_allocation.width = allocation->width - MIN (50.0,
					allocation->width);
		child_allocation.height = allocation->height - MIN (50.0,
					allocation->height);

		gtk_widget_size_allocate (child, &child_allocation);
	}

	GTK_WIDGET_CLASS (gtk_bubble_parent_class)->size_allocate (widget,
				allocation);
}