mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-14 15:41:23 +00:00
65 lines
2.1 KiB
C++
65 lines
2.1 KiB
C++
/*
|
|
Copyright (C) 2003 - 2016 by David White <dave@whitevine.net>
|
|
Part of the Battle for Wesnoth Project http://www.wesnoth.org/
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
(at your option) any later version.
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY.
|
|
|
|
See the COPYING file for more details.
|
|
*/
|
|
|
|
#ifndef LEADER_SCROLL_DIALOG_H_INCLUDED
|
|
#define LEADER_SCROLL_DIALOG_H_INCLUDED
|
|
|
|
#include "dialogs.hpp"
|
|
#include "display.hpp"
|
|
#include "gettext.hpp"
|
|
|
|
namespace gui {
|
|
|
|
void status_table(display& gui, int selected);
|
|
void scenario_settings_table(display& gui, int selected);
|
|
|
|
class leader_scroll_dialog : public gui::dialog {
|
|
public:
|
|
leader_scroll_dialog(display &disp, const std::string &title,
|
|
std::vector<bool> &leader_bools, int selected,
|
|
gui::DIALOG_RESULT extra_result) :
|
|
dialog(disp.video(), title, "", gui::NULL_DIALOG),
|
|
scroll_btn_(new gui::standard_dialog_button(disp.video(), _("Scroll To"), 0, false)),
|
|
leader_bools_(leader_bools),
|
|
extra_result_(extra_result)
|
|
{
|
|
scroll_btn_->enable(leader_bools[selected]);
|
|
add_button(scroll_btn_, gui::dialog::BUTTON_STANDARD);
|
|
add_button(new gui::standard_dialog_button(disp.video(),
|
|
_("Close"), 1, true), gui::dialog::BUTTON_STANDARD);
|
|
}
|
|
void action(gui::dialog_process_info &info) {
|
|
const bool leader_bool = leader_bools_[get_menu().selection()];
|
|
scroll_btn_->enable(leader_bool);
|
|
if(leader_bool && (info.double_clicked || (!info.key_down
|
|
&& (info.key[SDLK_RETURN] || info.key[SDLK_KP_ENTER])))) {
|
|
set_result(get_menu().selection());
|
|
} else if(!info.key_down && info.key[SDLK_ESCAPE]) {
|
|
set_result(gui::CLOSE_DIALOG);
|
|
} else if(!info.key_down && info.key[SDLK_SPACE]) {
|
|
set_result(extra_result_);
|
|
} else if(result() == gui::CONTINUE_DIALOG) {
|
|
dialog::action(info);
|
|
}
|
|
}
|
|
private:
|
|
gui::standard_dialog_button *scroll_btn_;
|
|
std::vector<bool> &leader_bools_;
|
|
gui::DIALOG_RESULT extra_result_;
|
|
};
|
|
|
|
}
|
|
#endif
|
|
|