MxWidget

## MxWidget MxWidget — Base class for stylable actors |

## Synopsis

    enum                MxLongPressAction;
    struct              MxWidget;
    struct              MxWidgetClass;
    void                mx_widget_set_tooltip_text          (MxWidget *widget,
                                                             const gchar *text);
    const gchar *       mx_widget_get_tooltip_text          (MxWidget *widget);
    void                mx_widget_show_tooltip              (MxWidget *widget);
    void                mx_widget_hide_tooltip              (MxWidget *widget);
    void                mx_widget_set_menu                  (MxWidget *widget,
                                                             MxMenu *menu);
    MxMenu *            mx_widget_get_menu                  (MxWidget *widget);
    gboolean            mx_widget_get_disabled              (MxWidget *widget);
    void                mx_widget_set_disabled              (MxWidget *widget,
                                                             gboolean disabled);
    void                mx_widget_long_press_query          (MxWidget *widget,
                                                             ClutterButtonEvent *event);
    void                mx_widget_long_press_cancel         (MxWidget *widget);
    ClutterActor *      mx_widget_get_background_image      (MxWidget *actor);
    ClutterActor *      mx_widget_get_border_image          (MxWidget *actor);
    void                mx_widget_get_padding               (MxWidget *widget,
                                                             MxPadding *padding);
    void                mx_widget_paint_background          (MxWidget *widget);
    void                mx_widget_apply_style               (MxWidget *widget,
                                                             MxStyle *style);
    void                mx_widget_get_available_area        (MxWidget *widget,
                                                             const ClutterActorBox *allocation,
                                                             ClutterActorBox *area);
    void                mx_widget_set_tooltip_delay         (MxWidget *widget,
                                                             guint delay);
    guint               mx_widget_get_tooltip_delay         (MxWidget *widget);

## Object Hierarchy

      GObject
       +----GInitiallyUnowned
             +----ClutterActor
                   +----MxWidget
                         +----MxBin
                         +----MxBoxLayout
                         +----MxComboBox
                         +----MxDeformTexture
                         +----MxEntry
                         +----MxFloatingWidget
                         +----MxGrid
                         +----MxIcon
                         +----MxImage
                         +----MxLabel
                         +----MxNotebook
                         +----MxPathBar
                         +----MxProgressBar
                         +----MxSlider
                         +----MxSpinner
                         +----MxStack
                         +----MxTable
                         +----MxToggle

## Implemented Interfaces

MxWidget implements ClutterContainer, ClutterScriptable, ClutterAnimatable, AtkImplementorIface and MxStylable.

## Properties

      "disabled"                 gboolean              : Read / Write
      "menu"                     MxMenu*               : Read / Write
      "tooltip-delay"            gint                  : Read / Write / Construct
      "tooltip-text"             gchar*                : Read / Write

## Signals

      "long-press"                                     : Run Last

## Description

MxWidget is a simple abstract class on top of ClutterActor. It provides basic themeing properties.

Actors in the Mx library should subclass MxWidget if they plan to obey to a certain MxStyle.

## Details

### enum MxLongPressAction

    typedef enum {
      MX_LONG_PRESS_QUERY,
      MX_LONG_PRESS_ACTION,
      MX_LONG_PRESS_CANCEL
    } MxLongPressAction;

### struct MxWidget

    struct MxWidget;

Base class for stylable actors. The contents of the MxWidget structure are private and should only be accessed through the public API.

### struct MxWidgetClass

    struct MxWidgetClass {
    };

Base class for stylable actors.

### mx_widget_set_tooltip_text ()

    void                mx_widget_set_tooltip_text          (MxWidget *widget,
                                                             const gchar *text);

Set the tooltip text of the widget. Note that setting tooltip text will cause the widget to be set reactive. If you no longer need tooltips and you do not need the widget to be reactive, you must set ClutterActor::reactive to `FALSE`.

`widget` : | A MxWidget
`text` : | text to set as the tooltip

### mx_widget_get_tooltip_text ()

    const gchar *       mx_widget_get_tooltip_text          (MxWidget *widget);

Get the current tooltip string

`widget` : | A MxWidget
Returns : | The current tooltip string, owned by the MxWidget

### mx_widget_show_tooltip ()

    void                mx_widget_show_tooltip              (MxWidget *widget);

Show the tooltip for `widget`

`widget` : | A MxWidget

### mx_widget_hide_tooltip ()

    void                mx_widget_hide_tooltip              (MxWidget *widget);

Hide the tooltip for `widget`

`widget` : | A MxWidget

### mx_widget_set_menu ()

    void                mx_widget_set_menu                  (MxWidget *widget,
                                                             MxMenu *menu);

Set the value of the "menu" property.

`widget` : | A MxWidget
`menu` : | A MxMenu

### mx_widget_get_menu ()

    MxMenu *            mx_widget_get_menu                  (MxWidget *widget);

Get the object in the "menu" property.

`widget` : | A MxWidget
Returns : | The current object in the "menu" property. [transfer none]

### mx_widget_get_disabled ()

    gboolean            mx_widget_get_disabled              (MxWidget *widget);

Get the value of the "disabled" property.

`widget` : | an MxWidget

### mx_widget_set_disabled ()

    void                mx_widget_set_disabled              (MxWidget *widget,
                                                             gboolean disabled);

Set the disabled property. Disabled widgets have a "disabled" pseudo-class until disabled is set to FALSE.

`widget` : | an MxWidget
`disabled` : | value to set

### mx_widget_long_press_query ()

    void                mx_widget_long_press_query          (MxWidget *widget,
                                                             ClutterButtonEvent *event);

Emit the long-press query signal and start a long-press timeout if required.

`widget` : | An MxWidget
`event` : | the event used to determine whether to run a long-press

### mx_widget_long_press_cancel ()

    void                mx_widget_long_press_cancel         (MxWidget *widget);

Cancel a long-press timeout if one is running and emit the signal to notify that the long-press has been cancelled.

`widget` : | An MxWidget

### mx_widget_get_background_image ()

    ClutterActor *      mx_widget_get_background_image      (MxWidget *actor);

Get the texture used as the background image. This is set using the "background-image" CSS property. This function should normally only be used by subclasses.

`actor` : | A MxWidget
Returns : | a ClutterActor. [transfer none]

### mx_widget_get_border_image ()

    ClutterActor *      mx_widget_get_border_image          (MxWidget *actor);

Get the texture used as the border image. This is set using the "border-image" CSS property. This function should normally only be used by subclasses.

`actor` : | A MxWidget
Returns : | ClutterActor. [transfer none]

### mx_widget_get_padding ()

    void                mx_widget_get_padding               (MxWidget *widget,
                                                             MxPadding *padding);

Gets the padding of the widget, set using the "padding" CSS property. This function should normally only be used by subclasses.

`widget` : | A MxWidget
`padding` : | A pointer to an MxPadding to fill

### mx_widget_paint_background ()

    void                mx_widget_paint_background          (MxWidget *widget);

Invokes MxWidget::`paint_background()` using the default background image and/or color from the `widget` style

This function should be used by subclasses of MxWidget that override the `paint()` virtual function and cannot chain up

`widget` : | a MxWidget

### mx_widget_apply_style ()

    void                mx_widget_apply_style               (MxWidget *widget,
                                                             MxStyle *style);

Used to implement how a new style instance should be applied in the widget. For instance, setting style instance on stylable internal children.

`widget` : | A MxWidget
`style` : | A MxStyle

Since 1.2

### mx_widget_get_available_area ()

    void                mx_widget_get_available_area        (MxWidget *widget,
                                                             const ClutterActorBox *allocation,
                                                             ClutterActorBox *area);

Copies `allocation` into `area` and accounts for the padding values. This gives the area that is available in which to allocate children with respect to padding.

`widget` : | A MxWidget
`allocation` : | A ClutterActorBox
`area` : | A ClutterActorBox

### mx_widget_set_tooltip_delay ()

    void                mx_widget_set_tooltip_delay         (MxWidget *widget,
                                                             guint delay);

Set the value, in milliseconds, of the "tooltip-delay" property. This is initially set to MX_WIDGET_TOOLTIP_TIMEOUT.

`widget` : | an MxWidget

### mx_widget_get_tooltip_delay ()

    guint               mx_widget_get_tooltip_delay         (MxWidget *widget);

Get the value of the "tooltip-delay" property.

`widget` : | an MxWidget
Returns : | the current delay value in milliseconds

## Property Details

### The `"disabled"` property

      "disabled"                 gboolean              : Read / Write

Whether disabled styling should be applied and the widget made unreactive.

Default value: FALSE

### The `"menu"` property

      "menu"                     MxMenu*               : Read / Write

MxMenu associated with the widget.

### The `"tooltip-delay"` property

      "tooltip-delay"            gint                  : Read / Write / Construct

Delay time before showing the tooltip.

Allowed values: >= 0

Default value: 500

### The `"tooltip-text"` property

      "tooltip-text"             gchar*                : Read / Write

text displayed on the tooltip

Default value: ""

## Signal Details

### The `"long-press"` signal

    gboolean            user_function                      (MxWidget         *widget,
                                                            gfloat            arg1,
                                                            gfloat            arg2,
                                                            MxLongPressAction arg3,
                                                            gpointer          user_data)      : Run Last

Emitted when the user holds a mouse button down for a longer period.

`widget` : | the object that received the signal
`user_data` : | user data set when the signal handler was connected.