src/GUIEvent.cpp

Go to the documentation of this file.
00001 #include "glwx.h"
00002 
00003 GUIEvent::GUIEvent(GUIRectangle *element)
00004 {
00005   callbackString = element? element->getCallbackString() : "Unknown";
00006   eventSource    = element;
00007   consumed       = false;
00008 }
00009 
00010 GUIEvent::GUIEvent(const GUIEvent& copy)
00011 {
00012   this->operator =(copy);
00013 }
00014 
00015 GUIEvent &GUIEvent::operator= (const GUIEvent& copy)
00016 {
00017   if(this != &copy)
00018   {
00019     callbackString = copy.callbackString;
00020     eventSource    = copy.eventSource;
00021     consumed       = copy.consumed;
00022   }
00023   return *this;
00024 }
00025 
00026 void GUIEvent::setConsumed(bool consumedArg)
00027 {
00028   consumed = consumedArg;
00029 }
00030 
00031 bool GUIEvent::isConsumed()
00032 {
00033   return consumed;
00034 }
00035 GUIRectangle      *GUIEvent::getEventSource()   { return eventSource ;   }
00036 const std::string &GUIEvent::getCallbackString(){ return callbackString; }
00037 
00038 KeyEvent::KeyEvent(int keyID)
00039 {
00040   id = keyID;
00041   used = false;
00042 }
00043 
00044 KeyEvent::KeyEvent(const KeyEvent& copy)
00045 {
00046   this->operator =(copy);
00047 }
00048 
00049 KeyEvent &KeyEvent::operator= (const KeyEvent& copy)
00050 {
00051   if(this != &copy)
00052   {
00053     id = copy.id;
00054     used = copy.used;
00055   }
00056   return *this;
00057 }
00058 
00059 bool KeyEvent::displayable()
00060 {
00061   return id >= 32 && id <= 126;
00062 }
00063 
00064 bool KeyEvent::getUsed() { return used; }
00065 void KeyEvent::setUsed(bool value) { used = value; }
00066 
00067 char KeyEvent::getKeyChar(){ return char(id); }
00068 int  KeyEvent::getKeyID()  { return id      ; }
00069 
00070 MouseEvent::MouseEvent()
00071 {
00072   MouseEvent(MB_UNKNOWN_BUTTON, 0, 0, 0, 0);
00073 }
00074 
00075 MouseEvent::MouseEvent(int bID, int xMouse, int yMouse, int invYMouse, int scroll)
00076 {
00077   scrolling = scroll,
00078   buttonID  = bID;
00079   x         = xMouse;
00080   y         = yMouse;
00081   yInverse  = invYMouse;
00082   used          = false;
00083 }
00084 
00085 MouseEvent::MouseEvent(const MouseEvent& copy)
00086 {
00087   this->operator =(copy);
00088 }
00089 
00090 MouseEvent &MouseEvent::operator= (const MouseEvent& copy)
00091 {
00092   if(this != &copy)
00093   {
00094     scrolling = copy.scrolling;
00095     buttonID  = copy.buttonID;
00096     yInverse  = copy.yInverse;
00097     x         = copy.x;
00098     y         = copy.y;
00099         used      = copy.used;
00100   }
00101   return *this;
00102 }
00103 
00104 bool MouseEvent::getUsed() { return used; }
00105 void MouseEvent::setUsed(bool value) { used = value; }
00106 
00107 void MouseEvent::consume()
00108 {
00109   scrolling = 0;
00110   buttonID  = MB_UNKNOWN_BUTTON;
00111   x         = 0;
00112   y         = 0;
00113   yInverse  = 0;
00114   used      = true;
00115 }
00116 
00117 int MouseEvent::getScrolling(){ return scrolling ; }
00118 int MouseEvent::getButtonID() { return buttonID;   }
00119 int MouseEvent::getYInverse() { return yInverse;   }
00120 int MouseEvent::getX()        { return x;          }
00121 int MouseEvent::getY()        { return y;          }
00122 

Generated on Wed Dec 5 20:32:03 2007 for GLWX by  doxygen 1.5.3