The Battle for Wesnoth  1.15.12+dev
Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
gui2::dialogs::loading_screen Class Reference

#include <loading_screen.hpp>

Inheritance diagram for gui2::dialogs::loading_screen:

Public Member Functions

 loading_screen (std::function< void()> f)
 
 ~loading_screen ()
 
- Public Member Functions inherited from gui2::dialogs::modal_dialog
 modal_dialog ()
 
virtual ~modal_dialog ()
 
bool show (const unsigned auto_close_time=0)
 Shows the window. More...
 
windowget_window () const
 Returns a pointer to the dialog's window. More...
 
int get_retval () const
 Returns the cached window exit code. More...
 
void set_retval (int retval)
 Convenience wrapper to set the window's exit code. More...
 
void set_always_save_fields (const bool always_save_fields)
 
void set_restore (const bool restore)
 
void set_allow_plugin_skip (const bool allow_plugin_skip)
 
void set_show_even_without_video (const bool show_even_without_video)
 
- Public Member Functions inherited from events::pump_monitor
 pump_monitor ()
 
virtual ~pump_monitor ()
 

Static Public Member Functions

static void display (std::function< void()> f)
 
static bool displaying ()
 
static void progress (loading_stage stage=loading_stage::none)
 

Private Types

using stage_map = std::map< loading_stage, t_string >
 

Private Member Functions

virtual const std::string & window_id () const override
 The id of the window to build. More...
 
virtual void pre_show (window &window) override
 Actions to be taken before showing the window. More...
 
virtual void post_show (window &window) override
 Actions to be taken after the window has been shown. More...
 
virtual void process (events::pump_info &) override
 Inherited from events::pump_monitor. More...
 
void draw_callback ()
 Callback to handle drawing the progress animation. More...
 

Private Attributes

std::function< void()> load_func_
 
std::future< void > worker_result_
 
std::unique_ptr< cursor::settercursor_setter_
 
labelprogress_stage_label_
 
drawinganimation_
 
std::optional< decltype(std::chrono::steady_clock::now())> animation_start_
 
std::atomic< loading_stagecurrent_stage_
 
stage_map visible_stages_
 
stage_map::const_iterator current_visible_stage_
 

Static Private Attributes

static loading_screensingleton_ = nullptr
 

Additional Inherited Members

- Protected Member Functions inherited from gui2::dialogs::modal_dialog
field_boolregister_bool (const std::string &id, const bool mandatory, const std::function< bool()> callback_load_value=nullptr, const std::function< void(bool)> callback_save_value=nullptr, const std::function< void(widget &)> callback_change=nullptr, const bool initial_fire=false)
 Creates a new boolean field. More...
 
field_boolregister_bool (const std::string &id, const bool mandatory, bool &linked_variable, const std::function< void(widget &)> callback_change=nullptr, const bool initial_fire=false)
 Creates a new boolean field. More...
 
field_integerregister_integer (const std::string &id, const bool mandatory, const std::function< int()> callback_load_value=nullptr, const std::function< void(int)> callback_save_value=nullptr)
 Creates a new integer field. More...
 
field_integerregister_integer (const std::string &id, const bool mandatory, int &linked_variable)
 Creates a new integer field. More...
 
field_textregister_text (const std::string &id, const bool mandatory, const std::function< std::string()> callback_load_value=nullptr, const std::function< void(const std::string &)> callback_save_value=nullptr, const bool capture_focus=false)
 Creates a new text field. More...
 
field_textregister_text (const std::string &id, const bool mandatory, std::string &linked_variable, const bool capture_focus=false)
 Creates a new text field. More...
 
field_labelregister_label (const std::string &id, const bool mandatory, const std::string &text, const bool use_markup=false)
 Registers a new styled_widget as a label. More...
 
field_labelregister_image (const std::string &id, const bool mandatory, const std::string &filename)
 Registers a new styled_widget as image. More...
 
- Protected Attributes inherited from gui2::dialogs::modal_dialog
std::unique_ptr< windowwindow_
 The window object build for this dialog. More...
 

Detailed Description

Definition at line 74 of file loading_screen.hpp.

Member Typedef Documentation

◆ stage_map

Definition at line 112 of file loading_screen.hpp.

Constructor & Destructor Documentation

◆ loading_screen()

gui2::dialogs::loading_screen::loading_screen ( std::function< void()>  f)

Definition at line 74 of file loading_screen.cpp.

References current_visible_stage_, none, singleton_, stage_names, and visible_stages_.

Referenced by display().

◆ ~loading_screen()

gui2::dialogs::loading_screen::~loading_screen ( )

Definition at line 172 of file loading_screen.cpp.

References singleton_, and worker_result_.

Member Function Documentation

◆ display()

void gui2::dialogs::loading_screen::display ( std::function< void()>  f)
static

◆ displaying()

static bool gui2::dialogs::loading_screen::displaying ( )
inlinestatic

Definition at line 82 of file loading_screen.hpp.

References none, and tooltips::process().

Referenced by display::handle_event().

◆ draw_callback()

void gui2::dialogs::loading_screen::draw_callback ( )
private

◆ post_show()

void gui2::dialogs::loading_screen::post_show ( window window)
overrideprivatevirtual

Actions to be taken after the window has been shown.

At this point the registered fields already stored their values (if the OK has been pressed).

Parameters
windowThe window which has been shown.

Reimplemented from gui2::dialogs::modal_dialog.

Definition at line 118 of file loading_screen.cpp.

References cursor_setter_.

◆ pre_show()

void gui2::dialogs::loading_screen::pre_show ( window window)
overrideprivatevirtual

Actions to be taken before showing the window.

At this point the registered fields are registered and initialized with their initial values.

Parameters
windowThe window to be shown.

Reimplemented from gui2::dialogs::modal_dialog.

Definition at line 93 of file loading_screen.cpp.

References animation_, gui2::event::dispatcher::connect_signal(), cursor_setter_, gui2::event::DRAW, draw_callback(), e, ERR_LS, gui2::event::dispatcher::front_child, load_func_, progress_stage_label_, gui2::window::set_enter_disabled(), gui2::window::set_escape_disabled(), cursor::WAIT, and worker_result_.

◆ process()

void gui2::dialogs::loading_screen::process ( events::pump_info )
overrideprivatevirtual

◆ progress()

void gui2::dialogs::loading_screen::progress ( loading_stage  stage = loading_stage::none)
static

◆ window_id()

virtual const std::string& gui2::dialogs::loading_screen::window_id ( ) const
overrideprivatevirtual

The id of the window to build.

Implements gui2::dialogs::modal_dialog.

Member Data Documentation

◆ animation_

drawing* gui2::dialogs::loading_screen::animation_
private

Definition at line 106 of file loading_screen.hpp.

Referenced by draw_callback(), and pre_show().

◆ animation_start_

std::optional<decltype(std::chrono::steady_clock::now())> gui2::dialogs::loading_screen::animation_start_
private

Definition at line 108 of file loading_screen.hpp.

Referenced by draw_callback().

◆ current_stage_

std::atomic<loading_stage> gui2::dialogs::loading_screen::current_stage_
private

Definition at line 110 of file loading_screen.hpp.

Referenced by draw_callback(), and progress().

◆ current_visible_stage_

stage_map::const_iterator gui2::dialogs::loading_screen::current_visible_stage_
private

Definition at line 114 of file loading_screen.hpp.

Referenced by draw_callback(), and loading_screen().

◆ cursor_setter_

std::unique_ptr<cursor::setter> gui2::dialogs::loading_screen::cursor_setter_
private

Definition at line 103 of file loading_screen.hpp.

Referenced by post_show(), and pre_show().

◆ load_func_

std::function<void()> gui2::dialogs::loading_screen::load_func_
private

Definition at line 101 of file loading_screen.hpp.

Referenced by pre_show(), and process().

◆ progress_stage_label_

label* gui2::dialogs::loading_screen::progress_stage_label_
private

Definition at line 105 of file loading_screen.hpp.

Referenced by draw_callback(), and pre_show().

◆ singleton_

loading_screen * gui2::dialogs::loading_screen::singleton_ = nullptr
staticprivate

Definition at line 99 of file loading_screen.hpp.

Referenced by display(), loading_screen(), progress(), and ~loading_screen().

◆ visible_stages_

stage_map gui2::dialogs::loading_screen::visible_stages_
private

Definition at line 113 of file loading_screen.hpp.

Referenced by draw_callback(), and loading_screen().

◆ worker_result_

std::future<void> gui2::dialogs::loading_screen::worker_result_
private

Definition at line 102 of file loading_screen.hpp.

Referenced by pre_show(), process(), and ~loading_screen().


The documentation for this class was generated from the following files: