Author: mordante
Date: Mon Dec 8 22:10:23 2008
New Revision: 31382
URL: http://svn.gna.org/viewcvs/wesnoth?rev=31382&view=rev
Log:
Added an extra build function.
In some cases it's easier to use an existing grid in the grid builder.
So added a new function which takes a grid pointer as parameter.
Modified:
trunk/src/gui/widgets/window_builder.cpp
trunk/src/gui/widgets/window_builder.hpp
Modified: trunk/src/gui/widgets/window_builder.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/widgets/window_builder.cpp?rev=31382&r1=31381&r2=31382&view=diff
==============================================================================
--- trunk/src/gui/widgets/window_builder.cpp (original)
+++ trunk/src/gui/widgets/window_builder.cpp Mon Dec 8 22:10:23 2008
@@ -1009,7 +1009,8 @@
init_control(widget);
boost::intrusive_ptr<const tscroll_label_definition::tresolution> conf =
- boost::dynamic_pointer_cast<const
tscroll_label_definition::tresolution>(widget->config());
+ boost::dynamic_pointer_cast
+ <const tscroll_label_definition::tresolution>(widget->config());
assert(conf);
tgrid* grid = dynamic_cast<tgrid*>(conf->grid->build());
@@ -1250,14 +1251,18 @@
twidget* tbuilder_grid::build() const
{
- tgrid* grid = new tgrid();
-
+ return build(new tgrid());
+}
+
+twidget* tbuilder_grid::build (tgrid* grid) const
+{
grid->set_id(id);
grid->set_rows_cols(rows, cols);
log_scope2(gui, "Window builder: building grid");
- DBG_GUI << "Window builder: grid has " << rows << " rows and "
+ DBG_GUI << "Window builder: grid '" << id
+ << "' has " << rows << " rows and "
<< cols << " columns.\n";
for(unsigned x = 0; x < rows; ++x) {
Modified: trunk/src/gui/widgets/window_builder.hpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/widgets/window_builder.hpp?rev=31382&r1=31381&r2=31382&view=diff
==============================================================================
--- trunk/src/gui/widgets/window_builder.hpp (original)
+++ trunk/src/gui/widgets/window_builder.hpp Mon Dec 8 22:10:23 2008
@@ -28,6 +28,7 @@
namespace gui2 {
class twidget;
+class tgrid;
class twindow;
twindow build(CVideo& video, const std::string& type);
@@ -75,7 +76,8 @@
/** The widgets per grid cell. */
std::vector<tbuilder_widget_ptr> widgets;
- twidget* build () const;
+ twidget* build() const;
+ twidget* build(tgrid* grid) const;
private:
/** After reading the general part in the constructor read extra data.
*/
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits