/* Relay -- a tool to record and play Quake2 demos Copyright (C) 2000 Conor Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Conor Davis cedavis@planetquake.com */ #ifndef __MENU_H #define __MENU_H enum { MENU_ALIGN_LEFT, MENU_ALIGN_CENTER, MENU_ALIGN_RIGHT }; typedef struct menuitem_s menuitem_t; typedef struct menu_s menu_t; struct menuitem_s { char *text; // text to be displayed int align; // left, center, right int indent; // pixels to indent to the right (or left, depending // on alignment) int numparams; int *param; // params used by the Select function void (*Select)(menu_t *menu, menuitem_t *item, int key); }; struct menu_s { void *client; // client who is viewing the menu char *title; // always displayed at top int id; // ID_* menu type menuitem_t *items; // item array int num; // number of items in the item array int top; // index of first item to be displayed int cur; // current selected item int numparams; int *param; // params used by the Show function void (*Show)(menu_t *menu); void (*Close)(menu_t *menu); struct menu_s *next; }; extern void Menu_Close(menu_t **head); extern void Menu_CloseAll(menu_t **head); extern int Menu_AddItem(const char *text, const char *fmt, ...); extern void Menu_Display(menu_t *menu, char *layout, size_t len); extern void Menu_Update(menu_t **head, char *layout, size_t len, int id); extern void Menu_Prev(menu_t *menu); extern void Menu_Next(menu_t *menu); extern void Menu_Select(menu_t *menu, int key); extern void Menu_Start(menu_t *menu); extern void Menu_Finish(menu_t *menu); extern void Menu_Open(void *client, menu_t **head, void (*Show)(menu_t *), const char *fmt, ...); #endif // __MENU_H