Panda3D
Loading...
Searching...
No Matches
mouseWatcherParameter.cxx
Go to the documentation of this file.
1/**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file mouseWatcherParameter.cxx
10 * @author drose
11 * @date 2001-07-06
12 */
13
15
16/**
17 *
18 */
19void MouseWatcherParameter::
20output(std::ostream &out) const {
21 bool output_anything = false;
22
23 if (has_button()) {
24 out << _button;
25 output_anything = true;
26 }
27
28 if (has_keycode()) {
29 if (output_anything) {
30 out << ", ";
31 }
32 out << "key" << _keycode;
33 output_anything = true;
34 }
35
36 if (_mods.is_any_down()) {
37 if (output_anything) {
38 out << ", ";
39 }
40 out << _mods;
41 output_anything = true;
42 }
43
44 if (has_mouse()) {
45 if (output_anything) {
46 out << ", ";
47 }
48 out << "(" << _mouse << ")";
49 output_anything = true;
50 }
51
52 if (is_outside()) {
53 if (output_anything) {
54 out << ", ";
55 }
56 out << "outside";
57 output_anything = true;
58 }
59
60 if (!output_anything) {
61 out << "no parameters";
62 }
63}
bool is_any_down() const
Returns true if any of the tracked button are known to be down, or false if all of them are up.
bool has_mouse() const
Returns true if this parameter has an associated mouse position, false otherwise.
bool has_keycode() const
Returns true if this parameter has an associated keycode, false otherwise.
bool has_button() const
Returns true if this parameter has an associated mouse or keyboard button, false otherwise.
bool is_outside() const
Returns true if the mouse was outside the region at the time the event was generated,...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.