gui/dialogs/popup.cpp

Go to the documentation of this file.
00001 /* $Id: popup.cpp 52869 2012-02-03 20:18:33Z shadowmaster $ */
00002 /*
00003    Copyright (C) 2011 - 2012 by Mark de Wever <koraq@xs4all.nl>
00004    Part of the Battle for Wesnoth Project http://www.wesnoth.org/
00005 
00006    This program is free software; you can redistribute it and/or modify
00007    it under the terms of the GNU General Public License as published by
00008    the Free Software Foundation; either version 2 of the License, or
00009    (at your option) any later version.
00010    This program is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY.
00012 
00013    See the COPYING file for more details.
00014 */
00015 
00016 #define GETTEXT_DOMAIN "wesnoth-lib"
00017 
00018 #include "gui/dialogs/popup.hpp"
00019 
00020 #include "gui/widgets/window.hpp"
00021 #include "video.hpp"
00022 
00023 namespace gui2 {
00024 
00025 tpopup::tpopup()
00026     : window_(NULL)
00027 {
00028 }
00029 
00030 tpopup::~tpopup()
00031 {
00032     hide();
00033 }
00034 
00035 void tpopup::show(CVideo& video
00036         , const bool allow_interaction
00037         , const unsigned /*auto_close_time*/)
00038 {
00039     if(video.faked()) {
00040         return;
00041     }
00042 
00043     hide();
00044 
00045     window_ = build_window(video);
00046 
00047     post_build(video, *window_);
00048 
00049     pre_show(video, *window_);
00050 
00051     if(allow_interaction) {
00052         window_->show_non_modal();
00053     } else {
00054         window_->show_tooltip(/*auto_close_time*/);
00055     }
00056 }
00057 
00058 void tpopup::hide()
00059 {
00060     if(window_) {
00061         window_->undraw();
00062         delete window_;
00063         window_ = NULL;
00064     }
00065 }
00066 
00067 twindow* tpopup::build_window(CVideo& video) const
00068 {
00069     return build(video, window_id());
00070 }
00071 
00072 } // namespace gui2
00073 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated by doxygen 1.7.1 on Fri May 25 2012 01:02:58 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs