/* * event.h * * Handling and dispatching events * * © 1994-1998 Straylight */ /*----- Licensing note ----------------------------------------------------* * * This file is part of Straylight's Steel library. * * Steel 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, or (at your option) * any later version. * * Steel 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 Steel. If not, write to the Free Software Foundation, * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __event_h #define __event_h /*----- Required headers --------------------------------------------------*/ #ifndef __wimp_h #include "wimp.h" #endif #ifndef __menu_h typedef struct menu__menustr *menu; typedef menu (*event_menu_maker)(void *handle); typedef void (*event_menu_proc)(void *handle,char* hit); #include "menu.h" #endif /*----- Type definitions --------------------------------------------------*/ typedef enum { event_MENUSELECT, event_MENUSUBMENU, event_MENUDELETE, event_MENUHELP } event_menuPurpose; typedef void (*event_midbhandler)(wimp_w w, int gadget, void *handlea, void *handleb, void *handlec); /*----- Exported functions ------------------------------------------------*/ void event__process(void); void event_process(void); #define event_process(x) dbox__eventProcess() event_menuPurpose event_whyMenuEvent(void); void event_returnMenuHelp(BOOL doit); /* * BOOL event_attachMidbHandler(wimp_w w, * event_midbhandler proc, * int gadget, * void *handlea, * void *handleb, * void *handlec) * * Use * Registers a function to be called by event when a menu button event is * received by a particular window. Typically, this handler will display a * menu at the mouse coordinates, although you can do anything you want. * * You shouldn't need to call this function very much. It's really for * allowing other systems to supply menu attachment functions like event_- * attachmenu etc. * * Parameters * wimp_w == the window to which to attach the function * event_midbhandler proc == the function to call when a menu button event * is received for the window * others == arguments to be passed (unprocessed) to proc when it's called. * * Returns * TRUE if the attachment succeeded. */ BOOL event_attachMidbHandler(wimp_w w, event_midbhandler proc, int gadget, void *handlea, void *handleb, void *handlec); void event_attachedMenu(wimp_w w, menu *m, event_menu_maker *mk, event_menu_proc *proc, void **handle); /* * void event_openMenu(menu it,event_menu_proc proc,void *handle) * void event_makeMenu(event_menu_maker it,event_menu_proc proc,void *handle) * void event_openIconbarMenu(...) * void event_makeIconbarMenu(...) * * Use * Opens a menu onto the screen and tells your routine when it's finished. * * Parameters * menu it == the menu or menu maker procedure * event_menu_proc proc == the menu handler function * void *handle == it's jolly old handle */ void event_openMenu(menu it,event_menu_proc proc,void *handle); void event_makeMenu(event_menu_maker maker, event_menu_proc proc, void *handle); void event_openIconbarMenu(menu it,event_menu_proc proc,void *handle); void event_makeIconbarMenu(event_menu_maker maker, event_menu_proc proc, void *handle); /* * void event_attachmenu(wimp_w w,menu m,event_menu_proc p,void *handle) * * Use * Attaches a menu to a window so that it opens when you click menu on it. * * Parameters * wimp_w w == the window to attach to * menu m == the menu to attach to it * event_menu_proc p == what to do when a menu item is chosen * void *handle == something else to send to p */ BOOL event_attachmenu(wimp_w w,menu m,event_menu_proc p,void *handle); /* * void event_attachmenumaker(wimp_w w, * event_menu_maker m, * event_menu_proc p, * void *handle) * * Use * Attaches a menu to a window so that it opens when you click menu on it. * * Parameters * wimp_w w == the window to attach to * event_menu_maker m == how to create the menu * event_menu_proc p == what to do when a menu item is chosen * void *handle == something else to send to p */ BOOL event_attachmenumaker(wimp_w w, event_menu_maker m, event_menu_proc p, void *handle); BOOL event_anywindows(void); BOOL event_is_menu_being_recreated(void); void event_clear_current_menu(void); void event_setmask (wimp_emask mask); wimp_emask event_getmask (void); #endif