void texpedite::disband(bool& handled, bool& halt, int index) { twindow& window = *window_; tlistbox* list = find_widget<tlistbox>(&window, "type_list", false, true); if (!disband_->button_pressed(index)) { return; } list->remove_row(index); int size = city_.reside_troops().size(); for (int i = index; i < size; i ++) { tgrid* grid_ptr = list->get_row_grid(i); // tbutton& disband = find_widget<tbutton>(&window, "disband", false); tbutton& disband = *dynamic_cast<tbutton*>(grid_ptr->find("disband", false)); disconnect_signal_mouse_left_click( disband , boost::bind( &texpedite::disband , this , _3, _4 , i + 1)); connect_signal_mouse_left_click( disband , boost::bind( &texpedite::disband , this , _3, _4 , i)); disband.set_active(city_.reside_troops()[i]->human()); } tbutton* ok = find_widget<tbutton>(&window, "ok", false, true); if (!city_.reside_troops().empty()) { if (index == size) { index --; } list->select_row(index); const unit& u = *city_.reside_troops()[index]; ok->set_active(can_move(u) && u.human()); } else { ok->set_active(false); } type_selected(window); handled = true; halt = true; window.invalidate_layout(); }
void tplay_card::discard(bool& handled, bool& halt, twindow& window, int index) { tlistbox* list = find_widget<tlistbox>(&window, "card_list", false, true); if (!discard_->button_pressed(index)) { return; } list->remove_row(index); int size = current_team_.holded_cards().size(); for (int i = index; i < size; i ++) { tgrid* grid_ptr = list->get_row_grid(i); tbutton& discard = *dynamic_cast<tbutton*>(grid_ptr->find("discard", false)); disconnect_signal_mouse_left_click( discard , boost::bind( &tplay_card::discard , this , _3, _4 , boost::ref(window) , i + 1)); connect_signal_mouse_left_click( discard , boost::bind( &tplay_card::discard , this , _3, _4 , boost::ref(window) , i)); } if (!current_team_.holded_cards().empty()) { if (index == size) { index --; } list->select_row(index); } else { tbutton* ok = find_widget<tbutton>(&window, "ok", false, true); ok->set_active(false); } card_selected(window); handled = true; halt = true; }
void texpedite::disband(bool& handled, bool& halt, int index) { twindow& window = *window_; tlistbox* list = find_widget<tlistbox>(&window, "type_list", false, true); if (!disband_->button_pressed(index)) { return; } list->remove_row(index); int size = city_.reside_troops().size(); for (int i = index; i < size; i ++) { twidget* grid_ptr = list->get_row_panel(i); // tbutton& disband = find_widget<tbutton>(&window, "disband", false); tbutton& disband = *dynamic_cast<tbutton*>(grid_ptr->find("disband", false)); disconnect_signal_mouse_left_click( disband , boost::bind( &texpedite::disband , this , _3, _4 , i + 1)); connect_signal_mouse_left_click( disband , boost::bind( &texpedite::disband , this , _3, _4 , i)); disband.set_active(city_.reside_troops()[i]->human()); } type_selected(window, *list); handled = true; halt = true; }
/** Inherited from tclickable. */ void disconnect_click_handler(const event::signal_function& signal) override { disconnect_signal_mouse_left_click(*this, signal); }
/** Inherited from tclickable. */ void disconnect_click_handler(const event::tsignal_function& signal) { disconnect_signal_mouse_left_click(signal); }