Exemplo n.º 1
0
void tside_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 {
		hero_changed(window);
	}
}
Exemplo n.º 2
0
void ttreasure_list::catalog_page(twindow& window, int catalog, bool swap)
{
    if (catalog < MIN_PAGE || catalog > MAX_PAGE) {
        return;
    }
    int index = catalog - MIN_PAGE;

    if (hero_table_->current_page() == 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();
    }

    hero_table_->swap_uh(window, index);

    fill_table(catalog);

    if (swap) {
        hero_table_->swap_bh(window);
        hero_table_->select_row(selected_row);
        // swap to other page, there is no sorted column.
        sorting_widget_ = NULL;
    } else {
        hero_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.back()->set_active(false);
        widgets.push_back(&find_widget<tbutton>(&window, "button_feature", false));
        widgets.back()->set_active(false);
        widgets.push_back(&find_widget<tbutton>(&window, "button_side", false));
        widgets.back()->set_active(false);
        widgets.push_back(&find_widget<tbutton>(&window, "button_hero", 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(
                &ttreasure_list::sort_column
                , this
                , boost::ref(window)
                , boost::ref(widget)));
    }
    sorting_widgets_[catalog] = widgets;

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