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

C++ clutter_actor_get_preferred_width函数代码示例

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

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



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

示例1: mpl_entry_get_preferred_width

static void
mpl_entry_get_preferred_width (ClutterActor *actor,
                               gfloat        for_height,
                               gfloat       *min_width_p,
                               gfloat       *natural_width_p)
{
  MplEntryPrivate *priv = MPL_ENTRY (actor)->priv;
  MxPadding padding = { 0, 0, 0, 0 };
  gfloat min_width_entry, min_width_button;
  gfloat natural_width_entry, natural_width_button;

  mx_widget_get_padding (MX_WIDGET (actor), &padding);

  clutter_actor_get_preferred_width (priv->entry, for_height,
                                     &min_width_entry,
                                     &natural_width_entry);

  clutter_actor_get_preferred_width (priv->table, for_height,
                                     &min_width_button,
                                     &natural_width_button);

  if (min_width_p)
    *min_width_p = padding.left +
                   min_width_entry +
                   min_width_button +
                   padding.right;

  if (natural_width_p)
    *natural_width_p = padding.left +
                       natural_width_entry +
                       natural_width_button +
                       padding.right;
}
开发者ID:Cordia,项目名称:dawati-shell,代码行数:33,代码来源:mpl-entry.c


示例2: ntf_overlay_allocate

static void
ntf_overlay_allocate (ClutterActor          *actor,
                      const ClutterActorBox *box,
                      ClutterAllocationFlags flags)
{
    NtfOverlayPrivate *priv = NTF_OVERLAY (actor)->priv;
    ClutterActorClass *klass;
    gfloat             my_width, my_height;
    ClutterActor      *tna = CLUTTER_ACTOR (priv->tray_normal);
    ClutterActor      *tua = CLUTTER_ACTOR (priv->tray_urgent);
    ClutterActor      *lowlight = priv->lowlight;

    klass = CLUTTER_ACTOR_CLASS (ntf_overlay_parent_class);

    klass->allocate (actor, box, flags);

    my_width  = box->x2 - box->x1;
    my_height = box->y2 - box->y1;

    {
        ClutterActorBox tray_box;
        gfloat p_width, p_height, m_width, m_height;

        clutter_actor_get_preferred_width  (tna, -1.0, &m_width, &p_width);
        clutter_actor_get_preferred_height (tna, p_width, &m_height, &p_height);

        tray_box.x1 = my_width  - p_width;
        tray_box.y1 = my_height - p_height;
        tray_box.x2 = tray_box.x1 + p_width;
        tray_box.y2 = tray_box.y1 + p_height;

        clutter_actor_allocate (tna, &tray_box, flags);
    }

    {
        ClutterActorBox tray_box;
        gfloat p_width, p_height, m_width, m_height;

        clutter_actor_get_preferred_width  (tua, -1.0, &m_width, &p_width);
        clutter_actor_get_preferred_height (tua, p_width, &m_height, &p_height);

        tray_box.x1 = (gint)((my_width  - p_width)  / 2.0);
        tray_box.y1 = (gint)((my_height - p_height) / 2.0);
        tray_box.x2 = tray_box.x1 + p_width;
        tray_box.y2 = tray_box.y1 + p_height;

        clutter_actor_allocate (tua, &tray_box, flags);
    }

    {
        ClutterActorBox lowlight_box;

        lowlight_box.x1 = 0.0;
        lowlight_box.y1 = 0.0;
        lowlight_box.x2 = my_width;
        lowlight_box.y2 = my_height;

        clutter_actor_allocate (lowlight, &lowlight_box, flags);
    }
}
开发者ID:xclaesse,项目名称:dawati-shell,代码行数:60,代码来源:ntf-overlay.c


示例3: mex_content_box_get_preferred_width

static void
mex_content_box_get_preferred_width (ClutterActor *actor,
                                     gfloat        for_height,
                                     gfloat       *min_width,
                                     gfloat       *pref_width)
{
  MexContentBoxPrivate *priv = MEX_CONTENT_BOX (actor)->priv;
  gfloat list_w;

  clutter_actor_get_preferred_width (priv->tile, for_height, min_width,
                                     pref_width);
  if (!priv->extras_visible)
    return;

  if (pref_width)
    {
      clutter_actor_get_preferred_width (priv->action_list, for_height, NULL,
                                         &list_w);

      if (clutter_timeline_is_playing (priv->timeline))
        *pref_width = *pref_width +
          (list_w * clutter_alpha_get_alpha (priv->alpha));
      else
        *pref_width = *pref_width + list_w;
    }
}
开发者ID:Cyrene,项目名称:media-explorer,代码行数:26,代码来源:mex-content-box.c


示例4: mex_column_view_get_preferred_width

static void
mex_column_view_get_preferred_width (ClutterActor *actor,
                                     gfloat        for_height,
                                     gfloat       *min_width_p,
                                     gfloat       *nat_width_p)
{
  MxPadding padding;
  gfloat min_width, nat_width;
  gfloat min_header, nat_header;
  gfloat min_placeholder, nat_placeholder;
  gfloat height;

  MexColumnView *self = MEX_COLUMN_VIEW (actor);
  MexColumnViewPrivate *priv = self->priv;

  clutter_actor_get_preferred_width (priv->header,
                                     -1,
                                     &min_header,
                                     &nat_header);

  clutter_actor_get_preferred_height (priv->header, -1, NULL, &height);
  for_height = MAX (0, for_height - height);

  if (mex_column_is_empty (MEX_COLUMN (priv->column)))
    {
      if (priv->placeholder_actor)
        {
          clutter_actor_get_preferred_width (priv->placeholder_actor,
                                             for_height,
                                             &min_placeholder,
                                             &nat_placeholder);

          min_width = MAX (min_header, min_placeholder);
          nat_width = MAX (min_header, nat_placeholder);
        }
      else
        {
          min_width = min_header;
          nat_width = nat_header;
        }
    }
  else
    {
      clutter_actor_get_preferred_width (priv->scroll,
                                         for_height,
                                         &min_placeholder,
                                         &nat_placeholder);

      min_width = MAX (min_header, min_placeholder);
      nat_width = MAX (min_header, nat_placeholder);
    }

  mx_widget_get_padding (MX_WIDGET (actor), &padding);

  if (min_width_p)
    *min_width_p = min_width + padding.left + padding.right;
  if (nat_width_p)
    *nat_width_p = nat_width + padding.left + padding.right;
}
开发者ID:frankopt,项目名称:media-explorer,代码行数:59,代码来源:mex-column-view.c


示例5: mpl_application_view_allocate

static void
mpl_application_view_allocate (ClutterActor          *actor,
                               const ClutterActorBox *box,
                               ClutterAllocationFlags flags)
{
  MplApplicationViewPrivate *priv = ((MplApplicationView *) actor)->priv;
  MxPadding padding;
  ClutterActorBox child_box;
  gfloat icon_width = 0, icon_height = 0, button_width, button_height;

  CLUTTER_ACTOR_CLASS (mpl_application_view_parent_class)->allocate (actor,
                                                                     box,
                                                                     flags);

  mx_widget_get_padding (MX_WIDGET (actor), &padding);

  /* Icon */
  child_box.x1 = padding.left;
  child_box.y1 = padding.top;

  if (priv->icon)
    {
      clutter_actor_get_preferred_width (priv->icon, -1, NULL, &icon_width);
      clutter_actor_get_preferred_height (priv->icon, -1, NULL, &icon_height);

      child_box.x2 = child_box.x1 + icon_width;
      child_box.y2 = child_box.y1 + icon_height;

      clutter_actor_allocate (priv->icon, &child_box, flags);
    }

  /* Close button */
  clutter_actor_get_preferred_width (priv->close_button, -1, NULL, &button_width);
  clutter_actor_get_preferred_height (priv->close_button, -1, NULL, &button_height);

  child_box.x2 = box->x2 - box->x1 - padding.right;
  child_box.y2 = child_box.y1 + button_height;
  child_box.x1 = child_box.x2 - button_width;

  clutter_actor_allocate (priv->close_button, &child_box, flags);

  /* Titles */
  child_box.x1 = padding.left + icon_width;
  child_box.x2 = box->x2 - box->x1 - padding.right - button_width;
  child_box.y2 = padding.top + icon_height;

  clutter_actor_allocate (priv->title_box, &child_box, flags);

  /* App frame */
  child_box.x1 = padding.left;
  child_box.x2 = box->x2 - box->x1 - padding.right;
  child_box.y1 = padding.top + icon_width;
  child_box.y2 = box->y2 - box->y1 - padding.bottom;

  clutter_actor_allocate (priv->app_frame, &child_box, flags);
}
开发者ID:phmccarty,项目名称:dawati-shell,代码行数:56,代码来源:mpl-application-view.c


示例6: mex_content_box_allocate

static void
mex_content_box_allocate (ClutterActor           *actor,
                          const ClutterActorBox  *box,
                          ClutterAllocationFlags  flags)
{
  MexContentBoxPrivate *priv = MEX_CONTENT_BOX (actor)->priv;
  ClutterActorBox child_box;
  gfloat pref_w = 0, pref_h = 0, tile_w, tile_h;

  CLUTTER_ACTOR_CLASS (mex_content_box_parent_class)->allocate (actor, box,
                                                                flags);

  tile_w = box->x2 - box->x1;
  clutter_actor_get_preferred_width (priv->tile, -1, NULL, &tile_w);
  if (tile_w > box->x2 - box->x1)
    tile_w = box->x2 - box->x1;

  clutter_actor_get_preferred_height (priv->tile, tile_w, NULL, &tile_h);
  child_box.x1 = 0;
  child_box.x2 = child_box.x1 + tile_w;
  child_box.y1 = 0;
  child_box.y2 = child_box.y1 + tile_h;

  clutter_actor_allocate (priv->tile, &child_box, flags);

  if (G_UNLIKELY (priv->extras_visible))
    {
      /* action list */
      clutter_actor_get_preferred_width (priv->action_list, -1, NULL, &pref_w);
      clutter_actor_get_preferred_height (priv->info_panel, -1, NULL, &pref_h);

      child_box.x1 = tile_w;
      child_box.x2 = tile_w + pref_w;
      child_box.y1 = 0;
      child_box.y2 = tile_h;
      clutter_actor_allocate (priv->action_list, &child_box, flags);


      child_box.x1 = 0;
      child_box.x2 = tile_w + pref_w;
      child_box.y1 = tile_h;
      child_box.y2 = tile_h + pref_h;
      clutter_actor_allocate (priv->info_panel, &child_box, flags);
    }

  /* enable clip-to-allocation if the children will extend beyond the allocated
   * box */
  if ((tile_w + pref_w) > (box->x2 - box->x1)
      || (tile_h + pref_h) > (box->y2 - box->y1))
    priv->clip_to_allocation = TRUE;
  else
    priv->clip_to_allocation = FALSE;
}
开发者ID:Cyrene,项目名称:media-explorer,代码行数:53,代码来源:mex-content-box.c


示例7: _xfdashboard_workspace_selector_get_preferred_width_for_child

/* Get width of a child of this actor */
static void _xfdashboard_workspace_selector_get_preferred_width_for_child(XfdashboardWorkspaceSelector *self,
																			ClutterActor *inChild,
																			gfloat inForHeight,
																			gfloat *outMinWidth,
																			gfloat *outNaturalWidth)
{
	XfdashboardWorkspaceSelectorPrivate		*priv;
	gfloat									minWidth, naturalWidth;
	gfloat									maxSize;

	g_return_if_fail(XFDASHBOARD_IS_WORKSPACE_SELECTOR(self));

	priv=self->priv;

	/* Set up default values */
	minWidth=naturalWidth=0.0f;

	/* Determine width for horizontal orientation ... */
	if(priv->orientation==CLUTTER_ORIENTATION_HORIZONTAL)
	{
		/* Adjust requested height to maximum height */
		maxSize=_xfdashboard_workspace_selector_get_max_size_internal(self)-(2*priv->spacing);
		if(maxSize>=0.0f && inForHeight>maxSize) inForHeight=maxSize;

		/* Get width of child */
		clutter_actor_get_preferred_width(inChild, inForHeight, &minWidth, &naturalWidth);
	}
		/* ... otherwise determine height for vertical orientation */
		else
		{
			/* Get width of child */
			clutter_actor_get_preferred_width(inChild, inForHeight, &minWidth, &naturalWidth);

			/* Adjust child's width to maximum width */
			maxSize=_xfdashboard_workspace_selector_get_max_size_internal(self)-(2*priv->spacing);
			if(maxSize>=0.0)
			{
				/* Adjust minimum width if it exceed limit */
				if(minWidth>maxSize) minWidth=maxSize;

				/* Adjust natural width if it exceed limit */
				if(naturalWidth>maxSize) naturalWidth=maxSize;
			}
		}

	/* Store sizes computed */
	if(outMinWidth) *outMinWidth=minWidth;
	if(outNaturalWidth) *outNaturalWidth=naturalWidth;
}
开发者ID:paulmadore,项目名称:luckyde,代码行数:50,代码来源:workspace-selector.c


示例8: mx_progress_bar_get_preferred_width

static void
mx_progress_bar_get_preferred_width (ClutterActor *actor,
                                     gfloat        for_height,
                                     gfloat       *min_width_p,
                                     gfloat       *nat_width_p)
{
  MxPadding padding;
  MxProgressBarPrivate *priv = MX_PROGRESS_BAR (actor)->priv;
  gfloat height;

  clutter_actor_get_preferred_width (priv->fill,
                                     for_height,
                                     min_width_p,
                                     nat_width_p);

  clutter_actor_get_preferred_height (priv->fill,
                                      -1,
                                      &height,
                                      NULL);

  mx_widget_get_padding (MX_WIDGET (actor), &padding);

  if (min_width_p)
    *min_width_p += padding.left + padding.right;

  /* Add an arbitrary amount to the width for preferred width, so that the
   * indicator is visible and can display some values */
  if (nat_width_p)
    *nat_width_p += padding.left + padding.right + height * 4;
}
开发者ID:GunioRobot,项目名称:mx,代码行数:30,代码来源:mx-progress-bar.c


示例9: mx_label_get_preferred_width

static void
mx_label_get_preferred_width (ClutterActor *actor,
                              gfloat        for_height,
                              gfloat       *min_width_p,
                              gfloat       *natural_width_p)
{
  MxLabelPrivate *priv = MX_LABEL (actor)->priv;
  MxPadding padding = { 0, };

  mx_widget_get_padding (MX_WIDGET (actor), &padding);

  for_height -= padding.top + padding.bottom;

  clutter_actor_get_preferred_width (priv->label, for_height,
                                     min_width_p,
                                     natural_width_p);

  /* If we're fading out, make sure our minimum width is zero */
  if (priv->fade_out && min_width_p)
    *min_width_p = 0;

  if (min_width_p)
    *min_width_p += padding.left + padding.right;

  if (natural_width_p)
    *natural_width_p += padding.left + padding.right;
}
开发者ID:bhgv,项目名称:mx--clutter-based-GUI-framework--orange-pi-2-h3,代码行数:27,代码来源:mx-label.c


示例10: mnb_fancy_bin_get_preferred_width

static void
mnb_fancy_bin_get_preferred_width (ClutterActor *actor,
                                   gfloat        for_height,
                                   gfloat       *min_width_p,
                                   gfloat       *nat_width_p)
{
  MxPadding padding;
  MnbFancyBinPrivate *priv = MNB_FANCY_BIN (actor)->priv;

  if (min_width_p)
    *min_width_p = 0;
  if (nat_width_p)
    *nat_width_p = 0;

  if (priv->real_child)
    clutter_actor_get_preferred_width (priv->real_child,
                                       for_height,
                                       min_width_p,
                                       nat_width_p);

  mx_widget_get_padding (MX_WIDGET (actor), &padding);

  if (min_width_p)
    *min_width_p += padding.left + padding.right;
  if (nat_width_p)
    *nat_width_p += padding.left + padding.right;
}
开发者ID:dudochkin-victor,项目名称:mutter-netbook,代码行数:27,代码来源:mnb-fancy-bin.c


示例11: mx_toggle_get_preferred_width

static void
mx_toggle_get_preferred_width (ClutterActor *actor,
                               gfloat        for_height,
                               gfloat       *min_width_p,
                               gfloat       *pref_width_p)
{
  ClutterActor *background;
  gfloat pref_w;

  background = mx_widget_get_background_image (MX_WIDGET (actor));

  if (!background)
    {
      if (min_width_p)
        *min_width_p = 0;
      if (pref_width_p)
        *pref_width_p = 0;

      return;
    }

  clutter_actor_get_preferred_width (background, -1, NULL, &pref_w);

  if (min_width_p)
    *min_width_p = pref_w;

  if (pref_width_p)
    *pref_width_p = pref_w;
}
开发者ID:jlec,项目名称:mx,代码行数:29,代码来源:mx-toggle.c


示例12: clutter_bin_layout_get_preferred_width

static void
clutter_bin_layout_get_preferred_width (ClutterLayoutManager *manager,
                                        ClutterContainer     *container,
                                        gfloat                for_height,
                                        gfloat               *min_width_p,
                                        gfloat               *nat_width_p)
{
  ClutterActor *actor = CLUTTER_ACTOR (container);
  ClutterActorIter iter;
  ClutterActor *child;
  gfloat min_width, nat_width;

  min_width = nat_width = 0.0;

  clutter_actor_iter_init (&iter, actor);
  while (clutter_actor_iter_next (&iter, &child))
    {
      gfloat minimum, natural;

      clutter_actor_get_preferred_width (child, for_height,
                                         &minimum,
                                         &natural);

      min_width = MAX (min_width, minimum);
      nat_width = MAX (nat_width, natural);
    }

  if (min_width_p)
    *min_width_p = min_width;

  if (nat_width_p)
    *nat_width_p = nat_width;
}
开发者ID:kerrickstaley,项目名称:clutter-vala,代码行数:33,代码来源:clutter-bin-layout.c


示例13: ntf_tray_get_preferred_width

static void
ntf_tray_get_preferred_width (ClutterActor *actor,
                              gfloat        for_height,
                              gfloat       *min_width,
                              gfloat       *nat_width)
{
  NtfTrayPrivate *priv = NTF_TRAY (actor)->priv;

  if (min_width)
    *min_width = CLUSTER_WIDTH;
  if (nat_width)
    {
      if (priv->urgent)
        {
          gfloat nat_notif;
          MetaPlugin *plugin = dawati_netbook_get_plugin_singleton ();
          MetaScreen *screen = meta_plugin_get_screen (plugin);
          gint screen_width, screen_height;

          meta_screen_get_size (screen, &screen_width, &screen_height);

          clutter_actor_get_preferred_width (priv->notifiers, for_height,
                                             NULL, &nat_notif);

          *nat_width = MIN ((2 * screen_width) / 3, nat_notif);
        }
      else
        *nat_width = CLUSTER_WIDTH;
    }
}
开发者ID:Cordia,项目名称:dawati-shell,代码行数:30,代码来源:ntf-tray.c


示例14: clutter_bin_layout_get_preferred_width

static void
clutter_bin_layout_get_preferred_width (ClutterLayoutManager *manager,
                                        ClutterContainer     *container,
                                        gfloat                for_height,
                                        gfloat               *min_width_p,
                                        gfloat               *nat_width_p)
{
  GList *children = clutter_container_get_children (container);
  GList *l;
  gfloat min_width, nat_width;

  min_width = nat_width = 0.0;

  for (l = children; l != NULL; l = l->next)
    {
      ClutterActor *child = l->data;
      gfloat minimum, natural;

      clutter_actor_get_preferred_width (child, for_height,
                                         &minimum,
                                         &natural);

      min_width = MAX (min_width, minimum);
      nat_width = MAX (nat_width, natural);
    }

  if (min_width_p)
    *min_width_p = min_width;

  if (nat_width_p)
    *nat_width_p = nat_width;
}
开发者ID:nobled,项目名称:clutter,代码行数:32,代码来源:clutter-bin-layout.c


示例15: mex_clock_bin_get_preferred_width

static void
mex_clock_bin_get_preferred_width (ClutterActor *actor,
                                   gfloat        for_height,
                                   gfloat       *min_width_p,
                                   gfloat       *nat_width_p)
{
  MxPadding padding;
  gfloat min_width, nat_width;

  MexClockBinPrivate *priv = MEX_CLOCK_BIN (actor)->priv;

  CLUTTER_ACTOR_CLASS (mex_clock_bin_parent_class)->
    get_preferred_width (actor, for_height, min_width_p, nat_width_p);

  mx_widget_get_padding (MX_WIDGET (actor), &padding);
  if (for_height >= 0)
    for_height = MAX (0, for_height - padding.top - padding.bottom);

  clutter_actor_get_preferred_width (priv->clock_hbox,
                                     for_height,
                                     &min_width,
                                     &nat_width);

  min_width += padding.left + padding.right;
  nat_width += padding.left + padding.right;

  if (min_width_p && (*min_width_p < min_width))
    *min_width_p = min_width;
  if (nat_width_p && (*nat_width_p < nat_width))
    *nat_width_p = nat_width;
}
开发者ID:frankopt,项目名称:media-explorer,代码行数:31,代码来源:mex-clock-bin.c


示例16: mx_button_get_preferred_width

static void
mx_button_get_preferred_width (ClutterActor *actor,
                               gfloat        for_height,
                               gfloat       *min_width,
                               gfloat       *pref_width)
{
  MxButtonPrivate *priv = MX_BUTTON (actor)->priv;

  if (priv->content_image)
    {
      gfloat width;

      clutter_actor_get_preferred_width (priv->content_image, for_height,
                                         NULL, &width);
      if (min_width)
        *min_width = width;
      if (pref_width)
        *pref_width = width;

      return;
    }

  CLUTTER_ACTOR_CLASS (mx_button_parent_class)->get_preferred_width (actor,
                                                                     for_height,
                                                                     min_width,
                                                                     pref_width);
}
开发者ID:danni,项目名称:mx,代码行数:27,代码来源:mx-button.c


示例17: mx_frame_get_preferred_width

static void
mx_frame_get_preferred_width (ClutterActor *actor,
                              gfloat        for_height,
                              gfloat       *min_width,
                              gfloat       *pref_width)
{
    MxFramePrivate *priv = ((MxFrame *) actor)->priv;
    MxPadding padding;

    mx_widget_get_padding (MX_WIDGET (actor), &padding);

    if (min_width)
        *min_width = 0;

    if (pref_width)
        *pref_width = 0;

    if (priv->child)
    {
        clutter_actor_get_preferred_width (priv->child,
                                           for_height - padding.top - padding.bottom,
                                           min_width, pref_width);
    }

    if (min_width)
        *min_width += padding.left + padding.right;

    if (pref_width)
        *pref_width += padding.left + padding.right;

}
开发者ID:jonnylamb,项目名称:mx,代码行数:31,代码来源:mx-frame.c


示例18: mx_toolbar_get_preferred_width

static void
mx_toolbar_get_preferred_width (ClutterActor *actor,
                                gfloat        for_height,
                                gfloat       *min_width,
                                gfloat       *pref_width)
{
  MxToolbarPrivate *priv = MX_TOOLBAR (actor)->priv;
  MxPadding padding;
  gfloat min_child, pref_child, min_close, pref_close;

  mx_widget_get_padding (MX_WIDGET (actor), &padding);

  for_height = for_height - padding.top - padding.bottom;

  if (priv->has_close_button && priv->close_button)
    {
      clutter_actor_get_preferred_width (priv->close_button,
                                         for_height,
                                         &min_close,
                                         &pref_close);
    }
  else
    {
      min_close = 0;
      pref_close = 0;
    }

  if (priv->child)
    {
      clutter_actor_get_preferred_width (priv->child,
                                         for_height,
                                         &min_child,
                                         &pref_child);
    }
  else
    {
      min_child = 0;
      pref_child = 0;
    }

  if (min_width)
    *min_width = padding.left + padding.right + min_close + min_child + SPACING;

  if (pref_width)
    *pref_width = padding.left + padding.right + pref_close + pref_child + SPACING;
}
开发者ID:3v1n0,项目名称:mx,代码行数:46,代码来源:mx-toolbar.c


示例19: mx_toggle_allocate

static void
mx_toggle_allocate (ClutterActor          *actor,
                    const ClutterActorBox *box,
                    ClutterAllocationFlags flags)
{
  MxTogglePrivate *priv = MX_TOGGLE (actor)->priv;
  ClutterActorBox handle_box, child_box;
  ClutterActor *background;
  gfloat handle_w;
  gfloat toggle_pos;

  CLUTTER_ACTOR_CLASS (mx_toggle_parent_class)->allocate (actor, box, flags);

  mx_widget_get_available_area (MX_WIDGET (actor), box, &child_box);

  /* background-image don't get stretched, so adjust the child box so that the
   * handle appears in the correct place.
   */
  background = mx_widget_get_background_image (MX_WIDGET (actor));
  if (background)
    {
      gfloat width;
      MxPadding padding;

      mx_widget_get_padding (MX_WIDGET (actor), &padding);
      clutter_actor_get_preferred_width (background, -1, NULL, &width);
      width -= padding.left + padding.right;

      child_box.x1 += (child_box.x2 - child_box.x1) / 2.f;
      child_box.x1 -= width / 2.f;
      child_box.x2 = child_box.x1 + width;
    }

  clutter_actor_get_preferred_width (priv->handle, -1, NULL, &handle_w);
  toggle_pos = child_box.x2 - handle_w - child_box.x1;
  priv->slide_length = toggle_pos;

  toggle_pos = toggle_pos * priv->position;

  handle_box.x1 = (gint) (child_box.x1 + toggle_pos);
  handle_box.y1 = child_box.y1;
  handle_box.x2 = handle_box.x1 + handle_w;
  handle_box.y2 = child_box.y2;

  clutter_actor_allocate (priv->handle, &handle_box, flags);
}
开发者ID:jlec,项目名称:mx,代码行数:46,代码来源:mx-toggle.c


示例20: mx_expander_get_preferred_width

static void
mx_expander_get_preferred_width (ClutterActor *actor,
                                 gfloat        for_height,
                                 gfloat       *min_width,
                                 gfloat       *pref_width)
{
  MxExpanderPrivate *priv = MX_EXPANDER (actor)->priv;
  ClutterActor *child;
  MxPadding padding;
  gfloat min_child_w, pref_child_w, min_label_w, pref_label_w, arrow_w;

  child = mx_bin_get_child (MX_BIN (actor));
  mx_widget_get_padding (MX_WIDGET (actor), &padding);

  if (child)
    {
      clutter_actor_get_preferred_width (child,
                                         -1,
                                         &min_child_w,
                                         &pref_child_w);
    }
  else
    {
      min_child_w = 0;
      pref_child_w = 0;
    }

  clutter_actor_get_preferred_width (priv->label,
                                     -1, &min_label_w, &pref_label_w);
  clutter_actor_get_preferred_width (priv->arrow,
                                     -1, NULL, &arrow_w);

  /* TODO: create a style property for this padding between arrow and label */
  if (arrow_w)
    arrow_w += 6.0f;

  if (min_width)
    *min_width = padding.left
                 + MAX (min_child_w, min_label_w + arrow_w)
                 + padding.right;

  if (pref_width)
    *pref_width = padding.left
                  + MAX (pref_child_w, pref_label_w + arrow_w)
                  + padding.right;
}
开发者ID:GunioRobot,项目名称:mx,代码行数:46,代码来源:mx-expander.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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