Convert GUI1 functions to use CVideo directly instead of display
This commit is contained in:
parent
716b6e8e87
commit
8c0e56213b
18 changed files with 59 additions and 63 deletions
|
@ -107,7 +107,7 @@ bool recall_action::redo(int side)
|
|||
}
|
||||
sync.do_final_checkup();
|
||||
} else {
|
||||
gui::dialog(gui, "", msg, gui::OK_ONLY).show();
|
||||
gui::dialog(gui.video(), "", msg, gui::OK_ONLY).show();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -105,7 +105,7 @@ bool recruit_action::redo(int side)
|
|||
}
|
||||
sync.do_final_checkup();
|
||||
} else {
|
||||
gui::dialog(gui, "", msg, gui::OK_ONLY).show();
|
||||
gui::dialog(gui.video(), "", msg, gui::OK_ONLY).show();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -239,7 +239,7 @@ addon_op_result do_resolve_addon_dependencies(display& disp, addons_client& clie
|
|||
}
|
||||
|
||||
/* do */ {
|
||||
gui::dialog dlg(disp, _("Install Dependencies"),
|
||||
gui::dialog dlg(disp.video(), _("Install Dependencies"),
|
||||
_n("The selected add-on has the following dependency, which is not currently installed. Do you wish to install it before continuing?",
|
||||
"The selected add-on has the following dependencies, which are not currently installed. Do you wish to install them before continuing?",
|
||||
missing_deps.size()),
|
||||
|
@ -825,7 +825,7 @@ void show_addons_manager_dialog(display& disp, addons_client& client, addons_lis
|
|||
: _("There are no add-ons matching the specified criteria on this server.");
|
||||
}
|
||||
|
||||
gui::dialog dlg(disp, _("Add-ons Manager"), dlg_message, gui::OK_CANCEL);
|
||||
gui::dialog dlg(disp.video(), _("Add-ons Manager"), dlg_message, gui::OK_CANCEL);
|
||||
|
||||
gui::menu::basic_sorter sorter;
|
||||
sorter.set_alpha_sort(1).set_alpha_sort(2).set_alpha_sort(3);
|
||||
|
|
|
@ -548,7 +548,7 @@ attack_prediction_displayer::RESULT attack_prediction_displayer::button_pressed(
|
|||
std::vector<gui::preview_pane*> preview_panes;
|
||||
preview_panes.push_back(&battle_pane);
|
||||
|
||||
gui::show_dialog(*resources::screen, NULL, _("Damage Calculations"), "", gui::OK_ONLY, NULL, &preview_panes);
|
||||
gui::show_dialog(resources::screen->video(), NULL, _("Damage Calculations"), "", gui::OK_ONLY, NULL, &preview_panes);
|
||||
}
|
||||
|
||||
return gui::CONTINUE_DIALOG;
|
||||
|
|
|
@ -93,16 +93,16 @@ dialog::dimension_measurements::dimension_measurements() :
|
|||
//(unnamed namespace and/or const object defined at declaration time).
|
||||
}
|
||||
|
||||
dialog::dialog(display &disp, const std::string& title, const std::string& message,
|
||||
dialog::dialog(CVideo& video, const std::string& title, const std::string& message,
|
||||
const DIALOG_TYPE type, const style& dialog_style) :
|
||||
disp_(disp),
|
||||
video_(video),
|
||||
image_(NULL),
|
||||
title_(title),
|
||||
style_(dialog_style),
|
||||
title_widget_(NULL),
|
||||
message_(NULL),
|
||||
type_(type),
|
||||
menu_(get_empty_menu(disp)),
|
||||
menu_(get_empty_menu(video)),
|
||||
preview_panes_(),
|
||||
button_pool_(),
|
||||
standard_buttons_(),
|
||||
|
@ -116,36 +116,34 @@ dialog::dialog(display &disp, const std::string& title, const std::string& messa
|
|||
dim_(),
|
||||
result_(CONTINUE_DIALOG)
|
||||
{
|
||||
CVideo& screen = disp_.video();
|
||||
|
||||
switch(type)
|
||||
{
|
||||
case MESSAGE:
|
||||
default:
|
||||
break;
|
||||
case OK_ONLY:
|
||||
add_button(new standard_dialog_button(screen,_("OK"),0,true), BUTTON_STANDARD);
|
||||
add_button(new standard_dialog_button(video_,_("OK"),0,true), BUTTON_STANDARD);
|
||||
break;
|
||||
case YES_NO:
|
||||
add_button(new standard_dialog_button(screen,_("Yes"),0,false), BUTTON_STANDARD);
|
||||
add_button(new standard_dialog_button(screen,_("No"),1,true), BUTTON_STANDARD);
|
||||
add_button(new standard_dialog_button(video_,_("Yes"),0,false), BUTTON_STANDARD);
|
||||
add_button(new standard_dialog_button(video_,_("No"),1,true), BUTTON_STANDARD);
|
||||
break;
|
||||
case OK_CANCEL:
|
||||
add_button(new standard_dialog_button(screen,_("OK"),0,false), BUTTON_STANDARD);
|
||||
add_button(new standard_dialog_button(screen,_("Cancel"),1,true), BUTTON_STANDARD);
|
||||
add_button(new standard_dialog_button(video_,_("OK"),0,false), BUTTON_STANDARD);
|
||||
add_button(new standard_dialog_button(video_,_("Cancel"),1,true), BUTTON_STANDARD);
|
||||
break;
|
||||
case CANCEL_ONLY:
|
||||
add_button(new standard_dialog_button(screen,_("Cancel"),0,true), BUTTON_STANDARD);
|
||||
add_button(new standard_dialog_button(video_,_("Cancel"),0,true), BUTTON_STANDARD);
|
||||
break;
|
||||
case CLOSE_ONLY:
|
||||
add_button(new standard_dialog_button(screen,_("Close"),0,true), BUTTON_STANDARD);
|
||||
add_button(new standard_dialog_button(video_,_("Close"),0,true), BUTTON_STANDARD);
|
||||
break;
|
||||
}
|
||||
//dialog creator should catch(button::error&) ?
|
||||
|
||||
try {
|
||||
std::string msg = font::word_wrap_text(message, message_font_size, screen.getx() / 2, screen.gety() / 2);
|
||||
message_ = new label(screen, msg, message_font_size, font::NORMAL_COLOR, false);
|
||||
std::string msg = font::word_wrap_text(message, message_font_size, video_.getx() / 2, video_.gety() / 2);
|
||||
message_ = new label(video_, msg, message_font_size, font::NORMAL_COLOR, false);
|
||||
} catch(utf8::invalid_utf8_exception&) {
|
||||
ERR_DP << "Problem handling utf8 in message '" << message << "'" << std::endl;
|
||||
throw;
|
||||
|
@ -219,13 +217,13 @@ void dialog::add_button(dialog_button *const btn, BUTTON_LOCATION loc)
|
|||
|
||||
void dialog::add_button(dialog_button_info btn_info, BUTTON_LOCATION loc)
|
||||
{
|
||||
dialog_button *btn = new dialog_button(disp_.video(), btn_info.label, button::TYPE_PRESS, CONTINUE_DIALOG, btn_info.handler);
|
||||
dialog_button *btn = new dialog_button(video_, btn_info.label, button::TYPE_PRESS, CONTINUE_DIALOG, btn_info.handler);
|
||||
add_button(btn, loc);
|
||||
}
|
||||
|
||||
void dialog::add_option(const std::string& label, bool checked, BUTTON_LOCATION loc, const std::string& help_string)
|
||||
{
|
||||
gui::dialog_button *btn = new dialog_button(disp_.video(), label, button::TYPE_CHECK);
|
||||
gui::dialog_button *btn = new dialog_button(video_, label, button::TYPE_CHECK);
|
||||
btn->set_check(checked);
|
||||
btn->set_help_string(help_string);
|
||||
add_button(btn, loc);
|
||||
|
@ -235,15 +233,15 @@ void dialog::set_textbox(const std::string& text_widget_label,
|
|||
const std::string& text_widget_text,
|
||||
const int text_widget_max_chars, const unsigned int text_box_width)
|
||||
{
|
||||
label *label_ptr = new label(disp_.video(), text_widget_label, message_font_size, font::NORMAL_COLOR, false);
|
||||
label *label_ptr = new label(video_, text_widget_label, message_font_size, font::NORMAL_COLOR, false);
|
||||
const bool editable_textbox = std::find(text_widget_text.begin(),text_widget_text.end(),'\n') == text_widget_text.end();
|
||||
text_widget_ = new dialog_textbox(label_ptr, disp_.video(), text_box_width, text_widget_text, editable_textbox, text_widget_max_chars);
|
||||
text_widget_ = new dialog_textbox(label_ptr, video_, text_box_width, text_widget_text, editable_textbox, text_widget_max_chars);
|
||||
text_widget_->set_wrap(!editable_textbox);
|
||||
}
|
||||
|
||||
void dialog::set_menu(const std::vector<std::string> &menu_items, menu::sorter* sorter)
|
||||
{
|
||||
set_menu(new gui::menu(disp_.video(), menu_items, (type_==MESSAGE),
|
||||
set_menu(new gui::menu(video_, menu_items, (type_==MESSAGE),
|
||||
-1, dialog::max_menu_width, sorter, &menu::default_style, false));
|
||||
}
|
||||
|
||||
|
@ -269,10 +267,10 @@ void dialog::set_menu_items(const std::vector<std::string> &menu_items, bool kee
|
|||
* Provides create-on-use semantics for empty_menu.
|
||||
* This is called by dialog's constructor, so other code can use empty_menu directly.
|
||||
*/
|
||||
menu * dialog::get_empty_menu(display &disp)
|
||||
menu * dialog::get_empty_menu(CVideo& video)
|
||||
{
|
||||
if ( empty_menu == NULL ) {
|
||||
empty_menu = new gui::menu(disp.video(), empty_string_vector, false, -1, -1, NULL, &menu::simple_style);
|
||||
empty_menu = new gui::menu(video, empty_string_vector, false, -1, -1, NULL, &menu::simple_style);
|
||||
empty_menu->leave();
|
||||
}
|
||||
return empty_menu;
|
||||
|
@ -286,7 +284,7 @@ int dialog::show(int xloc, int yloc)
|
|||
|
||||
int dialog::show()
|
||||
{
|
||||
if (disp_.video().faked()) {
|
||||
if (video_.faked()) {
|
||||
plugins_manager * pm = plugins_manager::get();
|
||||
if (pm && pm->any_running()) {
|
||||
pm->notify_event("show_dialog", config(config_of
|
||||
|
@ -305,7 +303,7 @@ int dialog::show()
|
|||
return CLOSE_DIALOG;
|
||||
}
|
||||
|
||||
if(disp_.video().update_locked()) {
|
||||
if(video_.update_locked()) {
|
||||
ERR_DP << "display locked ignoring dialog '" << title_ << "' '" << message_->get_text() << "'" << std::endl;
|
||||
return CLOSE_DIALOG;
|
||||
}
|
||||
|
@ -366,7 +364,7 @@ void dialog::draw_contents()
|
|||
}
|
||||
events::raise_draw_event(); //draw widgets
|
||||
|
||||
disp_.video().flip();
|
||||
video_.flip();
|
||||
}
|
||||
|
||||
dialog_frame& dialog::get_frame()
|
||||
|
@ -377,7 +375,7 @@ dialog_frame& dialog::get_frame()
|
|||
{
|
||||
frame_buttons_.push_back(*b);
|
||||
}
|
||||
frame_ = new dialog_frame(screen, title_, style_, true, &frame_buttons_, help_button_);
|
||||
frame_ = new dialog_frame(video_, title_, style_, true, &frame_buttons_, help_button_);
|
||||
}
|
||||
return *frame_;
|
||||
}
|
||||
|
@ -460,13 +458,13 @@ void dialog::update_widget_positions()
|
|||
|
||||
void dialog::refresh()
|
||||
{
|
||||
disp_.video().flip();
|
||||
video_.flip();
|
||||
CVideo::delay(10);
|
||||
}
|
||||
|
||||
dialog::dimension_measurements dialog::layout(int xloc, int yloc)
|
||||
{
|
||||
CVideo& screen = disp_.video();
|
||||
CVideo& screen = video_;
|
||||
const surface& scr = screen.getSurface();
|
||||
|
||||
dimension_measurements dim;
|
||||
|
@ -907,9 +905,9 @@ void dialog::set_image(surface surf, const std::string &caption)
|
|||
{
|
||||
label *label_ptr = NULL;
|
||||
if(!caption.empty()) {
|
||||
label_ptr = new label(disp_.video(), caption, caption_font_size, font::NORMAL_COLOR, false);
|
||||
label_ptr = new label(video_, caption, caption_font_size, font::NORMAL_COLOR, false);
|
||||
}
|
||||
set_image( new dialog_image(label_ptr, disp_.video(), surf ));
|
||||
set_image( new dialog_image(label_ptr, video_, surf ));
|
||||
}
|
||||
|
||||
void dialog_image::draw_contents()
|
||||
|
|
|
@ -224,7 +224,7 @@ public:
|
|||
//Constructor & destructor
|
||||
//dialog - throws button::error() if standard buttons fail to initialize
|
||||
// throws utf8::invalid_utf8_exception() if message is invalid
|
||||
dialog(display &disp,
|
||||
dialog(CVideo& video,
|
||||
const std::string& title="",
|
||||
const std::string& message="",
|
||||
const DIALOG_TYPE type=MESSAGE,
|
||||
|
@ -277,7 +277,6 @@ public:
|
|||
std::string textbox_text() const { return text_widget_->text();}
|
||||
dialog_textbox& get_textbox() const { return *text_widget_; }
|
||||
bool option_checked(unsigned int option_index=0);
|
||||
display& get_display() { return disp_; }
|
||||
|
||||
/// Explicit freeing of class static resources.
|
||||
/// Must not be called if any instances of this class exist.
|
||||
|
@ -307,10 +306,10 @@ private:
|
|||
/// A pointer to this empty menu is used instead of NULL (for menu_).
|
||||
static menu * empty_menu;
|
||||
/// Provides create-on-use semantics for empty_menu.
|
||||
static menu * get_empty_menu(display &disp);
|
||||
static menu * get_empty_menu(CVideo& video);
|
||||
|
||||
//Members
|
||||
display &disp_;
|
||||
CVideo& video_;
|
||||
dialog_image *image_;
|
||||
std::string title_;
|
||||
const style& style_;
|
||||
|
|
|
@ -220,7 +220,7 @@ int advance_unit_dialog(const map_location &loc)
|
|||
std::vector<gui::preview_pane*> preview_panes;
|
||||
preview_panes.push_back(&unit_preview);
|
||||
|
||||
gui::dialog advances = gui::dialog(*resources::screen,
|
||||
gui::dialog advances = gui::dialog(resources::screen->video(),
|
||||
_("Advance Unit"),
|
||||
_("What should our victorious unit become?"),
|
||||
gui::OK_ONLY);
|
||||
|
@ -402,7 +402,7 @@ void show_unit_list(display& gui)
|
|||
dialogs::units_list_preview_pane unit_preview(units_list);
|
||||
unit_preview.set_selection(selected);
|
||||
|
||||
gui::dialog umenu(gui, _("Unit List"), "", gui::NULL_DIALOG);
|
||||
gui::dialog umenu(gui.video(), _("Unit List"), "", gui::NULL_DIALOG);
|
||||
umenu.set_menu(items, &sorter);
|
||||
umenu.add_pane(&unit_preview);
|
||||
//sort by type name
|
||||
|
@ -440,7 +440,7 @@ int recruit_dialog(display& disp, std::vector< const unit_type* >& units, const
|
|||
gui::menu::basic_sorter sorter;
|
||||
sorter.set_alpha_sort(1);
|
||||
|
||||
gui::dialog rmenu(disp, _("Recruit") + title_suffix,
|
||||
gui::dialog rmenu(disp.video(), _("Recruit") + title_suffix,
|
||||
_("Select unit:") + std::string("\n"),
|
||||
gui::OK_CANCEL,
|
||||
gui::dialog::default_style);
|
||||
|
@ -554,7 +554,7 @@ int recall_dialog(display& disp, const boost::shared_ptr<std::vector< unit_const
|
|||
options_to_filter.push_back(option_to_filter.str());
|
||||
}
|
||||
|
||||
gui::dialog rmenu(disp, _("Recall") + title_suffix,
|
||||
gui::dialog rmenu(disp.video(), _("Recall") + title_suffix,
|
||||
_("Select unit:") + std::string("\n"),
|
||||
gui::OK_CANCEL, gui::dialog::default_style);
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ int show_file_chooser_dialog_save(display &disp, std::string &filename,
|
|||
file_dialog::file_dialog(display &disp, const std::string& file_path,
|
||||
const std::string& title, const std::string& default_file_name,
|
||||
bool show_directory_buttons) :
|
||||
gui::dialog(disp, title, file_path, gui::OK_CANCEL),
|
||||
gui::dialog(disp.video(), title, file_path, gui::OK_CANCEL),
|
||||
show_directory_buttons_(show_directory_buttons),
|
||||
files_list_(NULL),
|
||||
last_selection_(-1),
|
||||
|
@ -204,7 +204,7 @@ void file_dialog::action(gui::dialog_process_info &dp_info)
|
|||
if(!chosen_file_.empty())
|
||||
{
|
||||
if(files_list_->delete_chosen_file() == -1) {
|
||||
gui2::show_transient_error_message(get_display().video()
|
||||
gui2::show_transient_error_message(CVideo::get_singleton()
|
||||
, _("Deletion of the file failed."));
|
||||
dp_info.clear_buttons();
|
||||
} else {
|
||||
|
@ -217,10 +217,10 @@ void file_dialog::action(gui::dialog_process_info &dp_info)
|
|||
else if(result() == gui::CREATE_ITEM)
|
||||
{
|
||||
std::string new_dir_name = "";
|
||||
if(gui2::tfolder_create::execute(new_dir_name, get_display().video()))
|
||||
if(gui2::tfolder_create::execute(new_dir_name, CVideo::get_singleton()))
|
||||
{
|
||||
if( !files_list_->make_directory(new_dir_name) ) {
|
||||
gui2::show_transient_error_message(get_display().video()
|
||||
gui2::show_transient_error_message(CVideo::get_singleton()
|
||||
, _("Creation of the directory failed."));
|
||||
} else {
|
||||
dp_info.first_time = true;
|
||||
|
|
|
@ -367,7 +367,7 @@ void wait::join_game(bool observe)
|
|||
leader_preview_pane leader_selector(disp(), flg, color);
|
||||
preview_panes.push_back(&leader_selector);
|
||||
|
||||
const int faction_choice = gui::show_dialog(disp(), NULL,
|
||||
const int faction_choice = gui::show_dialog(disp().video(), NULL,
|
||||
_("Choose your faction:"), _("Starting position: ") +
|
||||
lexical_cast<std::string>(side_num + 1), gui::OK_CANCEL,
|
||||
&choices, &preview_panes);
|
||||
|
|
|
@ -67,7 +67,7 @@ struct advanced_preferences_sorter
|
|||
class preferences_parent_dialog : public gui::dialog
|
||||
{
|
||||
public:
|
||||
preferences_parent_dialog(display &disp) : dialog(disp, _("Preferences"),"",gui::CLOSE_ONLY),
|
||||
preferences_parent_dialog(display &disp) : dialog(disp.video(), _("Preferences"),"",gui::CLOSE_ONLY),
|
||||
clear_buttons_(false) {}
|
||||
~preferences_parent_dialog() {write_preferences();}
|
||||
void action(gui::dialog_process_info &info)
|
||||
|
|
|
@ -341,7 +341,7 @@ void command_executor::show_menu(const std::vector<std::string>& items_arg, int
|
|||
std::vector<std::string> menu = get_menu_images(gui, items);
|
||||
int res = 0;
|
||||
{
|
||||
gui::dialog mmenu = gui::dialog(gui,"","",
|
||||
gui::dialog mmenu = gui::dialog(gui.video(),"","",
|
||||
gui::MESSAGE, gui::dialog::hotkeys_style);
|
||||
mmenu.set_menu(menu);
|
||||
res = mmenu.show(xloc, yloc);
|
||||
|
|
|
@ -164,7 +164,7 @@ public:
|
|||
|
||||
hotkey_preferences_parent_dialog(display &disp,
|
||||
hotkey_preferences_dialog& hotkey_preferences_dialog) :
|
||||
dialog(disp, _("Hotkey Settings"), "", gui::OK_CANCEL),
|
||||
dialog(disp.video(), _("Hotkey Settings"), "", gui::OK_CANCEL),
|
||||
clear_buttons_(false),
|
||||
hotkey_cfg_(),
|
||||
resetter_(disp, hotkey_preferences_dialog) {
|
||||
|
|
|
@ -29,7 +29,7 @@ public:
|
|||
leader_scroll_dialog(display &disp, const std::string &title,
|
||||
std::vector<bool> &leader_bools, int selected,
|
||||
gui::DIALOG_RESULT extra_result) :
|
||||
dialog(disp, title, "", gui::NULL_DIALOG),
|
||||
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)
|
||||
|
|
|
@ -173,7 +173,7 @@ public:
|
|||
leader_scroll_dialog(display &disp, const std::string &title,
|
||||
std::vector<bool> &leader_bools, int selected,
|
||||
gui::DIALOG_RESULT extra_result) :
|
||||
dialog(disp, title, "", gui::NULL_DIALOG),
|
||||
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)
|
||||
|
@ -2809,7 +2809,7 @@ void console_handler::do_layers() {
|
|||
// NOTE using ", " also allows better word wrapping
|
||||
info << "Flags :" << utils::join(flags, ", ");
|
||||
{
|
||||
gui::dialog menu(*menu_handler_.gui_, _("Layers"), info.str(), gui::OK_CANCEL);
|
||||
gui::dialog menu(menu_handler_.gui_->video(), _("Layers"), info.str(), gui::OK_CANCEL);
|
||||
menu.set_menu(layers);
|
||||
menu.show();
|
||||
}
|
||||
|
|
|
@ -79,7 +79,7 @@ dialog_manager::~dialog_manager()
|
|||
SDL_PushEvent(&pb_event);
|
||||
}
|
||||
|
||||
dialog_frame::dialog_frame(CVideo &video, const std::string& title,
|
||||
dialog_frame::dialog_frame(CVideo& video, const std::string& title,
|
||||
const style& style, bool auto_restore,
|
||||
std::vector<button*>* buttons, button* help_button) :
|
||||
title_(title),
|
||||
|
@ -456,7 +456,7 @@ private:
|
|||
namespace gui
|
||||
{
|
||||
|
||||
int show_dialog(display& screen, surface image,
|
||||
int show_dialog(CVideo& video, surface image,
|
||||
const std::string& caption, const std::string& message,
|
||||
DIALOG_TYPE type,
|
||||
const std::vector<std::string>* menu_items,
|
||||
|
@ -475,16 +475,15 @@ int show_dialog(display& screen, surface image,
|
|||
std::string title;
|
||||
if (image.null()) title = caption;
|
||||
const dialog::style& style = (dialog_style)? *dialog_style : dialog::default_style;
|
||||
CVideo &disp = screen.video();
|
||||
|
||||
gui::dialog d(screen, title, message, type, style);
|
||||
gui::dialog d(video, title, message, type, style);
|
||||
|
||||
//add the components
|
||||
if(!image.null()) {
|
||||
d.set_image(image, caption);
|
||||
}
|
||||
if(menu_items) {
|
||||
d.set_menu( new gui::menu(disp,*menu_items,type == MESSAGE,-1,dialog::max_menu_width,sorter,menu_style,false));
|
||||
d.set_menu( new gui::menu(video,*menu_items,type == MESSAGE,-1,dialog::max_menu_width,sorter,menu_style,false));
|
||||
}
|
||||
if(preview_panes) {
|
||||
for(unsigned int i=0; i < preview_panes->size(); ++i) {
|
||||
|
|
|
@ -186,7 +186,7 @@ public:
|
|||
//if a menu is given, then returns -1 if the dialog was canceled, and the
|
||||
//index of the selection otherwise. If no menu is given, returns the index
|
||||
//of the button that was pressed
|
||||
int show_dialog(display &screen, surface image,
|
||||
int show_dialog(CVideo& video, surface image,
|
||||
const std::string& caption, const std::string& message,
|
||||
DIALOG_TYPE type=MESSAGE,
|
||||
const std::vector<std::string>* menu_items=NULL,
|
||||
|
|
|
@ -149,7 +149,7 @@ void statistics_dialog::action(gui::dialog_process_info &dp_info)
|
|||
break;
|
||||
}
|
||||
if (items_sub.empty() == false) {
|
||||
gui::dialog d(get_display(), title + " (" + player_name_ + ")", "", gui::CLOSE_ONLY);
|
||||
gui::dialog d(CVideo::get_singleton(), title + " (" + player_name_ + ")", "", gui::CLOSE_ONLY);
|
||||
d.set_menu(items_sub);
|
||||
d.show();
|
||||
dp_info.clear_buttons();
|
||||
|
@ -163,7 +163,7 @@ statistics_dialog::statistics_dialog(game_display &disp,
|
|||
const unsigned int team,
|
||||
const std::string& team_id,
|
||||
const std::string& player) :
|
||||
dialog(disp, title, "", gui::NULL_DIALOG),
|
||||
dialog(disp.video(), title, "", gui::NULL_DIALOG),
|
||||
detail_btn_(new gui::standard_dialog_button(disp.video(), _("Details"), 0 , false)),
|
||||
toggle_btn_(new gui::dialog_button(disp.video(), "", gui::button::TYPE_PRESS, BUTTON_TOGGLE)),
|
||||
scene_btn_(new gui::dialog_button(disp.video(), _("Select Scenario"), gui::button::TYPE_PRESS, BUTTON_SCENE)),
|
||||
|
@ -317,7 +317,7 @@ void statistics_dialog::do_scene_selection()
|
|||
|
||||
// Let the player choose a scenario.
|
||||
SDL_Rect const &loc = scene_btn_->location();
|
||||
size_t new_scenario = gui::show_dialog(get_display(), NULL, "", "",
|
||||
size_t new_scenario = gui::show_dialog(CVideo::get_singleton(), NULL, "", "",
|
||||
gui::MESSAGE, &names, NULL, "", NULL,
|
||||
-1, NULL, loc.x, loc.y + loc.h);
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ void combo::set_selected(int val)
|
|||
void combo::make_drop_down_menu()
|
||||
{
|
||||
SDL_Rect const &loc = location();
|
||||
set_selected_internal(gui::show_dialog(*disp_, NULL, "", "", gui::MESSAGE, &items_,
|
||||
set_selected_internal(gui::show_dialog(disp_->video(), NULL, "", "", gui::MESSAGE, &items_,
|
||||
NULL, "", NULL, -1, NULL, loc.x, loc.y + loc.h));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue