menus.h revision 645f5050
1/*****************************************************************************/ 2/** Copyright 1988 by Evans & Sutherland Computer Corporation, **/ 3/** Salt Lake City, Utah **/ 4/** Portions Copyright 1989 by the Massachusetts Institute of Technology **/ 5/** Cambridge, Massachusetts **/ 6/** **/ 7/** All Rights Reserved **/ 8/** **/ 9/** Permission to use, copy, modify, and distribute this software and **/ 10/** its documentation for any purpose and without fee is hereby **/ 11/** granted, provided that the above copyright notice appear in all **/ 12/** copies and that both that copyright notice and this permis- **/ 13/** sion notice appear in supporting documentation, and that the **/ 14/** names of Evans & Sutherland and M.I.T. not be used in advertising **/ 15/** in publicity pertaining to distribution of the software without **/ 16/** specific, written prior permission. **/ 17/** **/ 18/** EVANS & SUTHERLAND AND M.I.T. DISCLAIM ALL WARRANTIES WITH REGARD **/ 19/** TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANT- **/ 20/** ABILITY AND FITNESS, IN NO EVENT SHALL EVANS & SUTHERLAND OR **/ 21/** M.I.T. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAM- **/ 22/** AGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA **/ 23/** OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER **/ 24/** TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE **/ 25/** OR PERFORMANCE OF THIS SOFTWARE. **/ 26/*****************************************************************************/ 27/* 28 * [ ctwm ] 29 * 30 * Copyright 1992 Claude Lecommandeur. 31 * 32 * Permission to use, copy, modify and distribute this software [ctwm] and 33 * its documentation for any purpose is hereby granted without fee, provided 34 * that the above copyright notice appear in all copies and that both that 35 * copyright notice and this permission notice appear in supporting documen- 36 * tation, and that the name of Claude Lecommandeur not be used in adverti- 37 * sing or publicity pertaining to distribution of the software without 38 * specific, written prior permission. Claude Lecommandeur make no represen- 39 * tations about the suitability of this software for any purpose. It is 40 * provided "as is" without express or implied warranty. 41 * 42 * Claude Lecommandeur DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, 43 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO 44 * EVENT SHALL Claude Lecommandeur BE LIABLE FOR ANY SPECIAL, INDIRECT OR 45 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF 46 * USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 47 * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 48 * PERFORMANCE OF THIS SOFTWARE. 49 * 50 * Author: Claude Lecommandeur [ lecom@sic.epfl.ch ][ April 1992 ] 51 */ 52 53 54/*********************************************************************** 55 * 56 * $XConsortium: menus.h,v 1.24 89/12/10 17:46:26 jim 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#define TWM_ICONS "TwmIcons" /* for f.menu "TwmIcons" */ 70#define TWM_WORKSPACES "TwmWorkspaces" /* for f.menu "TwmWorkspaces" */ 71#define TWM_ALLWINDOWS "TwmAllWindows" /* for f.menu "TwmAllWindows" */ 72 73/* Added by dl 2004 */ 74#define TWM_ALLICONS "TwmAllIcons" /* for f.menu "TwmAllIcons" */ 75 76/*******************************************************************/ 77/* Added by Dan Lilliehorn (dl@dl.nu) 2000-02-29 */ 78#define TWM_KEYS "TwmKeys" /* for f.menu "TwmKeys" */ 79#define TWM_VISIBLE "TwmVisible" /* for f.menu "TwmVisible" */ 80 81#define MAX_FILE_SIZE 4096 /* max chars to read from file for cut */ 82 83struct MenuItem 84{ 85 struct MenuItem *next; /* next menu item */ 86 struct MenuItem *prev; /* prev menu item */ 87 struct MenuRoot *sub; /* MenuRoot of a pull right menu */ 88 struct MenuRoot *root; /* back pointer to my MenuRoot */ 89 char *item; /* the character string displayed */ 90 char *action; /* action to be performed */ 91 ColorPair normal; /* unhiglight colors */ 92 ColorPair highlight; /* highlight colors */ 93 short item_num; /* item number of this menu */ 94 short x; /* x coordinate for text */ 95 short func; /* twm built in function */ 96 short state; /* video state, 0 = normal, 1 = reversed */ 97 short strlen; /* strlen(item) */ 98 short user_colors; /* colors were specified */ 99 short separated; /* separated from the next item */ 100}; 101 102struct MenuRoot 103{ 104 struct MenuItem *first; /* first item in menu */ 105 struct MenuItem *last; /* last item in menu */ 106 struct MenuItem *lastactive; /* last active item in menu */ 107 struct MenuItem *defaultitem; /* default item in menu */ 108 struct MenuRoot *prev; /* previous root menu if pull right */ 109 struct MenuRoot *next; /* next in list of root menus */ 110 char *name; /* name of root */ 111 Window w; /* the window of the menu */ 112 Window shadow; /* the shadow window */ 113 ColorPair highlight; /* highlight colors */ 114 short mapped; /* NEVER_MAPPED, UNMAPPED, or MAPPED */ 115 short height; /* height of the menu */ 116 short width; /* width of the menu */ 117 short items; /* number of items in the menu */ 118 short pull; /* is there a pull right entry ? */ 119 short entered; /* EnterNotify following pop up */ 120 short real_menu; /* this is a real menu */ 121 short x, y; /* position (for pinned menus) */ 122 short pinned; /* is this a pinned menu*/ 123 struct MenuRoot *pmenu; /* the associated pinned menu */ 124}; 125 126#define NEVER_MAPPED 0 /* constants for mapped field of MenuRoot */ 127#define UNMAPPED 1 128#define MAPPED 2 129 130 131struct MouseButton 132{ 133 int func; /* the function number */ 134 int mask; /* modifier mask */ 135 MenuRoot *menu; /* menu if func is F_MENU */ 136 MenuItem *item; /* action to perform if func != F_MENU */ 137}; 138 139struct FuncButton 140{ 141 struct FuncButton *next; /* next in the list of function buttons */ 142 int num; /* button number */ 143 int cont; /* context */ 144 int mods; /* modifiers */ 145 int func; /* the function number */ 146 MenuRoot *menu; /* menu if func is F_MENU */ 147 MenuItem *item; /* action to perform if func != F_MENU */ 148}; 149 150struct FuncKey 151{ 152 struct FuncKey *next; /* next in the list of function keys */ 153 char *name; /* key name */ 154 KeySym keysym; /* X keysym */ 155 KeyCode keycode; /* X keycode */ 156 int cont; /* context */ 157 int mods; /* modifiers */ 158 int func; /* function to perform */ 159 char *win_name; /* window name (if any) */ 160 char *action; /* action string (if any) */ 161 MenuRoot *menu; /* menu if func is F_MENU */ 162}; 163 164extern int RootFunction; 165extern MenuRoot *ActiveMenu; 166extern MenuItem *ActiveItem; 167extern int MoveFunction; 168extern int WindowMoved; 169extern int ConstMove; 170extern int ConstMoveDir; 171extern int ConstMoveX; 172extern int ConstMoveY; 173extern int ConstMoveXL; 174extern int ConstMoveXR; 175extern int ConstMoveYT; 176extern int ConstMoveYB; 177 178#define MAXMENUDEPTH 10 /* max number of nested menus */ 179extern int MenuDepth; 180 181#define MOVE_NONE 0 /* modes of constrained move */ 182#define MOVE_VERT 1 183#define MOVE_HORIZ 2 184 185#define WARPSCREEN_NEXT "next" 186#define WARPSCREEN_PREV "prev" 187#define WARPSCREEN_BACK "back" 188 189#define COLORMAP_NEXT "next" 190#define COLORMAP_PREV "prev" 191#define COLORMAP_DEFAULT "default" 192 193extern void InitTitlebarButtons(void); 194extern void InitMenus(void); 195extern MenuRoot *NewMenuRoot(char *name); 196extern MenuItem *AddToMenu(MenuRoot *menu, char *item, char *action, 197 MenuRoot *sub, int func, char *fore, char *back); 198extern Bool PopUpMenu(MenuRoot *menu, int x, int y, Bool center); 199extern void MakeWorkspacesMenu (void); 200extern MenuRoot *FindMenuRoot(char *name); 201extern Bool AddFuncKey(char *name, int cont, int mods, int func, 202 MenuRoot *menu, char *win_name, char *action); 203extern Bool AddFuncButton(int num, int cont, int mods, int func, 204 MenuRoot *menu, MenuItem *item); 205extern void DestroyMenu (MenuRoot *menu); 206extern int PopDownMenu(void); 207extern int HideMenu(MenuRoot *menu); 208extern int ExecuteFunction(int func, void *action, 209 Window w, TwmWindow *tmp_win, 210 XEvent *eventp, 211 int context, int pulldown); 212extern int DeferExecution(int context, int func, Cursor cursor); 213extern int NeedToDefer(MenuRoot *root); 214extern void ReGrab(void); 215extern int CreateTitleButton(char *name, int func, char *action, 216 MenuRoot *menuroot, Bool rightside, 217 Bool append); 218extern void PaintEntry(MenuRoot *mr, MenuItem *mi, int exposure); 219extern void Paint3DEntry(MenuRoot *mr, MenuItem *mi, int exposure); 220extern void PaintNormalEntry(MenuRoot *mr, MenuItem *mi, int exposure); 221extern void PaintMenu(MenuRoot *mr, XEvent *e); 222extern int UpdateMenu(void); 223extern void MakeMenus(void); 224extern int MakeMenu(MenuRoot *mr); 225extern int MoveMenu(XEvent *eventp); 226extern void DeIconify(TwmWindow *tmp_win); 227extern void Iconify(TwmWindow *tmp_win, int def_x, int def_y); 228extern int WarpToScreen(int n, int inc); 229extern int BumpWindowColormap(TwmWindow *tmp, int inc); 230extern void SetMapStateProp(TwmWindow *tmp_win, int state); 231extern void SendDeleteWindowMessage (TwmWindow *tmp, Time timestamp); 232extern void SendSaveYourselfMessage (TwmWindow *tmp, Time timestamp); 233extern void SendTakeFocusMessage (TwmWindow *tmp, Time timestamp); 234extern int FindConstraint (TwmWindow *tmp_win, int direction); 235extern void MosaicFade (TwmWindow *tmp_win, Window blanket); 236extern void ZoomInWindow (TwmWindow *tmp_win, Window blanket); 237extern void ZoomOutWindow (TwmWindow *tmp_win, Window blanket); 238extern void FadeWindow (TwmWindow *tmp_win, Window blanket); 239extern void SweepWindow (TwmWindow *tmp_win, Window blanket); 240extern int WarpCursorToDefaultEntry (MenuRoot *menu); 241extern void PlaceTransients(TwmWindow *tmp_win, int where); 242extern void PlaceOntop (int ontop, int where); 243extern void ModifyCurrentTB(int button, int mods, int func, char *action, 244 MenuRoot *menuroot); 245extern void Execute(char *s); 246extern void ShowIconManager (void); 247extern void HideIconManager (void); 248extern void RaiseWindow(TwmWindow *tmp_win); 249extern void LowerWindow(TwmWindow *tmp_win); 250extern void RaiseLower(TwmWindow *tmp_win); 251extern void RaiseLowerFrame(Window frame, int ontop); 252extern void MapRaised(TwmWindow *tmp_win); 253extern void RaiseFrame(Window frame); 254extern void FocusOnRoot(void); 255extern void TryToPack (TwmWindow *tmp_win, int *x, int *y); 256extern void TryToPush (TwmWindow *tmp_win, int x, int y, int dir); 257extern void TryToGrid (TwmWindow *tmp_win, int *x, int *y); 258extern void resizeFromCenter(Window w, TwmWindow *tmp_win); 259extern void WarpAlongRing (XButtonEvent *ev, Bool forward); 260extern void WarpToWindow (TwmWindow *t, int must_raise); 261extern void DisplayPosition (TwmWindow *tmp_win, int x, int y); 262extern void packwindow (TwmWindow *tmp_win, char *direction); 263extern void fillwindow (TwmWindow *tmp_win, char *direction); 264#if 0 /* Not implemented!!! */ 265extern Boolean TryNotToMoveOff (); 266#endif 267extern void AutoSqueeze (TwmWindow *tmp_win); 268extern void Squeeze(TwmWindow *tmp_win); 269 270#endif /* _MENUS_ */ 271