The Battle for Wesnoth  1.19.5+dev
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
quit_confirmation Class Reference

Implements a quit confirmation dialog. More...

#include <quit_confirmation.hpp>

Inheritance diagram for quit_confirmation:

Public Member Functions

 quit_confirmation (const std::function< bool()> &prompt=&quit_confirmation::default_prompt)
 
 ~quit_confirmation ()
 

Static Public Member Functions

static bool quit ()
 Shows the quit confirmation if needed. More...
 
static void quit_to_title ()
 
static void quit_to_desktop ()
 
static bool show_prompt (const std::string &message)
 
static bool default_prompt ()
 

Private Member Functions

 quit_confirmation (const quit_confirmation &)=delete
 
const quit_confirmationoperator= (const quit_confirmation &)=delete
 

Private Attributes

std::function< bool()> prompt_
 

Static Private Attributes

static std::vector< quit_confirmation * > blockers_ {}
 
static bool open_ = false
 

Detailed Description

Implements a quit confirmation dialog.

Any object of this type will prevent the game from quitting immediately. Instead, a confirmation dialog will pop up when attempting to close.

Definition at line 28 of file quit_confirmation.hpp.

Constructor & Destructor Documentation

◆ quit_confirmation() [1/2]

quit_confirmation::quit_confirmation ( const std::function< bool()> &  prompt = &quit_confirmation::default_prompt)
inlineexplicit

Definition at line 31 of file quit_confirmation.hpp.

References blockers_.

◆ ~quit_confirmation()

quit_confirmation::~quit_confirmation ( )
inline

Definition at line 34 of file quit_confirmation.hpp.

References blockers_.

◆ quit_confirmation() [2/2]

quit_confirmation::quit_confirmation ( const quit_confirmation )
privatedelete

Member Function Documentation

◆ default_prompt()

bool quit_confirmation::default_prompt ( )
static

◆ operator=()

const quit_confirmation& quit_confirmation::operator= ( const quit_confirmation )
privatedelete

◆ quit()

bool quit_confirmation::quit ( )
static

Shows the quit confirmation if needed.

Exceptions
video::quitIf the user chooses to quit or no prompt was displayed.

Definition at line 26 of file quit_confirmation.cpp.

References blockers_, open_, and utils::reversed_view().

Referenced by editor::editor_controller::do_execute_command(), gui2::dialogs::mp_lobby::exit_hook(), quit_to_desktop(), and quit_to_title().

◆ quit_to_desktop()

void quit_confirmation::quit_to_desktop ( )
static

◆ quit_to_title()

void quit_confirmation::quit_to_title ( )
static

◆ show_prompt()

bool quit_confirmation::show_prompt ( const std::string &  message)
static

Member Data Documentation

◆ blockers_

std::vector<quit_confirmation*> quit_confirmation::blockers_ {}
inlinestaticprivate

Definition at line 54 of file quit_confirmation.hpp.

Referenced by quit(), quit_confirmation(), and ~quit_confirmation().

◆ open_

bool quit_confirmation::open_ = false
inlinestaticprivate

Definition at line 55 of file quit_confirmation.hpp.

Referenced by quit().

◆ prompt_

std::function<bool()> quit_confirmation::prompt_
private

Definition at line 57 of file quit_confirmation.hpp.


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