Back to index

plt-scheme  4.2.1
wb_stdev.cc
Go to the documentation of this file.
00001 /*
00002  * File:             wb_stdev.cc
00003  * Purpose:   Standard event definitions
00004  * Author:           Julian Smart
00005  * Created:   1993
00006  * Updated:   August 1994
00007  * Copyright: (c) 2004-2009 PLT Scheme Inc.
00008  * Copyright: (c) 1993, AIAI, University of Edinburgh
00009  */
00010 
00011 #ifdef __GNUG__
00012 #pragma implementation "wx_stdev.h"
00013 #endif
00014 
00015 #   define  Uses_wxEvent
00016 #   define  Uses_wxItem
00017 #   include "wx.h"
00018 
00019 /*
00020  * Command events
00021  *
00022  */
00023 
00024 wxScrollEvent::wxScrollEvent() : wxEvent() 
00025 {
00026   direction = wxHORIZONTAL;
00027   moveType = wxEVENT_TYPE_SCROLL_THUMBTRACK;
00028 }
00029 
00030 wxPopupEvent::wxPopupEvent() : wxCommandEvent(wxEVENT_TYPE_MENU_SELECT) 
00031 { 
00032   __type = wxTYPE_POPUP_EVENT;
00033 }
00034 
00035 wxCommandEvent::wxCommandEvent(WXTYPE commandType)
00036 {
00037   eventType = commandType;
00038 }
00039 
00040 /*
00041  * Mouse events
00042  *
00043  */
00044 
00045 wxMouseEvent::wxMouseEvent(WXTYPE commandType)
00046 {
00047   eventType = commandType;
00048   metaDown = FALSE;
00049   altDown = FALSE;
00050   controlDown = FALSE;
00051   shiftDown = FALSE;
00052 }
00053 
00054 Bool wxMouseEvent::ControlDown(void)
00055 {
00056   return controlDown;
00057 }
00058 
00059 Bool wxMouseEvent::MetaDown(void)
00060 {
00061   return metaDown;
00062 }
00063 
00064 Bool wxMouseEvent::AltDown(void)
00065 {
00066   return altDown;
00067 }
00068 
00069 Bool wxMouseEvent::ShiftDown(void)
00070 {
00071   return shiftDown;
00072 }
00073 
00074 // Is a button event (*doesn't* mean: is any button *down*?)
00075 Bool wxMouseEvent::IsButton(void)
00076 {
00077   return (Button(-1)) ;
00078 }
00079 
00080 // True if was a button dclick event (1 = left, 2 = middle, 3 = right)
00081 // or any button dclick event (but = -1)
00082 Bool wxMouseEvent::ButtonDClick(int but)
00083 {
00084   switch (but) {
00085     case -1:
00086       return (LeftDClick() || MiddleDClick() || RightDClick());
00087     case 1:
00088       return LeftDClick();
00089     case 2:
00090       return MiddleDClick();
00091     case 3:
00092       return RightDClick();
00093     default:
00094       return FALSE;
00095   }
00096   // NOTREACHED
00097 }
00098 
00099 // True if was a button down event (1 = left, 2 = middle, 3 = right)
00100 // or any button down event (but = -1)
00101 Bool wxMouseEvent::ButtonDown(int but)
00102 {
00103   switch (but) {
00104     case -1:
00105       return (LeftDown() || MiddleDown() || RightDown());
00106     case 1:
00107       return LeftDown();
00108     case 2:
00109       return MiddleDown();
00110     case 3:
00111       return RightDown();
00112     default:
00113       return FALSE;
00114   }
00115   // NOTREACHED
00116 }
00117 
00118 // True if was a button up event (1 = left, 2 = middle, 3 = right)
00119 // or any button up event (but = -1)
00120 Bool wxMouseEvent::ButtonUp(int but)
00121 {
00122   switch (but) {
00123     case -1:
00124       return (LeftUp() || MiddleUp() || RightUp());
00125     case 1:
00126       return LeftUp();
00127     case 2:
00128       return MiddleUp();
00129     case 3:
00130       return RightUp();
00131     default:
00132       return FALSE;
00133   }
00134   // NOTREACHED
00135 }
00136 
00137 // True if the given button is currently changing state
00138 Bool wxMouseEvent::Button(int but)
00139 {
00140   switch (but) {
00141     case -1:
00142       return (ButtonUp(-1) || ButtonDown(-1) || ButtonDClick(-1)) ;
00143     case 1:
00144       return (LeftDown() || LeftUp() || LeftDClick());
00145     case 2:
00146       return (MiddleDown() || MiddleUp() || MiddleDClick());
00147     case 3:
00148       return (RightDown() || RightUp() || RightDClick());
00149     default:
00150       return FALSE;
00151   }
00152   // NOTREACHED
00153 }
00154 
00155 Bool wxMouseEvent::LeftDown(void)
00156 {
00157   return (eventType == wxEVENT_TYPE_LEFT_DOWN);
00158 }
00159 
00160 Bool wxMouseEvent::MiddleDown(void)
00161 {
00162   return (eventType == wxEVENT_TYPE_MIDDLE_DOWN);
00163 }
00164 
00165 Bool wxMouseEvent::RightDown(void)
00166 {
00167   return (eventType == wxEVENT_TYPE_RIGHT_DOWN);
00168 }
00169 
00170 Bool wxMouseEvent::LeftDClick(void)
00171 {
00172   return (eventType == wxEVENT_TYPE_LEFT_DCLICK);
00173 }
00174 
00175 Bool wxMouseEvent::MiddleDClick(void)
00176 {
00177   return (eventType == wxEVENT_TYPE_MIDDLE_DCLICK);
00178 }
00179 
00180 Bool wxMouseEvent::RightDClick(void)
00181 {
00182   return (eventType == wxEVENT_TYPE_RIGHT_DCLICK);
00183 }
00184 
00185 Bool wxMouseEvent::LeftUp(void)
00186 {
00187   return (eventType == wxEVENT_TYPE_LEFT_UP);
00188 }
00189 
00190 Bool wxMouseEvent::MiddleUp(void)
00191 {
00192   return (eventType == wxEVENT_TYPE_MIDDLE_UP);
00193 }
00194 
00195 Bool wxMouseEvent::RightUp(void)
00196 {
00197   return (eventType == wxEVENT_TYPE_RIGHT_UP);
00198 }
00199 
00200 Bool wxMouseEvent::Dragging(void)
00201 {
00202   return ((eventType == wxEVENT_TYPE_MOTION) && (LeftIsDown() || MiddleIsDown() || RightIsDown()));
00203 }
00204 
00205 Bool wxMouseEvent::ButtonIsDown(int but)
00206 {
00207   switch (but) {
00208     case -1:
00209       return (LeftIsDown() || MiddleIsDown() || RightIsDown());
00210     case 1:
00211       return LeftIsDown();
00212     case 2:
00213       return MiddleIsDown();
00214     case 3:
00215       return RightIsDown();
00216     default:
00217       return FALSE;
00218   }
00219   // NOTREACHED
00220 }
00221 
00222 Bool wxMouseEvent::LeftIsDown(void)
00223 {
00224   return leftDown;
00225 }
00226 
00227 Bool wxMouseEvent::MiddleIsDown(void)
00228 {
00229   return middleDown;
00230 }
00231 
00232 Bool wxMouseEvent::RightIsDown(void)
00233 {
00234   return rightDown;
00235 }
00236 
00237 Bool wxMouseEvent::Moving(void)
00238 {
00239   return (eventType == wxEVENT_TYPE_MOTION);
00240 }
00241 
00242 Bool wxMouseEvent::Entering(void)
00243 {
00244   return (eventType == wxEVENT_TYPE_ENTER_WINDOW) ;
00245 }
00246 
00247 Bool wxMouseEvent::Leaving(void)
00248 {
00249   return (eventType == wxEVENT_TYPE_LEAVE_WINDOW) ;
00250 }
00251 
00252 void wxMouseEvent::Position(int *xpos, int *ypos)
00253 {
00254   *xpos = x;
00255   *ypos = y;
00256 }
00257 
00258 /*
00259  * Keyboard events
00260  *
00261  */
00262  
00263 wxKeyEvent::wxKeyEvent(WXTYPE type)
00264 {
00265   eventType = type;
00266   shiftDown = FALSE;
00267   controlDown = FALSE;
00268   metaDown = FALSE;
00269   altDown = FALSE;
00270   keyCode = 0;
00271   keyUpCode = WXK_PRESS;
00272 }
00273 
00274 Bool wxKeyEvent::ControlDown(void)
00275 {
00276   return controlDown;
00277 }
00278 
00279 Bool wxKeyEvent::AltDown(void)
00280 {
00281   return altDown;
00282 }
00283 
00284 Bool wxKeyEvent::MetaDown(void)
00285 {
00286   return metaDown;
00287 }
00288 
00289 Bool wxKeyEvent::ShiftDown(void)
00290 {
00291   return shiftDown;
00292 }
00293 
00294 long wxKeyEvent::KeyCode(void)
00295 {
00296   return keyCode;
00297 }
00298 
00299 void wxKeyEvent::Position(int *xpos, int *ypos)
00300 {
00301   *xpos = x;
00302   *ypos = y;
00303 }