OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimMouseEvent.h
Go to the documentation of this file.
1 //*******************************************************************
2 //
3 // License: See top level LICENSE.txt file.
4 //
5 // Author: Garrett Potts (gpotts@imagelinks.com)
6 //
7 //*************************************************************************
8 // $Id: ossimMouseEvent.h 9968 2006-11-29 14:01:53Z gpotts $
9 
10 #ifndef ossimMouseEvent_HEADER
11 #define ossimMouseEvent_HEADER
12 #include <ossim/base/ossimEvent.h>
13 #include <ossim/base/ossimIpt.h>
14 
16 {
17 public:
18  ossimMouseEvent(const ossimDpt& scenePoint=ossimDpt(0,0),
19  const ossimDpt& relViewPoint=ossimDpt(0,0),
20  ossimObject* object = NULL,
21  long id = OSSIM_MOUSE_EVENT_ID,
22  long mouseType = 0)
23  :ossimEvent(object, id),
24  theScenePoint(scenePoint),
25  theRelViewPoint(relViewPoint),
26  theMouseType(mouseType)
27  {
28  }
29 
30  virtual ossimObject* dup()const{return new ossimMouseEvent(*this);}
31 
32  bool controlDown() const { return theControlKeyDown; }
33  bool altDown() const { return theAltKeyDown; }
34  bool shiftDown() const { return theShiftKeyDown; }
35 
36  // Find which event was just generated
37  bool leftDown() const{ return (theMouseType == OSSIM_MOUSE_EVENT_LEFT_DOWN_ID); }
38  bool middleDown() const{ return (theMouseType == OSSIM_MOUSE_EVENT_MIDDLE_DOWN_ID); }
39  bool rightDown() const{ return (theMouseType == OSSIM_MOUSE_EVENT_RIGHT_DOWN_ID); }
40  bool leftUp() const{ return (theMouseType == OSSIM_MOUSE_EVENT_LEFT_UP_ID); }
41  bool middleUp() const{ return (theMouseType == OSSIM_MOUSE_EVENT_MIDDLE_UP_ID); }
42  bool rightUp() const{ return (theMouseType == OSSIM_MOUSE_EVENT_RIGHT_UP_ID); }
43 
44  bool leftDClick() const { return (theMouseType == OSSIM_MOUSE_EVENT_LEFT_DCLICK_ID); }
45  bool middleDClick() const { return (theMouseType == OSSIM_MOUSE_EVENT_MIDDLE_DCLICK_ID); }
46  bool rightDClick() const { return (theMouseType == OSSIM_MOUSE_EVENT_RIGHT_DCLICK_ID); }
47 
48  // Find the current state of the mouse buttons (regardless
49  // of current event type)
50  bool leftIsDown() const { return theLeftDown; }
51  bool middleIsDown() const { return theMiddleDown; }
52  bool rightIsDown() const { return theRightDown; }
53 
54  // True if a button is down and the mouse is moving
55  bool dragging() const
56  {
57  return (moving() &&
58  (leftIsDown() || middleIsDown() || rightIsDown()));
59  }
60 
61  // True if the mouse is moving, and no button is down
62  bool moving() const { return (theMouseType == OSSIM_MOUSE_EVENT_MOTION_ID); }
63 
64  // True if the mouse is just entering the window
65  bool entering() const { return (theMouseType == OSSIM_MOUSE_EVENT_ENTER_WINDOW_ID); }
66 
67  // True if the mouse is just leaving the window
68  bool leaving() const { return (theMouseType == OSSIM_MOUSE_EVENT_LEAVE_WINDOW_ID); }
69 
79 
81 };
82 
83 #endif
#define OSSIM_MOUSE_EVENT_ID
Definition: ossimEventIds.h:39
bool rightUp() const
#define OSSIMDLLEXPORT
#define OSSIM_MOUSE_EVENT_ENTER_WINDOW_ID
Definition: ossimEventIds.h:52
bool middleUp() const
#define OSSIM_MOUSE_EVENT_LEFT_DCLICK_ID
Definition: ossimEventIds.h:49
virtual ossimObject * dup() const
bool rightDClick() const
bool controlDown() const
bool entering() const
#define OSSIM_MOUSE_EVENT_RIGHT_DOWN_ID
Definition: ossimEventIds.h:43
#define OSSIM_MOUSE_EVENT_LEFT_UP_ID
Definition: ossimEventIds.h:45
#define OSSIM_MOUSE_EVENT_MIDDLE_DOWN_ID
Definition: ossimEventIds.h:44
ossimDpt theScenePoint
bool shiftDown() const
#define OSSIM_MOUSE_EVENT_LEAVE_WINDOW_ID
Definition: ossimEventIds.h:40
bool altDown() const
bool leftIsDown() const
bool middleIsDown() const
bool leaving() const
#define TYPE_DATA
Definition: ossimRtti.h:339
bool leftDClick() const
ossimDpt theRelViewPoint
#define OSSIM_MOUSE_EVENT_LEFT_DOWN_ID
Definition: ossimEventIds.h:42
bool middleDClick() const
bool leftDown() const
ossimMouseEvent(const ossimDpt &scenePoint=ossimDpt(0, 0), const ossimDpt &relViewPoint=ossimDpt(0, 0), ossimObject *object=NULL, long id=OSSIM_MOUSE_EVENT_ID, long mouseType=0)
bool rightIsDown() const
#define OSSIM_MOUSE_EVENT_MOTION_ID
Definition: ossimEventIds.h:41
bool middleDown() const
#define OSSIM_MOUSE_EVENT_RIGHT_UP_ID
Definition: ossimEventIds.h:46
bool rightDown() const
#define OSSIM_MOUSE_EVENT_MIDDLE_UP_ID
Definition: ossimEventIds.h:47
#define OSSIM_MOUSE_EVENT_RIGHT_DCLICK_ID
Definition: ossimEventIds.h:50
#define OSSIM_MOUSE_EVENT_MIDDLE_DCLICK_ID
Definition: ossimEventIds.h:51
bool dragging() const
bool moving() const
bool leftUp() const