Panda3D
Public Member Functions | Static Public Member Functions | Protected Member Functions
MouseInterfaceNode Class Reference

This is the base class for some classes that monitor the mouse and keyboard input and perform some action due to their state. More...

#include "mouseInterfaceNode.h"

Inheritance diagram for MouseInterfaceNode:
DataNode PandaNode TypedWritable Namable LinkedListNode ReferenceCount TypedObject MemoryBase MemoryBase MemoryBase DriveInterface MouseSubregion Trackball

List of all members.

Public Member Functions

 MouseInterfaceNode (const string &name)
void clear_all_buttons ()
 Removes all requirements on buttons set by an earlier call to require_button().
void clear_button (const ButtonHandle &button)
 Removes any requirement on the indicated button set by an earlier call to require_button().
virtual TypeHandle force_init_type ()
virtual TypeHandle get_type () const
void require_button (const ButtonHandle &button, bool is_down)
 Indicates that the indicated button must be in the required state (either up or down) in order for this particular MouseInterfaceNode to do anything.

Static Public Member Functions

static TypeHandle get_class_type ()
static void init_type ()

Protected Member Functions

const ButtonEventListcheck_button_events (const DataNodeTransmit &input, bool &required_buttons_match)
 Gets the button events from the data graph and updates the ModifierButtons objects appropriately.
bool is_down (ButtonHandle button) const
 Returns true if the indicated button (which must have been specified in a previous call to watch_button()) is known to be held down, false otherwise.
void watch_button (const ButtonHandle &button)
 Indicates that the derived class would like to know the state of the given button.

Detailed Description

This is the base class for some classes that monitor the mouse and keyboard input and perform some action due to their state.

It collects together some common interface; in particular, the require_button() and related methods.

Definition at line 34 of file mouseInterfaceNode.h.


Member Function Documentation

const ButtonEventList * MouseInterfaceNode::check_button_events ( const DataNodeTransmit input,
bool &  required_buttons_match 
) [protected]

Gets the button events from the data graph and updates the ModifierButtons objects appropriately.

Sets required_buttons_match to true if the required combination of buttons are being held down, or false otherwise.

The return value is the list of button events processed this frame, or NULL if there are no button events.

Definition at line 138 of file mouseInterfaceNode.cxx.

References DataNodeTransmit::get_data(), EventParameter::get_ptr(), DataNodeTransmit::has_data(), and ButtonEventList::update_mods().

Referenced by Trackball::do_transmit_data(), and DriveInterface::do_transmit_data().

Removes all requirements on buttons set by an earlier call to require_button().

Definition at line 97 of file mouseInterfaceNode.cxx.

References ModifierButtons::all_buttons_up(), and ModifierButtons::set_button_list().

Removes any requirement on the indicated button set by an earlier call to require_button().

Definition at line 76 of file mouseInterfaceNode.cxx.

References ModifierButtons::button_up(), ModifierButtons::has_button(), ModifierButtons::remove_button(), and ModifierButtons::set_button_list().

bool MouseInterfaceNode::is_down ( ButtonHandle  button) const [inline, protected]

Returns true if the indicated button (which must have been specified in a previous call to watch_button()) is known to be held down, false otherwise.

Definition at line 24 of file mouseInterfaceNode.I.

References ModifierButtons::is_down().

Referenced by Trackball::do_transmit_data(), and DriveInterface::do_transmit_data().

void MouseInterfaceNode::require_button ( const ButtonHandle button,
bool  is_down 
)

Indicates that the indicated button must be in the required state (either up or down) in order for this particular MouseInterfaceNode to do anything.

For instance, this may be called to make a Trackball object respect mouse input only when the control key is held down.

Definition at line 56 of file mouseInterfaceNode.cxx.

References ModifierButtons::add_button(), ModifierButtons::button_down(), ModifierButtons::button_up(), and ModifierButtons::set_button_list().

void MouseInterfaceNode::watch_button ( const ButtonHandle button) [protected]

Indicates that the derived class would like to know the state of the given button.

Definition at line 113 of file mouseInterfaceNode.cxx.

References ModifierButtons::add_button(), and ModifierButtons::set_button_list().


The documentation for this class was generated from the following files:
 All Classes Functions Variables Enumerations