Blender  V2.93
GHOST_ModifierKeys.cpp
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
17  * All rights reserved.
18  */
19 
28 #include "GHOST_ModifierKeys.h"
29 
31 {
32  clear();
33 }
34 
36 {
37 }
38 
40 {
41  GHOST_TKey key;
42  switch (mask) {
44  key = GHOST_kKeyLeftShift;
45  break;
48  break;
50  key = GHOST_kKeyLeftAlt;
51  break;
53  key = GHOST_kKeyRightAlt;
54  break;
57  break;
60  break;
62  key = GHOST_kKeyOS;
63  break;
64  default:
65  // Should not happen
66  key = GHOST_kKeyUnknown;
67  break;
68  }
69  return key;
70 }
71 
73 {
74  switch (mask) {
76  return m_LeftShift;
78  return m_RightShift;
80  return m_LeftAlt;
82  return m_RightAlt;
84  return m_LeftControl;
86  return m_RightControl;
88  return m_OS;
89  default:
90  return false;
91  }
92 }
93 
95 {
96  switch (mask) {
98  m_LeftShift = down;
99  break;
101  m_RightShift = down;
102  break;
104  m_LeftAlt = down;
105  break;
107  m_RightAlt = down;
108  break;
110  m_LeftControl = down;
111  break;
113  m_RightControl = down;
114  break;
116  m_OS = down;
117  break;
118  default:
119  break;
120  }
121 }
122 
124 {
125  m_LeftShift = false;
126  m_RightShift = false;
127  m_LeftAlt = false;
128  m_RightAlt = false;
129  m_LeftControl = false;
130  m_RightControl = false;
131  m_OS = false;
132 }
133 
135 {
136  return (m_LeftShift == keys.m_LeftShift) && (m_RightShift == keys.m_RightShift) &&
137  (m_LeftAlt == keys.m_LeftAlt) && (m_RightAlt == keys.m_RightAlt) &&
138  (m_LeftControl == keys.m_LeftControl) && (m_RightControl == keys.m_RightControl) &&
139  (m_OS == keys.m_OS);
140 }
GHOST_TKey
Definition: GHOST_Types.h:267
@ GHOST_kKeyLeftAlt
Definition: GHOST_Types.h:336
@ GHOST_kKeyRightShift
Definition: GHOST_Types.h:333
@ GHOST_kKeyLeftControl
Definition: GHOST_Types.h:334
@ GHOST_kKeyOS
Definition: GHOST_Types.h:338
@ GHOST_kKeyRightAlt
Definition: GHOST_Types.h:337
@ GHOST_kKeyRightControl
Definition: GHOST_Types.h:335
@ GHOST_kKeyUnknown
Definition: GHOST_Types.h:268
@ GHOST_kKeyLeftShift
Definition: GHOST_Types.h:332
GHOST_TModifierKeyMask
Definition: GHOST_Types.h:133
@ GHOST_kModifierKeyRightControl
Definition: GHOST_Types.h:139
@ GHOST_kModifierKeyLeftControl
Definition: GHOST_Types.h:138
@ GHOST_kModifierKeyRightAlt
Definition: GHOST_Types.h:137
@ GHOST_kModifierKeyOS
Definition: GHOST_Types.h:140
@ GHOST_kModifierKeyRightShift
Definition: GHOST_Types.h:135
@ GHOST_kModifierKeyLeftAlt
Definition: GHOST_Types.h:136
@ GHOST_kModifierKeyLeftShift
Definition: GHOST_Types.h:134
bool get(GHOST_TModifierKeyMask mask) const
bool equals(const GHOST_ModifierKeys &keys) const
GHOST_TUns8 m_RightControl
static GHOST_TKey getModifierKeyCode(GHOST_TModifierKeyMask mask)
void set(GHOST_TModifierKeyMask mask, bool down)
ccl_device_inline float4 mask(const int4 &mask, const float4 &a)