menus.h revision 3e747e6d
1/*****************************************************************************/ 2/* 3 4Copyright 1989,1998 The Open Group 5 6Permission to use, copy, modify, distribute, and sell this software and its 7documentation for any purpose is hereby granted without fee, provided that 8the above copyright notice appear in all copies and that both that 9copyright notice and this permission notice appear in supporting 10documentation. 11 12The above copyright notice and this permission notice shall be included in 13all copies or substantial portions of the Software. 14 15THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 19AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 22Except as contained in this notice, the name of The Open Group shall not be 23used in advertising or otherwise to promote the sale, use or other dealings 24in this Software without prior written authorization from The Open Group. 25 26*/ 27/** Copyright 1988 by Evans & Sutherland Computer Corporation, **/ 28/** Salt Lake City, Utah **/ 29/** Cambridge, Massachusetts **/ 30/** **/ 31/** All Rights Reserved **/ 32/** **/ 33/** Permission to use, copy, modify, and distribute this software and **/ 34/** its documentation for any purpose and without fee is hereby **/ 35/** granted, provided that the above copyright notice appear in all **/ 36/** copies and that both that copyright notice and this permis- **/ 37/** sion notice appear in supporting documentation, and that the **/ 38/** name of Evans & Sutherland not be used in advertising **/ 39/** in publicity pertaining to distribution of the software without **/ 40/** specific, written prior permission. **/ 41/** **/ 42/** EVANS & SUTHERLAND DISCLAIMs ALL WARRANTIES WITH REGARD **/ 43/** TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANT- **/ 44/** ABILITY AND FITNESS, IN NO EVENT SHALL EVANS & SUTHERLAND **/ 45/** BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAM- **/ 46/** AGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA **/ 47/** OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER **/ 48/** TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE **/ 49/** OR PERFORMANCE OF THIS SOFTWARE. **/ 50/*****************************************************************************/ 51/* $XFree86: xc/programs/twm/menus.h,v 1.5 2001/08/27 21:11:40 dawes Exp $ */ 52 53 54/*********************************************************************** 55 * 56 * $Xorg: menus.h,v 1.4 2001/02/09 02:05:37 xorgcvs Exp $ 57 * 58 * twm menus include file 59 * 60 * 17-Nov-87 Thomas E. LaStrange File created 61 * 62 ***********************************************************************/ 63 64#ifndef _MENUS_ 65#define _MENUS_ 66 67#define TWM_ROOT "bLoB_GoOp" /* my private root menu */ 68#define TWM_WINDOWS "TwmWindows" /* for f.menu "TwmWindows" */ 69 70#define MAX_FILE_SIZE 4096 /* max chars to read from file for cut */ 71 72typedef struct MenuItem 73{ 74 struct MenuItem *next; /* next menu item */ 75 struct MenuItem *prev; /* prev menu item */ 76 struct MenuRoot *sub; /* MenuRoot of a pull right menu */ 77 struct MenuRoot *root; /* back pointer to my MenuRoot */ 78 char *item; /* the character string displayed */ 79 char *action; /* action to be performed */ 80 Pixel fore; /* foreground color */ 81 Pixel back; /* background color */ 82 Pixel hi_fore; /* highlight foreground */ 83 Pixel hi_back; /* highlight background */ 84 short item_num; /* item number of this menu */ 85 short x; /* x coordinate for text */ 86 short func; /* twm built in function */ 87 short state; /* video state, 0 = normal, 1 = reversed */ 88 short strlen; /* strlen(item) */ 89 short user_colors; /* colors were specified */ 90} MenuItem; 91 92typedef struct MenuRoot 93{ 94 struct MenuItem *first; /* first item in menu */ 95 struct MenuItem *last; /* last item in menu */ 96 struct MenuRoot *prev; /* previous root menu if pull right */ 97 struct MenuRoot *next; /* next in list of root menus */ 98 char *name; /* name of root */ 99 Window w; /* the window of the menu */ 100 Window shadow; /* the shadow window */ 101 Pixel hi_fore; /* highlight foreground */ 102 Pixel hi_back; /* highlight background */ 103 short mapped; /* NEVER_MAPPED, UNMAPPED, or MAPPED */ 104 short height; /* height of the menu */ 105 short width; /* width of the menu */ 106 short items; /* number of items in the menu */ 107 short pull; /* is there a pull right entry ? */ 108 short entered; /* EnterNotify following pop up */ 109 short real_menu; /* this is a real menu */ 110} MenuRoot; 111 112#define NEVER_MAPPED 0 /* constants for mapped field of MenuRoot */ 113#define UNMAPPED 1 114#define MAPPED 2 115 116 117typedef struct MouseButton 118{ 119 int func; /* the function number */ 120 int mask; /* modifier mask */ 121 MenuRoot *menu; /* menu if func is F_MENU */ 122 MenuItem *item; /* action to perform if func != F_MENU */ 123} MouseButton; 124 125typedef struct FuncKey 126{ 127 struct FuncKey *next; /* next in the list of function keys */ 128 char *name; /* key name */ 129 KeySym keysym; /* X keysym */ 130 KeyCode keycode; /* X keycode */ 131 int cont; /* context */ 132 int mods; /* modifiers */ 133 int func; /* function to perform */ 134 char *win_name; /* window name (if any) */ 135 char *action; /* action string (if any) */ 136} FuncKey; 137 138extern int RootFunction; 139extern MenuRoot *ActiveMenu; 140extern MenuItem *ActiveItem; 141extern int MoveFunction; 142extern int WindowMoved; 143extern int ConstMove; 144extern int ConstMoveDir; 145extern int ConstMoveX; 146extern int ConstMoveY; 147extern int ConstMoveXL; 148extern int ConstMoveXR; 149extern int ConstMoveYT; 150extern int ConstMoveYB; 151extern int menuFromFrameOrWindowOrTitlebar; 152extern int ResizeOrigX; 153extern int ResizeOrigY; 154 155#define MAXMENUDEPTH 10 /* max number of nested menus */ 156extern int MenuDepth; 157 158#define MOVE_NONE 0 /* modes of constrained move */ 159#define MOVE_VERT 1 160#define MOVE_HORIZ 2 161 162#define WARPSCREEN_NEXT "next" 163#define WARPSCREEN_PREV "prev" 164#define WARPSCREEN_BACK "back" 165 166#define COLORMAP_NEXT "next" 167#define COLORMAP_PREV "prev" 168#define COLORMAP_DEFAULT "default" 169 170extern void InitMenus ( void ); 171extern Bool AddFuncKey ( char *name, int cont, int mods, int func, char *win_name, char *action ); 172extern int CreateTitleButton ( char *name, int func, char *action, MenuRoot *menuroot, Bool rightside, Bool append ); 173extern void InitTitlebarButtons ( void ); 174extern void PaintEntry ( MenuRoot *mr, MenuItem *mi, int exposure ); 175extern void PaintMenu ( MenuRoot *mr, XEvent *e ); 176extern void UpdateMenu ( void ); 177extern MenuRoot * NewMenuRoot ( char *name ); 178extern MenuItem * AddToMenu ( MenuRoot *menu, char *item, char *action, MenuRoot *sub, int func, char *fore, char *back ); 179extern void MakeMenus ( void ); 180extern void MakeMenu ( MenuRoot *mr ); 181extern Bool PopUpMenu ( MenuRoot *menu, int x, int y, Bool center ); 182extern void PopDownMenu ( void ); 183extern MenuRoot * FindMenuRoot ( char *name ); 184extern void resizeFromCenter ( Window w, TwmWindow *tmp_win ); 185extern int WarpThere ( TwmWindow * t ); 186extern int ExecuteFunction ( int func, char *action, Window w, TwmWindow *tmp_win, XEvent *eventp, int context, int pulldown ); 187extern int DeferExecution ( int context, int func, Cursor cursor ); 188extern void ReGrab ( void ); 189extern Bool NeedToDefer ( MenuRoot *root ); 190extern void Execute ( char *s ); 191extern void FocusOnRoot ( void ); 192extern void DeIconify ( TwmWindow *tmp_win ); 193extern void Iconify ( TwmWindow *tmp_win, int def_x, int def_y ); 194extern void SetMapStateProp ( TwmWindow *tmp_win, int state ); 195extern void WarpToScreen ( int n, int inc ); 196extern void BumpWindowColormap ( TwmWindow *tmp, int inc ); 197extern void HideIconManager ( void ); 198extern void SetBorder ( TwmWindow *tmp, Bool onoroff ); 199extern void DestroyMenu ( MenuRoot *menu ); 200extern void WarpAlongRing ( XButtonEvent *ev, Bool forward ); 201extern void WarpToWindow ( TwmWindow *t ); 202extern void SendDeleteWindowMessage ( TwmWindow *tmp, Time timestamp ); 203extern void SendSaveYourselfMessage ( TwmWindow *tmp, Time timestamp ); 204extern void SendTakeFocusMessage ( TwmWindow *tmp, Time timestamp ); 205 206#endif /* _MENUS_ */ 207