This commit is contained in:
Cary Sandvig 2001-02-16 00:56:09 +00:00
parent 9a567761c7
commit ba117e608b
3 changed files with 32 additions and 8 deletions

View File

@ -17,7 +17,8 @@ void GuiBehavior::BehaviorFunctor::doit(GuiBehavior*) {
}
GuiBehavior::GuiBehavior(const string& name) : GuiItem(name),
_eh((EventHandler*)0L) {
_eh((EventHandler*)0L),
_behavior_running(false) {
}
GuiBehavior::~GuiBehavior(void) {

View File

@ -450,6 +450,8 @@ void GuiButton::start_behavior(void) {
GuiBehavior::start_behavior();
if (_mgr == (GuiManager*)0L)
return;
if (!this->is_active())
return;
_eh->add_hook(_down_event, GuiButton::behavior_down, (void*)this);
_eh->add_hook(_down_rollover_event, GuiButton::behavior_down, (void*)this);
}

View File

@ -16,9 +16,9 @@ GuiChooser::ChooseFunctor::~ChooseFunctor(void) {
}
void GuiChooser::ChooseFunctor::doit(GuiBehavior* b) {
if (b == this->_ch->_prev_button)
if ((b == this->_ch->_prev_button) && this->_ch->_prev_button->is_active())
this->_ch->move_prev();
if (b == this->_ch->_next_button)
if ((b == this->_ch->_next_button) && this->_ch->_next_button->is_active())
this->_ch->move_next();
}
@ -50,13 +50,23 @@ void GuiChooser::move_prev(void) {
_items[tmp]->manage(_mgr, *_eh);
if (tmp == 0)
_prev_button->inactive();
else
else {
_prev_button->up();
if (_behavior_running) {
_prev_button->start_behavior();
_prev_button->set_behavior_functor(_prev_functor);
}
}
int foo = _items.size() - 1;
if (tmp == foo)
_next_button->inactive();
else
else {
_next_button->up();
if (_behavior_running) {
_next_button->start_behavior();
_next_button->set_behavior_functor(_next_functor);
}
}
}
_curr = tmp;
}
@ -77,12 +87,23 @@ void GuiChooser::move_next(void) {
_items[tmp]->manage(_mgr, *_eh);
if (tmp == 0)
_prev_button->inactive();
else
else {
_prev_button->up();
if (tmp == (_items.size() - 1))
if (_behavior_running) {
_prev_button->start_behavior();
_prev_button->set_behavior_functor(_prev_functor);
}
}
int foo = _items.size() - 1;
if (tmp == foo)
_next_button->inactive();
else
else {
_next_button->up();
if (_behavior_running) {
_next_button->start_behavior();
_next_button->set_behavior_functor(_next_functor);
}
}
}
_curr = tmp;
}