As-yet uncommitted changes from end of summer. General code cleanup Mac-side, removed...
[blender.git] / intern / ghost / intern / GHOST_Buttons.cpp
1 /**
2  * $Id$
3  * ***** BEGIN GPL LICENSE BLOCK *****
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License
7  * as published by the Free Software Foundation; either version 2
8  * of the License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software Foundation,
17  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18  *
19  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
20  * All rights reserved.
21  *
22  * The Original Code is: all of this file.
23  *
24  * Contributor(s): none yet.
25  *
26  * ***** END GPL LICENSE BLOCK *****
27  */
28
29 #include "GHOST_Buttons.h"
30
31
32 GHOST_Buttons::GHOST_Buttons()
33 {
34         clear();
35 }
36
37 GHOST_Buttons::~GHOST_Buttons() {}
38
39 bool GHOST_Buttons::get(GHOST_TButtonMask mask) const
40 {
41         switch (mask) {
42                 case GHOST_kButtonMaskLeft:
43                         return m_ButtonLeft;
44                 case GHOST_kButtonMaskMiddle:
45                         return m_ButtonMiddle;
46                 case GHOST_kButtonMaskRight:
47                         return m_ButtonRight;
48                 default:
49                         return false;
50         }
51 }
52
53 void GHOST_Buttons::set(GHOST_TButtonMask mask, bool down)
54 {
55         switch (mask) {
56                 case GHOST_kButtonMaskLeft:
57                         m_ButtonLeft = down; break;
58                 case GHOST_kButtonMaskMiddle:
59                         m_ButtonMiddle = down; break;
60                 case GHOST_kButtonMaskRight:
61                         m_ButtonRight = down; break;
62                 default:
63                         break;
64         }
65 }
66
67 void GHOST_Buttons::clear()
68 {
69         m_ButtonLeft = false;
70         m_ButtonMiddle = false;
71         m_ButtonRight = false;
72 }
73
74 bool GHOST_Buttons::anyDown() const
75 {
76         return m_ButtonLeft || m_ButtonMiddle || m_ButtonRight;
77 }