# ModifierButtons

from pandac.PandaModules import ModifierButtons

Class : ModifierButtons
Description : This class monitors the state of a number of individual buttons and tracks whether each button is known to be down or up.

## Inheritance:

ModifierButtons:

## Methods of ModifierButtons:

addButton
allButtonsUp
buttonDown
buttonUp
getButton
getNumButtons
getPrefix
hasButton
isAnyDown
isDown
matches
operator !=
operator &
operator &=
operator <
operator =
operator ==
operator |
operator |=
output
removeButton
setButtonList
write

addButton bool ModifierButtons::add_button(ButtonHandle button); Description: Adds the indicated button to the set of buttons that will be monitored for upness and downness. Returns true if the button was added, false if it was already being monitored or if too many buttons are currently being monitored.

allButtonsUp void ModifierButtons::all_buttons_up(void); Description: Marks all monitored buttons as being in the "up" state.

buttonDown bool ModifierButtons::button_down(ButtonHandle button); Description: Records that a particular button has been pressed. If the given button is one of the buttons that is currently being monitored, this will update the internal state appropriately; otherwise, it will do nothing. Returns true if the button is one that was monitored, or false otherwise.

buttonUp bool ModifierButtons::button_up(ButtonHandle button); Description: Records that a particular button has been released. If the given button is one of the buttons that is currently being monitored, this will update the internal state appropriately; otherwise, it will do nothing. Returns true if the button is one that was monitored, or false otherwise.

getButton ButtonHandle ModifierButtons::get_button(int index) const; Description: Returns the nth button that the ModifierButtons object is monitoring (the nth button passed to add_button()). This must be in the range 0 <= index < get_num_buttons().

getNumButtons int ModifierButtons::get_num_buttons(void) const; Description: Returns the number of buttons that the ModifierButtons object is monitoring (e.g. the number of buttons passed to add_button()).

getPrefix string ModifierButtons::get_prefix(void) const; Description: Returns a string which can be used to prefix any button name or event name with the unique set of modifier buttons currently being held.

hasButton bool ModifierButtons::has_button(ButtonHandle button) const; Description: Returns true if the indicated button is in the set of buttons being monitored, false otherwise.

isAnyDown bool ModifierButtons::is_any_down(void) const; Description: Returns true if any of the tracked button are known to be down, or false if all of them are up.

isDown bool ModifierButtons::is_down(ButtonHandle button) const; Description: Returns true if the indicated button is known to be down, or false if it is known to be up. Description: Returns true if the indicated button is known to be down, or false if it is known to be up or if it is not in the set of buttons being tracked.

matches bool ModifierButtons::matches(ModifierButtons const &other) const; Description: Returns true if the set of buttons indicated as down by this ModifierButtons object is the same set of buttons indicated as down by the other ModifierButtons object. The buttons indicated as up are not relevant.

operator != bool ModifierButtons::operator !=(ModifierButtons const &other) const; Description:

operator & ModifierButtons ModifierButtons::operator &(ModifierButtons const &other) const; Description: Returns a new ModifierButtons object for which is_down() will be true only if it is true on both source objects. The set of buttons reported by has_button() is not completely defined if both source objects have a different set.

operator &= void ModifierButtons::operator &=(ModifierButtons const &other); Description: Sets is_down() true for any button that is already true for this object and the other object.

operator < bool ModifierButtons::operator <(ModifierButtons const &other) const; Description:

operator = void ModifierButtons::operator =(ModifierButtons const &copy); Filename: modifierButtons.I Created by: drose (01Mar00) PANDA 3D SOFTWARE Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved All use of this software is subject to the terms of the Panda 3d Software license. You should have received a copy of this license along with this source code; you will also find a current copy of the license at http://etc.cmu.edu/panda3d/docs/license/ . To contact the maintainers of this program write to panda3d-general@lists.sourceforge.net . Description:

operator == bool ModifierButtons::operator ==(ModifierButtons const &other) const; Description: The equality operator is an exact comparision: the two ModifierButtons are equal if they share the same button list--indeed, the same pointer--and they all the buttons have the same state. Use matches() if a less exact equality test is needed.

operator | ModifierButtons ModifierButtons::operator |(ModifierButtons const &other) const; Description: Returns a new ModifierButtons object for which is_down() will be true if it is true on either of the source objects. The set of buttons reported by has_button() is not completely defined if both source objects have a different set.

operator |= void ModifierButtons::operator |=(ModifierButtons const &other); Description: Sets is_down() true for any button that is already true for this object and the other object. Adds whatever buttons are necessary to the list to make this so

output void ModifierButtons::output(ostream &out) const; Description: Writes a one-line summary of the buttons known to be down.

removeButton bool ModifierButtons::remove_button(ButtonHandle button); Description: Removes the indicated button from the set of buttons being monitored. Returns true if the button was removed, false if it was not being monitored in the first place. Unlike the other methods, you cannot remove a button by removing its alias; you have to remove exactly the button itself.

setButtonList void ModifierButtons::set_button_list(ModifierButtons const &other); Description: Sets the list of buttons to watch to be the same as that of the other ModifierButtons object. This makes the lists pointer equivalent (until one or the other is later modified). This will preserve the state of any button that was on the original list and is also on the new lists. Any other buttons will get reset to the default state of "up".

write void ModifierButtons::write(ostream &out) const; Description: Writes a multi-line summary including all of the buttons being monitored and which ones are known to be down.