Ejemplo n.º 1
0
void tartifical_list::catalog_page(twindow& window, int catalog, bool swap)
{
	if (catalog < MIN_PAGE || catalog > MAX_PAGE) {
		return;
	}
	int index = catalog - MIN_PAGE;

	if (window.alternate_index() == index) {
		// desired page is the displaying page, do nothing.
		return;
	}
	
	int selected_row = 0;
	if (swap) {
		selected_row = hero_table_->get_selected_row();
	}

	window.alternate_uh(hero_table_, index);

	fill_table(catalog);

	if (swap) {
		window.alternate_bh(hero_table_, index);
		hero_table_->select_row(selected_row);
	} else {
		city_changed(window);
	}
}
Ejemplo n.º 2
0
void tside_report::catalog_page(twindow& window, int catalog, bool swap)
{
	fill_table(*hero_table_, catalog);
	city_changed(window, *hero_table_);

	// in order to support sortable, form relative data.
	std::vector<tbutton*> widgets;
	if (catalog == STATUS_PAGE) {
		widgets.push_back(&find_widget<tbutton>(&window, "button_name", false));
		widgets.back()->set_active(false);
		widgets.push_back(&find_widget<tbutton>(&window, "button_hp", false));
		widgets.back()->set_active(false);
		widgets.push_back(&find_widget<tbutton>(&window, "button_xp", false));
		widgets.back()->set_active(false);
		widgets.push_back(&find_widget<tbutton>(&window, "button_hero", false));
		widgets.back()->set_active(false);
		widgets.push_back(&find_widget<tbutton>(&window, "button_troop", false));
		widgets.back()->set_active(false);
		widgets.push_back(&find_widget<tbutton>(&window, "button_income", false));
		widgets.back()->set_label(tintegrate::generate_img("misc/gold.png") + " " + tintegrate::generate_img("misc/technology.png"));
		widgets.back()->set_active(false);
		widgets.push_back(&find_widget<tbutton>(&window, "button_ea", false));
		widgets.back()->set_active(false);
	}
	for (std::vector<tbutton*>::iterator i = widgets.begin(); i != widgets.end(); ++ i) {
		tbutton& widget = **i;
		connect_signal_mouse_left_click(
			widget
			, boost::bind(
				&tside_report::sort_column
				, this
				, boost::ref(widget)));
	}
	sorting_widgets_[catalog] = widgets;

	// speeden compare_row, remember this catalog.
	current_page_ = catalog;
}
Ejemplo n.º 3
0
void ttroop_list::catalog_page(twindow& window, int catalog, bool swap)
{
	if (catalog < MIN_PAGE || catalog > MAX_PAGE) {
		return;
	}
	int index = catalog - MIN_PAGE;

	if (window.alternate_index() == index) {
		// desired page is the displaying page, do nothing.
		return;
	}
	
	unsigned int selected_row = 0;
	if (swap) {
		// because sort, order is changed.
		selected_row = hero_table_->get_selected_row();
		tgrid* grid_ptr = hero_table_->get_row_grid(hero_table_->get_selected_row());
		selected_row = dynamic_cast<ttoggle_panel*>(grid_ptr->find("_toggle", true))->get_data();
	}

	window.alternate_uh(hero_table_, index);

	fill_table(catalog);

	if (swap) {
		window.alternate_bh(hero_table_, index);
		hero_table_->select_row(selected_row);
		// swap to other page, there is no sorted column.
		sorting_widget_ = NULL;
	} else {
		city_changed(window);
	}

	// in order to support sortable, form relative data.
	std::vector<tbutton*> widgets;
	if (catalog == OWNERSHIP_PAGE) {
		widgets.push_back(&find_widget<tbutton>(&window, "button_name", false));
		widgets.push_back(&find_widget<tbutton>(&window, "button_type", false));
		widgets.push_back(&find_widget<tbutton>(&window, "button_side", false));
		widgets.push_back(&find_widget<tbutton>(&window, "button_city", false));
	} else if (catalog == STATUS_PAGE) {
		widgets.push_back(&find_widget<tbutton>(&window, "button_name", false));
		widgets.push_back(&find_widget<tbutton>(&window, "button_type", false));
		widgets.push_back(&find_widget<tbutton>(&window, "button_level", false));
		widgets.push_back(&find_widget<tbutton>(&window, "button_hp", false));
		widgets.push_back(&find_widget<tbutton>(&window, "button_xp", false));
		widgets.push_back(&find_widget<tbutton>(&window, "button_traits", false));
		widgets.push_back(&find_widget<tbutton>(&window, "button_movement", false));
		widgets.push_back(&find_widget<tbutton>(&window, "button_status", false));
		widgets.back()->set_active(false);
	} else if (catalog == MERIT_PAGE) {
		widgets.push_back(&find_widget<tbutton>(&window, "button_name", false));
		widgets.push_back(&find_widget<tbutton>(&window, "button_type", false));
		widgets.push_back(&find_widget<tbutton>(&window, "button_cause_damage", false));
		widgets.push_back(&find_widget<tbutton>(&window, "button_been_damage", false));
		widgets.push_back(&find_widget<tbutton>(&window, "button_defeat_units", false));
		widgets.push_back(&find_widget<tbutton>(&window, "button_field_turns", false));
	}
	for (std::vector<tbutton*>::iterator i = widgets.begin(); i != widgets.end(); ++ i) {
		tbutton& widget = **i;
		connect_signal_mouse_left_click(
			widget
			, boost::bind(
				&ttroop_list::sort_column
				, this
				, boost::ref(widget)));
	}
	sorting_widgets_[catalog] = widgets;

	// speeden compare_row, remember this catalog.
	current_page_ = catalog;
}