Author: mordante
Date: Wed Jun 24 21:56:47 2009
New Revision: 36393

URL: http://svn.gna.org/viewcvs/wesnoth?rev=36393&view=rev
Log:
Move gui2::tbuilder_toggle_panel to its own file.

Added:
    trunk/src/gui/auxiliary/window_builder/toggle_panel.cpp   (with props)
    trunk/src/gui/auxiliary/window_builder/toggle_panel.hpp   (with props)
Modified:
    trunk/po/wesnoth-lib/POTFILES.in
    trunk/src/CMakeLists.txt
    trunk/src/Makefile.am
    trunk/src/SConscript
    trunk/src/gui/auxiliary/window_builder.cpp
    trunk/src/gui/auxiliary/window_builder_private.hpp

Modified: trunk/po/wesnoth-lib/POTFILES.in
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/po/wesnoth-lib/POTFILES.in?rev=36393&r1=36392&r2=36393&view=diff
==============================================================================
--- trunk/po/wesnoth-lib/POTFILES.in (original)
+++ trunk/po/wesnoth-lib/POTFILES.in Wed Jun 24 21:56:47 2009
@@ -16,6 +16,7 @@
 src/gui/auxiliary/window_builder/text_box.cpp
 src/gui/auxiliary/window_builder/panel.cpp
 src/gui/auxiliary/window_builder/password_box.cpp
+src/gui/auxiliary/window_builder/toggle_panel.cpp
 src/gui/auxiliary/window_builder.cpp
 src/gui/dialogs/addon_connect.cpp
 src/gui/dialogs/addon_list.cpp

Modified: trunk/src/CMakeLists.txt
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/CMakeLists.txt?rev=36393&r1=36392&r2=36393&view=diff
==============================================================================
--- trunk/src/CMakeLists.txt (original)
+++ trunk/src/CMakeLists.txt Wed Jun 24 21:56:47 2009
@@ -273,6 +273,7 @@
     gui/auxiliary/window_builder/text_box.cpp
     gui/auxiliary/window_builder/panel.cpp
     gui/auxiliary/window_builder/password_box.cpp
+    gui/auxiliary/window_builder/toggle_panel.cpp
     gui/auxiliary/window_builder.cpp
     gui/dialogs/addon_connect.cpp
     gui/dialogs/addon_list.cpp

Modified: trunk/src/Makefile.am
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/Makefile.am?rev=36393&r1=36392&r2=36393&view=diff
==============================================================================
--- trunk/src/Makefile.am (original)
+++ trunk/src/Makefile.am Wed Jun 24 21:56:47 2009
@@ -98,6 +98,7 @@
        gui/auxiliary/window_builder/text_box.cpp \
        gui/auxiliary/window_builder/panel.cpp \
        gui/auxiliary/window_builder/password_box.cpp \
+       gui/auxiliary/window_builder/toggle_panel.cpp \
        gui/auxiliary/window_builder.cpp \
        gui/dialogs/addon_connect.cpp \
        gui/dialogs/addon_list.cpp \

Modified: trunk/src/SConscript
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/SConscript?rev=36393&r1=36392&r2=36393&view=diff
==============================================================================
--- trunk/src/SConscript (original)
+++ trunk/src/SConscript Wed Jun 24 21:56:47 2009
@@ -254,6 +254,7 @@
     gui/auxiliary/window_builder/text_box.cpp
     gui/auxiliary/window_builder/panel.cpp
     gui/auxiliary/window_builder/password_box.cpp
+    gui/auxiliary/window_builder/toggle_panel.cpp
     gui/auxiliary/window_builder.cpp
     gui/dialogs/addon_connect.cpp
     gui/dialogs/addon_list.cpp

Modified: trunk/src/gui/auxiliary/window_builder.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/auxiliary/window_builder.cpp?rev=36393&r1=36392&r2=36393&view=diff
==============================================================================
--- trunk/src/gui/auxiliary/window_builder.cpp (original)
+++ trunk/src/gui/auxiliary/window_builder.cpp Wed Jun 24 21:56:47 2009
@@ -29,6 +29,7 @@
 #include "gui/auxiliary/window_builder/text_box.hpp"
 #include "gui/auxiliary/window_builder/panel.hpp"
 #include "gui/auxiliary/window_builder/password_box.hpp"
+#include "gui/auxiliary/window_builder/toggle_panel.hpp"
 #include "gui/widgets/button.hpp"
 #include "gui/widgets/horizontal_scrollbar.hpp"
 #include "gui/widgets/image.hpp"
@@ -968,57 +969,6 @@
        return toggle_button;
 }
 
-tbuilder_toggle_panel::tbuilder_toggle_panel(const config& cfg) :
-       implementation::tbuilder_control(cfg),
-       grid(0),
-       retval_id_(cfg["return_value_id"]),
-       retval_(lexical_cast_default<int>(cfg["return_value"]))
-{
-/*WIKI
- * @page = GUIWidgetInstanceWML
- * @order = 2_toggle_panel
- *
- * == Toggle panel ==
- *
- * A panel is an item which can hold other items. The difference between a grid
- * and a panel is that it's possible to define how a panel looks. A grid in an
- * invisible container to just hold the items. The toggle panel is a
- * combination of the panel and a toggle button, it allows a toggle button with
- * its own grid.
- *
- * @start_table = config
- *     grid (grid)                     Defines the grid with the widgets to
- *                                     place on the panel.
- *     return_value_id (string = "")   The return value id, see
- *                                     [[GUIToolkitWML#Button]] for more info.
- *     return_value (int = 0)          The return value, see
- *                                     [[GUIToolkitWML#Button]] for more info.
- * @end_table
- *
- */
-
-       const config &c = cfg.child("grid");
-
-       VALIDATE(c, _("No grid defined."));
-
-       grid = new tbuilder_grid(c);
-}
-
-twidget* tbuilder_toggle_panel::build() const
-{
-       ttoggle_panel* toggle_panel = new ttoggle_panel();
-
-       init_control(toggle_panel);
-
-       toggle_panel->set_retval(get_retval(retval_id_, retval_, id));
-
-       DBG_GUI_G << "Window builder: placed toggle panel '"
-                       << id << "' with defintion '" << definition << "'.\n";
-
-       toggle_panel->init_grid(grid);
-       return toggle_panel;
-}
-
 twidget* tbuilder_vertical_scrollbar::build() const
 {
        tvertical_scrollbar *vertical_scrollbar = new tvertical_scrollbar();

Added: trunk/src/gui/auxiliary/window_builder/toggle_panel.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/auxiliary/window_builder/toggle_panel.cpp?rev=36393&view=auto
==============================================================================
--- trunk/src/gui/auxiliary/window_builder/toggle_panel.cpp (added)
+++ trunk/src/gui/auxiliary/window_builder/toggle_panel.cpp Wed Jun 24 21:56:47 
2009
@@ -1,0 +1,88 @@
+/* $Id$ */
+/*
+   Copyright (C) 2008 - 2009 by Mark de Wever <[email protected]>
+   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/window_builder/toggle_panel.hpp"
+
+#include "config.hpp"
+#include "gettext.hpp"
+#include "gui/auxiliary/log.hpp"
+#include "gui/widgets/toggle_panel.hpp"
+#include "wml_exception.hpp"
+
+namespace gui2 {
+
+/** @todo move to it's own header. */
+extern int get_retval(const std::string& retval_id,
+               const int retval, const std::string& id);
+
+namespace implementation {
+
+tbuilder_toggle_panel::tbuilder_toggle_panel(const config& cfg)
+       : tbuilder_control(cfg)
+       , grid(NULL)
+       , retval_id_(cfg["return_value_id"])
+       , retval_(lexical_cast_default<int>(cfg["return_value"]))
+{
+       const config &c = cfg.child("grid");
+
+       VALIDATE(c, _("No grid defined."));
+
+       grid = new tbuilder_grid(c);
+}
+
+twidget* tbuilder_toggle_panel::build() const
+{
+       ttoggle_panel* widget = new ttoggle_panel();
+
+       init_control(widget);
+
+       widget->set_retval(get_retval(retval_id_, retval_, id));
+
+       DBG_GUI_G << "Window builder: placed toggle panel '"
+                       << id << "' with defintion '"
+                       << definition << "'.\n";
+
+       widget->init_grid(grid);
+       return widget;
+}
+
+} // namespace implementation
+
+} // namespace gui2
+
+/*WIKI
+ * @page = GUIWidgetInstanceWML
+ * @order = 2_toggle_panel
+ *
+ * == Toggle panel ==
+ *
+ * A panel is an item which can hold other items. The difference between a
+ * grid and a panel is that it's possible to define how a panel looks. A grid
+ * in an invisible container to just hold the items. The toggle panel is a
+ * combination of the panel and a toggle button, it allows a toggle button
+ * with its own grid.
+ *
+ * @start_table = config
+ *     grid (grid)                     Defines the grid with the widgets to
+ *                                     place on the panel.
+ *     return_value_id (string = "")   The return value id, see
+ *                                     [[GUIToolkitWML#Button]] for more info.
+ *     return_value (int = 0)          The return value, see
+ *                                     [[GUIToolkitWML#Button]] for more info.
+ * @end_table
+ *
+ */
+

Propchange: trunk/src/gui/auxiliary/window_builder/toggle_panel.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: trunk/src/gui/auxiliary/window_builder/toggle_panel.cpp
------------------------------------------------------------------------------
    svn:keywords = 'Author Date Id Revision'

Added: trunk/src/gui/auxiliary/window_builder/toggle_panel.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/auxiliary/window_builder/toggle_panel.hpp?rev=36393&view=auto
==============================================================================
--- trunk/src/gui/auxiliary/window_builder/toggle_panel.hpp (added)
+++ trunk/src/gui/auxiliary/window_builder/toggle_panel.hpp Wed Jun 24 21:56:47 
2009
@@ -1,0 +1,44 @@
+/* $Id$ */
+/*
+   Copyright (C) 2008 - 2009 by Mark de Wever <[email protected]>
+   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_WINDOW_BUILDER_TOGGLE_PANEL_HPP_INCLUDED
+#define GUI_AUXILIARY_WINDOW_BUILDER_TOGGLE_PANEL_HPP_INCLUDED
+
+#include "gui/auxiliary/window_builder/control.hpp"
+
+namespace gui2 {
+
+namespace implementation {
+
+struct tbuilder_toggle_panel
+       : public tbuilder_control
+{
+       tbuilder_toggle_panel(const config& cfg);
+
+       twidget* build () const;
+
+       tbuilder_grid_ptr grid;
+
+private:
+       std::string retval_id_;
+       int retval_;
+};
+
+
+} // namespace implementation
+
+} // namespace gui2
+
+#endif
+

Propchange: trunk/src/gui/auxiliary/window_builder/toggle_panel.hpp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: trunk/src/gui/auxiliary/window_builder/toggle_panel.hpp
------------------------------------------------------------------------------
    svn:keywords = 'Author Date Id Revision'

Modified: trunk/src/gui/auxiliary/window_builder_private.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/auxiliary/window_builder_private.hpp?rev=36393&r1=36392&r2=36393&view=diff
==============================================================================
--- trunk/src/gui/auxiliary/window_builder_private.hpp (original)
+++ trunk/src/gui/auxiliary/window_builder_private.hpp Wed Jun 24 21:56:47 2009
@@ -232,23 +232,6 @@
        int retval_;
 };
 
-struct tbuilder_toggle_panel : public implementation::tbuilder_control
-{
-
-private:
-       tbuilder_toggle_panel();
-public:
-       tbuilder_toggle_panel(const config& cfg);
-
-       twidget* build () const;
-
-       tbuilder_grid_ptr grid;
-
-private:
-       std::string retval_id_;
-       int retval_;
-};
-
 struct tbuilder_vertical_scrollbar : public implementation::tbuilder_control
 {
 private:


_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits

Reply via email to