ALBA
albaEventInteraction.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: ALBA (Agile Library for Biomedical Applications)
4 Module: albaEventInteraction
5 Authors: Marco Petrone
6
7 Copyright (c) BIC
8 All rights reserved. See Copyright.txt or
9
10
11 This software is distributed WITHOUT ANY WARRANTY; without even
12 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
13 PURPOSE. See the above copyright notice for more information.
14
15=========================================================================*/
16
17#ifndef __albaEventInteraction_h
18#define __albaEventInteraction_h
19
20#include "albaEventBase.h"
21#include "albaMatrix.h"
22#include "albaSmartPointer.h"
23
24template class ALBA_EXPORT albaAutoPointer<albaMatrix>;
25
35class ALBA_EXPORT albaEventInteraction : public albaEventBase
36{
37public:
40
42 void Set2DPosition(double x,double y);
44 void Set2DPosition(const double pos[2]);
45
47 void Get2DPosition(double pos[2]);
48
50 void SetXYFlag(bool val);
51
53 bool GetXYFlag();
54
56 void SetButton(int button);
58 int GetButton() {return m_Button;}
59
61 void SetKey(unsigned char key);
63 unsigned char GetKey() {return m_Key;}
64
68 void SetMatrix(albaMatrix *matrix);
69
71 void SetModifier(unsigned long idx,bool value=true);
73 bool GetModifier(unsigned long idx);
75 void SetModifiers(unsigned long modifiers);
77 unsigned long GetModifiers() {return m_Modifiers;}
78
80 virtual void DeepCopy(const albaEventBase *event);
81
83 albaEventInteraction(void *sender=NULL,albaID id=-1,int button=0,unsigned long modifiers=0):
84 albaEventBase(sender,id),m_Button(button),m_Modifiers(modifiers),m_Key(0),m_X(0),m_Y(0),m_XYFlag(false) {}
85
87 albaEventInteraction(void *sender,albaID id,albaMatrix *matrix,int button=0,unsigned long modifiers=0):
88 albaEventBase(sender,id),m_Button(button),m_Modifiers(modifiers),m_Key(0),m_Matrix(matrix),m_X(0),m_Y(0),m_XYFlag(false) {}
89
91 albaEventInteraction(void *sender,albaID id,double x,double y,int button=0,unsigned long modifiers=0):
92 albaEventBase(sender,id),m_X(x),m_Y(y),m_XYFlag(true),m_Button(button),m_Modifiers(modifiers),m_Key(0) {}
94
95protected:
96
98 unsigned long m_Modifiers;
99 unsigned char m_Key;
100 double m_X;
101 double m_Y;
102 bool m_XYFlag;
103
105};
106
107#endif /* __albaEventInteraction_h */
108
long albaID
type for IDs inside ALBA
Definition: albaDefines.h:58
Hold a reference to a T instance.
Implementation of the message object for the Subject/Observer design pattern.
Definition: albaEventBase.h:49
Event class to transport a triggering button and a position from pointing devices.
void Set2DPosition(const double pos[2])
Set screen position, for 2D tracking devices.
albaEventInteraction(void *sender, albaID id, albaMatrix *matrix, int button=0, unsigned long modifiers=0)
overloaded constructor
void SetMatrix(albaMatrix *matrix)
Set the pose matrix, for 3D tracking devices.
void SetKey(unsigned char key)
Set the optional key argument.
void SetModifiers(unsigned long modifiers)
Set the given modifiers value.
void SetModifier(unsigned long idx, bool value=true)
Set the given modifier value.
void Get2DPosition(double pos[2])
Get screen position, for 2D tracking devices.
unsigned char m_Key
Optional Key.
double m_X
X coordinate, used by mouse device.
albaEventInteraction(void *sender=NULL, albaID id=-1, int button=0, unsigned long modifiers=0)
overloaded constructor
bool m_XYFlag
Used to signal a 2D coordinate is present.
virtual void DeepCopy(const albaEventBase *event)
Deep Copy of the object.
bool GetXYFlag()
get the flag for 2D coords
void Set2DPosition(double x, double y)
Set screen position, for 2D tracking devices.
unsigned long GetModifiers()
Get the given modifiers value.
albaAutoPointer< albaMatrix > m_Matrix
Pose matrix, used by 3D trackers.
albaEventInteraction(void *sender, albaID id, double x, double y, int button=0, unsigned long modifiers=0)
overloaded constructor
albaTypeMacro(albaEventInteraction, albaEventBase)
RTTI macro.
void SetXYFlag(bool val)
set the flag for 2D coords
double m_Y
Y coordinate, used by mouse device.
unsigned long m_Modifiers
Optional modifiers for the button.
void SetButton(int button)
Set the triggering button.
bool GetModifier(unsigned long idx)
Get the given modifier value.
int GetButton()
Get the triggering button.
albaMatrix * GetMatrix()
Get the pose matrix, for 3D tracking devices.
int m_Button
Optional button which triggered the event.
unsigned char GetKey()
Get the optional key argument.
albaMatrix - Time stamped 4x4 Matrix.
Definition: albaMatrix.h:44