JWM Source Documentation
menu.h
Go to the documentation of this file.
00001 00010 #ifndef MENU_H 00011 #define MENU_H 00012 00014 typedef enum { 00015 MA_NONE, 00016 MA_EXECUTE, 00017 MA_DESKTOP, 00018 MA_SENDTO, 00019 MA_LAYER, 00020 MA_STICK, 00021 MA_MAXIMIZE, 00022 MA_MAXIMIZE_H, 00023 MA_MAXIMIZE_V, 00024 MA_MINIMIZE, 00025 MA_RESTORE, 00026 MA_SHADE, 00027 MA_MOVE, 00028 MA_RESIZE, 00029 MA_KILL, 00030 MA_CLOSE, 00031 MA_EXIT, 00032 MA_RESTART 00033 } MenuActionType; 00034 00036 typedef struct MenuAction { 00037 00038 MenuActionType type; 00041 union { 00042 int i; 00043 char *str; 00044 } data; 00045 00046 } MenuAction; 00047 00049 typedef enum { 00050 MENU_ITEM_NORMAL, 00051 MENU_ITEM_SUBMENU, 00052 MENU_ITEM_SEPARATOR 00053 } MenuItemType; 00054 00056 typedef struct MenuItem { 00057 00058 MenuItemType type; 00059 char *name; 00060 MenuAction action; 00061 char *iconName; 00062 struct Menu *submenu; 00063 struct MenuItem *next; 00067 struct IconNode *icon; 00069 } MenuItem; 00070 00072 typedef struct Menu { 00073 00074 /* These fields must be set before calling ShowMenu */ 00075 struct MenuItem *items; 00076 char *label; 00077 int itemHeight; 00079 /* These fields are handled by menu.c */ 00080 Window window; 00081 int x; 00082 int y; 00083 int width; 00084 int height; 00085 int currentIndex; 00086 int lastIndex; 00087 unsigned int itemCount; 00088 int parentOffset; 00089 int textOffset; 00090 int *offsets; 00091 struct Menu *parent; 00093 } Menu; 00094 00095 typedef void (*RunMenuCommandType)(const MenuAction *action); 00096 00100 void InitializeMenu(Menu *menu); 00101 00108 void ShowMenu(Menu *menu, RunMenuCommandType runner, int x, int y); 00109 00113 void DestroyMenu(Menu *menu); 00114 00116 extern int menuShown; 00117 00121 void SetMenuOpacity(const char *str); 00122 00123 #endif /* MENU_H */ 00124