• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ gtk_widget_set_allocation函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中gtk_widget_set_allocation函数的典型用法代码示例。如果您正苦于以下问题:C++ gtk_widget_set_allocation函数的具体用法?C++ gtk_widget_set_allocation怎么用?C++ gtk_widget_set_allocation使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了gtk_widget_set_allocation函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: test_scrollbars_visibility

/**
 * test_scrollbars_visibility:
 *
 * The objective of this test is to verify that the scrollbars aren't
 * shown when the image clearly fits inside the allocation and that
 * they are shown when the image clearly does not fit.
 **/
static void
test_scrollbars_visibility ()
{
    printf ("test_scrollbars_visibility\n");
    setup ();

    GtkAllocation alloc = {0, 0, 200, 200};
    gtk_widget_set_allocation (GTK_WIDGET (scroll_win), &alloc);

    fake_realize (GTK_WIDGET (scroll_win));

    gtk_widget_set_allocation (GTK_WIDGET (view), &alloc);
    fake_realize (GTK_WIDGET (view));

    // The 100x100 pixbuf is smaller than the 200x200 allocation, so
    // don't show scrollbars.
    gtk_image_view_set_pixbuf (view, pixbuf, TRUE);

    assert (!gtk_widget_get_visible (scroll_win->hscroll));
    assert (!gtk_widget_get_visible (scroll_win->vscroll));

    // Zoomed width and height is 3 * 100 == 300 which is greater than
    // 200, so the scrollbars should be shown.
    gtk_image_view_set_zoom (view, 3.0);

    assert (gtk_widget_get_visible (scroll_win->hscroll));
    assert (gtk_widget_get_visible (scroll_win->vscroll));
    
    teardown ();
}
开发者ID:GNOME,项目名称:gtkimageview,代码行数:37,代码来源:test-scrollwin.c


示例2: rb_vis_widget_size_allocate

static void
rb_vis_widget_size_allocate (GtkWidget *widget,
			     GtkAllocation *allocation)
{
	RBVisWidget *rbvw = RB_VIS_WIDGET (widget);
	gtk_widget_set_allocation (widget, allocation);

	if (!gtk_widget_get_realized (widget))
		return;

	rb_debug ("handling size allocate event ([%d,%d] - [%d,%d])",
		  allocation->x, allocation->y,
		  allocation->width, allocation->height);
	gdk_window_move_resize (gtk_widget_get_window (widget),
				allocation->x, allocation->y,
				allocation->width, allocation->height);

	if (rbvw->width != allocation->width) {
		rbvw->width = allocation->width;
		g_object_notify (G_OBJECT (rbvw), "width");
	}
	if (rbvw->height != allocation->height) {
		rbvw->height = allocation->height;
		g_object_notify (G_OBJECT (rbvw), "height");
	}
}
开发者ID:AdamZ,项目名称:rhythmbox-magnatune,代码行数:26,代码来源:rb-vis-widget.c


示例3: gd_stack_size_allocate

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);
    }
}
开发者ID:Udit93,项目名称:gnome-music,代码行数:32,代码来源:gd-stack.c


示例4: gimp_frame_size_allocate

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);
    }
}
开发者ID:AdamGrzonkowski,项目名称:gimp-1,代码行数:35,代码来源:gimpframe.c


示例5: moz_gtk_scrolled_window_paint

static gint
moz_gtk_scrolled_window_paint(GdkDrawable* drawable, GdkRectangle* rect,
                              GdkRectangle* cliprect, GtkWidgetState* state)
{
    GtkStyle* style;
    GtkAllocation allocation;
    GtkWidget* widget;

    ensure_scrolled_window_widget();
    widget = gParts->scrolledWindowWidget;

    gtk_widget_get_allocation(widget, &allocation);
    allocation.x = rect->x;
    allocation.y = rect->y;
    allocation.width = rect->width;
    allocation.height = rect->height;
    gtk_widget_set_allocation(widget, &allocation);

    style = gtk_widget_get_style(widget);
    TSOffsetStyleGCs(style, rect->x - 1, rect->y - 1);
    gtk_paint_shadow(style, drawable, GTK_STATE_NORMAL, GTK_SHADOW_IN,
                     cliprect, gParts->scrolledWindowWidget, "scrolled_window",
                     rect->x, rect->y, rect->width, rect->height);
    return MOZ_GTK_SUCCESS;
}
开发者ID:dslab-epfl,项目名称:warr,代码行数:25,代码来源:gtk2drawing.c


示例6: xfce_panel_image_size_allocate

static void
xfce_panel_image_size_allocate (GtkWidget     *widget,
                                GtkAllocation *allocation)
{
  XfcePanelImagePrivate *priv = XFCE_PANEL_IMAGE (widget)->priv;

  gtk_widget_set_allocation (widget, allocation);

  /* check if the available size changed */
  if ((priv->pixbuf != NULL || priv->source != NULL)
      && allocation->width > 0
      && allocation->height > 0
      && (allocation->width != priv->width
      || allocation->height != priv->height))
    {
      /* store the new size */
      priv->width = allocation->width;
      priv->height = allocation->height;

      /* free cache */
      xfce_panel_image_unref_null (priv->cache);

      if (priv->pixbuf == NULL)
        {
          /* delay icon loading */
          priv->idle_load_id = gdk_threads_add_idle_full (G_PRIORITY_DEFAULT_IDLE, xfce_panel_image_load,
                                                          widget, xfce_panel_image_load_destroy);
        }
      else
        {
          /* directly render pixbufs */
          xfce_panel_image_load (widget);
        }
    }
}
开发者ID:BrotherAl,项目名称:xfce4-panel,代码行数:35,代码来源:xfce-panel-image.c


示例7: gtk_bubble_size_allocate

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);
}
开发者ID:echoline,项目名称:gtk-background,代码行数:25,代码来源:bubble.c


示例8: columns_size_allocate

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);
    }
  }
}
开发者ID:FauxFaux,项目名称:PuTTYTray,代码行数:31,代码来源:gtkcols.c


示例9: gstyle_color_widget_size_allocate

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);
}
开发者ID:badwolfie,项目名称:gnome-builder,代码行数:28,代码来源:gstyle-color-widget.c


示例10: gd_tagged_entry_size_allocate

static void
gd_tagged_entry_size_allocate (GtkWidget *widget,
                               GtkAllocation *allocation)
{
    GdTaggedEntry *self = GD_TAGGED_ENTRY (widget);
    gint x, y, width, height;
    GdTaggedEntryTag *tag;
    GList *l;

    gtk_widget_set_allocation (widget, allocation);
    GTK_WIDGET_CLASS (gd_tagged_entry_parent_class)->size_allocate (widget, allocation);

    if (gtk_widget_get_realized (widget))
    {
        gd_tagged_entry_tag_panel_get_position (self, &x, &y);

        for (l = self->tags; l != NULL; l = l->next)
        {
            GtkBorder margin;

            tag = l->data;
            gd_tagged_entry_tag_get_size (tag, self, &width, &height);
            gd_tagged_entry_tag_get_margin (tag, self, &margin);
            gdk_window_move_resize (tag->window, x, y + margin.top, width, height);

            x += width;
        }

        gtk_widget_queue_draw (widget);
    }
}
开发者ID:riadnassiffe,项目名称:gnome-builder,代码行数:31,代码来源:gd-tagged-entry.c


示例11: size_allocate

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);
    }
}
开发者ID:chrisinvisible,项目名称:empathy,代码行数:26,代码来源:empathy-individual-linker.c


示例12: gtk_cell_view_size_allocate

static void
gtk_cell_view_size_allocate (GtkWidget     *widget,
                             GtkAllocation *allocation)
{
  GtkCellView        *cellview = GTK_CELL_VIEW (widget);
  GtkCellViewPrivate *priv = cellview->priv;
  gint                alloc_width, alloc_height;

  gtk_widget_set_allocation (widget, allocation);

  gtk_cell_area_context_get_allocation (priv->context, &alloc_width, &alloc_height);

  /* The first cell view in context is responsible for allocating the context at allocate time 
   * (or the cellview has its own context and is not grouped with any other cell views) 
   *
   * If the cellview is in "fit model" mode, we assume its not in context and needs to
   * allocate every time.
   */
  if (priv->fit_model)
    gtk_cell_area_context_allocate (priv->context, allocation->width, allocation->height);
  else if (alloc_width != allocation->width && priv->orientation == GTK_ORIENTATION_HORIZONTAL)
    gtk_cell_area_context_allocate (priv->context, allocation->width, -1);
  else if (alloc_height != allocation->height && priv->orientation == GTK_ORIENTATION_VERTICAL)
    gtk_cell_area_context_allocate (priv->context, -1, allocation->height);
}
开发者ID:BYC,项目名称:gtk,代码行数:25,代码来源:gtkcellview.c


示例13: ViewOvBoxSizeAllocate

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);
}
开发者ID:Jactry,项目名称:virt-viewer,代码行数:35,代码来源:ovBox.c


示例14: pizza_size_allocate

static void pizza_size_allocate(GtkWidget* widget, GtkAllocation* alloc)
{
    wxPizza* pizza = WX_PIZZA(widget);
    GtkBorder border;
    pizza->get_border(border);
    int w = alloc->width - border.left - border.right;
    if (w < 0) w = 0;

    if (gtk_widget_get_realized(widget))
    {
        int h = alloc->height - border.top - border.bottom;
        if (h < 0) h = 0;
        const int x = alloc->x + border.left;
        const int y = alloc->y + border.top;

        GdkWindow* window = gtk_widget_get_window(widget);
        int old_x, old_y;
        gdk_window_get_position(window, &old_x, &old_y);

        if (x != old_x || y != old_y ||
            w != gdk_window_get_width(window) || h != gdk_window_get_height(window))
        {
            gdk_window_move_resize(window, x, y, w, h);

            if (border.left + border.right + border.top + border.bottom)
            {
                // old and new border areas need to be invalidated,
                // otherwise they will not be erased/redrawn properly
                GtkAllocation old_alloc;
                gtk_widget_get_allocation(widget, &old_alloc);
                GdkWindow* parent = gtk_widget_get_parent_window(widget);
                gdk_window_invalidate_rect(parent, &old_alloc, false);
                gdk_window_invalidate_rect(parent, alloc, false);
            }
        }
    }

    gtk_widget_set_allocation(widget, alloc);

    // adjust child positions
    for (const GList* p = pizza->m_children; p; p = p->next)
    {
        const wxPizzaChild* child = static_cast<wxPizzaChild*>(p->data);
        if (gtk_widget_get_visible(child->widget))
        {
            GtkAllocation child_alloc;
            // note that child positions do not take border into
            // account, they need to be relative to widget->window,
            // which has already been adjusted
            child_alloc.x = child->x - pizza->m_scroll_x;
            child_alloc.y = child->y - pizza->m_scroll_y;
            child_alloc.width  = child->width;
            child_alloc.height = child->height;
            if (gtk_widget_get_direction(widget) == GTK_TEXT_DIR_RTL)
                child_alloc.x = w - child_alloc.x - child_alloc.width;
            gtk_widget_size_allocate(child->widget, &child_alloc);
        }
    }
}
开发者ID:chromylei,项目名称:third_party,代码行数:59,代码来源:win_gtk.cpp


示例15: test_scrollbars_hide_when_zooming_out

/**
 * test_scrollbars_hide_when_zooming_out:
 *
 * The objective of this test is to verify that the scrollbars aren't
 * shown if the view is zoomed out so that it exactly fits inside its
 * allocation.
 *
 * For example if the image width is 100, zoom 1.0 and allocation
 * width 55, then the scrollbars are shown, 100 * 1.0 > 55. If the
 * image is then zoomed out to 0.5 zoom, the scrollbars shouldn't be
 * shown, 100 * 0.5 < 55.
 **/
static void
test_scrollbars_hide_when_zooming_out ()
{
    printf ("test_scrollbars_hide_when_zooming_out\n");
    setup ();

    GtkAllocation alloc = {0, 0, 105, 105};
    
    gtk_widget_set_allocation (GTK_WIDGET (scroll_win), &alloc);
    fake_realize (GTK_WIDGET (scroll_win));

    gtk_widget_set_allocation (GTK_WIDGET (view), &alloc);
    fake_realize (GTK_WIDGET (view));

    gtk_image_view_set_pixbuf (view, pixbuf, TRUE);
    // 105 > 100, so no scrollbars
    assert (!gtk_widget_get_visible (scroll_win->hscroll));
    assert (!gtk_widget_get_visible (scroll_win->vscroll));

    gtk_image_view_zoom_in (view);
    // 105 < 100 * 1.5, so show scrollbars. Due to the scrollbars, the
    // views allocation changes! The scrollbars are roughly 15 pixels
    // in width and height. In real code, the zoom in action would
    // automatically cause the allocation to be recalculated, but I
    // don't know how to simulate that.
    gtk_widget_get_allocation (GTK_WIDGET (view), &alloc);
    alloc.width -= 15;
    alloc.height -= 15;
    gtk_widget_set_allocation (GTK_WIDGET (view), &alloc);
    assert (gtk_widget_get_visible (scroll_win->hscroll));
    assert (gtk_widget_get_visible (scroll_win->vscroll));

    gtk_image_view_zoom_out (view);
    // 105 > 100, so no scrollbars. Same here as above, the zoom out
    // should cause the view to be resized.

    gtk_widget_get_allocation (GTK_WIDGET (view), &alloc);
    alloc.width += 15;
    alloc.height += 15;
    gtk_widget_set_allocation (GTK_WIDGET (view), &alloc);
    
    assert (!gtk_widget_get_visible (scroll_win->hscroll));
    assert (!gtk_widget_get_visible (scroll_win->vscroll));

    teardown();
}
开发者ID:GNOME,项目名称:gtkimageview,代码行数:58,代码来源:test-scrollwin.c


示例16: gtk_sys_menu_size_allocate

/* 
 * sysmenu have to adjusts: x, y, width, height 
 */
static void gtk_sys_menu_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
{
    GtkSysMenuPrivate * priv = GTK_SYS_MENU(widget)->priv;
    GdkRectangle rectangle;
    GdkScreen  * screen;

    if (gtk_widget_get_realized (widget))
    {
        screen = gdk_window_get_screen (priv->event_window);
        gdk_screen_get_monitor_geometry (screen, gdk_screen_get_primary_monitor (screen), &rectangle);
        priv->monitor_height = rectangle.height;
        priv->monitor_width  = rectangle.width;
        priv->allocation.height = MAX (allocation->height, priv->amount * SYS_MENU_ITEM_HEIGHT + 15);
        
        if (priv->allocation.height > priv->monitor_height)
        {
            priv->allocation.height = priv->monitor_height - SYS_MENU_BOTTOM_Y;
            priv->exceed = TRUE;
        }
        priv->allocation.y = priv->monitor_height - priv->allocation.height - SYS_MENU_BOTTOM_Y;
        if (priv->exceed)
        {
            priv->allocation.y += 5;
            priv->allocation.height -= 5;
        }
        if (allocation->x + priv->allocation.width > priv->monitor_width && allocation->x < priv->allocation.width)
            priv->allocation.x = allocation->x - priv->allocation.width;
        else
            priv->allocation.x = allocation->x;

        priv->end = priv->start + (priv->allocation.height - 15) / SYS_MENU_ITEM_HEIGHT - 1;

        gtk_widget_set_allocation (widget, &priv->allocation);
        gdk_window_move_resize (priv->event_window,
                                priv->allocation.x, 
                                priv->allocation.y + 7, 
                                priv->allocation.width, 
                                priv->allocation.height - 15);
    }
    else
    {
        gtk_widget_set_allocation (widget, allocation);
    }
}
开发者ID:hualet,项目名称:lightdm-startos-greeter,代码行数:47,代码来源:gtksysmenu.c


示例17: gtk_widget_get_allocation

void wxStaticBox::GetBordersForSizer(int *borderTop, int *borderOther) const
{
    GtkAllocation alloc, child_alloc;
    gtk_widget_get_allocation(m_widget, &alloc);
    const int w_save = alloc.width;
    const int h_save = alloc.height;
    if (alloc.width < 50) alloc.width = 50;
    if (alloc.height < 50) alloc.height = 50;
    gtk_widget_set_allocation(m_widget, &alloc);

    GTK_FRAME_GET_CLASS(m_widget)->compute_child_allocation(GTK_FRAME(m_widget), &child_alloc);

    alloc.width = w_save;
    alloc.height = h_save;
    gtk_widget_set_allocation(m_widget, &alloc);

    *borderTop = child_alloc.y - alloc.y;
    *borderOther = child_alloc.x - alloc.x;
}
开发者ID:3v1n0,项目名称:wxWidgets,代码行数:19,代码来源:statbox.cpp


示例18: gtk_rotated_bin_size_allocate

static void
gtk_rotated_bin_size_allocate (GtkWidget     *widget,
                               GtkAllocation *allocation)
{
  GtkRotatedBin *bin = GTK_ROTATED_BIN (widget);
  guint border_width;
  gint w, h;
  gdouble s, c;

  gtk_widget_set_allocation (widget, allocation);

  border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));

  w = allocation->width - border_width * 2;
  h = allocation->height - border_width * 2;

  if (gtk_widget_get_realized (widget))
    gdk_window_move_resize (gtk_widget_get_window (widget),
                            allocation->x + border_width,
                            allocation->y + border_width,
                            w, h);

  if (bin->child && gtk_widget_get_visible (bin->child))
    {
      GtkRequisition child_requisition;
      GtkAllocation child_allocation;

      s = sin (bin->angle);
      c = cos (bin->angle);

      gtk_widget_get_preferred_size (bin->child,
                                     &child_requisition, NULL);
      child_allocation.x = 0;
      child_allocation.y = 0;
      child_allocation.height = child_requisition.height;
      if (c == 0.0)
        child_allocation.width = h / s;
      else if (s == 0.0)
        child_allocation.width = w / c;
      else
        child_allocation.width = MIN ((w - s * child_allocation.height) / c,
                                      (h - c * child_allocation.height) / s);

      if (gtk_widget_get_realized (widget))
        gdk_window_move_resize (bin->offscreen_window,
                                child_allocation.x,
                                child_allocation.y,
                                child_allocation.width,
                                child_allocation.height);

      child_allocation.x = child_allocation.y = 0;
      gtk_widget_size_allocate (bin->child, &child_allocation);
    }
}
开发者ID:3v1n0,项目名称:gtk,代码行数:54,代码来源:offscreen_window.c


示例19: color_swatch_size_allocate

static void
color_swatch_size_allocate (GtkWidget *widget,
                            GtkAllocation *allocation)
{
	GtkhtmlColorSwatchPrivate *priv;

	priv = GTKHTML_COLOR_SWATCH (widget)->priv;

	gtk_widget_set_allocation (widget, allocation);
	gtk_widget_size_allocate (priv->frame, allocation);
}
开发者ID:Distrotech,项目名称:gtkhtml,代码行数:11,代码来源:gtkhtml-color-swatch.c


示例20: bytes_view_allocate

static void
bytes_view_allocate(GtkWidget *widget, GtkAllocation *allocation)
{
	gtk_widget_set_allocation(widget, allocation);

	if (gtk_widget_get_realized(widget)) {
		BytesView *bv = BYTES_VIEW(widget);

		gdk_window_move_resize(gtk_widget_get_window(widget), allocation->x, allocation->y, allocation->width, allocation->height);
		bytes_view_adjustment_set(bv);
	}
}
开发者ID:pvons,项目名称:wireshark,代码行数:12,代码来源:bytes_view.c



注:本文中的gtk_widget_set_allocation函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ gtk_widget_set_can_focus函数代码示例发布时间:2022-05-28
下一篇:
C++ gtk_widget_reparent函数代码示例发布时间:2022-05-28
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap