aboutsummaryrefslogtreecommitdiffstats
path: root/src/bin/e_dbusmenu.h
blob: cbc9df45fa03e0e3ca41e70967ddee766c6fc7b5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#ifndef _E_DBUSMENU_H_
#define _E_DBUSMENU_H_

#include <Eina.h>
#include <Eldbus.h>

typedef enum {
   E_DBUSMENU_ITEM_TYPE_STANDARD = 0,
   E_DBUSMENU_ITEM_TYPE_SEPARATOR,
   E_DBUSMENU_ITEM_TYPE_LAST
} E_DBusMenu_Item_Type;

typedef enum {
   E_DBUSMENU_ITEM_TOGGLE_TYPE_NONE = 0,
   E_DBUSMENU_ITEM_TOGGLE_TYPE_CHECKMARK,
   E_DBUSMENU_ITEM_TOGGLE_TYPE_RADIO,
   E_DBUSMENU_ITEM_TOGGLE_TYPE_LAST
} E_DBusMenu_Item_Toggle_Type;

typedef enum {
   E_DBUSMENU_ITEM_DISPOSITION_NORMAL = 0,
   E_DBUSMENU_ITEM_DISPOSITION_INFORMATIVE,
   E_DBUSMENU_ITEM_DISPOSITION_WARNING,
   E_DBUSMENU_ITEM_DISPOSITION_ALERT,
   E_DBUSMENU_ITEM_DISPOSTION_LAST
} E_DBusMenu_Item_Disposition;

typedef enum
{
   E_DBUSMENU_ITEM_EVENT_CLICKED = 0,
   E_DBUSMENU_ITEM_EVENT_HOVERED,
   E_DBUSMENU_ITEM_EVENT_OPENED,
   E_DBUSMENU_ITEM_EVENT_CLOSED,
   E_DBUSMENU_ITEM_EVENT_LAST
} E_DBusMenu_Item_Event;

typedef struct _E_DBusMenu_Item  E_DBusMenu_Item;
typedef struct _E_DBusMenu_Ctx E_DBusMenu_Ctx;

struct _E_DBusMenu_Item
{
   EINA_INLIST;
   unsigned revision;
   int id;
   const char *label;
   E_DBusMenu_Item_Type type;
   E_DBusMenu_Item_Toggle_Type toggle_type;
   E_DBusMenu_Item_Disposition disposition;
   Eina_Bool toggle_state;
   Eina_Bool enabled;
   Eina_Bool visible;
   Eina_Bool is_submenu;
   const char *icon_name;
   unsigned char *icon_data;
   unsigned icon_data_size;
   Eina_Inlist *sub_items;
   E_DBusMenu_Item *parent;
   E_DBusMenu_Ctx *ctx;
};

typedef void (*E_DBusMenu_Pop_Request_Cb)(void *data, const E_DBusMenu_Item *item);
typedef void (*E_DBusMenu_Update_Cb)(void *data, E_DBusMenu_Item *new_root_item);

E_API E_DBusMenu_Ctx * e_dbusmenu_load(Eldbus_Connection *conn, const char *bus, const char *path, const void *data);
E_API void e_dbusmenu_unload(E_DBusMenu_Ctx *ctx);
E_API void e_dbusmenu_update_cb_set(E_DBusMenu_Ctx *menu_data, E_DBusMenu_Update_Cb cb);
E_API void e_dbusmenu_pop_request_cb_set(E_DBusMenu_Ctx *menu_data, E_DBusMenu_Pop_Request_Cb cb);

E_API void e_dbusmenu_event_send(E_DBusMenu_Item *m, E_DBusMenu_Item_Event event);

#endif