Пример #1
0
static void
mnb_toolbar_background_class_init (MnbToolbarBackgroundClass *klass)
{
  GObjectClass *object_class = G_OBJECT_CLASS (klass);
#if TOOLBAR_CUT_OUT
  MxWidgetClass *widget_class = MX_WIDGET_CLASS (klass);
#endif /* TOOLBAR_CUT_OUT */

  g_type_class_add_private (klass, sizeof (MnbToolbarBackgroundPrivate));

  object_class->get_property = mnb_toolbar_background_get_property;
  object_class->set_property = mnb_toolbar_background_set_property;
  object_class->dispose = mnb_toolbar_background_dispose;
  object_class->finalize = mnb_toolbar_background_finalize;

#if TOOLBAR_CUT_OUT
  widget_class->paint_background = mnb_toolbar_background_paint_background;
#endif /* TOOLBAR_CUT_OUT */

  g_object_class_install_property (object_class,
                                   PROP_TOOLBAR,
                                   g_param_spec_object ("toolbar",
                                                        "Toolbar",
                                                        "Toolbar",
                                                        MNB_TYPE_TOOLBAR,
                                                        G_PARAM_READWRITE |
                                                        G_PARAM_CONSTRUCT_ONLY));
}
Пример #2
0
static void
mex_action_button_paint_background (MxWidget *widget,
                                    ClutterActor *background,
                                    const ClutterColor *color)
{
    MexActionButtonPrivate *priv = MEX_ACTION_BUTTON (widget)->priv;
    gfloat width, height;
    gfloat factor_x, factor_y;

    cogl_push_matrix ();

    if (priv->has_focus)
    {
        clutter_actor_get_size (background, &width, &height);

        factor_x = (width + 4) / width;
        factor_y = (height + 4) / height;

        cogl_translate (width/2, height/2, 0);
        cogl_scale (factor_x, factor_y, 1);
        cogl_translate (-width/2, -height/2, 0);
    }

    MX_WIDGET_CLASS(mex_action_button_parent_class)->paint_background (widget,
            background,
            color);
    cogl_pop_matrix ();
}
Пример #3
0
static void
mx_progress_bar_class_init (MxProgressBarClass *klass)
{
  GParamSpec *pspec;
  GObjectClass *object_class = G_OBJECT_CLASS (klass);
  ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass);
  MxWidgetClass *widget_class = MX_WIDGET_CLASS (klass);

  g_type_class_add_private (klass, sizeof (MxProgressBarPrivate));

  object_class->get_property = mx_progress_bar_get_property;
  object_class->set_property = mx_progress_bar_set_property;
  object_class->dispose = mx_progress_bar_dispose;
  object_class->finalize = mx_progress_bar_finalize;

  actor_class->paint = mx_progress_bar_paint;
  actor_class->get_preferred_width = mx_progress_bar_get_preferred_width;
  actor_class->get_preferred_height = mx_progress_bar_get_preferred_height;
  actor_class->allocate = mx_progress_bar_allocate;
  actor_class->map = mx_progress_bar_map;
  actor_class->unmap = mx_progress_bar_unmap;

  widget_class->apply_style = mx_progress_bar_apply_style;

  pspec = g_param_spec_double ("progress",
                               "Progress",
                               "Progress",
                               0.0, 1.0, 0.0, MX_PARAM_READWRITE);
  g_object_class_install_property (object_class, PROP_PROGRESS, pspec);
}
Пример #4
0
static void
mx_expander_class_init (MxExpanderClass *klass)
{
  GObjectClass *object_class = G_OBJECT_CLASS (klass);
  ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass);
  MxWidgetClass *widget_class = MX_WIDGET_CLASS (klass);
  GParamSpec *pspec;

  g_type_class_add_private (klass, sizeof (MxExpanderPrivate));

  object_class->get_property = mx_expander_get_property;
  object_class->set_property = mx_expander_set_property;
  object_class->dispose = mx_expander_dispose;
  object_class->finalize = mx_expander_finalize;

  actor_class->button_release_event = mx_expander_button_release;
  actor_class->allocate = mx_expander_allocate;
  actor_class->get_preferred_width = mx_expander_get_preferred_width;
  actor_class->get_preferred_height = mx_expander_get_preferred_height;
  actor_class->paint = mx_expander_paint;
  actor_class->map = mx_expander_map;
  actor_class->unmap = mx_expander_unmap;

  widget_class->apply_style = mx_expander_apply_style;

  pspec = g_param_spec_boolean ("expanded",
                                "Expanded",
                                "Indicates that the expander is open or closed",
                                FALSE,
                                MX_PARAM_READWRITE);
  g_object_class_install_property (object_class,
                                   PROP_EXPANDED,
                                   pspec);

  pspec = g_param_spec_string ("label",
                               "Label",
                               "Expander title label.",
                               NULL,
                               G_PARAM_READWRITE | MX_PARAM_TRANSLATEABLE);
  g_object_class_install_property (object_class,
                                   PROP_LABEL,
                                   pspec);

  /**
   * MxExpander::expand-complete:
   * @expander: the object that received the signal
   *
   * Emitted after the expand animation finishes. Check the "expanded" property
   * of the #MxExpander to determine if the expander is expanded or not.
   */

  expander_signals[EXPAND_COMPLETE] =
    g_signal_new ("expand-complete",
                  G_TYPE_FROM_CLASS (klass),
                  G_SIGNAL_RUN_LAST,
                  G_STRUCT_OFFSET (MxExpanderClass, expand_complete),
                  NULL, NULL,
                  _mx_marshal_VOID__VOID,
                  G_TYPE_NONE, 0);
}
Пример #5
0
static void
mx_combo_box_class_init (MxComboBoxClass *klass)
{
  GParamSpec *pspec;
  GObjectClass *object_class = G_OBJECT_CLASS (klass);
  ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass);
  MxWidgetClass *widget_class = MX_WIDGET_CLASS (klass);

  g_type_class_add_private (klass, sizeof (MxComboBoxPrivate));

  object_class->get_property = mx_combo_box_get_property;
  object_class->set_property = mx_combo_box_set_property;
  object_class->dispose = mx_combo_box_dispose;
  object_class->finalize = mx_combo_box_finalize;

  actor_class->map = mx_combo_box_map;
  actor_class->unmap = mx_combo_box_unmap;
  actor_class->paint = mx_combo_box_paint;

  actor_class->get_preferred_width = mx_combo_box_get_preferred_width;
  actor_class->get_preferred_height = mx_combo_box_get_preferred_height;
  actor_class->allocate = mx_combo_box_allocate;

  actor_class->button_press_event = mx_combo_box_button_press_event;
  actor_class->key_press_event = mx_combo_box_key_press_event;

  widget_class->apply_style = mx_combo_box_apply_style;

  pspec = g_param_spec_string ("active-text",
                               "Active Text",
                               "Text currently displayed in the combo box"
                               " button",
                               "",
                               MX_PARAM_READWRITE);
  g_object_class_install_property (object_class, PROP_ACTIVE_TEXT, pspec);

  pspec = g_param_spec_string ("active-icon-name",
                               "Active Icon-name",
                               "Name of the icon currently displayed in the "
                               "combo-box",
                               NULL,
                               MX_PARAM_READWRITE);
  g_object_class_install_property (object_class, PROP_ACTIVE_ICON_NAME, pspec);

  pspec = g_param_spec_int ("index",
                            "Index",
                            "Index of the selected item, or -1 if no item is"
                            " selected.",
                            -1, G_MAXINT, -1,
                            MX_PARAM_READWRITE);
  g_object_class_install_property (object_class, PROP_INDEX, pspec);
}
Пример #6
0
static void
mx_scroll_view_class_init (MxScrollViewClass *klass)
{
  GParamSpec *pspec;
  GObjectClass *object_class = G_OBJECT_CLASS (klass);
  ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass);
  MxWidgetClass *widget_class = MX_WIDGET_CLASS (klass);

  g_type_class_add_private (klass, sizeof (MxScrollViewPrivate));

  object_class->get_property = mx_scroll_view_get_property;
  object_class->set_property = mx_scroll_view_set_property;
  object_class->dispose= mx_scroll_view_dispose;
  object_class->finalize = mx_scroll_view_finalize;

  actor_class->paint = mx_scroll_view_paint;
  actor_class->pick = mx_scroll_view_pick;
  actor_class->get_preferred_width = mx_scroll_view_get_preferred_width;
  actor_class->get_preferred_height = mx_scroll_view_get_preferred_height;
  actor_class->allocate = mx_scroll_view_allocate;
  actor_class->scroll_event = mx_scroll_view_scroll_event;

  widget_class->apply_style = mx_scroll_view_apply_style;

  pspec = g_param_spec_boolean ("enable-mouse-scrolling",
                                "Enable Mouse Scrolling",
                                "Enable automatic mouse wheel scrolling",
                                TRUE,
                                MX_PARAM_READWRITE);
  g_object_class_install_property (object_class,
                                   PROP_MOUSE_SCROLL,
                                   pspec);

  pspec = g_param_spec_boolean ("enable-gestures",
                                "Enable Gestures",
                                "Enable use of pointer gestures for scrolling "
                                "if Mx was built with ClutterGesture support",
                                FALSE,
                                MX_PARAM_READWRITE);
  g_object_class_install_property (object_class, PROP_ENABLE_GESTURES, pspec);

  pspec = g_param_spec_enum ("scroll-policy",
                             "Scroll Policy",
                             "The scroll policy",
                             MX_TYPE_SCROLL_POLICY,
                             MX_SCROLL_POLICY_BOTH,
                             MX_PARAM_READWRITE);
  g_object_class_install_property (object_class, PROP_SCROLL_POLICY, pspec);
}
Пример #7
0
static void
mex_action_button_class_init (MexActionButtonClass *klass)
{
    GObjectClass *object_class = G_OBJECT_CLASS (klass);

    g_type_class_add_private (klass, sizeof (MexActionButtonPrivate));

    object_class->get_property = mex_action_button_get_property;
    object_class->set_property = mex_action_button_set_property;
    object_class->dispose = mex_action_button_dispose;
    object_class->finalize = mex_action_button_finalize;

#if 0
    {
        MxWidgetClass *widget_class = MX_WIDGET_CLASS (klass);
        widget_class->paint_background = mex_action_button_paint_background;
    }
#endif
}
static void
mpl_panel_background_class_init (MplPanelBackgroundClass *klass)
{
  GObjectClass      *object_class = G_OBJECT_CLASS (klass);
  ClutterActorClass *actor_class  = CLUTTER_ACTOR_CLASS (klass);
  MxWidgetClass     *widget_class = MX_WIDGET_CLASS (klass);

  g_type_class_add_private (klass, sizeof (MplPanelBackgroundPrivate));

  object_class->get_property        = mpl_panel_background_get_property;
  object_class->set_property        = mpl_panel_background_set_property;
  object_class->dispose             = mpl_panel_background_dispose;
  object_class->finalize            = mpl_panel_background_finalize;

  actor_class->get_preferred_width  = mpl_panel_background_get_preferred_width;
  actor_class->get_preferred_height = mpl_panel_background_get_preferred_height;
  actor_class->allocate             = mpl_panel_background_allocate;
#if 0
  widget_class->paint_background    = mpl_panel_background_paint_background;
#endif //DV
}
Пример #9
0
static void
mx_toggle_class_init (MxToggleClass *klass)
{
  GObjectClass *object_class = G_OBJECT_CLASS (klass);
  ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass);
  MxWidgetClass *widget_class = MX_WIDGET_CLASS (klass);
  GParamSpec *pspec;

  g_type_class_add_private (klass, sizeof (MxTogglePrivate));

  object_class->get_property = mx_toggle_get_property;
  object_class->set_property = mx_toggle_set_property;
  object_class->dispose = mx_toggle_dispose;
  object_class->finalize = mx_toggle_finalize;

  actor_class->pick = mx_toggle_pick;
  actor_class->paint = mx_toggle_paint;
  actor_class->map = mx_toggle_map;
  actor_class->unmap = mx_toggle_unmap;
  actor_class->get_preferred_width = mx_toggle_get_preferred_width;
  actor_class->get_preferred_height = mx_toggle_get_preferred_height;
  actor_class->allocate = mx_toggle_allocate;
  actor_class->button_release_event = mx_toggle_button_release_event;

  actor_class->button_press_event = mx_toggle_button_press_event;
  actor_class->leave_event = mx_toggle_leave_event;
  actor_class->enter_event = mx_toggle_enter_event;
  actor_class->key_press_event = mx_toggle_key_press;

  widget_class->apply_style = mx_toggle_apply_style;

  pspec = g_param_spec_boolean ("active",
                                "Active",
                                "Whether the toggle switch is activated",
                                FALSE,
                                MX_PARAM_READWRITE);
  g_object_class_install_property (object_class, PROP_ACTIVE, pspec);
}
static void
mx_scroll_bar_class_init (MxScrollBarClass *klass)
{
  GObjectClass *object_class = G_OBJECT_CLASS (klass);
  ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass);
  MxWidgetClass *widget_class = MX_WIDGET_CLASS (klass);
  GParamSpec *pspec;

  g_type_class_add_private (klass, sizeof (MxScrollBarPrivate));

  object_class->get_property = mx_scroll_bar_get_property;
  object_class->set_property = mx_scroll_bar_set_property;
  object_class->dispose      = mx_scroll_bar_dispose;
  object_class->constructor  = mx_scroll_bar_constructor;

  actor_class->get_preferred_width  = mx_scroll_bar_get_preferred_width;
  actor_class->get_preferred_height = mx_scroll_bar_get_preferred_height;
  actor_class->allocate       = mx_scroll_bar_allocate;
  actor_class->paint          = mx_scroll_bar_paint;
  actor_class->pick           = mx_scroll_bar_pick;
  actor_class->scroll_event   = mx_scroll_bar_scroll_event;
  actor_class->map            = mx_scroll_bar_map;
  actor_class->unmap          = mx_scroll_bar_unmap;

  widget_class->apply_style = mx_scroll_bar_apply_style;

  g_object_class_install_property
                 (object_class,
                 PROP_ADJUSTMENT,
                 g_param_spec_object ("adjustment",
                                      "Adjustment",
                                      "The adjustment",
                                      MX_TYPE_ADJUSTMENT,
                                      MX_PARAM_READWRITE));

  pspec = g_param_spec_enum ("orientation",
                             "Orientation",
                             "The orientation of the scrollbar",
                             MX_TYPE_ORIENTATION,
                             MX_ORIENTATION_HORIZONTAL,
                             MX_PARAM_READWRITE);
  g_object_class_install_property (object_class, PROP_ORIENTATION, pspec);

  signals[SCROLL_START] =
    g_signal_new ("scroll-start",
                  G_TYPE_FROM_CLASS (klass),
                  G_SIGNAL_RUN_LAST,
                  G_STRUCT_OFFSET (MxScrollBarClass, scroll_start),
                  NULL, NULL,
                  g_cclosure_marshal_VOID__VOID,
                  G_TYPE_NONE, 0);

  signals[SCROLL_STOP] =
    g_signal_new ("scroll-stop",
                  G_TYPE_FROM_CLASS (klass),
                  G_SIGNAL_RUN_LAST,
                  G_STRUCT_OFFSET (MxScrollBarClass, scroll_stop),
                  NULL, NULL,
                  g_cclosure_marshal_VOID__VOID,
                  G_TYPE_NONE, 0);
}