summaryrefslogtreecommitdiff
path: root/src/player/CursorEvent.h
blob: e84272ac0e1869a0fc57725ee3d01803feb7f67e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
//
//  libavg - Media Playback Engine. 
//  Copyright (C) 2003-2014 Ulrich von Zadow
//
//  This library is free software; you can redistribute it and/or
//  modify it under the terms of the GNU Lesser General Public
//  License as published by the Free Software Foundation; either
//  version 2 of the License, or (at your option) any later version.
//
//  This library is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
//  Lesser General Public License for more details.
//
//  You should have received a copy of the GNU Lesser General Public
//  License along with this library; if not, write to the Free Software
//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
//
//  Current versions can be found at www.libavg.de
//
//  Original author of this file is igor@c-base.org
//

#ifndef _CursorEvent_h_
#define _CursorEvent_h_

#include "../api.h"
#include "Event.h"

#include "../base/GLMHelper.h"

#include <boost/shared_ptr.hpp>
#include <boost/weak_ptr.hpp>

namespace avg {

const int MOUSECURSORID=-1;

class AVG_API CursorEvent;
typedef boost::shared_ptr<class CursorEvent> CursorEventPtr;

class AVG_API Contact;
typedef boost::shared_ptr<class Contact> ContactPtr;
typedef boost::weak_ptr<class Contact> ContactWeakPtr;

class Node;
typedef boost::shared_ptr<class Node> NodePtr;
typedef boost::weak_ptr<class Node> NodeWeakPtr;

class AVG_API CursorEvent: public Event 
{
    public:
        CursorEvent(int id, Type eventType, const IntPoint& position, Source source,
                int when=-1);
        virtual ~CursorEvent();
        virtual CursorEventPtr cloneAs(Type eventType) const;
        void setPos(const glm::vec2& pos);
        glm::vec2 getPos() const;
        int getXPosition() const;
        int getYPosition() const;
        void setCursorID(int id);
        int getCursorID() const;
        void setNode(NodePtr pNode);
        NodePtr getNode() const;
        void setSpeed(glm::vec2 speed);
        virtual const glm::vec2& getSpeed() const;

        void setContact(ContactPtr pContact);
        ContactPtr getContact() const;
        virtual void removeBlob() {};

        friend bool operator ==(const CursorEvent& event1, const CursorEvent& event2);
        virtual void trace();

    private:
        IntPoint m_Position;
        int m_ID;
        ContactWeakPtr m_pContact;
        NodePtr m_pNode;
        glm::vec2 m_Speed;
};

bool operator ==(const CursorEvent& event1, const CursorEvent& event2);

}

#endif