The Battle for Wesnoth  1.15.2+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:
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 &)=delete
 
const quit_confirmationoperator= (const quit_confirmation &)=delete
 

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() [1/2]

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_.

Referenced by ~quit_confirmation().

◆ ~quit_confirmation()

quit_confirmation::~quit_confirmation ( )
inline

◆ 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

Referenced by ~quit_confirmation().

◆ quit()

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 30 of file quit_confirmation.cpp.

References blockers_, open_, and reverse().

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

◆ 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_ = std::vector<quit_confirmation*>()
staticprivate

Definition at line 56 of file quit_confirmation.hpp.

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

◆ open_

bool quit_confirmation::open_ = false
staticprivate

Definition at line 57 of file quit_confirmation.hpp.

Referenced by quit().

◆ prompt_

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: