## MxStyle MxStyle — a data store for style properties |

## Synopsis

    enum                MxStyleError;
    struct              MxStyle;
    struct              MxStyleClass;
    MxStyle *           mx_style_get_default                (void);
    MxStyle *           mx_style_new                        (void);
    gboolean            mx_style_load_from_file             (MxStyle *style,
                                                             const gchar *filename,
                                                             GError **error);
    void                mx_style_get_property               (MxStyle *style,
                                                             MxStylable *stylable,
                                                             GParamSpec *pspec,
                                                             GValue *value);
    void                mx_style_get                        (MxStyle *style,
                                                             MxStylable *stylable,
                                                             const gchar *first_property_name,
                                                             ...);
    void                mx_style_get_valist                 (MxStyle *style,
                                                             MxStylable *stylable,
                                                             const gchar *first_property_name,
                                                             va_list va_args);

## Object Hierarchy

      GObject
       +----MxStyle

## Signals

      "changed"                                        : Run Last

## Description

MxStyle is a property data store that can read properties from a style sheet. It is queried with objects that implement the MxStylable interface.

## Details

### enum MxStyleError

    typedef enum {
     /*< prefix=MX_STYLE_ERROR >*/
      MX_STYLE_ERROR_INVALID_FILE
    } MxStyleError;

### struct MxStyle

    struct MxStyle;

The contents of this structure is private and should only be accessed using the provided API.

### struct MxStyleClass

    struct MxStyleClass {
      GObjectClass parent_class;

      void (* changed) (MxStyle *style);

      /* padding for future expansion */
      void (*_padding_0) (void);
      void (*_padding_1) (void);
      void (*_padding_2) (void);
      void (*_padding_3) (void);
      void (*_padding_4) (void);
    };

### mx_style_get_default ()

    MxStyle *           mx_style_get_default                (void);

Return the default MxStyle object. This includes the current theme (if any).

Returns : | a MxStyle object. This must not be freed or unref'd by applications. [transfer none]

### mx_style_new ()

    MxStyle *           mx_style_new                        (void);

Creates a new MxStyle object. This must be freed using g_object_unref when no longer required.

Returns : | a newly allocated MxStyle

### mx_style_load_from_file ()

    gboolean            mx_style_load_from_file             (MxStyle *style,
                                                             const gchar *filename,
                                                             GError **error);

Load style information from the specified file.

`style` : | a MxStyle
`filename` : | filename of the style sheet to load
`error` : | a GError or NULL
Returns : | TRUE if the style information was loaded successfully. Returns FALSE on error.

### mx_style_get_property ()

    void                mx_style_get_property               (MxStyle *style,
                                                             MxStylable *stylable,
                                                             GParamSpec *pspec,
                                                             GValue *value);

Requests the property described in `pspec` for the specified stylable

`style` : | the style data store object
`stylable` : | a stylable to retreive the data for
`pspec` : | a GParamSpec describing the property required
`value` : | a GValue to place the return value in. [out]

### mx_style_get ()

    void                mx_style_get                        (MxStyle *style,
                                                             MxStylable *stylable,
                                                             const gchar *first_property_name,
                                                             ...);

Gets the style properties for `stylable` from `style`.

In general, a copy is made of the property contents and the caller is responsible for freeing the memory in the appropriate manner for the property type.

`style` : | a MxStyle
`stylable` : | a MxStylable
`first_property_name` : | name of the first property to get
`Varargs` : | return location for the first property, followed optionally by more name/return location pairs, followed by `NULL`

### mx_style_get_valist ()

    void                mx_style_get_valist                 (MxStyle *style,
                                                             MxStylable *stylable,
                                                             const gchar *first_property_name,
                                                             va_list va_args);

Gets the style properties for `stylable` from `style`.

Please refer to `mx_style_get()` for further information.

`style` : | a MxStyle
`stylable` : | a MxStylable
`first_property_name` : | name of the first property to get
`va_args` : | return location for the first property, followed optionally by more name/return location pairs, followed by `NULL`

## Signal Details

### The `"changed"` signal

    void                user_function                      (MxStyle *arg0,
                                                            gpointer user_data)      : Run Last

Indicates that the style data has changed in some way. For example, a new stylesheet may have been loaded.

`user_data` : | user data set when the signal handler was connected.