src/hcode/include/coolmenu.h

Go to the documentation of this file.
00001 
00002 /*
00003  * $Id: coolmenu.h,v 1.1 2005/06/13 20:50:52 murrayma Exp $
00004  *
00005  * Author: Markus Stenberg <fingon@iki.fi>
00006  *
00007  *  Copyright (c) 1996 Markus Stenberg
00008  *       All rights reserved
00009  *
00010  * Created: Mon Sep 16 20:38:54 1996 fingon
00011  * Last modified: Wed Jun 24 22:37:38 1998 fingon
00012  *
00013  */
00014 
00015 #ifndef COOLMENU_H
00016 #define COOLMENU_H
00017 
00018 /* #define MAX_MENU_LENGTH 24 */
00019 #define MAX_MENU_LENGTH 400
00020 #define MAX_MENU_WIDTH  240
00021 #define MENU_CHAR_WIDTH 78
00022 
00023 /*
00024 non-ticked toggle
00025    [a] ....    < >
00026 ticked toggle
00027    [A] ....    <X>
00028 value
00029    [a] ....    ___
00030 string that can be changed
00031    [a] ...
00032 string
00033    ...
00034    */
00035 
00036 #define CM_ONE        0x001     /* Just one / line */
00037 #define CM_TWO        0x002     /* Two / line */
00038 #define CM_THREE      0x004     /* Three / line */
00039 #define CM_FOUR       0x008     /* Four / line */
00040 #define CM_CENTER     0x010     /* Stuff's centered, not left-edge */
00041 #define CM_TOGGLE     0x020     /* Field that can be toggled */
00042 #define CM_NUMBER     0x040     /* Field with number in it (add/lower) */
00043 #define CM_LINE       0x080     /* No text, just blank line */
00044 #define CM_STRING     0x100     /* String with letter ahead of it */
00045 #define CM_NO_HILITE  0x200     /* No extra highlight */
00046 #define CM_NOTOG      0x400     /* Not really toggleable */
00047 #define CM_NORIGHT    0x800     /* No right-end field */
00048 #define CM_NOCUT      0x1000    /* Turn off cutoff */
00049 
00050 #define LETTERFIRST (CM_TOGGLE|CM_NUMBER|CM_STRING)
00051 #define RIGHTEDGES  (CM_TOGGLE|CM_NUMBER)
00052 
00053 typedef struct coolmenu_type {
00054     int id;                     /* Used for some purposes by external agency */
00055     char *text;                 /* Text (varies) */
00056     int value;                  /* toggle = 0/1, number=0-999 */
00057     int maxvalue;               /* if maxvalue's < 999 */
00058     char letter;                /* Letter allocated to this entry */
00059     int flags;                  /* This entry's flags */
00060     struct coolmenu_type *next;
00061 } coolmenu;
00062 
00063 #define CreateMenuEntry_VSimple(c,text) \
00064      CreateMenuEntry_Normal(c, text, CM_ONE, 0, 999)
00065 #define CreateMenuEntry_Simple(c,text,flag) \
00066      CreateMenuEntry_Normal(c, text, flag, 0, 999)
00067 #define CreateMenuEntry_Normal(c,text,flag,id,mv) \
00068      CreateMenuEntry_Killer(c, text, flag, id, 0, mv)
00069 void CreateMenuEntry_Killer(coolmenu ** c, char *text, int flag, int id,
00070     int value, int maxvalue);
00071 
00072 void KillCoolMenu(coolmenu * c);
00073 void ShowCoolMenu(dbref player, coolmenu * c);
00074 char **MakeCoolMenuText(coolmenu * c);
00075 int CoolMenu_FPWBit(int number, int maxlen);
00076 
00077 /* Automated 'nice' looking menus: */
00078 coolmenu *SelCol_Menu(int columns, char *heading, char **strings, int type,
00079     int max);
00080 
00081 /* last = how many entries we have */
00082 coolmenu *SelCol_FunStringMenuK(int columns, char *heading,
00083     char *(*fun) (), int last);
00084 
00085 /* Same, except we dunno how many entries we got */
00086 coolmenu *SelCol_FunStringMenu(int columns, char *heading,
00087     char *(*fun) ());
00088 
00089 #define AutoCol_Menu(hea,stri,typ) SelCol_Menu(-1,hea,stri,typ,0)
00090 #define AutoCol_StringMenu(head,str)    AutoCol_Menu(head,str,0)
00091 #define AutoCol_FunStringMenuK(hea,fun,las) \
00092    SelCol_FunStringMenuK(-1,hea,fun,las)
00093 #define AutoCol_FunStringMenu(hea,fun) \
00094    SelCol_FunStringMenuK(-1,hea,fun)
00095 #define SelCol_StringMenu(col,head,str) SelCol_Menu(col,head,str,0,0)
00096 
00097 #endif                          /* COOLMENU_H */

Generated on Mon May 28 04:25:24 2007 for BattletechMUX by  doxygen 1.4.7