diff --git a/po/wesnoth-lib/POTFILES.in b/po/wesnoth-lib/POTFILES.in index 41fe8e98740..d871d62d1eb 100644 --- a/po/wesnoth-lib/POTFILES.in +++ b/po/wesnoth-lib/POTFILES.in @@ -30,6 +30,7 @@ src/gui/auxiliary/widget_definition/toggle_button.cpp src/gui/auxiliary/widget_definition/toggle_panel.cpp src/gui/auxiliary/widget_definition/tooltip.cpp src/gui/auxiliary/widget_definition/vertical_scrollbar.cpp +src/gui/auxiliary/widget_definition/window.cpp src/gui/auxiliary/window_builder/button.cpp src/gui/auxiliary/window_builder/control.cpp src/gui/auxiliary/window_builder.cpp diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 98a685e2fe1..13bba4c212f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -246,6 +246,7 @@ set(wesnoth-main_SRC gui/auxiliary/widget_definition/toggle_panel.cpp gui/auxiliary/widget_definition/tooltip.cpp gui/auxiliary/widget_definition/vertical_scrollbar.cpp + gui/auxiliary/widget_definition/window.cpp gui/auxiliary/window_builder/button.cpp gui/auxiliary/window_builder/control.cpp gui/auxiliary/window_builder/helper.cpp diff --git a/src/Makefile.am b/src/Makefile.am index 19b9648bc78..9f4945cb1b0 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -126,6 +126,7 @@ wesnoth_source = \ gui/auxiliary/widget_definition/toggle_panel.cpp \ gui/auxiliary/widget_definition/tooltip.cpp \ gui/auxiliary/widget_definition/vertical_scrollbar.cpp \ + gui/auxiliary/widget_definition/window.cpp \ gui/auxiliary/window_builder/button.cpp \ gui/auxiliary/window_builder/control.cpp \ gui/auxiliary/window_builder/helper.cpp \ diff --git a/src/SConscript b/src/SConscript index 12dfce550b0..a8379a586f3 100644 --- a/src/SConscript +++ b/src/SConscript @@ -286,6 +286,7 @@ wesnoth_sources = Split(""" gui/auxiliary/widget_definition/toggle_button.cpp gui/auxiliary/widget_definition/toggle_panel.cpp gui/auxiliary/widget_definition/tooltip.cpp + gui/auxiliary/widget_definition/window.cpp gui/auxiliary/window_builder/button.cpp gui/auxiliary/window_builder/control.cpp gui/auxiliary/window_builder/helper.cpp diff --git a/src/gui/auxiliary/widget_definition/window.cpp b/src/gui/auxiliary/widget_definition/window.cpp new file mode 100644 index 00000000000..c68c2c1201b --- /dev/null +++ b/src/gui/auxiliary/widget_definition/window.cpp @@ -0,0 +1,56 @@ +/* $Id$ */ +/* + Copyright (C) 2007 - 2010 by Mark de Wever + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 + or at your option any later version. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY. + + See the COPYING file for more details. +*/ + +#define GETTEXT_DOMAIN "wesnoth-lib" + +#include "gui/auxiliary/widget_definition/window.hpp" + +#include "gui/auxiliary/log.hpp" + +namespace gui2 { + +twindow_definition::twindow_definition(const config& cfg) + : tcontrol_definition(cfg) +{ +/*WIKI + * @page = GUIWidgetDefinitionWML + * @order = 1_window + * + * == Window == + * + * The definition of a window. A window is a kind of panel see the panel for + * which fields exist + * + */ + + DBG_GUI_P << "Parsing window " << id << '\n'; + + load_resolutions(cfg); +} + +twindow_definition::tresolution::tresolution(const config& cfg) + : tpanel_definition::tresolution(cfg) + , grid(NULL) +{ + const config &child = cfg.child("grid"); +// VALIDATE(child, _("No grid defined.")); + + /** @todo Evaluate whether the grid should become mandatory. */ + if(child) { + grid = new tbuilder_grid(child); + } +} + +} // namespace gui2 + diff --git a/src/gui/auxiliary/widget_definition/window.hpp b/src/gui/auxiliary/widget_definition/window.hpp new file mode 100644 index 00000000000..132721268f2 --- /dev/null +++ b/src/gui/auxiliary/widget_definition/window.hpp @@ -0,0 +1,40 @@ +/* $Id$ */ +/* + Copyright (C) 2007 - 2010 by Mark de Wever + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 + or at your option any later version. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY. + + See the COPYING file for more details. +*/ + +#ifndef GUI_AUXILIARY_WIDGET_DEFINITION_WINDOW_HPP_INCLUDED +#define GUI_AUXILIARY_WIDGET_DEFINITION_WINDOW_HPP_INCLUDED + +#include "gui/auxiliary/widget_definition/panel.hpp" +#include "gui/auxiliary/window_builder.hpp" + +namespace gui2 { + +struct twindow_definition + : public tcontrol_definition +{ + explicit twindow_definition(const config& cfg); + + struct tresolution + : public tpanel_definition::tresolution + { + explicit tresolution(const config& cfg); + + tbuilder_grid_ptr grid; + }; +}; + +} // namespace gui2 + +#endif + diff --git a/src/gui/widgets/settings.cpp b/src/gui/widgets/settings.cpp index 7a227e40fd3..2e1c04bfdaa 100644 --- a/src/gui/widgets/settings.cpp +++ b/src/gui/widgets/settings.cpp @@ -460,38 +460,6 @@ tstate_definition::tstate_definition(const config &cfg) : canvas.set_cfg(draw); } -twindow_definition::twindow_definition(const config& cfg) : - tcontrol_definition(cfg) -{ -/*WIKI - * @page = GUIWidgetDefinitionWML - * @order = 1_window - * - * == Window == - * - * The definition of a window. A window is a kind of panel see the panel for - * which fields exist - * - */ - - DBG_GUI_P << "Parsing window " << id << '\n'; - - load_resolutions(cfg); -} - -twindow_definition::tresolution::tresolution(const config& cfg) - : tpanel_definition::tresolution(cfg) - , grid(NULL) -{ - const config &child = cfg.child("grid"); -// VALIDATE(child, _("No grid defined.")); - - /** @todo Evaluate whether the grid should become mandatory. */ - if(child) { - grid = new tbuilder_grid(child); - } -} - tresolution_definition_ptr get_control( const std::string& control_type, const std::string& definition) { diff --git a/src/gui/widgets/settings.hpp b/src/gui/widgets/settings.hpp index 58b34d44026..feb0f3b35e7 100644 --- a/src/gui/widgets/settings.hpp +++ b/src/gui/widgets/settings.hpp @@ -22,7 +22,7 @@ #include "gui/auxiliary/formula.hpp" #include "gui/auxiliary/widget_definition.hpp" -#include "gui/auxiliary/widget_definition/panel.hpp" +#include "gui/auxiliary/widget_definition/window.hpp" #include "gui/auxiliary/window_builder.hpp" #include "tstring.hpp" @@ -86,20 +86,6 @@ enum twindow_type { const std::string& get_id(const twindow_type window_type); -struct twindow_definition - : public tcontrol_definition -{ - twindow_definition(const config& cfg); - - struct tresolution - : public tpanel_definition::tresolution - { - tresolution(const config& cfg); - - tbuilder_grid_ptr grid; - }; -}; - struct tgui_definition { tgui_definition()