Exemplo n.º 1
0
void temploy::type_selected(twindow& window, tlistbox& list, const int type)
{
	cursel_ = list.get_selected_row();

	set_ok_active(window);

	refresh_tooltip(window);
}
Exemplo n.º 2
0
void tside_report::city_changed(twindow& window, tlistbox& list, const int type)
{
	if (candidate_cities_.empty()) {
		return;
	}

	twidget* grid_ptr = list.get_row_panel(list.get_selected_row());
	unsigned int selected_row = dynamic_cast<ttoggle_panel*>(grid_ptr)->get_data();
}
Exemplo n.º 3
0
void tinapp_purchase::item_selected(twindow& window, tlistbox& list, const int type)
{
	twindow::tinvalidate_layout_blocker blocker(window);

	int cursel = list.get_selected_row();

	purchase_->set_active(!browse_ && operating_anim_ == twidget::npos);

	refresh_tip(window, items_[cursel]);
}
Exemplo n.º 4
0
void tcampaign_selection::campaign_selected(twindow& window, tlistbox& list, const int type)
{
	const int selected_row = list.get_selected_row();

	tscrollbar_panel& multi_page = find_widget<tscrollbar_panel>(&window, "campaign_details", false);

	tscroll_label& label = find_widget<tscroll_label>(&window, "description", false);
	label.set_label(campaigns_[selected_row].description);

	tcontrol& image = find_widget<tcontrol>(&window, "image", false);
	image.set_label(campaigns_[selected_row].image);

	window.invalidate_layout();
}
Exemplo n.º 5
0
void tgame_load::display_savegame(twindow& window, tlistbox& list)
{
	const int selected_row = list.get_selected_row();

	twidget& preview_pane =
			find_widget<twidget>(&window, "preview_pane", false);

	if (selected_row == -1) {
		preview_pane.set_visible(twidget::HIDDEN);
	} else if (current_page_ == LOCAL_PAGE) {
		preview_pane.set_visible(twidget::VISIBLE);

		savegame::save_info& game = games_[selected_row];
		filename_ = game.name;

		config cfg_summary;
		std::string dummy;

		try {
			savegame::manager::load_summary(game.name, cfg_summary, &dummy);
		} catch(game::load_game_failed&) {
			cfg_summary["corrupt"] = "yes";
		}

		find_widget<timage>(&window, "imgLeader", false).
				set_label(cfg_summary["leader_image"]);

		find_widget<tminimap>(&window, "minimap", false).
				set_map_data(tminimap::TILE_MAP, cfg_summary["map_data"]);

		find_widget<tscroll_label>(&window, "lblSummary", false).set_label(generate_summary(game.name, cfg_summary));

		// window.invalidate_layout();

	} else if (current_page_ == NETWORK_PAGE) {
		preview_pane.set_visible(twidget::VISIBLE);

		savegame::www_save_info& game = www_saves_[selected_row];
		filename_ = game.name;

		find_widget<tminimap>(&window, "minimap", false).set_map_data(tminimap::TILE_MAP, "");

		find_widget<tscroll_label>(&window, "lblSummary", false).set_label(generate_summary(game.name, null_cfg));
	}
}
Exemplo n.º 6
0
void tbrowse::item_selected(twindow& window, tlistbox& list, const int type)
{
	int row = list.get_selected_row();

	tristate dir = t_unset;
	if (row >= 0) {
		std::set<tfile>::const_iterator it;
		if (row < (int)dirs_in_current_dir_.size()) {
			dir = t_true;
			it = dirs_in_current_dir_.begin();
		} else {
			dir = t_false;
			it = files_in_current_dir_.begin();
			row -= dirs_in_current_dir_.size();
		}
		std::advance(it, row);
		selected_ = it->name;
	} else {
		selected_.empty();
	}

	set_ok_active(window, dir);
}
Exemplo n.º 7
0
void texpedite::type_selected(twindow& window, tlistbox& list, const int type)
{
	tbutton* task = find_widget<tbutton>(&window, "task", false, true);
	tbutton* ok = find_widget<tbutton>(&window, "ok", false, true);

	// prevent visible/disable disband button from layouting window.
	twindow::tinvalidate_layout_blocker invalidate_layout_blocker(window);
	list.invalidate_layout(false);

	troop_index_ = list.get_selected_row();
	refresh_tooltip(window);

	// There is maybe no troop after disband. so troop_index_ maybe equal -1.
	if (troop_index_ >= 0) {
		int size = city_.reside_troops().size();
		const unit& u = *city_.reside_troops()[troop_index_];
		for (int index = 0; index < size; index ++) {
			twidget* grid_ptr = list.get_row_panel(index);
			// tbutton& disband = find_widget<tbutton>(&window, "disband", false);
			tbutton& disband = *dynamic_cast<tbutton*>(grid_ptr->find("disband", false));
			if (index == troop_index_) {
				disband.set_visible(twidget::VISIBLE);
				disband.set_active(u.human());
			} else {
				disband.set_visible(twidget::INVISIBLE);
			}
		}

		set_task_str(window, u);
		ok->set_active(u.human() && can_move(u));

	} else {
		task->set_active(false);
		ok->set_active(false);
	}
}
Exemplo n.º 8
0
void trpg_detail::type_selected(twindow& window, tlistbox& list, const int type)
{
	troop_index_ = list.get_selected_row();
}
Exemplo n.º 9
0
void tpreferences::page_selected(twindow& window, tlistbox& list, const int type)
{
	page_ = list.get_selected_row();

	swap_page(window, page_, true);
}
Exemplo n.º 10
0
void tfinal_battle::type_selected(twindow& window, tlistbox& list, const int type)
{
	type_index_ = list.get_selected_row();
}