The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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:
Inheritance graph

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 &)
 
const quit_confirmationoperator= (const quit_confirmation &)
 

Private Attributes

std::function< bool()> prompt_
 

Static Private Attributes

static std::vector
< quit_confirmation * > 
blockers_ = std::vector<quit_confirmation*>()
 
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 31 of file quit_confirmation.hpp.

Constructor & Destructor Documentation

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

Definition at line 34 of file quit_confirmation.hpp.

References blockers_.

quit_confirmation::~quit_confirmation ( )
inline

Definition at line 37 of file quit_confirmation.hpp.

References blockers_.

quit_confirmation::quit_confirmation ( const quit_confirmation )
private

Member Function Documentation

bool quit_confirmation::default_prompt ( )
static

Definition at line 60 of file quit_confirmation.cpp.

References _(), and show_prompt().

const quit_confirmation& quit_confirmation::operator= ( const quit_confirmation )
private
bool quit_confirmation::quit ( )
static

Shows the quit confirmation if needed.

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

Definition at line 27 of file quit_confirmation.cpp.

References blockers_, and open_.

Referenced by editor::editor_controller::execute_command(), playmp_controller::linger(), quit_to_desktop(), and quit_to_title().

void quit_confirmation::quit_to_desktop ( )
static
void quit_confirmation::quit_to_title ( )
static
bool quit_confirmation::show_prompt ( const std::string message)
static

Member Data Documentation

std::vector< quit_confirmation * > quit_confirmation::blockers_ = std::vector<quit_confirmation*>()
staticprivate

Definition at line 56 of file quit_confirmation.hpp.

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

bool quit_confirmation::open_ = false
staticprivate

Definition at line 57 of file quit_confirmation.hpp.

Referenced by quit().

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

Definition at line 59 of file quit_confirmation.hpp.


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