mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 02:15:43 -04:00
Back to 1.6 version
This commit is contained in:
parent
addb68b630
commit
1243548892
@ -69,6 +69,7 @@ PGButton(const PGButton ©) :
|
||||
////////////////////////////////////////////////////////////////////
|
||||
PandaNode *PGButton::
|
||||
make_copy() const {
|
||||
LightReMutexHolder holder(_lock);
|
||||
return new PGButton(*this);
|
||||
}
|
||||
|
||||
@ -80,6 +81,7 @@ make_copy() const {
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void PGButton::
|
||||
enter_region(const MouseWatcherParameter ¶m) {
|
||||
LightReMutexHolder holder(_lock);
|
||||
if (get_active()) {
|
||||
set_state(_button_down ? S_depressed : S_rollover);
|
||||
}
|
||||
@ -94,6 +96,7 @@ enter_region(const MouseWatcherParameter ¶m) {
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void PGButton::
|
||||
exit_region(const MouseWatcherParameter ¶m) {
|
||||
LightReMutexHolder holder(_lock);
|
||||
if (get_active()) {
|
||||
set_state(S_ready);
|
||||
}
|
||||
@ -109,6 +112,7 @@ exit_region(const MouseWatcherParameter ¶m) {
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void PGButton::
|
||||
press(const MouseWatcherParameter ¶m, bool background) {
|
||||
LightReMutexHolder holder(_lock);
|
||||
if (has_click_button(param.get_button())) {
|
||||
if (get_active()) {
|
||||
_button_down = true;
|
||||
@ -127,6 +131,7 @@ press(const MouseWatcherParameter ¶m, bool background) {
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void PGButton::
|
||||
release(const MouseWatcherParameter ¶m, bool background) {
|
||||
LightReMutexHolder holder(_lock);
|
||||
if (has_click_button(param.get_button())) {
|
||||
_button_down = false;
|
||||
if (get_active()) {
|
||||
@ -149,6 +154,7 @@ release(const MouseWatcherParameter ¶m, bool background) {
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void PGButton::
|
||||
click(const MouseWatcherParameter ¶m) {
|
||||
LightReMutexHolder holder(_lock);
|
||||
PGMouseWatcherParameter *ep = new PGMouseWatcherParameter(param);
|
||||
string event = get_click_event(param.get_button());
|
||||
play_sound(event);
|
||||
@ -170,6 +176,7 @@ click(const MouseWatcherParameter ¶m) {
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void PGButton::
|
||||
setup(const string &label, float bevel) {
|
||||
LightReMutexHolder holder(_lock);
|
||||
clear_state_def(S_ready);
|
||||
clear_state_def(S_depressed);
|
||||
clear_state_def(S_rollover);
|
||||
@ -226,6 +233,7 @@ setup(const string &label, float bevel) {
|
||||
void PGButton::
|
||||
setup(const NodePath &ready, const NodePath &depressed,
|
||||
const NodePath &rollover, const NodePath &inactive) {
|
||||
LightReMutexHolder holder(_lock);
|
||||
clear_state_def(S_ready);
|
||||
clear_state_def(S_depressed);
|
||||
clear_state_def(S_rollover);
|
||||
@ -246,6 +254,7 @@ setup(const NodePath &ready, const NodePath &depressed,
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void PGButton::
|
||||
set_active(bool active) {
|
||||
LightReMutexHolder holder(_lock);
|
||||
if (active != get_active()) {
|
||||
PGItem::set_active(active);
|
||||
set_state(active ? S_ready : S_inactive);
|
||||
@ -262,6 +271,7 @@ set_active(bool active) {
|
||||
////////////////////////////////////////////////////////////////////
|
||||
bool PGButton::
|
||||
add_click_button(const ButtonHandle &button) {
|
||||
LightReMutexHolder holder(_lock);
|
||||
return _click_buttons.insert(button).second;
|
||||
}
|
||||
|
||||
@ -276,6 +286,7 @@ add_click_button(const ButtonHandle &button) {
|
||||
////////////////////////////////////////////////////////////////////
|
||||
bool PGButton::
|
||||
remove_click_button(const ButtonHandle &button) {
|
||||
LightReMutexHolder holder(_lock);
|
||||
return (_click_buttons.erase(button) != 0);
|
||||
}
|
||||
|
||||
@ -288,6 +299,7 @@ remove_click_button(const ButtonHandle &button) {
|
||||
////////////////////////////////////////////////////////////////////
|
||||
bool PGButton::
|
||||
has_click_button(const ButtonHandle &button) {
|
||||
LightReMutexHolder holder(_lock);
|
||||
return (_click_buttons.count(button) != 0);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user