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