The Battle for Wesnoth  1.19.0-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 29 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)

Definition at line 32 of file quit_confirmation.hpp.

References blockers_.

◆ ~quit_confirmation()

quit_confirmation::~quit_confirmation ( )

Definition at line 35 of file quit_confirmation.hpp.

References blockers_.

◆ quit_confirmation() [2/2]

quit_confirmation::quit_confirmation ( const quit_confirmation )

Member Function Documentation

◆ default_prompt()

bool quit_confirmation::default_prompt ( )

◆ operator=()

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

◆ quit()

bool quit_confirmation::quit ( )

Shows the quit confirmation if needed.

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(), playmp_controller::linger(), quit_to_desktop(), and quit_to_title().

◆ quit_to_desktop()

void quit_confirmation::quit_to_desktop ( )

◆ quit_to_title()

void quit_confirmation::quit_to_title ( )

◆ show_prompt()

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

Member Data Documentation

◆ blockers_

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

Definition at line 55 of file quit_confirmation.hpp.

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

◆ open_

bool quit_confirmation::open_ = false

Definition at line 56 of file quit_confirmation.hpp.

Referenced by quit().

◆ prompt_

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

Definition at line 58 of file quit_confirmation.hpp.

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