GCC Code Coverage Report
Directory: src/ Exec Total Coverage
File: src/listeners/mouselistener.h Lines: 2 11 18.2 %
Date: 2021-03-17 Branches: 0 0 0.0 %

Line Branch Exec Source
1
/*
2
 *  The ManaPlus Client
3
 *  Copyright (C) 2011-2019  The ManaPlus Developers
4
 *  Copyright (C) 2019-2021  Andrei Karas
5
 *
6
 *  This file is part of The ManaPlus Client.
7
 *
8
 *  This program is free software; you can redistribute it and/or modify
9
 *  it under the terms of the GNU General Public License as published by
10
 *  the Free Software Foundation; either version 2 of the License, or
11
 *  any later version.
12
 *
13
 *  This program is distributed in the hope that it will be useful,
14
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
 *  GNU General Public License for more details.
17
 *
18
 *  You should have received a copy of the GNU General Public License
19
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
 */
21
22
/*      _______   __   __   __   ______   __   __   _______   __   __
23
 *     / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___  /\ /  |\/ /\
24
 *    / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
25
 *   / / /__   / / // / // / // / /    / ___  / // ___  / // /| ' / /
26
 *  / /_// /\ / /_// / // / // /_/_   / / // / // /\_/ / // / |  / /
27
 * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
28
 * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
29
 *
30
 * Copyright (c) 2004 - 2008 Olof Naessén and Per Larsson
31
 *
32
 *
33
 * Per Larsson a.k.a finalman
34
 * Olof Naessén a.k.a jansem/yakslem
35
 *
36
 * Visit: http://guichan.sourceforge.net
37
 *
38
 * License: (BSD)
39
 * Redistribution and use in source and binary forms, with or without
40
 * modification, are permitted provided that the following conditions
41
 * are met:
42
 * 1. Redistributions of source code must retain the above copyright
43
 *    notice, this list of conditions and the following disclaimer.
44
 * 2. Redistributions in binary form must reproduce the above copyright
45
 *    notice, this list of conditions and the following disclaimer in
46
 *    the documentation and/or other materials provided with the
47
 *    distribution.
48
 * 3. Neither the name of Guichan nor the names of its contributors may
49
 *    be used to endorse or promote products derived from this software
50
 *    without specific prior written permission.
51
 *
52
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
53
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
54
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
55
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
56
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
57
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
58
 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
59
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
60
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
61
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
62
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
63
 */
64
65
#ifndef LISTENERS_MOUSELISTENER_H
66
#define LISTENERS_MOUSELISTENER_H
67
68
#include "events/mouseevent.h"
69
70
#include "localconsts.h"
71
72
/**
73
  * Interface for listening for mouse events from widgets.
74
  *
75
  * @see Widget::addMouseListener, Widget::removeMouseListener
76
  */
77
class MouseListener notfinal
78
{
79
    public:
80
        A_DELETE_COPY(MouseListener)
81
82
        /**
83
          * Destructor.
84
          */
85
        virtual ~MouseListener()
86
1221
        { }
87
88
        /**
89
          * Called when the mouse has entered into the widget area.
90
          *
91
          * @param event Describes the event.
92
          */
93
        virtual void mouseEntered(MouseEvent &event A_UNUSED)
94
        {
95
        }
96
97
        /**
98
          * Called when the mouse has exited the widget area.
99
          *
100
          * @param event Describes the event.
101
          */
102
        virtual void mouseExited(MouseEvent &event A_UNUSED)
103
        {
104
        }
105
106
        /**
107
          * Called when a mouse button has been pressed on the widget area.
108
          *
109
          * NOTE: A mouse press is NOT equal to a mouse click.
110
          *       Use mouseClickMessage to check for mouse clicks.
111
          *
112
          * @param event Describes the event.
113
          */
114
        virtual void mousePressed(MouseEvent &event A_UNUSED)
115
        {
116
        }
117
118
        /**
119
          * Called when a mouse button has been released on the widget area.
120
          *
121
          * @param event Describes the event.
122
          */
123
        virtual void mouseReleased(MouseEvent &event A_UNUSED)
124
        {
125
        }
126
127
        /**
128
          * Called when a mouse button is pressed and released (clicked) on
129
          * the widget area.
130
          *
131
          * @param event Describes the event.
132
          */
133
        virtual void mouseClicked(MouseEvent &event A_UNUSED)
134
        {
135
        }
136
137
        /**
138
          * Called when the mouse wheel has moved up on the widget area.
139
          *
140
          * @param event Describes the event.
141
          */
142
        virtual void mouseWheelMovedUp(MouseEvent &event A_UNUSED)
143
        {
144
        }
145
146
        /**
147
          * Called when the mouse wheel has moved down on the widget area.
148
          *
149
          * @param event Describes the event.
150
          */
151
        virtual void mouseWheelMovedDown(MouseEvent &event A_UNUSED)
152
        {
153
        }
154
155
        /**
156
          * Called when the mouse has moved in the widget area and no mouse button
157
          * has been pressed (i.e no widget is being dragged).
158
          *
159
          * @param event Describes the event.
160
          */
161
        virtual void mouseMoved(MouseEvent &event A_UNUSED)
162
        {
163
        }
164
165
        /**
166
          * Called when the mouse has moved and the mouse has previously been
167
          * pressed on the widget.
168
          *
169
          * @param event Describes the event.
170
          */
171
        virtual void mouseDragged(MouseEvent &event A_UNUSED)
172
        {
173
        }
174
175
    protected:
176
        /**
177
          * Constructor.
178
          *
179
          * You should not be able to make an instance of MouseListener,
180
          * therefore its constructor is protected.
181
          */
182
        MouseListener()
183
2277
        { }
184
};
185
186
#endif  // LISTENERS_MOUSELISTENER_H