Panda3D

Loading...
Searching...
No Matches
Public Types | Public Member Functions | Public Attributes | List of all members
MouseWatcherParameter Class Reference

This is sent along as a parameter to most events generated for a region to indicate the mouse and button state for the event. More...

`#include "mouseWatcherParameter.h"`

Inheritance diagram for MouseWatcherParameter:

## Public Types
enum | Flags { F_has_button = 0x001 , F_has_mouse = 0x002 , F_is_outside = 0x004 , F_has_keycode = 0x008 , F_has_candidate = 0x010 , F_is_keyrepeat = 0x020 }

## Public Member Functions
| MouseWatcherParameter (const MouseWatcherParameter &other)
ButtonHandle | get_button () const
| Returns the mouse or keyboard button associated with this event.
const std::wstring & | get_candidate_string () const
| Returns the candidate string associated with this event.
std::string | get_candidate_string_encoded () const
| Returns the candidate string associated with this event.
std::string | get_candidate_string_encoded (TextEncoder::Encoding encoding) const
| Returns the candidate string associated with this event.
size_t | get_cursor_pos () const
| Returns the position of the user's edit cursor within the candidate string.
size_t | get_highlight_end () const
| Returns one more than the last highlighted character in the candidate string.
size_t | get_highlight_start () const
| Returns the first highlighted character in the candidate string.
int | get_keycode () const
| Returns the keycode associated with this event.
const ModifierButtons & | get_modifier_buttons () const
| Returns the set of modifier buttons that were being held down while the event was generated.
const LPoint2 & | get_mouse () const
| Returns the mouse position at the time the event was generated, in the normalized range (-1 .
bool | has_button () const
| Returns true if this parameter has an associated mouse or keyboard button, false otherwise.
bool | has_candidate () const
| Returns true if this parameter has an associated candidate string, false otherwise.
bool | has_keycode () const
| Returns true if this parameter has an associated keycode, false otherwise.
bool | has_mouse () const
| Returns true if this parameter has an associated mouse position, false otherwise.
bool | is_keyrepeat () const
| Returns true if the button-down even was generated due to keyrepeat, or false if it was an original button down.
bool | is_outside () const
| Returns true if the mouse was outside the region at the time the event was generated, false otherwise.
void | operator= (const MouseWatcherParameter &other)
void | output (std::ostream &out) const
void | set_button (const ButtonHandle &button)
| Sets the mouse or keyboard button that generated this event, if any.
void | set_candidate (const std::wstring &candidate_string, size_t highlight_start, size_t higlight_end, size_t cursor_pos)
| Sets the candidate string associated with this event, if any.
void | set_keycode (int keycode)
| Sets the keycode associated with this event, if any.
void | set_keyrepeat (bool flag)
| Sets the state of the "keyrepeat" flag.
void | set_modifier_buttons (const ModifierButtons &mods)
| Sets the modifier buttons that were being held while this event was generated.
void | set_mouse (const LPoint2 &mouse)
| Sets the mouse position that was current at the time the event was generated.
void | set_outside (bool flag)
| Sets the state of the "outside" flag.

## Public Attributes
ButtonHandle | _button
std::wstring | _candidate_string
size_t | _cursor_pos
int | _flags
size_t | _highlight_end
size_t | _highlight_start
int | _keycode
ModifierButtons | _mods
LPoint2 | _mouse

## Detailed Description

This is sent along as a parameter to most events generated for a region to indicate the mouse and button state for the event.

Definition at line 28 of file mouseWatcherParameter.h.

## Member Enumeration Documentation

## ◆ Flags

enum MouseWatcherParameter::Flags

Definition at line 85 of file mouseWatcherParameter.h.

## Constructor & Destructor Documentation

## ◆ MouseWatcherParameter() [1/2]

MouseWatcherParameter::MouseWatcherParameter | ( |  | ) |
| inline

Definition at line 17 of file mouseWatcherParameter.I.

## ◆ MouseWatcherParameter() [2/2]

MouseWatcherParameter::MouseWatcherParameter | ( | const MouseWatcherParameter & | other | ) |
| inline

Definition at line 26 of file mouseWatcherParameter.I.

## ◆ ~MouseWatcherParameter()

MouseWatcherParameter::~MouseWatcherParameter | ( |  | ) |
| inline

Definition at line 51 of file mouseWatcherParameter.I.

## Member Function Documentation

## ◆ get_button()

ButtonHandle MouseWatcherParameter::get_button | ( |  | ) | const
| inline

Returns the mouse or keyboard button associated with this event.

If has_button(), above, returns false, this returns ButtonHandle::none().

Definition at line 147 of file mouseWatcherParameter.I.

Referenced by PGEntry::accept(), PGEntry::accept_failed(), PGButton::click(), PGButton::press(), PGEntry::press(), PGItem::press(), PGSliderBar::press(), PGButton::release(), PGItem::release(), and PGSliderBar::release().

## ◆ get_candidate_string()

const std::wstring & MouseWatcherParameter::get_candidate_string | ( |  | ) | const
| inline

Returns the candidate string associated with this event.

If has_candidate(), above, returns false, this returns the empty string.

Definition at line 191 of file mouseWatcherParameter.I.

Referenced by PGEntry::candidate().

## ◆ get_candidate_string_encoded() [1/2]

std::string MouseWatcherParameter::get_candidate_string_encoded | ( |  | ) | const
| inline

Returns the candidate string associated with this event.

If has_candidate(), above, returns false, this returns the empty string.

Definition at line 200 of file mouseWatcherParameter.I.

References get_candidate_string_encoded(), and TextEncoder::get_default_encoding.

Referenced by get_candidate_string_encoded().

## ◆ get_candidate_string_encoded() [2/2]

std::string MouseWatcherParameter::get_candidate_string_encoded | ( | TextEncoder::Encoding | encoding | ) | const
| inline

Returns the candidate string associated with this event.

If has_candidate(), above, returns false, this returns the empty string.

Definition at line 209 of file mouseWatcherParameter.I.

References TextEncoder::encode_wtext().

## ◆ get_cursor_pos()

size_t MouseWatcherParameter::get_cursor_pos | ( |  | ) | const
| inline

Returns the position of the user's edit cursor within the candidate string.

Definition at line 234 of file mouseWatcherParameter.I.

Referenced by PGEntry::candidate().

## ◆ get_highlight_end()

size_t MouseWatcherParameter::get_highlight_end | ( |  | ) | const
| inline

Returns one more than the last highlighted character in the candidate string.

Definition at line 226 of file mouseWatcherParameter.I.

Referenced by PGEntry::candidate().

## ◆ get_highlight_start()

size_t MouseWatcherParameter::get_highlight_start | ( |  | ) | const
| inline

Returns the first highlighted character in the candidate string.

Definition at line 217 of file mouseWatcherParameter.I.

Referenced by PGEntry::candidate().

## ◆ get_keycode()

int MouseWatcherParameter::get_keycode | ( |  | ) | const
| inline

Returns the keycode associated with this event.

If has_keycode(), above, returns false, this returns 0.

Definition at line 173 of file mouseWatcherParameter.I.

Referenced by PGEntry::keystroke().

## ◆ get_modifier_buttons()

const ModifierButtons & MouseWatcherParameter::get_modifier_buttons | ( |  | ) | const
| inline

Returns the set of modifier buttons that were being held down while the event was generated.

Definition at line 243 of file mouseWatcherParameter.I.

## ◆ get_mouse()

const LPoint2 & MouseWatcherParameter::get_mouse | ( |  | ) | const
| inline

Returns the mouse position at the time the event was generated, in the normalized range (-1 .

. 1). It is valid to call this only if has_mouse() returned true.

Definition at line 262 of file mouseWatcherParameter.I.

References has_mouse().

Referenced by PGSliderBar::move(), and PGSliderBar::press().

## ◆ has_button()

bool MouseWatcherParameter::has_button | ( |  | ) | const
| inline

Returns true if this parameter has an associated mouse or keyboard button, false otherwise.

Definition at line 138 of file mouseWatcherParameter.I.

Referenced by PGEntry::press().

## ◆ has_candidate()

bool MouseWatcherParameter::has_candidate | ( |  | ) | const
| inline

Returns true if this parameter has an associated candidate string, false otherwise.

Definition at line 182 of file mouseWatcherParameter.I.

Referenced by PGEntry::candidate().

## ◆ has_keycode()

bool MouseWatcherParameter::has_keycode | ( |  | ) | const
| inline

Returns true if this parameter has an associated keycode, false otherwise.

Definition at line 164 of file mouseWatcherParameter.I.

Referenced by PGEntry::keystroke().

## ◆ has_mouse()

bool MouseWatcherParameter::has_mouse | ( |  | ) | const
| inline

Returns true if this parameter has an associated mouse position, false otherwise.

Definition at line 252 of file mouseWatcherParameter.I.

Referenced by get_mouse(), and PGSliderBar::press().

## ◆ is_keyrepeat()

bool MouseWatcherParameter::is_keyrepeat | ( |  | ) | const
| inline

Returns true if the button-down even was generated due to keyrepeat, or false if it was an original button down.

Definition at line 156 of file mouseWatcherParameter.I.

Referenced by PGItem::press().

## ◆ is_outside()

bool MouseWatcherParameter::is_outside | ( |  | ) | const
| inline

Returns true if the mouse was outside the region at the time the event was generated, false otherwise.

This is only valid for "release" type events.

Definition at line 272 of file mouseWatcherParameter.I.

Referenced by PGButton::release().

## ◆ operator=()

void MouseWatcherParameter::operator= | ( | const MouseWatcherParameter & | other | ) |
| inline

Definition at line 39 of file mouseWatcherParameter.I.

## ◆ output()

void MouseWatcherParameter::output | ( | std::ostream & | out | ) | const

Definition at line 19 of file mouseWatcherParameter.cxx.

## ◆ set_button()

void MouseWatcherParameter::set_button | ( | const ButtonHandle & | button | ) |
| inline

Sets the mouse or keyboard button that generated this event, if any.

Definition at line 58 of file mouseWatcherParameter.I.

## ◆ set_candidate()

void MouseWatcherParameter::set_candidate | ( | const std::wstring & | candidate_string,
|  | size_t | highlight_start,
|  | size_t | higlight_end,
|  | size_t | cursor_pos )
| inline

Sets the candidate string associated with this event, if any.

Definition at line 90 of file mouseWatcherParameter.I.

## ◆ set_keycode()

void MouseWatcherParameter::set_keycode | ( | int | keycode | ) |
| inline

Sets the keycode associated with this event, if any.

Definition at line 81 of file mouseWatcherParameter.I.

## ◆ set_keyrepeat()

void MouseWatcherParameter::set_keyrepeat | ( | bool | flag | ) |
| inline

Sets the state of the "keyrepeat" flag.

This is true if a button-press event was generated due to keyrepeat, or false if it is an original button press.

Definition at line 69 of file mouseWatcherParameter.I.

## ◆ set_modifier_buttons()

void MouseWatcherParameter::set_modifier_buttons | ( | const ModifierButtons & | mods | ) |
| inline

Sets the modifier buttons that were being held while this event was generated.

Definition at line 105 of file mouseWatcherParameter.I.

## ◆ set_mouse()

void MouseWatcherParameter::set_mouse | ( | const LPoint2 & | mouse | ) |
| inline

Sets the mouse position that was current at the time the event was generated.

Definition at line 114 of file mouseWatcherParameter.I.

## ◆ set_outside()

void MouseWatcherParameter::set_outside | ( | bool | flag | ) |
| inline

Sets the state of the "outside" flag.

This is true if the mouse was outside the region at the time the event was generated, false otherwise. This only has meaning for "release" events.

Definition at line 125 of file mouseWatcherParameter.I.

## Member Data Documentation

## ◆ _button

ButtonHandle MouseWatcherParameter::_button

Definition at line 76 of file mouseWatcherParameter.h.

## ◆ _candidate_string

std::wstring MouseWatcherParameter::_candidate_string

Definition at line 78 of file mouseWatcherParameter.h.

## ◆ _cursor_pos

size_t MouseWatcherParameter::_cursor_pos

Definition at line 81 of file mouseWatcherParameter.h.

## ◆ _flags

int MouseWatcherParameter::_flags

Definition at line 93 of file mouseWatcherParameter.h.

## ◆ _highlight_end

size_t MouseWatcherParameter::_highlight_end

Definition at line 80 of file mouseWatcherParameter.h.

## ◆ _highlight_start

size_t MouseWatcherParameter::_highlight_start

Definition at line 79 of file mouseWatcherParameter.h.

## ◆ _keycode

int MouseWatcherParameter::_keycode

Definition at line 77 of file mouseWatcherParameter.h.

## ◆ _mods

ModifierButtons MouseWatcherParameter::_mods

Definition at line 82 of file mouseWatcherParameter.h.

## ◆ _mouse

LPoint2 MouseWatcherParameter::_mouse

Definition at line 83 of file mouseWatcherParameter.h.

The documentation for this class was generated from the following files:

- panda/src/tform/mouseWatcherParameter.h
- panda/src/tform/mouseWatcherParameter.cxx
- panda/src/tform/mouseWatcherParameter.I