当前位置: 首页>>代码示例>>C++>>正文


C++ MX_WIDGET函数代码示例

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


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

示例1: mx_progress_bar_allocate_fill

static void
mx_progress_bar_allocate_fill (MxProgressBar         *self,
                               const ClutterActorBox *box,
                               ClutterAllocationFlags flags)
{
  ClutterActorBox box_data;
  MxProgressBarPrivate *priv = self->priv;

  if (!box)
    {
      clutter_actor_get_allocation_box (CLUTTER_ACTOR (self), &box_data);
      box = &box_data;
    }

  if (priv->progress)
    {
      ClutterActorBox child_box;
      MxPadding padding;

      mx_widget_get_padding (MX_WIDGET (self), &padding);

      child_box.x1 = padding.left;
      child_box.y1 = padding.top;
      child_box.y2 = (box->y2 - box->y1) - padding.bottom;
      child_box.x2 = ((box->x2 - box->x1 - padding.left - padding.right) *
                      priv->progress) + padding.left;

      clutter_actor_allocate (priv->fill, &child_box, flags);
    }
}
开发者ID:GunioRobot,项目名称:mx,代码行数:30,代码来源:mx-progress-bar.c

示例2: 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

示例3: 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

示例4: mex_volume_control_init

static void
mex_volume_control_init (MexVolumeControl *self)
{
  MexVolumeControlPrivate *priv = self->priv = VOLUME_CONTROL_PRIVATE (self);
  gchar *new_style_class;
  MexPlayer *player;
  MexMusicPlayer *music;

  player = mex_player_get_default ();
  priv->media = mex_player_get_clutter_media (player);

  music = mex_music_player_get_default ();
  priv->music = mex_music_player_get_clutter_media (music);

  priv->volume = mx_button_new ();
  mx_widget_set_disabled (MX_WIDGET (priv->volume), TRUE);

  priv->vol_value = clutter_media_get_audio_volume (priv->media);

  /* The media sound can also be changed from another process changint the
   * stream audio with pulse audio, adjust the volume on those changes */
  g_signal_connect (priv->media, "notify::audio-volume",
                    G_CALLBACK (on_audio_volume_changed), self);
  g_signal_connect (priv->music, "notify::audio-volume",
                    G_CALLBACK (on_audio_volume_changed), self);

  new_style_class = g_strdup_printf ("volume-%.0f", priv->vol_value * 10);

  mx_stylable_set_style_class (MX_STYLABLE (priv->volume), new_style_class);
  g_free (new_style_class);

  clutter_actor_add_child (CLUTTER_ACTOR (self), priv->volume);
}
开发者ID:frankopt,项目名称:media-explorer,代码行数:33,代码来源:mex-volume-control.c

示例5: mnb_launcher_button_key_release_event

static gboolean
mnb_launcher_button_key_release_event (ClutterActor       *actor,
                                       ClutterKeyEvent    *event)
{
  if (event->keyval == CLUTTER_KEY_Return ||
      event->keyval == CLUTTER_KEY_KP_Enter ||
      event->keyval == CLUTTER_KEY_ISO_Enter)
    {
      MnbLauncherButton *self = MNB_LAUNCHER_BUTTON (actor);

      if (!self->priv->is_pressed)
        return FALSE;

      clutter_ungrab_keyboard ();
      self->priv->is_pressed = FALSE;
      g_signal_emit (self, _signals[ACTIVATED], 0);

      mx_stylable_set_style_pseudo_class (MX_STYLABLE (self), NULL);
      mx_widget_hide_tooltip (MX_WIDGET (self));

      return TRUE;
    }

  return FALSE;
}
开发者ID:Cordia,项目名称:dawati-shell,代码行数:25,代码来源:mnb-launcher-button.c

示例6: mpl_panel_background_allocate

static void
mpl_panel_background_allocate (ClutterActor          *actor,
                               const ClutterActorBox *box,
                               ClutterAllocationFlags flags)
{
  MplPanelBackgroundPrivate *priv = MPL_PANEL_BACKGROUND (actor)->priv;
#if 0
  ClutterActor              *border;

  border = mx_widget_get_border_image (MX_WIDGET (actor));

  /*
   * We need to use different background asset based on the size allocated to us
   * -- basically, the panel cannot be smaller than the size of the borders of
   * its border image (see MB#702), so if it is smaller than the current asset
   * allows, we change the asset to simpler one.
   *
   * The code here assumes that we either have no name, or are called
   * 'too-small', but since this is a private widget of libmeego-panel, we can
   * enforce this assumption.
   */
  if (border)
    {
      const gchar *name = clutter_actor_get_name (actor);
      gboolean     too_small = FALSE;

      /*
       * Get the dimensions of the base texture (we are guaranteed to be called
       * first with name == NULL, so this works).
       */
      if (!priv->base_geom_known && !name)
        {
          mx_texture_frame_get_border_values (/*MX_TEXTURE_FRAME*/ (border),
                                              &priv->base_t,
                                              &priv->base_r,
                                              &priv->base_b,
                                              &priv->base_l);

          priv->base_geom_known = TRUE;
        }

      if (priv->base_l + priv->base_r > box->x2 - box->x1 ||
          priv->base_t + priv->base_b > box->y2 - box->y1)
        {
          too_small = TRUE;
        }

      if (!name && too_small)
        {
          clutter_actor_set_name (actor, "too-small");
        }
      else if (name && !too_small)
        {
          clutter_actor_set_name (actor, NULL);
        }
    }
#endif //DV
  CLUTTER_ACTOR_CLASS (
             mpl_panel_background_parent_class)->allocate (actor, box, flags);
}
开发者ID:dudochkin-victor,项目名称:mutter-netbook,代码行数:60,代码来源:mpl-panel-background.c

示例7: mnb_fancy_bin_allocate

static void
mnb_fancy_bin_allocate (ClutterActor          *actor,
                        const ClutterActorBox *box,
                        ClutterAllocationFlags flags)
{
  MxPadding padding;
  ClutterActorBox child_box;

  MnbFancyBinPrivate *priv = MNB_FANCY_BIN (actor)->priv;

  mx_widget_get_padding (MX_WIDGET (actor), &padding);

  if (priv->real_child)
    clutter_actor_allocate_preferred_size (priv->real_child, flags);

  child_box.x1 = padding.left;
  child_box.x2 = box->x2 - box->x1 - padding.right;
  child_box.y1 = padding.top;
  child_box.y2 = box->y2 - box->y1 - padding.bottom;

  if (priv->child)
    clutter_actor_allocate (priv->child, &child_box, flags);

  if (priv->clone)
    clutter_actor_allocate (priv->clone, &child_box, flags);

  CLUTTER_ACTOR_CLASS (mnb_fancy_bin_parent_class)->
    allocate (actor, box, flags);
}
开发者ID:dudochkin-victor,项目名称:mutter-netbook,代码行数:29,代码来源:mnb-fancy-bin.c

示例8: mnb_fancy_bin_get_preferred_height

static void
mnb_fancy_bin_get_preferred_height (ClutterActor *actor,
                                    gfloat        for_width,
                                    gfloat       *min_height_p,
                                    gfloat       *nat_height_p)
{
  MxPadding padding;
  MnbFancyBinPrivate *priv = MNB_FANCY_BIN (actor)->priv;

  if (min_height_p)
    *min_height_p = 0;
  if (nat_height_p)
    *nat_height_p = 0;

  if (priv->real_child)
    clutter_actor_get_preferred_height (priv->real_child,
                                        for_width,
                                        min_height_p,
                                        nat_height_p);

  mx_widget_get_padding (MX_WIDGET (actor), &padding);

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

示例9: mx_toggle_get_preferred_height

static void
mx_toggle_get_preferred_height (ClutterActor *actor,
                                gfloat        for_width,
                                gfloat       *min_height_p,
                                gfloat       *pref_height_p)
{
  ClutterActor *background;
  gfloat pref_h;

  background = mx_widget_get_background_image (MX_WIDGET (actor));

  if (!background)
    {
      if (min_height_p)
        *min_height_p = 0;
      if (pref_height_p)
        *pref_height_p = 0;

      return;
    }

  clutter_actor_get_preferred_height (background, -1, NULL, &pref_h);

  if (min_height_p)
    *min_height_p = pref_h;

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

示例10: on_trough_bg_button_press_event

static gboolean
on_trough_bg_button_press_event (ClutterActor       *actor,
                                 ClutterButtonEvent *event,
                                 MxSlider           *self)
{
  MxSliderPrivate *priv = self->priv;
  ClutterActor *stage;

  if (event->button != 1)
    return FALSE;

  if (mx_widget_get_disabled (MX_WIDGET (actor)))
    return FALSE;


  move_handle (self, event->x, event->y);

  stage = clutter_actor_get_stage (priv->handle);

  /* Turn off picking for motion events */
  clutter_stage_set_motion_events_enabled (CLUTTER_STAGE (stage), FALSE);

  priv->capture_handler =
    g_signal_connect_after (stage,
                            "captured-event",
                            G_CALLBACK (on_handle_capture_event),
                            self);

  return TRUE;
}
开发者ID:3v1n0,项目名称:mx,代码行数:30,代码来源:mx-slider.c

示例11: mx_notebook_allocate

static void
mx_notebook_allocate (ClutterActor          *actor,
                      const ClutterActorBox *box,
                      ClutterAllocationFlags flags)
{
  MxNotebookPrivate *priv = MX_NOTEBOOK (actor)->priv;
  GList *l;
  MxPadding padding;
  ClutterActorBox childbox;

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

  mx_widget_get_padding (MX_WIDGET (actor), &padding);

  childbox.x1 = 0 + padding.left;
  childbox.x2 = box->x2 - box->x1 - padding.right;

  childbox.y1 = 0 + padding.top;
  childbox.y2 = box->y2 - box->y1 - padding.bottom;

  for (l = priv->children; l; l = l->next)
    {
      ClutterActor *child;

      child = CLUTTER_ACTOR (l->data);

      if (CLUTTER_ACTOR_IS_VISIBLE (l->data))
        clutter_actor_allocate (child, &childbox, flags);
    }
}
开发者ID:3v1n0,项目名称:mx,代码行数:30,代码来源:mx-notebook.c

示例12: mex_column_pick

static void
mex_column_pick (ClutterActor *actor, const ClutterColor *color)
{
  GList *c;
  gdouble value;
  MxPadding padding;
  ClutterActorBox box;

  MexColumn *self = MEX_COLUMN (actor);
  MexColumnPrivate *priv = self->priv;

  CLUTTER_ACTOR_CLASS (mex_column_parent_class)->pick (actor, color);

  /* Don't pick children when we don't have focus */
  if (!priv->has_focus)
    return;

  mx_widget_get_padding (MX_WIDGET (actor), &padding);
  clutter_actor_get_allocation_box (actor, &box);
  if (priv->adjustment)
    value = priv->adjustment_value;
  else
    value = 0;

  cogl_clip_push_rectangle (padding.left,
                            padding.top + value,
                            box.x2 - box.x1 - padding.right,
                            box.y2 - box.y1 - padding.bottom + value);

  for (c = priv->children; c; c = c->next)
    clutter_actor_paint (c->data);

  cogl_clip_pop ();
}
开发者ID:ocrete,项目名称:media-explorer,代码行数:34,代码来源:mex-column.c

示例13: mex_epg_grid_get_preferred_width

static void
mex_epg_grid_get_preferred_width (ClutterActor *actor,
                                  gfloat        for_height,
                                  gfloat       *min_width_p,
                                  gfloat       *nat_width_p)
{
  MexEpgGrid *grid = MEX_EPG_GRID (actor);
  MexEpgGridPrivate *priv = grid->priv;
  MxPadding padding;
  GTimeSpan diff;

  mx_widget_get_padding (MX_WIDGET (actor), &padding);

  if (priv->first_date == NULL || priv->last_date == NULL)
    diff = 0;
  else
    diff = g_date_time_difference (priv->last_date, priv->first_date);

  if (min_width_p)
    *min_width_p = 0;

  if (nat_width_p)
    *nat_width_p = time_span_to_pixels (grid, diff) + padding.left +
                   padding.right;
}
开发者ID:dudochkin-victor,项目名称:mex,代码行数:25,代码来源:mex-epg-grid.c

示例14: mex_column_paint

static void
mex_column_paint (ClutterActor *actor)
{
  GList *c;
  MxPadding padding;
  ClutterActorBox box;

  MexColumn *self = MEX_COLUMN (actor);
  MexColumnPrivate *priv = self->priv;

  CLUTTER_ACTOR_CLASS (mex_column_parent_class)->paint (actor);

  mx_widget_get_padding (MX_WIDGET (actor), &padding);
  clutter_actor_get_allocation_box (actor, &box);

  cogl_clip_push_rectangle (padding.left,
                            padding.top + priv->adjustment_value,
                            box.x2 - box.x1 - padding.right,
                            box.y2 - box.y1 - padding.bottom +
                            priv->adjustment_value);

  for (c = priv->children; c; c = c->next)
    {
      /* skip the current focus and paint it last*/
      if (priv->current_focus != c->data)
        clutter_actor_paint (c->data);
    }

  /* paint the current focused actor last to ensure any shadow is drawn
   * on top of other items */
  if (priv->current_focus)
    clutter_actor_paint (priv->current_focus);

  cogl_clip_pop ();
}
开发者ID:ocrete,项目名称:media-explorer,代码行数:35,代码来源:mex-column.c

示例15: mx_frame_get_preferred_height

static void
mx_frame_get_preferred_height (ClutterActor *actor,
                               gfloat        for_width,
                               gfloat       *min_height,
                               gfloat       *pref_height)
{
    MxFramePrivate *priv = ((MxFrame *) actor)->priv;
    MxPadding padding;

    mx_widget_get_padding (MX_WIDGET (actor), &padding);

    if (min_height)
        *min_height = 0;

    if (pref_height)
        *pref_height = 0;

    if (priv->child)
    {
        clutter_actor_get_preferred_height (priv->child,
                                            for_width - padding.left - padding.right,
                                            min_height, pref_height);
    }

    if (min_height)
        *min_height += padding.top + padding.bottom;

    if (pref_height)
        *pref_height += padding.top + padding.bottom;
}
开发者ID:jonnylamb,项目名称:mx,代码行数:30,代码来源:mx-frame.c


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