Ocean
apple/macos/Mouse.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) Meta Platforms, Inc. and affiliates.
3  *
4  * This source code is licensed under the MIT license found in the
5  * LICENSE file in the root directory of this source tree.
6  */
7 
8 #ifndef META_OCEAN_PLATFORM_APPLE_MACOS_MOUSE_H
9 #define META_OCEAN_PLATFORM_APPLE_MACOS_MOUSE_H
10 
12 
13 #include "ocean/math/Vector2.h"
14 
15 #include "ocean/platform/Mouse.h"
16 
17 #ifndef __OBJC__
18  #error Platform::Apple::MacOS::Mouse.h needs to be included from an ObjectiveC++ file
19 #endif
20 
21 namespace Ocean
22 {
23 
24 namespace Platform
25 {
26 
27 namespace Apple
28 {
29 
30 namespace MacOS
31 {
32 
33 /**
34  * This class implements mouse functionalities.
35  * @ingroup platformapplemacos
36  */
37 class Mouse : public Platform::Mouse
38 {
39  public:
40 
41  /**
42  * Returns whether all specified buttons of the mouse are currently pushed (down) or not.
43  * @param buttons The buttons for that the states are requested (may be a combination of several buttons)
44  * @param synchron True, to request the state synchronously with the message queue; False, to request the state in the current moment
45  * @return True, if so; also True if no button is provided
46  */
47  static bool allButtonsDown(const Button buttons, const bool synchron = true);
48 
49  /**
50  * Returns whether at least one button of the specified buttons of the mouse is currently pushed (down) or not.
51  * @param buttons The buttons for that the states are requested (may be a combination of several buttons)
52  * @param synchron True, to request the state synchronously with the message queue; False, to request the state in the current moment
53  * @return True, if so; also True if no button is provided
54  */
55  static bool oneButtonDown(const Button buttons, const bool synchron = true);
56 
57  /**
58  * Returns wheater exactly one (specified button) is currently pushed (down) or not.
59  * @param button One unique button for that the state is requested, must not be a combination of several buttons
60  * @param synchron True, to request the state synchronously with the message queue; False, to request the state in the current moment
61  * @return True, if so
62  */
63  static bool isButtonDown(const Button button, const bool synchron = true);
64 
65  /**
66  * Returns the current mouse button state for the left, middle and right mouse button.
67  * @param synchron True, to request the state synchronously with the message queue; False, to request the state in the current moment
68  * @return Current mouse button state
69  */
70  static Button currentMouseButtonState(const bool synchron = true);
71 
72  /**
73  * Returns the current position of the mouse (cursor) in screen coordinates.
74  * @return Mouse screen coordinates
75  */
77 };
78 
79 }
80 
81 }
82 
83 }
84 
85 }
86 
87 #endif // META_OCEAN_PLATFORM_APPLE_MACOS_MOUSE_H
This class implements mouse functionalities.
Definition: apple/macos/Mouse.h:38
static bool allButtonsDown(const Button buttons, const bool synchron=true)
Returns whether all specified buttons of the mouse are currently pushed (down) or not.
static VectorI2 screenPosition()
Returns the current position of the mouse (cursor) in screen coordinates.
static Button currentMouseButtonState(const bool synchron=true)
Returns the current mouse button state for the left, middle and right mouse button.
static bool oneButtonDown(const Button buttons, const bool synchron=true)
Returns whether at least one button of the specified buttons of the mouse is currently pushed (down) ...
static bool isButtonDown(const Button button, const bool synchron=true)
Returns wheater exactly one (specified button) is currently pushed (down) or not.
This class implements mouse functionalities.
Definition: Mouse.h:27
Button
Definition of individual mouse buttons.
Definition: Mouse.h:34
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15