MexMenu

MexMenu — A hierarchical menu widget

Synopsis

enum                MexMenuActionType;
struct              MexMenu;
struct              MexMenuClass;
ClutterActor *      mex_menu_new                        (void);
void                mex_menu_add_action                 (MexMenu *menu,
                                                         MxAction *action,
                                                         MexMenuActionType type);
void                mex_menu_action_set_detail          (MexMenu *menu,
                                                         const gchar *action,
                                                         const gchar *detail);
const gchar *       mex_menu_action_get_detail          (MexMenu *menu,
                                                         const gchar *action_name);
void                mex_menu_action_set_toggled         (MexMenu *menu,
                                                         const gchar *action_name,
                                                         gboolean toggled);
gboolean            mex_menu_action_get_toggled         (MexMenu *menu,
                                                         const gchar *action_name);
void                mex_menu_remove_action              (MexMenu *menu,
                                                         const gchar *action);
GList *             mex_menu_get_actions                (MexMenu *menu,
                                                         gint depth);
gint                mex_menu_push                       (MexMenu *menu);
gint                mex_menu_pop                        (MexMenu *menu);
void                mex_menu_clear_all                  (MexMenu *menu);
void                mex_menu_set_min_width              (MexMenu *menu,
                                                         gfloat min_width);
gfloat              mex_menu_get_min_width              (MexMenu *menu);
MxBoxLayout *       mex_menu_get_layout                 (MexMenu *menu);
                    MexMenuPrivate;

Object Hierarchy

  GEnum
   +----MexMenuActionType
  GObject
   +----GInitiallyUnowned
         +----ClutterActor
               +----MxWidget
                     +----MexResizingHBox
                           +----MexMenu

Implemented Interfaces

MexMenu implements ClutterScriptable, ClutterAnimatable, AtkImplementorIface, MxStylable, ClutterContainer, MxFocusable and MexScene.

Properties

  "depth"                    gint                  : Read
  "min-menu-width"           gfloat                : Read / Write

Description

MexMenu is a widget that can be used to represent a hierarchical menu structure. Menu items are created from MxAction objects, and the current menu depth can be incremented or decremented to represent different levels of a tree hierarchy.

MexMenu presents menu items vertically, and the menu can expand either to the right (where depth increases positively), or to the left (where depth increases negatively).

Details

enum MexMenuActionType

typedef enum
{
  MEX_MENU_NONE,
  MEX_MENU_LEFT,
  MEX_MENU_RIGHT,
  MEX_MENU_TOGGLE
} MexMenuActionType;

struct MexMenu

struct MexMenu;

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


struct MexMenuClass

struct MexMenuClass {
  MexResizingHBoxClass parent_class;
};

mex_menu_new ()

ClutterActor *      mex_menu_new                        (void);

Creates a new MexMenu.

Returns :

a newly allocated MexMenu

mex_menu_add_action ()

void                mex_menu_add_action                 (MexMenu *menu,
                                                         MxAction *action,
                                                         MexMenuActionType type);

Adds a menu item to menu at the current depth. action must be a uniquely named action, if an action with that name already exists in the menu, this function will do nothing.

menu :

A MexMenu

action :

A MxAction

type :

The menu action type

mex_menu_action_set_detail ()

void                mex_menu_action_set_detail          (MexMenu *menu,
                                                         const gchar *action,
                                                         const gchar *detail);

Adds detail text to a particular menu item. This is the text that is displayed below the display-name of the menu item.

menu :

A MexMenu

action :

The action name

detail :

The detail text

mex_menu_action_get_detail ()

const gchar *       mex_menu_action_get_detail          (MexMenu *menu,
                                                         const gchar *action_name);

mex_menu_action_set_toggled ()

void                mex_menu_action_set_toggled         (MexMenu *menu,
                                                         const gchar *action_name,
                                                         gboolean toggled);

mex_menu_action_get_toggled ()

gboolean            mex_menu_action_get_toggled         (MexMenu *menu,
                                                         const gchar *action_name);

mex_menu_remove_action ()

void                mex_menu_remove_action              (MexMenu *menu,
                                                         const gchar *action);

Remove the menu item that represents the given action name.

menu :

A MexMenu

action :

The action name

mex_menu_get_actions ()

GList *             mex_menu_get_actions                (MexMenu *menu,
                                                         gint depth);

Retrieves the actions represented at the given depth of the menu. If the given depth doesn't exist, or there are no menu items, this function will return NULL.

The returned MxAction objects are owned by menu. The list should be freed with g_list_free().

menu :

A MexMenu

depth :

The menu depth

Returns :

a newly allocated list of MxAction objects

mex_menu_push ()

gint                mex_menu_push                       (MexMenu *menu);

Increments the current depth of the menu. If the current depth is 0, or positive, this will add a new menu level. If the depth is negative, this will remove a menu level.

menu :

A MexMenu

Returns :

The new menu depth

mex_menu_pop ()

gint                mex_menu_pop                        (MexMenu *menu);

Decrements the current depth of the menu. If the current depth is 0, or negative, this will add a new menu level. If the depth is positive, this will remove a menu level.

menu :

A MexMenu

Returns :

The new menu depth

mex_menu_clear_all ()

void                mex_menu_clear_all                  (MexMenu *menu);

Removes all items from the menu.

menu :

A MexMenu

mex_menu_set_min_width ()

void                mex_menu_set_min_width              (MexMenu *menu,
                                                         gfloat min_width);

mex_menu_get_min_width ()

gfloat              mex_menu_get_min_width              (MexMenu *menu);

mex_menu_get_layout ()

MxBoxLayout *       mex_menu_get_layout                 (MexMenu *menu);

MexMenuPrivate

typedef struct _MexMenuPrivate MexMenuPrivate;

Property Details

The "depth" property

  "depth"                    gint                  : Read

The depth of the active menu item.

Allowed values: >= -2147483647

Default value: 0


The "min-menu-width" property

  "min-menu-width"           gfloat                : Read / Write

The minimum width of any menu layout.

Allowed values: >= -1

Default value: -1