|
event.h00001 /* 00002 Event system related interfaces 00003 Written by Andrew Zabolotny <bit@eltech.ru> 00004 00005 This program is free software; you can redistribute it and/or modify 00006 it under the terms of the GNU General Public License as published by 00007 the Free Software Foundation; either version 2 of the License, or 00008 (at your option) any later version. 00009 00010 This program is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 GNU General Public License for more details. 00014 00015 You should have received a copy of the GNU General Public License 00016 along with this program; if not, write to the Free Software 00017 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00018 */ 00019 00020 #ifndef __IUTIL_EVENT_H__ 00021 #define __IUTIL_EVENT_H__ 00022 00023 #include "iutil/evdefs.h" 00024 #include "csutil/scf.h" 00025 00026 struct iEventHandler; 00027 00028 SCF_VERSION (iEvent, 0, 0, 1); 00029 00045 struct iEvent : public iBase 00046 { 00047 uint8 Type; // Event type (one of csevXXX) 00048 uint8 Category; // Event cathegory (unused by CSWS) 00049 uint8 SubCategory; // Even finer granularity 00050 uint8 Flags; // Miscelaneous event flags 00051 csTicks Time; // Time when the event occured 00052 union 00053 { 00054 struct 00055 { 00056 int Code; // Key code 00057 int Char; // Character code 00058 int Modifiers; // Control key state 00059 } Key; 00060 struct 00061 { 00062 int x,y; // Mouse coords 00063 int Button; // Button number: 1-left, 2-right, 3-middle 00064 int Modifiers; // Control key state 00065 } Mouse; 00066 struct 00067 { 00068 int number; // Joystick number (1, 2, ...) 00069 int x, y; // Joystick x, y 00070 int Button; // Joystick button number 00071 int Modifiers; // Control key state 00072 } Joystick; 00073 struct 00074 { 00075 uint Code; // Command code 00076 void *Info; // Command info 00077 } Command; 00078 }; 00079 }; 00080 00120 SCF_VERSION (iEventPlug, 0, 0, 1); 00121 00130 struct iEventPlug : public iBase 00131 { 00140 virtual unsigned GetPotentiallyConflictingEvents () = 0; 00141 00150 virtual unsigned QueryEventPriority (unsigned iType) = 0; 00151 00159 virtual void EnableEvents (unsigned /*iType*/, bool /*iEnable*/) {} 00160 }; 00161 00162 SCF_VERSION (iEventOutlet, 0, 1, 0); 00163 00178 struct iEventOutlet : public iBase 00179 { 00188 virtual iEvent* CreateEvent () = 0; 00189 00196 virtual void Post (iEvent*) = 0; 00197 00215 virtual void Key (int iKey, int iChar, bool iDown) = 0; 00216 00224 virtual void Mouse (int iButton, bool iDown, int x, int y) = 0; 00225 00233 virtual void Joystick(int iNumber, int iButton, bool iDown, int x,int y) = 0; 00234 00244 virtual void Broadcast (int iCode, void *iInfo = NULL) = 0; 00245 00261 virtual void ImmediateBroadcast (int iCode, void *iInfo) = 0; 00262 }; 00263 00264 SCF_VERSION (iEventCord, 0, 0, 2); 00265 00273 struct iEventCord 00274 { 00282 virtual int Insert (iEventHandler*, int priority) = 0; 00283 00287 virtual void Remove (iEventHandler*) = 0; 00288 00293 virtual bool GetPass () const = 0; 00294 00299 virtual void SetPass (bool) = 0; 00300 00302 virtual int GetCategory() const = 0; 00303 // Get the subcategory of this cord. 00304 virtual int GetSubcategory() const = 0; 00305 }; 00306 00307 #endif // __IUTIL_EVENT_H__ Generated for Crystal Space by doxygen 1.2.5 written by Dimitri van Heesch, ©1997-2000 |