00001 /********************************************************************** 00002 * FILE: MESSAGES.H 00003 * AUTHOR: CAL 00004 * DATE: 18 April 1993 00005 * PURPOSE: 00006 * Messages are used to represent mouse and keyboard events, as 00007 * well as to inform control functions of event that occur at 00008 * the GUI level, for example, the pressing of a button. 00009 ***********************************************************************/ 00010 00011 #ifndef _MESSAGES_H 00012 #define _MESSAGES_H 00013 00014 #include "typedefs.h" 00015 00016 00017 /********************************************************************** 00018 * Message Structure 00019 ***********************************************************************/ 00020 00021 struct Message { 00022 unsigned origin; 00023 unsigned code; // Event code or message type 00024 int d1, d2; // Integer data 00025 char str [25]; // String data 00026 00027 Message (void) { origin = code = d1 = d2 = 0; str [0] = 0; } 00028 Message (unsigned o, unsigned c) 00029 { origin = o; code = c; d1 = d2 = 0; str [0] = 0; } 00030 Message (unsigned o, unsigned c, int a) 00031 { origin = o; code = c; d1 = a; d2 = 0; str [0] = 0; } 00032 Message (unsigned o, unsigned c, int a, int b) 00033 { origin = o; code = c; d1 = a; d2 = b; str [0] = 0; } 00034 bool operator == (Message &); 00035 bool operator != (Message &msg) { return (bool) (! (*this == msg)); } 00036 }; 00037 00038 00039 /********************************************************************** 00040 * Predefined Message Origins 00041 ***********************************************************************/ 00042 00043 const unsigned GodMsg = 0x0000; 00044 const unsigned Unknown = 0xFFFF; 00045 const unsigned MouseMsg = 0x0002; 00046 const unsigned KeyMsg = 0x0001; 00047 const unsigned ButtonMsg = 0x0010; 00048 00049 /********************************************************************** 00050 * Predefined Message Types 00051 ***********************************************************************/ 00052 00053 const unsigned Null = 0x0000; // Normal stuff 00054 const unsigned Idle = 0x0000; 00055 const unsigned String = 0x0001; 00056 const unsigned Acknowledgement = 0x0002; 00057 00058 const unsigned MouseDown = 0x0020; // Mouse stuff 00059 const unsigned LMouseDown = 0x0020; 00060 const unsigned RMouseDown = 0x0021; 00061 const unsigned MouseStillDown = 0x0022; 00062 const unsigned LMouseStillDown = 0x0022; 00063 const unsigned RMouseStillDown = 0x0023; 00064 const unsigned MouseUp = 0x0024; 00065 const unsigned LMouseUp = 0x0024; 00066 const unsigned RMouseUp = 0x0025; 00067 00068 const unsigned KeyPressed = 0x0010; // Keyboard 00069 00070 const unsigned ButtonPress = 0x0101; // Buttons 00071 const unsigned RequestStatus = 0x0102; 00072 const unsigned Status = 0x0103; 00073 const unsigned Enable = 0x0104; 00074 const unsigned Disable = 0x0105; 00075 00076 00077 /********************************************************************** 00078 * Predefined Message 00079 ***********************************************************************/ 00080 00081 extern Message NullMsg; 00082 extern Message Acknowledged; 00083 00084 00085 #endif