This is a particular kind of PGItem that is specialized to behave like a normal button object. More...
Public Types | |
enum | State { SReady = 0, SDepressed = 1, SRollover = 2, SInactive = 3 } |
Public Member Functions | |
PGButton (string name) | |
bool | addClickButton (ButtonHandle const button) |
Adds the indicated button to the set of buttons that can effectively "click" the PGButton. | |
string | getClickEvent (ButtonHandle const button) |
Returns the event name that will be thrown when the button is clicked normally. | |
bool | hasClickButton (ButtonHandle const button) |
Returns true if the indicated button is on the set of buttons that can effectively "click" the PGButton. | |
bool | isButtonDown () |
Returns true if the user is currently holding the mouse button down on the button, false otherwise. | |
bool | removeClickButton (ButtonHandle const button) |
Removes the indicated button from the set of buttons that can effectively "click" the PGButton. | |
setup (NodePath const ready) | |
Sets up the button using the indicated NodePath as arbitrary geometry. | |
setup (NodePath const ready, NodePath const depressed) | |
Sets up the button using the indicated NodePath as arbitrary geometry. | |
setup (NodePath const ready, NodePath const depressed, NodePath const rollover) | |
Sets up the button using the indicated NodePath as arbitrary geometry. | |
setup (NodePath const ready, NodePath const depressed, NodePath const rollover, NodePath const inactive) | |
Sets up the button using the indicated NodePath as arbitrary geometry. | |
setup (string label, float bevel) | |
Sets up the button as a default text button using the indicated label string. | |
setup (string label) | |
Sets up the button as a default text button using the indicated label string. | |
Static Public Member Functions | |
static TypeHandle | getClassType () |
static string | getClickPrefix () |
Returns the prefix that is used to define the click event for all PGButtons. |
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.
enum State |
PGButton | ( | string | name | ) |
bool addClickButton | ( | ButtonHandle const | 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.
static TypeHandle getClassType | ( | ) | [static] |
Reimplemented from PGItem.
string getClickEvent | ( | ButtonHandle const | button | ) |
Returns the event name that will be thrown when the button is clicked normally.
static string getClickPrefix | ( | ) | [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().
bool hasClickButton | ( | ButtonHandle const | button | ) |
Returns true if the indicated button is on the set of buttons that can effectively "click" the PGButton.
Normally, this is just MouseButton::one().
bool isButtonDown | ( | ) |
Returns true if the user is currently holding the mouse button down on the button, false otherwise.
bool removeClickButton | ( | ButtonHandle const | 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.
Sets up the button using the indicated NodePath as arbitrary geometry.
Sets up the button using the indicated NodePath as arbitrary geometry.
Sets up the button using the indicated NodePath as arbitrary geometry.
setup | ( | NodePath const | ready, |
NodePath const | depressed, | ||
NodePath const | rollover, | ||
NodePath const | inactive | ||
) |
Sets up the button using the indicated NodePath as arbitrary geometry.
setup | ( | string | label, |
float | bevel | ||
) |
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.