00001 /* $Id: progress_bar.cpp 52533 2012-01-07 02:35:17Z shadowmaster $ */ 00002 /* 00003 Copyright (C) 2010 - 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/widgets/progress_bar.hpp" 00019 00020 #include "gui/auxiliary/widget_definition/progress_bar.hpp" 00021 #include "gui/auxiliary/window_builder/progress_bar.hpp" 00022 #include "gui/auxiliary/log.hpp" 00023 #include "gui/widgets/settings.hpp" 00024 00025 #include <boost/bind.hpp> 00026 00027 #define LOG_SCOPE_HEADER get_control_type() + " [" + id() + "] " + __func__ 00028 #define LOG_HEADER LOG_SCOPE_HEADER + ':' 00029 00030 namespace gui2 { 00031 00032 REGISTER_WIDGET(progress_bar) 00033 00034 void tprogress_bar::set_percentage(const unsigned percentage) 00035 { 00036 assert(percentage <= 100); 00037 00038 if(percentage_ != percentage) { 00039 percentage_ = percentage; 00040 00041 foreach(tcanvas& c, canvas()) { 00042 c.set_variable("percentage", variant(percentage)); 00043 } 00044 00045 set_dirty(); 00046 } 00047 } 00048 00049 const std::string& tprogress_bar::get_control_type() const 00050 { 00051 static const std::string type = "progress_bar"; 00052 return type; 00053 } 00054 00055 } // namespace gui2 00056
| Generated by doxygen 1.7.1 on Fri May 25 2012 01:02:55 for The Battle for Wesnoth | Gna! | Forum | Wiki | CIA | devdocs |