Author: mordante
Date: Sat May 24 18:49:42 2008
New Revision: 26833

URL: http://svn.gna.org/viewcvs/wesnoth?rev=26833&view=rev
Log:
Remove not used listbox initialization process.
This will be replaced with another way and this proof-of-concept
method will no longer be used.

Modified:
    trunk/src/gui/widgets/listbox.cpp
    trunk/src/gui/widgets/window_builder.cpp

Modified: trunk/src/gui/widgets/listbox.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/widgets/listbox.cpp?rev=26833&r1=26832&r2=26833&view=diff
==============================================================================
--- trunk/src/gui/widgets/listbox.cpp (original)
+++ trunk/src/gui/widgets/listbox.cpp Sat May 24 18:49:42 2008
@@ -139,46 +139,6 @@
 
 void tlistbox::finalize_setup()
 {
-       // If we have a list already set up wire in the callback routine.
-       tgrid* list = dynamic_cast<tgrid*>(tcontainer_::find_widget("_list", 
false));
-       if(list) {
-               const unsigned col_count = list->get_cols();
-               const unsigned row_count = list->get_rows();
-
-               // We need to validate the stuff put inside us, we expect
-               // * panels or grids with more nested items.
-               // * selectable items.
-               for(unsigned row = 0; row < row_count; ++row) {
-                       for(unsigned col = 0; col < col_count; ++col) {
-                               twidget* widget = list->widget(row, col);
-                               assert(widget);
-
-
-                               tgrid* grid = dynamic_cast<tgrid*>(widget);
-                               tselectable_* selectable = 
dynamic_cast<tselectable_*>(widget);
-
-                               if(selectable) {
-                                       
-                                       // FIXME move the callback also in the 
selectable class
-                                       ttoggle_button* btn = 
dynamic_cast<ttoggle_button*>(widget);
-                                       assert(btn);
-
-                                       
btn->set_callback_mouse_left_click(callback_select_list_item);
-
-                               } else if(grid) {
-                                       // Grid not allowed atm.
-                                       assert(false);
-                               } else {
-                                       std::cerr << "Widget type " << 
typeid(*widget).name() << ".\n";
-                                       assert(false);
-                               }
-                       }
-               }
-       } else {
-               // Validate the existance.
-               tspacer* spacer = tlistbox::list();
-       }
-
        scrollbar()->set_callback_positioner_move(callback_scrollbar);
 
        static std::vector<std::string> button_names;

Modified: trunk/src/gui/widgets/window_builder.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/widgets/window_builder.cpp?rev=26833&r1=26832&r2=26833&view=diff
==============================================================================
--- trunk/src/gui/widgets/window_builder.cpp (original)
+++ trunk/src/gui/widgets/window_builder.cpp Sat May 24 18:49:42 2008
@@ -124,7 +124,6 @@
        twidget* build () const;
 
        tbuilder_grid* header;
-       tbuilder_grid* list;
        tbuilder_grid* footer;
 
        tbuilder_grid* list_builder;
@@ -738,7 +737,6 @@
 tbuilder_listbox::tbuilder_listbox(const config& cfg) :
        tbuilder_control(cfg),
        header(cfg.child("header") ? new tbuilder_grid(*(cfg.child("header"))) 
: 0),
-       list(0),
        footer(cfg.child("footer") ? new tbuilder_grid(*(cfg.child("footer"))) 
: 0),
        list_builder(0),
        assume_fixed_row_size(utils::string_bool(cfg["assume_fixed_row_size"]))
@@ -764,7 +762,6 @@
  *                                     never shown even not if more items are
  *                                     available as visible.
  *     header (section = [])           Defines the grid for the optional 
header.
- *     list (section)                  Defines the grid for the list data.
  *     footer (section = [])           Defines the grid for the optional 
footer.
  *    
  *     list_definition (section)       The list can be a hardcoded list (uses
@@ -794,15 +791,8 @@
  *
  */
 
-//     VALIDATE(cfg.child("list"), _("No list defined."));
-
-       if(cfg.child("list_definition")) {
-               list_builder = new 
tbuilder_grid(*(cfg.child("list_definition")));
-       } else if(cfg.child("list")) {
-               list = new tbuilder_grid(*(cfg.child("list")));
-       } else {
-               VALIDATE(false, _("No 'list_builder' nor a 'list' section 
defined."));
-       }
+       VALIDATE(cfg.child("list_definition"), _("No list defined."));
+       list_builder = new tbuilder_grid(*(cfg.child("list_definition")));
 }
 
 twidget* tbuilder_listbox::build() const
@@ -826,17 +816,9 @@
 
        scrollbar->set_id("_scroll");
 
-       twidget* list_area = 0;
-       if(list_builder) {
-               list_area = new tspacer();
-               assert(list_area);
-               list_area->set_definition("default");
-       } else {
-               assert(list);
-               list_area = dynamic_cast<tgrid*>(list->build());
-               assert(list_area);
-       }
-
+       twidget* list_area = new tspacer();
+       assert(list_area);
+       list_area->set_definition("default");
        list_area->set_id("_list");
 
        listbox->grid().set_rows_cols(1, 2);


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

Reply via email to