JWM Source Documentation
menu.h
Go to the documentation of this file.
1 
10 #ifndef MENU_H
11 #define MENU_H
12 
13 #include "timing.h"
14 
15 struct ScreenType;
16 
18 typedef unsigned char MenuActionType;
19 #define MA_NONE 0
20 #define MA_EXECUTE 1
21 #define MA_DESKTOP 2
22 #define MA_SENDTO 3
23 #define MA_LAYER 4
24 #define MA_STICK 5
25 #define MA_MAXIMIZE 6
26 #define MA_MAXIMIZE_H 7
27 #define MA_MAXIMIZE_V 8
28 #define MA_MINIMIZE 9
29 #define MA_RESTORE 10
30 #define MA_SHADE 11
31 #define MA_MOVE 12
32 #define MA_RESIZE 13
33 #define MA_KILL 14
34 #define MA_CLOSE 15
35 #define MA_EXIT 16
36 #define MA_RESTART 17
37 #define MA_DYNAMIC 18
38 #define MA_SENDTO_MENU 19
39 #define MA_DESKTOP_MENU 20
40 #define MA_WINDOW_MENU 21
41 #define MA_ACTION_MASK 0x7F
42 #define MA_GROUP_MASK 0x80
43 
45 typedef struct MenuAction {
46 
47  void *context;
49  /* Extra data for the action. */
50  char *str;
51  unsigned value;
52 
55 } MenuAction;
56 
58 typedef unsigned char MenuItemType;
59 #define MENU_ITEM_NORMAL 0
60 #define MENU_ITEM_SUBMENU 1
61 #define MENU_ITEM_SEPARATOR 2
64 typedef struct MenuItem {
65 
67  char *name;
68  char *tooltip;
70  char *iconName;
71  struct Menu *submenu;
72  struct MenuItem *next;
76  struct IconNode *icon;
78 } MenuItem;
79 
81 typedef struct Menu {
82 
83  /* These fields must be set before calling ShowMenu */
84  struct MenuItem *items;
85  char *label;
86  char *dynamic;
87  int itemHeight;
89  /* These fields are handled by menu.c */
90  Window window;
91  Pixmap pixmap;
92  int x;
93  int y;
94  int width;
95  int height;
97  int lastIndex;
98  unsigned int itemCount;
101  int *offsets;
102  struct Menu *parent;
103  const struct ScreenType *screen;
106 
107 } Menu;
108 
109 typedef void (*RunMenuCommandType)(MenuAction *action, unsigned button);
110 
112 Menu *CreateMenu();
113 
116 
120 void InitializeMenu(Menu *menu);
121 
130 char ShowMenu(Menu *menu, RunMenuCommandType runner,
131  int x, int y, char keyboard);
132 
136 void DestroyMenu(Menu *menu);
137 
139 extern int menuShown;
140 
141 #endif /* MENU_H */
142 

joewing.net / Projects / JWM