JWM Source Documentation
Data Structures | Macros | Typedefs | Functions | Variables
menu.h File Reference

Menu display and handling functions. More...

#include "timing.h"

Go to the source code of this file.

Data Structures

struct  MenuAction
 Structure to represent a menu action for callbacks. More...
 
struct  MenuItem
 Structure to represent a menu item. More...
 
struct  Menu
 Structure to represent a menu or submenu. More...
 

Macros

#define MA_NONE   0
 
#define MA_EXECUTE   1
 
#define MA_DESKTOP   2
 
#define MA_SENDTO   3
 
#define MA_LAYER   4
 
#define MA_STICK   5
 
#define MA_MAXIMIZE   6
 
#define MA_MAXIMIZE_H   7
 
#define MA_MAXIMIZE_V   8
 
#define MA_MINIMIZE   9
 
#define MA_RESTORE   10
 
#define MA_SHADE   11
 
#define MA_MOVE   12
 
#define MA_RESIZE   13
 
#define MA_KILL   14
 
#define MA_CLOSE   15
 
#define MA_EXIT   16
 
#define MA_RESTART   17
 
#define MA_DYNAMIC   18
 
#define MA_SENDTO_MENU   19
 
#define MA_DESKTOP_MENU   20
 
#define MA_WINDOW_MENU   21
 
#define MA_ACTION_MASK   0x7F
 
#define MA_GROUP_MASK   0x80
 
#define MENU_ITEM_NORMAL   0
 Normal menu item (button).
 
#define MENU_ITEM_SUBMENU   1
 Submenu.
 
#define MENU_ITEM_SEPARATOR   2
 Item separator.
 

Typedefs

typedef unsigned char MenuActionType
 Enumeration of menu action types.
 
typedef struct MenuAction MenuAction
 Structure to represent a menu action for callbacks.
 
typedef unsigned char MenuItemType
 Enumeration of possible menu elements.
 
typedef struct MenuItem MenuItem
 Structure to represent a menu item.
 
typedef struct Menu Menu
 Structure to represent a menu or submenu.
 
typedef void(* RunMenuCommandType )(MenuAction *action, unsigned button)
 

Functions

MenuCreateMenu ()
 Allocate an empty menu.
 
MenuItemCreateMenuItem (MenuItemType type)
 Create an empty menu item.
 
void InitializeMenu (Menu *menu)
 Initialize a menu structure to be shown.
 
char ShowMenu (Menu *menu, RunMenuCommandType runner, int x, int y, char keyboard)
 Show a menu.
 
void DestroyMenu (Menu *menu)
 Destroy a menu structure.
 

Variables

int menuShown
 The number of open menus.
 

Detailed Description

Menu display and handling functions.

Header for the menu functions.

Author
Joe Wingbermuehle
Date
2004-2006

Definition in file menu.h.

Macro Definition Documentation

#define MA_ACTION_MASK   0x7F

Definition at line 41 of file menu.h.

Referenced by DestroyMenu(), PatchMenu(), and UnpatchMenu().

#define MA_CLOSE   15
#define MA_DESKTOP   2

Definition at line 21 of file menu.h.

Referenced by CreateDesktopMenu(), RunRootCommand(), and RunWindowCommand().

#define MA_DESKTOP_MENU   20

Definition at line 39 of file menu.h.

Referenced by ParseMenuItem(), PatchMenu(), and UnpatchMenu().

#define MA_DYNAMIC   18

Definition at line 37 of file menu.h.

Referenced by DestroyMenu(), ParseMenuItem(), PatchMenu(), and UnpatchMenu().

#define MA_EXECUTE   1

Definition at line 20 of file menu.h.

Referenced by DestroyMenu(), ParseMenuItem(), RunRootCommand(), RunTaskBarCommand(), and ShowClientList().

#define MA_EXIT   16

Definition at line 35 of file menu.h.

Referenced by DestroyMenu(), ParseMenuItem(), and RunRootCommand().

#define MA_GROUP_MASK   0x80

Definition at line 42 of file menu.h.

Referenced by RunTaskBarCommand(), and ShowClientList().

#define MA_KILL   14

Definition at line 33 of file menu.h.

Referenced by CreateWindowMenu(), ParseMenuItem(), RunRootCommand(), and RunWindowCommand().

#define MA_LAYER   4

Definition at line 23 of file menu.h.

Referenced by CreateWindowLayerMenu(), RunRootCommand(), and RunWindowCommand().

#define MA_MAXIMIZE   6

Definition at line 25 of file menu.h.

Referenced by CreateWindowMenu(), ParseMenuItem(), RunRootCommand(), and RunWindowCommand().

#define MA_MAXIMIZE_H   7

Definition at line 26 of file menu.h.

Referenced by CreateWindowMenu(), and RunWindowCommand().

#define MA_MAXIMIZE_V   8

Definition at line 27 of file menu.h.

Referenced by CreateWindowMenu(), and RunWindowCommand().

#define MA_MINIMIZE   9
#define MA_MOVE   12

Definition at line 31 of file menu.h.

Referenced by CreateWindowMenu(), ParseMenuItem(), RunRootCommand(), and RunWindowCommand().

#define MA_NONE   0

Definition at line 19 of file menu.h.

Referenced by CreateWindowLayerMenu(), CreateWindowMenu(), and CreateWindowSendToMenu().

#define MA_RESIZE   13

Definition at line 32 of file menu.h.

Referenced by CreateWindowMenu(), ParseMenuItem(), RunRootCommand(), and RunWindowCommand().

#define MA_RESTART   17

Definition at line 36 of file menu.h.

Referenced by ParseMenuItem(), and RunRootCommand().

#define MA_RESTORE   10
#define MA_SENDTO   3

Definition at line 22 of file menu.h.

Referenced by CreateSendtoMenu(), RunRootCommand(), RunTaskBarCommand(), and RunWindowCommand().

#define MA_SENDTO_MENU   19

Definition at line 38 of file menu.h.

Referenced by ParseMenuItem(), PatchMenu(), ShowClientList(), and UnpatchMenu().

#define MA_SHADE   11

Definition at line 30 of file menu.h.

Referenced by CreateWindowMenu(), ParseMenuItem(), RunRootCommand(), and RunWindowCommand().

#define MA_STICK   5

Definition at line 24 of file menu.h.

Referenced by CreateWindowMenu(), ParseMenuItem(), and RunWindowCommand().

#define MA_WINDOW_MENU   21

Definition at line 40 of file menu.h.

Referenced by PatchMenu(), and UnpatchMenu().

#define MENU_ITEM_NORMAL   0

Normal menu item (button).

Definition at line 59 of file menu.h.

Referenced by AddWindowMenuItem(), CreateDesktopMenu(), CreateSendtoMenu(), InsertMenuItem(), MenuLoop(), and ShowClientList().

#define MENU_ITEM_SEPARATOR   2
#define MENU_ITEM_SUBMENU   1

Submenu.

Definition at line 60 of file menu.h.

Referenced by CreateWindowLayerMenu(), MenuCallback(), MenuLoop(), ParseMenuItem(), and ShowClientList().

Typedef Documentation

typedef struct Menu Menu

Structure to represent a menu or submenu.

typedef struct MenuAction MenuAction

Structure to represent a menu action for callbacks.

typedef unsigned char MenuActionType

Enumeration of menu action types.

Definition at line 15 of file menu.h.

typedef struct MenuItem MenuItem

Structure to represent a menu item.

typedef unsigned char MenuItemType

Enumeration of possible menu elements.

Definition at line 58 of file menu.h.

typedef void(* RunMenuCommandType)(MenuAction *action, unsigned button)

Definition at line 109 of file menu.h.

Function Documentation

Menu* CreateMenu ( )
MenuItem* CreateMenuItem ( MenuItemType  type)

Create an empty menu item.

Definition at line 77 of file menu.c.

References Allocate, and MenuItem::type.

Referenced by AddWindowMenuItem(), CreateDesktopMenu(), CreateSendtoMenu(), CreateWindowLayerMenu(), InsertMenuItem(), and ShowClientList().

void DestroyMenu ( Menu menu)
void InitializeMenu ( Menu menu)
char ShowMenu ( Menu menu,
RunMenuCommandType  runner,
int  x,
int  y,
char  keyboard 
)

Show a menu.

Parameters
menuThe menu to show.
runnerCallback executed when an item is selected.
xThe x-coordinate of the menu.
yThe y-coordinate of the menu.
keyboardSet if the request came from a key binding.
Returns
1 if the menu was shown, 0 otherwise.

Definition at line 181 of file menu.c.

References display, GetMousePosition(), GrabMouse(), IsMenuValid(), Menu::itemHeight, JUNLIKELY, JXGrabKeyboard, JXUngrabKeyboard, JXUngrabPointer, MenuCallback(), Menu::offsets, RefocusClient(), RegisterCallback(), ReloadMenu(), rootWindow, shouldExit, shouldReload, ShowSubmenu(), UnpatchMenu(), and UnregisterCallback().

Referenced by ShowClientList(), ShowRootMenu(), and ShowWindowMenu().

Variable Documentation

int menuShown

The number of open menus.

Definition at line 63 of file menu.c.

Referenced by ProcessActionPress(), ProcessActionRelease(), ReloadMenu(), ShowRootMenu(), ShowSubmenu(), and SignalTray().

joewing.net / Projects / JWM