The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
gui2::tpopup Class Referenceabstract

The popup class shows windows that are shown non-modal. More...

#include <popup.hpp>

Inheritance diagram for gui2::tpopup:
Inheritance graph

Public Member Functions

 tpopup ()
 
virtual ~tpopup ()
 
void show (CVideo &video, const bool allow_interaction=false, const unsigned auto_close_time=0)
 Shows the window. More...
 
void hide ()
 Hides the window. More...
 

Private Member Functions

virtual const std::stringwindow_id () const =0
 The id of the window to build. More...
 
twindowbuild_window (CVideo &video) const
 Builds the window. More...
 
virtual void post_build (twindow &window)
 Actions to be taken directly after the window is build. More...
 
virtual void pre_show (twindow &window)
 Actions to be taken before showing the window. More...
 

Private Attributes

twindowwindow_
 The window, used in show. More...
 

Friends

std::string unit_test_mark_popup_as_tested (const tpopup &dialog)
 Special helper function to get the id of the window. More...
 
twindowunit_test_window (const tpopup &dialog)
 Special helper function for the unit test to the the window. More...
 

Detailed Description

The popup class shows windows that are shown non-modal.

At the moment these windows also don't capture the mouse and keyboard so can only be used for things like tooltips. This behavior might change later.

Definition at line 33 of file popup.hpp.

Constructor & Destructor Documentation

gui2::tpopup::tpopup ( )

Definition at line 25 of file popup.cpp.

gui2::tpopup::~tpopup ( )
virtual

Definition at line 29 of file popup.cpp.

References hide().

Member Function Documentation

twindow * gui2::tpopup::build_window ( CVideo video) const
private

Builds the window.

Every dialog shows it's own kind of window, this function should return the window to show.

Parameters
videoThe video which contains the surface to draw upon.
Returns
The window to show.

Definition at line 66 of file popup.cpp.

References gui2::build(), and window_id().

Referenced by show().

void gui2::tpopup::hide ( )

Hides the window.

The hiding also destroys the window. It is save to call the function when the window is not shown.

Definition at line 57 of file popup.cpp.

References gui2::twindow::undraw(), and window_.

Referenced by gui2::tip::remove(), show(), and ~tpopup().

void gui2::tpopup::post_build ( twindow window)
privatevirtual

Actions to be taken directly after the window is build.

Parameters
videoThe video which contains the surface to draw upon.
windowThe window just created.

Definition at line 71 of file popup.cpp.

Referenced by show().

void gui2::tpopup::pre_show ( twindow window)
privatevirtual

Actions to be taken before showing the window.

Parameters
videoThe video which contains the surface to draw upon.
windowThe window to be shown.

Reimplemented in gui2::tdebug_clock, and gui2::ttip.

Definition at line 76 of file popup.cpp.

Referenced by show().

void gui2::tpopup::show ( CVideo video,
const bool  allow_interaction = false,
const unsigned  auto_close_time = 0 
)

Shows the window.

Parameters
videoThe video which contains the surface to draw upon.
allow_interactionDoes the dialog allow interaction?
  • true a non modal window is shown
  • false a tooltip window is shown
auto_close_timeThe time in ms after which the dialog will automatically close, if 0 it doesn't close.
Note
the timeout is a minimum time and there's no guarantee about how fast it closes after the minimum.

Definition at line 34 of file popup.cpp.

References build_window(), CVideo::faked(), hide(), post_build(), pre_show(), gui2::twindow::show_non_modal(), gui2::twindow::show_tooltip(), and window_.

Referenced by gui2::ttitle_screen::show_debug_clock_window().

virtual const std::string& gui2::tpopup::window_id ( ) const
privatepure virtual

The id of the window to build.

Implemented in gui2::tdebug_clock, and gui2::ttip.

Referenced by build_window(), and gui2::unit_test_mark_popup_as_tested().

Friends And Related Function Documentation

std::string unit_test_mark_popup_as_tested ( const tpopup dialog)
friend

Special helper function to get the id of the window.

This is used in the unit tests, but these implementation details shouldn't be used in the normal code.

Definition at line 116 of file test_gui2.cpp.

twindow* unit_test_window ( const tpopup dialog)
friend

Special helper function for the unit test to the the window.

This is used in the unit tests, but these implementation details shouldn't be used in the normal code.

Definition at line 125 of file test_gui2.cpp.

Member Data Documentation

twindow* gui2::tpopup::window_
private

The window, used in show.

Definition at line 85 of file popup.hpp.

Referenced by hide(), show(), and gui2::unit_test_window().


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