|
|
|
This is a particular kind of PGItem that is specialized to behave like a normal button object.
More...
#include "pgButton.h"
List of all members.
Public Types |
| enum | State { S_ready = 0,
S_depressed,
S_rollover,
S_inactive
} |
Public Member Functions |
|
| PGButton (const string &name) |
| bool | add_click_button (const ButtonHandle &button) |
| | Adds the indicated button to the set of buttons that can effectively "click" the PGButton.
|
| virtual void | click (const MouseWatcherParameter ¶m) |
| | This is a callback hook function, called whenever the button is clicked down-and-up by the user normally.
|
| virtual void | enter_region (const MouseWatcherParameter ¶m) |
| | This is a callback hook function, called whenever the mouse enters the region.
|
| virtual void | exit_region (const MouseWatcherParameter ¶m) |
| | This is a callback hook function, called whenever the mouse exits the region.
|
|
virtual TypeHandle | force_init_type () |
| string | get_click_event (const ButtonHandle &button) const |
| | Returns the event name that will be thrown when the button is clicked normally.
|
| PGButtonNotify * | get_notify () const |
| | Returns the object which will be notified when the PGButton changes, if any.
|
|
virtual TypeHandle | get_type () const |
| bool | has_click_button (const ButtonHandle &button) |
| | Returns true if the indicated button is on the set of buttons that can effectively "click" the PGButton.
|
| bool | is_button_down () |
| | Returns true if the user is currently holding the mouse button down on the button, false otherwise.
|
| virtual PandaNode * | make_copy () const |
| | Returns a newly-allocated Node that is a shallow copy of this one.
|
| virtual void | press (const MouseWatcherParameter ¶m, bool background) |
| | This is a callback hook function, called whenever a mouse or keyboard button is depressed while the mouse is within the region.
|
| virtual void | release (const MouseWatcherParameter ¶m, bool background) |
| | This is a callback hook function, called whenever a mouse or keyboard button previously depressed with press() is released.
|
| bool | remove_click_button (const ButtonHandle &button) |
| | Removes the indicated button from the set of buttons that can effectively "click" the PGButton.
|
| virtual void | set_active (bool active) |
| | Toggles the active/inactive state of the button.
|
| void | set_notify (PGButtonNotify *notify) |
| | Sets the object which will be notified when the PGButton changes.
|
| void | setup (const NodePath &ready) |
| | Sets up the button using the indicated NodePath as arbitrary geometry.
|
| void | setup (const NodePath &ready, const NodePath &depressed, const NodePath &rollover, const NodePath &inactive) |
| | Sets up the button using the indicated NodePath as arbitrary geometry.
|
| void | setup (const string &label, PN_stdfloat bevel=0.1f) |
| | Sets up the button as a default text button using the indicated label string.
|
| void | setup (const NodePath &ready, const NodePath &depressed, const NodePath &rollover) |
| | Sets up the button using the indicated NodePath as arbitrary geometry.
|
| void | setup (const NodePath &ready, const NodePath &depressed) |
| | Sets up the button using the indicated NodePath as arbitrary geometry.
|
Static Public Member Functions |
|
static TypeHandle | get_class_type () |
| static string | get_click_prefix () |
| | Returns the prefix that is used to define the click event for all PGButtons.
|
|
static void | init_type () |
Protected Member Functions |
|
| PGButton (const PGButton ©) |
Detailed Description
This is a particular kind of PGItem that is specialized to behave like a normal button object.
It keeps track of its own state, and handles mouse events sensibly.
Definition at line 32 of file pgButton.h.
Member Function Documentation
| bool PGButton::add_click_button |
( |
const ButtonHandle & |
button | ) |
|
Adds the indicated button to the set of buttons that can effectively "click" the PGButton.
Normally, this is just MouseButton::one(). Returns true if the button was added, or false if it was already there.
Definition at line 279 of file pgButton.cxx.
| string PGButton::get_click_event |
( |
const ButtonHandle & |
button | ) |
const [inline] |
| string PGButton::get_click_prefix |
( |
| ) |
[inline, static] |
Returns the prefix that is used to define the click event for all PGButtons.
The click event is the concatenation of this string followed by get_id().
Definition at line 84 of file pgButton.I.
Referenced by get_click_event().
Returns the object which will be notified when the PGButton changes, if any.
Returns NULL if there is no such object configured.
Reimplemented from PGItem.
Definition at line 38 of file pgButton.I.
Referenced by click().
| bool PGButton::has_click_button |
( |
const ButtonHandle & |
button | ) |
|
| bool PGButton::is_button_down |
( |
| ) |
[inline] |
Returns true if the user is currently holding the mouse button down on the button, false otherwise.
Definition at line 107 of file pgButton.I.
| PandaNode * PGButton::make_copy |
( |
| ) |
const [virtual] |
Returns a newly-allocated Node that is a shallow copy of this one.
It will be a different Node pointer, but its internal data may or may not be shared with that of the original Node.
Reimplemented from PGItem.
Definition at line 71 of file pgButton.cxx.
| bool PGButton::remove_click_button |
( |
const ButtonHandle & |
button | ) |
|
Removes the indicated button from the set of buttons that can effectively "click" the PGButton.
Normally, this is just MouseButton::one(). Returns true if the button was removed, or false if it was not in the set.
Definition at line 294 of file pgButton.cxx.
| void PGButton::set_active |
( |
bool |
active | ) |
[virtual] |
| void PGButton::setup |
( |
const NodePath & |
ready, |
|
|
const NodePath & |
depressed |
|
) |
| [inline] |
| void PGButton::setup |
( |
const NodePath & |
ready | ) |
[inline] |
| void PGButton::setup |
( |
const string & |
label, |
|
|
PN_stdfloat |
bevel = 0.1f |
|
) |
| |
Sets up the button as a default text button using the indicated label string.
The TextNode defined by PGItem::get_text_node() will be used to create the label geometry. This automatically sets up the frame according to the size of the text.
Definition at line 178 of file pgButton.cxx.
References NodePath::attach_new_node(), PGItem::clear_state_def(), TextNode::get_card_actual(), PGItem::get_state_def(), PGItem::get_text_node(), PGFrameStyle::set_color(), PGItem::set_frame(), PGItem::set_frame_style(), TextNode::set_text(), PGFrameStyle::set_type(), and PGFrameStyle::set_width().
Referenced by setup().
The documentation for this class was generated from the following files:
| | |