← Back to team overview

widelands-dev team mailing list archive

[Merge] lp:~nomeata/widelands/window-toggle-button into lp:widelands

 

Joachim Breitner has proposed merging lp:~nomeata/widelands/window-toggle-button into lp:widelands.

Requested reviews:
  Widelands Developers (widelands-dev)
Related bugs:
  #657878 Make button toggle-buttons
  https://bugs.launchpad.net/bugs/657878


As described in https://bugs.launchpad.net/widelands/+bug/657878 this patch makes the main UI buttons, as well as the statistics buttons and the readme/authors/license buttons stay pressed when the appropriate window is currently visible. This gives IMHO a better user experience.

With my latest change I also added code to make the buildhelp button (which does not reflect the state of a window) correctly reflect the state of the buildhelp display. Watch how it moves when you press Space.

While doing so, I refactored the Callback_Button class to not rely on templates for the callback method, but on boost::function. This also removes the now redundant Callback_IDButton. 

Feature wise I think this can be merged, but please look over the code if you like it :-)
-- 
https://code.launchpad.net/~nomeata/widelands/window-toggle-button/+merge/38774
Your team Widelands Developers is requested to review the proposed merge of lp:~nomeata/widelands/window-toggle-button into lp:widelands.
=== modified file 'src/editor/editorinteractive.cc'
--- src/editor/editorinteractive.cc	2010-05-24 18:42:55 +0000
+++ src/editor/editorinteractive.cc	2010-10-18 21:31:48 +0000
@@ -54,7 +54,7 @@
 #define INIT_BUTTON(picture, name, callback, tooltip)                         \
  TOOLBAR_BUTTON_COMMON_PARAMETERS(name),                                      \
  g_gr->get_picture(PicMod_Game, "pics/" picture ".png"),                      \
- &Editor_Interactive::callback, *this,                                        \
+ boost::bind(&Editor_Interactive::callback, boost::ref(*this)),               \
  tooltip                                                                      \
 
 m_toggle_main_menu

=== modified file 'src/editor/editorinteractive.h'
--- src/editor/editorinteractive.h	2010-04-10 11:17:21 +0000
+++ src/editor/editorinteractive.h	2010-10-18 21:31:48 +0000
@@ -147,12 +147,12 @@
 	UI::UniqueWindow::Registry m_bobmenu;
 	UI::UniqueWindow::Registry m_resourcesmenu;
 
-	UI::Callback_Button<Editor_Interactive> m_toggle_main_menu;
-	UI::Callback_Button<Editor_Interactive> m_toggle_tool_menu;
-	UI::Callback_Button<Editor_Interactive> m_toggle_toolsize_menu;
-	UI::Callback_Button<Editor_Interactive> m_toggle_minimap;
-	UI::Callback_Button<Editor_Interactive> m_toggle_buildhelp;
-	UI::Callback_Button<Editor_Interactive> m_toggle_player_menu;
+	UI::Callback_Button m_toggle_main_menu;
+	UI::Callback_Button m_toggle_tool_menu;
+	UI::Callback_Button m_toggle_toolsize_menu;
+	UI::Callback_Button m_toggle_minimap;
+	UI::Callback_Button m_toggle_buildhelp;
+	UI::Callback_Button m_toggle_player_menu;
 };
 
 #endif

=== modified file 'src/editor/ui_menus/editor_main_menu.cc'
--- src/editor/ui_menus/editor_main_menu.cc	2010-04-24 20:03:07 +0000
+++ src/editor/ui_menus/editor_main_menu.cc	2010-10-18 21:31:48 +0000
@@ -52,43 +52,43 @@
 		(this, "new_map",
 		 hmargin, vmargin + 0 * (height + vspacing), width, height,
 		 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
-		 &Editor_Main_Menu::new_map_btn, *this,
+		 boost::bind(&Editor_Main_Menu::new_map_btn, boost::ref(*this)),
 		 _("New Map")),
 	m_button_new_random_map
 		(this, "new_random_map",
 		 hmargin, vmargin + 1 * (height + vspacing), width, height,
 		 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
-		 &Editor_Main_Menu::new_random_map_btn, *this,
+		 boost::bind(&Editor_Main_Menu::new_random_map_btn, boost::ref(*this)),
 		 _("New Random Map")),
 	m_button_load_map
 		(this, "load_map",
 		 hmargin, vmargin + 2 * (height + vspacing), width, height,
 		 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
-		 &Editor_Main_Menu::load_btn, *this,
+		 boost::bind(&Editor_Main_Menu::load_btn, boost::ref(*this)),
 		 _("Load Map")),
 	m_button_save_map
 		(this, "save_map",
 		 hmargin, vmargin + 3 * (height + vspacing), width, height,
 		 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
-		 &Editor_Main_Menu::save_btn, *this,
+		 boost::bind(&Editor_Main_Menu::save_btn, boost::ref(*this)),
 		 _("Save Map")),
 	m_button_map_options
 		(this, "map_options",
 		 hmargin, vmargin + 4 * (height + vspacing), width, height,
 		 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
-		 &Editor_Main_Menu::map_options_btn, *this,
+		 boost::bind(&Editor_Main_Menu::map_options_btn, boost::ref(*this)),
 		 _("Map Options")),
 	m_button_view_readme
 		(this, "readme",
 		 hmargin, vmargin + 5 * (height + vspacing), width, height,
 		 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
-		 &Editor_Main_Menu::readme_btn, *this,
+		 boost::bind(&Editor_Main_Menu::readme_btn, boost::ref(*this)),
 		 _("View Readme")),
 	m_button_exit_editor
 		(this, "exit",
 		 hmargin, vmargin + 6 * (height + vspacing), width, height,
 		 g_gr->get_picture(PicMod_UI, "pics/but0.png"),
-		 &Editor_Main_Menu::exit_btn, *this,
+		 boost::bind(&Editor_Main_Menu::exit_btn, boost::ref(*this)),
 		 _("Exit Editor"))
 {
 	// Put in the default position, if necessary

=== modified file 'src/editor/ui_menus/editor_main_menu.h'
--- src/editor/ui_menus/editor_main_menu.h	2009-11-01 07:13:59 +0000
+++ src/editor/ui_menus/editor_main_menu.h	2010-10-18 21:31:48 +0000
@@ -33,13 +33,13 @@
 
 private:
 	Editor_Interactive & eia();
-	UI::Callback_Button<Editor_Main_Menu> m_button_new_map;
-	UI::Callback_Button<Editor_Main_Menu> m_button_new_random_map;
-	UI::Callback_Button<Editor_Main_Menu> m_button_load_map;
-	UI::Callback_Button<Editor_Main_Menu> m_button_save_map;
-	UI::Callback_Button<Editor_Main_Menu> m_button_map_options;
-	UI::Callback_Button<Editor_Main_Menu> m_button_view_readme;
-	UI::Callback_Button<Editor_Main_Menu> m_button_exit_editor;
+	UI::Callback_Button m_button_new_map;
+	UI::Callback_Button m_button_new_random_map;
+	UI::Callback_Button m_button_load_map;
+	UI::Callback_Button m_button_save_map;
+	UI::Callback_Button m_button_map_options;
+	UI::Callback_Button m_button_view_readme;
+	UI::Callback_Button m_button_exit_editor;
 
 	UI::UniqueWindow::Registry m_window_readme;
 

=== modified file 'src/editor/ui_menus/editor_main_menu_load_map.cc'
--- src/editor/ui_menus/editor_main_menu_load_map.cc	2010-04-24 20:03:07 +0000
+++ src/editor/ui_menus/editor_main_menu_load_map.cc	2010-10-18 21:31:48 +0000
@@ -113,20 +113,20 @@
 	posx = 5;
 	posy = get_inner_h() - 30;
 
-	m_ok_btn = new UI::Callback_Button<Main_Menu_Load_Map>
+	m_ok_btn = new UI::Callback_Button
 		(this, "ok",
 		 get_inner_w() / 2 - spacing - 80, posy, 80, 20,
 		 g_gr->get_picture(PicMod_UI, "pics/but0.png"),
-		 &Main_Menu_Load_Map::clicked_ok, *this,
+		 boost::bind(&Main_Menu_Load_Map::clicked_ok, boost::ref(*this)),
 		 _("OK"),
 		 std::string(),
 		 false);
 
-	new UI::Callback_Button<Main_Menu_Load_Map>
+	new UI::Callback_Button
 		(this, "cancel",
 		 get_inner_w() / 2 + spacing, posy, 80, 20,
 		 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
-		 &Main_Menu_Load_Map::die, *this,
+		 boost::bind(&Main_Menu_Load_Map::die, boost::ref(*this)),
 		 _("Cancel"));
 
 	m_basedir = "maps";

=== modified file 'src/editor/ui_menus/editor_main_menu_load_map.h'
--- src/editor/ui_menus/editor_main_menu_load_map.h	2009-11-01 07:13:59 +0000
+++ src/editor/ui_menus/editor_main_menu_load_map.h	2010-10-18 21:31:48 +0000
@@ -30,7 +30,7 @@
 template <typename T> struct Listselect;
 struct Textarea;
 struct Multiline_Textarea;
-template <typename T> struct Callback_Button;
+struct Callback_Button;
 };
 
 /**
@@ -49,7 +49,7 @@
 	UI::Textarea * m_name, * m_author, * m_size, * m_world, * m_nrplayers;
 	UI::Multiline_Textarea * m_descr;
 	UI::Listselect<const char *> * m_ls;
-	UI::Callback_Button<Main_Menu_Load_Map> * m_ok_btn;
+	UI::Callback_Button * m_ok_btn;
 
 	std::string m_basedir;
 	std::string m_curdir;

=== modified file 'src/editor/ui_menus/editor_main_menu_new_map.cc'
--- src/editor/ui_menus/editor_main_menu_new_map.cc	2010-04-30 17:02:43 +0000
+++ src/editor/ui_menus/editor_main_menu_new_map.cc	2010-10-18 21:31:48 +0000
@@ -65,19 +65,19 @@
 		(buffer, sizeof(buffer), _("Width: %u"), Widelands::MAP_DIMENSIONS[m_w]);
 	m_width = new UI::Textarea(this, posx + spacing + 20, posy, buffer);
 
-	new UI::Callback_IDButton<Main_Menu_New_Map, int32_t>
+	new UI::Callback_Button
 		(this, "width_up",
 		 posx, posy, 20, 20,
 		 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
 		 g_gr->get_picture(PicMod_UI, "pics/scrollbar_up.png"),
-		 &Main_Menu_New_Map::button_clicked, *this, 0);
+		 boost::bind(&Main_Menu_New_Map::button_clicked, boost::ref(*this), 0));
 
-	new UI::Callback_IDButton<Main_Menu_New_Map, int32_t>
+	new UI::Callback_Button
 		(this, "width_down",
 		 get_inner_w() - spacing - 20, posy, 20, 20,
 		 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
 		 g_gr->get_picture(PicMod_UI, "pics/scrollbar_down.png"),
-		 &Main_Menu_New_Map::button_clicked, *this, 1);
+		 boost::bind(&Main_Menu_New_Map::button_clicked, boost::ref(*this), 1));
 
 	posy += 20 + spacing + spacing;
 
@@ -86,19 +86,19 @@
 		 _("Height: %u"), Widelands::MAP_DIMENSIONS[m_h]);
 	m_height = new UI::Textarea(this, posx + spacing + 20, posy, buffer);
 
-	new UI::Callback_IDButton<Main_Menu_New_Map, int32_t>
+	new UI::Callback_Button
 		(this, "height_up",
 		 posx, posy, 20, 20,
 		 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
 		 g_gr->get_picture(PicMod_UI, "pics/scrollbar_up.png"),
-		 &Main_Menu_New_Map::button_clicked, *this, 2);
+		 boost::bind(&Main_Menu_New_Map::button_clicked, boost::ref(*this), 2));
 
-	new UI::Callback_IDButton<Main_Menu_New_Map, int32_t>
+	new UI::Callback_Button
 		(this, "height_down",
 		 get_inner_w() - spacing - 20, posy, 20, 20,
 		 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
 		 g_gr->get_picture(PicMod_UI, "pics/scrollbar_down.png"),
-		 &Main_Menu_New_Map::button_clicked, *this, 3);
+		 boost::bind(&Main_Menu_New_Map::button_clicked, boost::ref(*this), 3));
 
 	posy += 20 + spacing + spacing;
 
@@ -108,20 +108,20 @@
 	while (strcmp(map.get_world_name(), m_worlds[m_currentworld].c_str()))
 		++m_currentworld;
 
-	m_world = new UI::Callback_IDButton<Main_Menu_New_Map, int32_t>
+	m_world = new UI::Callback_Button
 		(this, "world",
 		 posx, posy, width, height,
 		 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
-		 &Main_Menu_New_Map::button_clicked, *this, 4,
+		 boost::bind(&Main_Menu_New_Map::button_clicked, boost::ref(*this), 4),
 		 Widelands::World(m_worlds[m_currentworld].c_str()).get_name());
 
 	posy += height + spacing + spacing + spacing;
 
-	new UI::Callback_Button<Main_Menu_New_Map>
+	new UI::Callback_Button
 		(this, "create_map",
 		 posx, posy, width, height,
 		 g_gr->get_picture(PicMod_UI, "pics/but0.png"),
-		 &Main_Menu_New_Map::clicked_create_map, *this,
+		 boost::bind(&Main_Menu_New_Map::clicked_create_map, boost::ref(*this)),
 		 _("Create Map"));
 
 	posy += height + spacing;

=== modified file 'src/editor/ui_menus/editor_main_menu_new_map.h'
--- src/editor/ui_menus/editor_main_menu_new_map.h	2009-11-01 07:13:59 +0000
+++ src/editor/ui_menus/editor_main_menu_new_map.h	2010-10-18 21:31:48 +0000
@@ -26,7 +26,7 @@
 
 struct Editor_Interactive;
 namespace UI {
-template <typename T, typename ID> struct Callback_IDButton;
+struct Callback_Button;
 struct Textarea;
 }
 
@@ -40,7 +40,7 @@
 
 private:
 	UI::Textarea * m_width, * m_height;
-	UI::Callback_IDButton<Main_Menu_New_Map, int32_t> * m_world;
+	UI::Callback_Button * m_world;
 	int32_t m_w, m_h;
 	std::vector<std::string>::size_type m_currentworld;
 	std::vector<std::string> m_worlds;

=== modified file 'src/editor/ui_menus/editor_main_menu_random_map.cc'
--- src/editor/ui_menus/editor_main_menu_random_map.cc	2010-07-22 22:02:19 +0000
+++ src/editor/ui_menus/editor_main_menu_random_map.cc	2010-10-18 21:31:48 +0000
@@ -98,19 +98,19 @@
 		for (m_h = 0; Widelands::MAP_DIMENSIONS[m_h] < map_extent.h; ++m_h) {}
 	}
 
-	new UI::Callback_IDButton<Main_Menu_New_Random_Map, int32_t>
+	new UI::Callback_Button
 		(this, "width_up",
 		 posx, posy, 20, 20,
 		 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
 		 g_gr->get_picture(PicMod_UI, "pics/scrollbar_up.png"),
-		 &Main_Menu_New_Random_Map::button_clicked, *this, MAP_W_PLUS);
+		 boost::bind(&Main_Menu_New_Random_Map::button_clicked, boost::ref(*this), MAP_W_PLUS));
 
-	new UI::Callback_IDButton<Main_Menu_New_Random_Map, int32_t>
+	new UI::Callback_Button
 		(this, "width_down",
 		 get_inner_w() - spacing - 20, posy, 20, 20,
 		 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
 		 g_gr->get_picture(PicMod_UI, "pics/scrollbar_down.png"),
-		 &Main_Menu_New_Random_Map::button_clicked, *this, MAP_W_MINUS);
+		 boost::bind(&Main_Menu_New_Random_Map::button_clicked, boost::ref(*this), MAP_W_MINUS));
 
 	snprintf
 		(buffer, sizeof(buffer), _("Width: %u"), Widelands::MAP_DIMENSIONS[m_w]);
@@ -126,38 +126,38 @@
 		 _("Height: %u"), Widelands::MAP_DIMENSIONS[m_h]);
 	m_height = new UI::Textarea(this, posx + spacing + 20, posy, buffer);
 
-	new UI::Callback_IDButton<Main_Menu_New_Random_Map, int32_t>
+	new UI::Callback_Button
 		(this, "height_up",
 		 posx, posy, 20, 20,
 		 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
 		 g_gr->get_picture(PicMod_UI, "pics/scrollbar_up.png"),
-		 &Main_Menu_New_Random_Map::button_clicked, *this, MAP_H_PLUS);
+		 boost::bind(&Main_Menu_New_Random_Map::button_clicked, boost::ref(*this), MAP_H_PLUS));
 
-	new UI::Callback_IDButton<Main_Menu_New_Random_Map, int32_t>
+	new UI::Callback_Button
 		(this, "height_down",
 		 get_inner_w() - spacing - 20, posy, 20, 20,
 		 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
 		 g_gr->get_picture(PicMod_UI, "pics/scrollbar_down.png"),
-		 &Main_Menu_New_Random_Map::button_clicked, *this, MAP_H_MINUS);
+		 boost::bind(&Main_Menu_New_Random_Map::button_clicked, boost::ref(*this), MAP_H_MINUS));
 
 	posy += 20 + spacing + spacing;
 
 
 	// ---------- Water -----------
 
-	new UI::Callback_IDButton<Main_Menu_New_Random_Map, int32_t>
+	new UI::Callback_Button
 		(this, "water_up",
 		 posx, posy, 20, 20,
 		 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
 		 g_gr->get_picture(PicMod_UI, "pics/scrollbar_up.png"),
-		 &Main_Menu_New_Random_Map::button_clicked, *this, WATER_PLUS);
+		 boost::bind(&Main_Menu_New_Random_Map::button_clicked, boost::ref(*this), WATER_PLUS));
 
-	new UI::Callback_IDButton<Main_Menu_New_Random_Map, int32_t>
+	new UI::Callback_Button
 		(this, "water_down",
 		 get_inner_w() - spacing - 20, posy, 20, 20,
 		 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
 		 g_gr->get_picture(PicMod_UI, "pics/scrollbar_down.png"),
-		 &Main_Menu_New_Random_Map::button_clicked, *this, WATER_MINUS);
+		 boost::bind(&Main_Menu_New_Random_Map::button_clicked, boost::ref(*this), WATER_MINUS));
 
 	snprintf(buffer, sizeof(buffer), _("Water: %u %%"), m_waterval);
 	m_water = new UI::Textarea(this, posx + spacing + 20, posy, buffer);
@@ -168,19 +168,19 @@
 
 	// ---------- Land -----------
 
-	new UI::Callback_IDButton<Main_Menu_New_Random_Map, int32_t>
+	new UI::Callback_Button
 		(this, "land_up",
 		 posx, posy, 20, 20,
 		 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
 		 g_gr->get_picture(PicMod_UI, "pics/scrollbar_up.png"),
-		 &Main_Menu_New_Random_Map::button_clicked, *this, LAND_PLUS);
+		 boost::bind(&Main_Menu_New_Random_Map::button_clicked, boost::ref(*this), LAND_PLUS));
 
-	new UI::Callback_IDButton<Main_Menu_New_Random_Map, int32_t>
+	new UI::Callback_Button
 		(this, "land_down",
 		 get_inner_w() - spacing - 20, posy, 20, 20,
 		 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
 		 g_gr->get_picture(PicMod_UI, "pics/scrollbar_down.png"),
-		 &Main_Menu_New_Random_Map::button_clicked, *this, LAND_MINUS);
+		 boost::bind(&Main_Menu_New_Random_Map::button_clicked, boost::ref(*this), LAND_MINUS));
 
 	snprintf
 		(buffer, sizeof(buffer), _("Land: %u %%"), m_landval);
@@ -192,19 +192,19 @@
 
 	// ---------- Wasteland -----------
 
-	new UI::Callback_IDButton<Main_Menu_New_Random_Map, int32_t>
+	new UI::Callback_Button
 		(this, "wasteland_up",
 		 posx, posy, 20, 20,
 		 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
 		 g_gr->get_picture(PicMod_UI, "pics/scrollbar_up.png"),
-		 &Main_Menu_New_Random_Map::button_clicked, *this, WASTE_PLUS);
+		 boost::bind(&Main_Menu_New_Random_Map::button_clicked, boost::ref(*this), WASTE_PLUS));
 
-	new UI::Callback_IDButton<Main_Menu_New_Random_Map, int32_t>
+	new UI::Callback_Button
 		(this, "wasteland_down",
 		 get_inner_w() - spacing - 20, posy, 20, 20,
 		 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
 		 g_gr->get_picture(PicMod_UI, "pics/scrollbar_down.png"),
-		 &Main_Menu_New_Random_Map::button_clicked, *this, WASTE_MINUS);
+		 boost::bind(&Main_Menu_New_Random_Map::button_clicked, boost::ref(*this), WASTE_MINUS));
 
 	snprintf
 		(buffer, sizeof(buffer), _("Wasteland: %u %%"), m_wastelandval);
@@ -250,11 +250,11 @@
 
 	m_res_amount = 2;
 
-	m_res = new UI::Callback_IDButton<Main_Menu_New_Random_Map, int32_t>
+	m_res = new UI::Callback_Button
 		(this, "resources",
 		 posx, posy, width, height,
 		 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
-		 &Main_Menu_New_Random_Map::button_clicked, *this, SWITCH_RES,
+		 boost::bind(&Main_Menu_New_Random_Map::button_clicked, boost::ref(*this), SWITCH_RES),
 		 m_res_amounts[m_res_amount].c_str());
 
 	posy += height + spacing + spacing + spacing;
@@ -269,11 +269,11 @@
 	while (strcmp(map.get_world_name(), m_worlds[m_currentworld].c_str()))
 		++m_currentworld;
 
-	m_world = new UI::Callback_IDButton<Main_Menu_New_Random_Map, int32_t>
+	m_world = new UI::Callback_Button
 		(this, "world",
 		 posx, posy, width, height,
 		 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
-		 &Main_Menu_New_Random_Map::button_clicked, *this, SWITCH_WORLD,
+		 boost::bind(&Main_Menu_New_Random_Map::button_clicked, boost::ref(*this), SWITCH_WORLD),
 		 Widelands::World(m_worlds[m_currentworld].c_str()).get_name());
 
 	posy += height + spacing + spacing + spacing;
@@ -300,19 +300,19 @@
 
 	// ---------- Players -----------
 
-	new UI::Callback_IDButton<Main_Menu_New_Random_Map, int32_t>
+	new UI::Callback_Button
 		(this, "player_up",
 		 posx, posy, 20, 20,
 		 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
 		 g_gr->get_picture(PicMod_UI, "pics/scrollbar_up.png"),
-		 &Main_Menu_New_Random_Map::button_clicked, *this, PLAYER_PLUS);
+		 boost::bind(&Main_Menu_New_Random_Map::button_clicked, boost::ref(*this), PLAYER_PLUS));
 
-	 new UI::Callback_IDButton<Main_Menu_New_Random_Map, int32_t>
+	 new UI::Callback_Button
 		(this, "player_down",
 		 get_inner_w() - spacing - 20, posy, 20, 20,
 		 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
 		 g_gr->get_picture(PicMod_UI, "pics/scrollbar_down.png"),
-		 &Main_Menu_New_Random_Map::button_clicked, *this, PLAYER_MINUS);
+		 boost::bind(&Main_Menu_New_Random_Map::button_clicked, boost::ref(*this), PLAYER_MINUS));
 
 	snprintf(buffer, sizeof(buffer), _("Players: %u"), m_pn);
 	m_players = new UI::Textarea(this, posx + spacing + 20, posy, buffer);
@@ -323,11 +323,11 @@
 
 	// ---------- "Generate Map" button ----------
 
-	m_goButton = new UI::Callback_Button<Main_Menu_New_Random_Map>
+	m_goButton = new UI::Callback_Button
 		(this, "generate_map",
 		 posx, posy, width, height,
 		 g_gr->get_picture(PicMod_UI, "pics/but0.png"),
-		 &Main_Menu_New_Random_Map::clicked_create_map, *this,
+		 boost::bind(&Main_Menu_New_Random_Map::clicked_create_map, boost::ref(*this)),
 		 _("Generate Map"));
 	posy += height + spacing;
 
@@ -341,7 +341,7 @@
 /**
  * Called, when button get clicked
 */
-void Main_Menu_New_Random_Map::button_clicked(int32_t n) {
+void Main_Menu_New_Random_Map::button_clicked(Main_Menu_New_Random_Map::ButtonID n) {
 	switch (n) {
 	case MAP_W_PLUS: ++m_w; break;
 	case MAP_W_MINUS:
@@ -526,7 +526,7 @@
 		m_world->set_title
 			(Widelands::World(m_worlds[m_currentworld].c_str()).get_name());
 
-		button_clicked(-1);  // Update other values in UI as well
+		button_clicked((ButtonID)-1);  // Update other values in UI as well
 
 		m_goButton->set_enabled(true);
 	}

=== modified file 'src/editor/ui_menus/editor_main_menu_random_map.h'
--- src/editor/ui_menus/editor_main_menu_random_map.h	2010-07-22 22:02:19 +0000
+++ src/editor/ui_menus/editor_main_menu_random_map.h	2010-10-18 21:31:48 +0000
@@ -44,7 +44,7 @@
 struct Main_Menu_New_Random_Map : public UI::Window {
 	Main_Menu_New_Random_Map(Editor_Interactive &);
 
-	enum {
+	typedef enum {
 		MAP_W_PLUS,
 		MAP_W_MINUS,
 		MAP_H_PLUS,
@@ -60,15 +60,15 @@
 		SWITCH_ISLAND_MODE,
 		SWITCH_RES,
 		SWITCH_WORLD
-	};
+	} ButtonID;
 
 private:
 	UI::Textarea * m_width, * m_height, * m_land;
 	UI::Textarea * m_water, * m_mountains, * m_wasteland, * m_players;
-	UI::Callback_IDButton<Main_Menu_New_Random_Map, int32_t> * m_res;
-	UI::Callback_IDButton<Main_Menu_New_Random_Map, int32_t> * m_world;
+	UI::Callback_Button * m_res;
+	UI::Callback_Button * m_world;
 	UI::Checkbox * m_island_mode;
-	UI::Callback_Button<Main_Menu_New_Random_Map>* m_goButton;
+	UI::Callback_Button* m_goButton;
 	int32_t m_w, m_h, m_landval, m_waterval, m_wastelandval;
 	uint8_t m_pn;
 	uint32_t m_mapNumber;
@@ -80,7 +80,7 @@
 	UI::EditBox * m_nrEditbox;
 	UI::EditBox * m_idEditbox;
 
-	void button_clicked(int32_t);
+	void button_clicked(ButtonID);
 	void clicked_create_map();
 	void id_edit_box_changed();
 	void nr_edit_box_changed();

=== modified file 'src/editor/ui_menus/editor_main_menu_save_map.cc'
--- src/editor/ui_menus/editor_main_menu_save_map.cc	2010-06-05 17:45:39 +0000
+++ src/editor/ui_menus/editor_main_menu_save_map.cc	2010-10-18 21:31:48 +0000
@@ -128,25 +128,25 @@
 	posx = 5;
 	posy = get_inner_h() - 30;
 
-	m_ok_btn = new UI::Callback_Button<Main_Menu_Save_Map>
+	m_ok_btn = new UI::Callback_Button
 		(this, "ok",
 		 get_inner_w() / 2 - spacing - 80, posy, 80, 20,
 		 g_gr->get_picture(PicMod_UI, "pics/but0.png"),
-		 &Main_Menu_Save_Map::clicked_ok, *this,
+		 boost::bind(&Main_Menu_Save_Map::clicked_ok, boost::ref(*this)),
 		 _("OK"));
 
-	new UI::Callback_Button<Main_Menu_Save_Map>
+	new UI::Callback_Button
 		(this, "cancel",
 		 get_inner_w() / 2 + spacing, posy, 80, 20,
 		 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
-		 &Main_Menu_Save_Map::die, *this,
+		 boost::bind(&Main_Menu_Save_Map::die, boost::ref(*this)),
 		 _("Cancel"));
 
-	new UI::Callback_Button<Main_Menu_Save_Map>
+	new UI::Callback_Button
 		(this, "make_directory",
 		 spacing, posy, 120, 20,
 		 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
-		 &Main_Menu_Save_Map::clicked_make_directory, *this,
+		 boost::bind(&Main_Menu_Save_Map::clicked_make_directory, boost::ref(*this)),
 		 _("Make Directory"));
 
 

=== modified file 'src/editor/ui_menus/editor_main_menu_save_map.h'
--- src/editor/ui_menus/editor_main_menu_save_map.h	2009-11-01 17:21:28 +0000
+++ src/editor/ui_menus/editor_main_menu_save_map.h	2010-10-18 21:31:48 +0000
@@ -26,7 +26,7 @@
 
 struct Editor_Interactive;
 namespace UI {
-template <typename T> struct Callback_Button;
+struct Callback_Button;
 struct EditBox;
 template <typename T> struct Listselect;
 struct Multiline_Textarea;
@@ -54,7 +54,7 @@
 	UI::Textarea * m_name, * m_author, * m_size, * m_world, * m_nrplayers;
 	UI::Multiline_Textarea * m_descr;
 	UI::Listselect<const char *> * m_ls;
-	UI::Callback_Button<Main_Menu_Save_Map> * m_ok_btn;
+	UI::Callback_Button * m_ok_btn;
 
 	std::string   m_basedir;
 	std::string   m_curdir;

=== modified file 'src/editor/ui_menus/editor_main_menu_save_map_make_directory.cc'
--- src/editor/ui_menus/editor_main_menu_save_map_make_directory.cc	2010-04-24 20:03:07 +0000
+++ src/editor/ui_menus/editor_main_menu_save_map_make_directory.cc	2010-10-18 21:31:48 +0000
@@ -53,20 +53,20 @@
 	posy = get_inner_h() - 30;
 
 	m_ok_button = new
-		UI::Callback_IDButton<Main_Menu_Save_Map_Make_Directory, int32_t>
+		UI::Callback_Button
 		(this, "ok",
 		 get_inner_w() / 2 - spacing - 80, posy, 80, 20,
 		 g_gr->get_picture(PicMod_UI, "pics/but0.png"),
-		 &Main_Menu_Save_Map_Make_Directory::end_modal, *this, 1,
+		 boost::bind(&Main_Menu_Save_Map_Make_Directory::end_modal, boost::ref(*this), 1),
 		 _("OK"),
 		 std::string(),
 		 m_dirname.size());
 
-	new UI::Callback_IDButton<Main_Menu_Save_Map_Make_Directory, int32_t>
+	new UI::Callback_Button
 		(this, "cancel",
 		 get_inner_w() / 2 + spacing, posy, 80, 20,
 		 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
-		 &Main_Menu_Save_Map_Make_Directory::end_modal, *this, 0,
+		 boost::bind(&Main_Menu_Save_Map_Make_Directory::end_modal, boost::ref(*this), 0),
 		 _("Cancel"));
 
 	center_to_parent();

=== modified file 'src/editor/ui_menus/editor_main_menu_save_map_make_directory.h'
--- src/editor/ui_menus/editor_main_menu_save_map_make_directory.h	2009-11-30 21:33:46 +0000
+++ src/editor/ui_menus/editor_main_menu_save_map_make_directory.h	2010-10-18 21:31:48 +0000
@@ -27,7 +27,7 @@
 
 namespace UI {
 struct EditBox;
-template <typename T, typename ID> struct Callback_IDButton;
+struct Callback_Button;
 }
 
 /**
@@ -42,10 +42,9 @@
 	char const * get_dirname() {return m_dirname.c_str();}
 
 private:
-	std::string                                                m_dirname;
-	UI::EditBox                                              * m_edit;
-	UI::Callback_IDButton<Main_Menu_Save_Map_Make_Directory, int32_t> *
-		m_ok_button;
+	std::string               m_dirname;
+	UI::EditBox             * m_edit;
+	UI::Callback_Button * m_ok_button;
 	void edit_changed();
 };
 

=== modified file 'src/editor/ui_menus/editor_player_menu.cc'
--- src/editor/ui_menus/editor_player_menu.cc	2010-09-22 21:48:29 +0000
+++ src/editor/ui_menus/editor_player_menu.cc	2010-10-18 21:31:48 +0000
@@ -45,7 +45,7 @@
 		 5, 5, 20, 20,
 		 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
 		 g_gr->get_picture(PicMod_UI, "pics/scrollbar_up.png"),
-		 &Editor_Player_Menu::clicked_add_player, *this,
+		 boost::bind(&Editor_Player_Menu::clicked_add_player, boost::ref(*this)),
 		 _("Add player"),
 		 parent.egbase().map().get_nrplayers() < MAX_PLAYERS),
 	m_remove_last_player
@@ -53,7 +53,7 @@
 		 get_inner_w() - 5 - 20, 5, 20, 20,
 		 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
 		 g_gr->get_picture(PicMod_UI, "pics/scrollbar_down.png"),
-		 &Editor_Player_Menu::clicked_remove_last_player, *this,
+		 boost::bind(&Editor_Player_Menu::clicked_remove_last_player, boost::ref(*this)),
 		 _("Remove last player"),
 		 1 < parent.egbase().map().get_nrplayers())
 {
@@ -147,12 +147,11 @@
 
 		if (!m_plr_set_tribes_buts[p - 1]) {
 			m_plr_set_tribes_buts[p - 1] =
-				new UI::Callback_IDButton
-				<Editor_Player_Menu, Widelands::Player_Number const>
+				new UI::Callback_Button
 					(this, "tribe",
 					 posx, posy, 140, size,
 					 g_gr->get_picture(PicMod_UI, "pics/but0.png"),
-					 &Editor_Player_Menu::player_tribe_clicked, *this, p - 1,
+					 boost::bind(&Editor_Player_Menu::player_tribe_clicked, boost::ref(*this), p - 1),
 					 std::string());
 			posx += 140 + spacing;
 		}
@@ -173,13 +172,12 @@
 		//  Set Starting pos button.
 		if (!m_plr_set_pos_buts[p - 1]) {
 			m_plr_set_pos_buts[p - 1] =
-				new UI::Callback_IDButton
-				<Editor_Player_Menu, Widelands::Player_Number const>
+				new UI::Callback_Button
 					(this, "starting_pos",
 					 posx, posy, size, size,
 					 g_gr->get_picture(PicMod_UI, "pics/but0.png"),
 					 g_gr->get_no_picture(), //  set below
-					 &Editor_Player_Menu::set_starting_pos_clicked, *this, p,
+					 boost::bind(&Editor_Player_Menu::set_starting_pos_clicked, boost::ref(*this), p),
 					 std::string());
 			posx += size + spacing;
 		}
@@ -193,13 +191,12 @@
 		// Still disabled at the moment.
       // if(!m_plr_make_infrastructure_buts[p - 1]) {
       //                   m_plr_make_infrastructure_buts[p - 1] =
-      //                           new UI::Callback_IDButton
-      //                           <Editor_Player_Menu, Widelands::Player_Number const>
+      //                           new UI::Callback_Button
       //                                   (this, "build_infrastructure",
       //                                    posx, posy, size, size,
       //                                    g_gr->get_picture(PicMod_UI, "pics/but0.png"),
       //                                    g_gr->get_no_picture(), //  set below
-      //                                    &Editor_Player_Menu::make_infrastructure_clicked, *this, p,
+      //                                    boost::bind(&Editor_Player_Menu::make_infrastructure_clicked, boost::ref(*this), p),
       //                                    std::string());
       //                                    // _("I"), //  SirVer, TODO come up with a picture for this
       //                                    // _("Make infrastructure"));

=== modified file 'src/editor/ui_menus/editor_player_menu.h'
--- src/editor/ui_menus/editor_player_menu.h	2010-04-10 11:17:21 +0000
+++ src/editor/ui_menus/editor_player_menu.h	2010-10-18 21:31:48 +0000
@@ -35,7 +35,7 @@
 namespace UI {
 struct Textarea;
 struct EditBox;
-template <typename T, typename ID> struct Callback_IDButton;
+struct Callback_Button;
 }
 
 struct Editor_Player_Menu : public UI::UniqueWindow {
@@ -47,9 +47,9 @@
 	UI::UniqueWindow::Registry m_allow_buildings_menu;
 	UI::Textarea * m_nr_of_players_ta;
 	UI::EditBox * m_plr_names[MAX_PLAYERS];
-	UI::Callback_Button<Editor_Player_Menu>
+	UI::Callback_Button
 		m_add_player, m_remove_last_player;
-	UI::Callback_IDButton<Editor_Player_Menu, Widelands::Player_Number const>
+	UI::Callback_Button
 		* m_plr_make_infrastructure_buts[MAX_PLAYERS],
 		* m_plr_set_pos_buts            [MAX_PLAYERS],
 		* m_plr_set_tribes_buts         [MAX_PLAYERS];

=== modified file 'src/editor/ui_menus/editor_player_menu_allowed_buildings_menu.cc'
--- src/editor/ui_menus/editor_player_menu_allowed_buildings_menu.cc	2010-04-24 20:03:07 +0000
+++ src/editor/ui_menus/editor_player_menu_allowed_buildings_menu.cc	2010-10-18 21:31:48 +0000
@@ -80,7 +80,7 @@
 		 + (list_height - middle_button_height * 2 - vspacing) / 2,
 		 middle_button_width, middle_button_height,
 		 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
-		 &Editor_Player_Menu_Allowed_Buildings_Menu::clicked, *this, false,
+		 boost::bind(&Editor_Player_Menu_Allowed_Buildings_Menu::clicked, boost::ref(*this), false),
 		 ("->"),
 		 _("Forbid"),
 		 false),
@@ -90,7 +90,7 @@
 		 m_forbid_button.get_y() + middle_button_height + vspacing,
 		 middle_button_width, middle_button_height,
 		 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
-		 &Editor_Player_Menu_Allowed_Buildings_Menu::clicked, *this, true,
+		 boost::bind(&Editor_Player_Menu_Allowed_Buildings_Menu::clicked, boost::ref(*this), true),
 		 _("<-"),
 		 _("Allow"),
 		 false)

=== modified file 'src/editor/ui_menus/editor_player_menu_allowed_buildings_menu.h'
--- src/editor/ui_menus/editor_player_menu_allowed_buildings_menu.h	2009-11-22 23:03:13 +0000
+++ src/editor/ui_menus/editor_player_menu_allowed_buildings_menu.h	2010-10-18 21:31:48 +0000
@@ -43,8 +43,7 @@
 	Widelands::Player & m_player;
 	UI::Textarea              m_allowed_label, m_forbidden_label;
 	UI::Listselect<Widelands::Building_Index> m_allowed, m_forbidden;
-	UI::Callback_IDButton<Editor_Player_Menu_Allowed_Buildings_Menu, bool const>
-		m_forbid_button, m_allow_button;
+	UI::Callback_Button   m_forbid_button, m_allow_button;
 	void allowed_selected        (uint32_t);
 	void forbidden_selected      (uint32_t);
 	void allowed_double_clicked  (uint32_t);

=== modified file 'src/editor/ui_menus/editor_tool_change_height_options_menu.cc'
--- src/editor/ui_menus/editor_tool_change_height_options_menu.cc	2010-04-14 14:09:12 +0000
+++ src/editor/ui_menus/editor_tool_change_height_options_menu.cc	2010-10-18 21:31:48 +0000
@@ -50,8 +50,7 @@
 		 width, height,
 		 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
 		 g_gr->get_picture(PicMod_UI, "pics/scrollbar_up.png"),
-		 &Editor_Tool_Change_Height_Options_Menu::clicked_change_by_increment,
-		 *this,
+		 boost::bind(&Editor_Tool_Change_Height_Options_Menu::clicked_change_by_increment, boost::ref(*this)),
 		 std::string(),
 		 increase_tool.get_change_by() < MAX_FIELD_HEIGHT_DIFF),
 	m_change_by_decrease
@@ -60,8 +59,7 @@
 		 width, height,
 		 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
 		 g_gr->get_picture(PicMod_UI, "pics/scrollbar_down.png"),
-		 &Editor_Tool_Change_Height_Options_Menu::clicked_change_by_decrement,
-		 *this,
+		 boost::bind(&Editor_Tool_Change_Height_Options_Menu::clicked_change_by_decrement, boost::ref(*this)),
 		 std::string(),
 		 1 < increase_tool.get_change_by()),
 	m_change_by_value
@@ -88,7 +86,7 @@
 		 width, height,
 		 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
 		 g_gr->get_picture(PicMod_UI, "pics/scrollbar_up.png"),
-		 &Editor_Tool_Change_Height_Options_Menu::clicked_setto_increment, *this,
+		 boost::bind(&Editor_Tool_Change_Height_Options_Menu::clicked_setto_increment, boost::ref(*this)),
 		 std::string(),
 		 increase_tool.set_tool().get_interval().min < MAX_FIELD_HEIGHT),
 	m_set_to_decrease
@@ -96,7 +94,7 @@
 		 m_change_by_decrease.get_x(), m_set_to_increase.get_y(), width, height,
 		 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
 		 g_gr->get_picture(PicMod_UI, "pics/scrollbar_down.png"),
-		 &Editor_Tool_Change_Height_Options_Menu::clicked_setto_decrement, *this,
+		 boost::bind(&Editor_Tool_Change_Height_Options_Menu::clicked_setto_decrement, boost::ref(*this)),
 		 std::string(),
 		 0 < increase_tool.set_tool().get_interval().min),
 	m_set_to_value

=== modified file 'src/editor/ui_menus/editor_tool_change_height_options_menu.h'
--- src/editor/ui_menus/editor_tool_change_height_options_menu.h	2009-05-06 20:54:01 +0000
+++ src/editor/ui_menus/editor_tool_change_height_options_menu.h	2010-10-18 21:31:48 +0000
@@ -39,12 +39,10 @@
 private:
 	Editor_Increase_Height_Tool & m_increase_tool;
 	UI::Textarea                  m_change_by_label;
-	UI::Callback_Button<Editor_Tool_Change_Height_Options_Menu>
-		m_change_by_increase, m_change_by_decrease;
+	UI::Callback_Button       m_change_by_increase, m_change_by_decrease;
 	UI::Textarea                  m_change_by_value;
 	UI::Textarea                  m_set_to_label;
-	UI::Callback_Button<Editor_Tool_Change_Height_Options_Menu>
-		m_set_to_increase,     m_set_to_decrease;
+	UI::Callback_Button       m_set_to_increase, m_set_to_decrease;
 	UI::Textarea                  m_set_to_value;
 
 	void clicked_change_by_decrement();

=== modified file 'src/editor/ui_menus/editor_tool_change_resources_options_menu.cc'
--- src/editor/ui_menus/editor_tool_change_resources_options_menu.cc	2010-04-14 14:09:12 +0000
+++ src/editor/ui_menus/editor_tool_change_resources_options_menu.cc	2010-10-18 21:31:48 +0000
@@ -53,16 +53,14 @@
 		 width, height,
 		 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
 		 g_gr->get_picture(PicMod_Game, "pics/scrollbar_up.png"),
-		 &Editor_Tool_Change_Resources_Options_Menu::clicked_button,
-		 *this, Change_By_Increase),
+		 boost::bind(&Editor_Tool_Change_Resources_Options_Menu::clicked_button, boost::ref(*this), Change_By_Increase)),
 	m_change_by_decrease
 		(this, "decr_change_by",
 		 get_inner_w() - hmargin() - width, m_change_by_increase.get_y(),
 		 width, height,
 		 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
 		 g_gr->get_picture(PicMod_Game, "pics/scrollbar_down.png"),
-		 &Editor_Tool_Change_Resources_Options_Menu::clicked_button,
-		 *this, Change_By_Decrease),
+		 boost::bind(&Editor_Tool_Change_Resources_Options_Menu::clicked_button, boost::ref(*this), Change_By_Decrease)),
 	m_change_by_value
 		(this,
 		 m_change_by_increase.get_x() + m_change_by_increase.get_w() +
@@ -86,15 +84,13 @@
 		 width, height,
 		 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
 		 g_gr->get_picture(PicMod_Game, "pics/scrollbar_up.png"),
-		 &Editor_Tool_Change_Resources_Options_Menu::clicked_button,
-		 *this, Set_To_Increase),
+		 boost::bind(&Editor_Tool_Change_Resources_Options_Menu::clicked_button, boost::ref(*this), Set_To_Increase)),
 	m_set_to_decrease
 		(this, "decr_set_to",
 		 m_change_by_decrease.get_x(), m_set_to_increase.get_y(), width, height,
 		 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
 		 g_gr->get_picture(PicMod_Game, "pics/scrollbar_down.png"),
-		 &Editor_Tool_Change_Resources_Options_Menu::clicked_button,
-		 *this, Set_To_Decrease),
+		 boost::bind(&Editor_Tool_Change_Resources_Options_Menu::clicked_button, boost::ref(*this), Set_To_Decrease)),
 	m_set_to_value
 		(this,
 		 m_change_by_value.get_x(), m_set_to_increase.get_y(),

=== modified file 'src/editor/ui_menus/editor_tool_change_resources_options_menu.h'
--- src/editor/ui_menus/editor_tool_change_resources_options_menu.h	2009-05-06 20:54:01 +0000
+++ src/editor/ui_menus/editor_tool_change_resources_options_menu.h	2010-10-18 21:31:48 +0000
@@ -46,14 +46,10 @@
 	void clicked_button(Button);
 	void update();
 	UI::Textarea                     m_change_by_label;
-	UI::Callback_IDButton
-		<Editor_Tool_Change_Resources_Options_Menu, Button const>
-		m_change_by_increase, m_change_by_decrease;
+	UI::Callback_Button          m_change_by_increase, m_change_by_decrease;
 	UI::Textarea                     m_change_by_value;
 	UI::Textarea                     m_set_to_label;
-	UI::Callback_IDButton
-		<Editor_Tool_Change_Resources_Options_Menu, Button const>
-		m_set_to_increase,    m_set_to_decrease;
+	UI::Callback_Button          m_set_to_increase,    m_set_to_decrease;
 	UI::Textarea                     m_set_to_value;
 	UI::Textarea                     m_cur_selection;
 	UI::Radiogroup m_radiogroup;

=== modified file 'src/editor/ui_menus/editor_tool_noise_height_options_menu.cc'
--- src/editor/ui_menus/editor_tool_noise_height_options_menu.cc	2010-04-14 14:09:12 +0000
+++ src/editor/ui_menus/editor_tool_noise_height_options_menu.cc	2010-10-18 21:31:48 +0000
@@ -59,7 +59,7 @@
 		 width, height,
 		 g_gr->get_picture(PicMod_UI, "pics/but0.png"),
 		 g_gr->get_picture(PicMod_UI, "pics/scrollbar_up.png"),
-		 &Editor_Tool_Noise_Height_Options_Menu::clicked_lower_increase, *this,
+		 boost::bind(&Editor_Tool_Noise_Height_Options_Menu::clicked_lower_increase, boost::ref(*this)),
 		 std::string(),
 		 noise_tool.get_interval().min < MAX_FIELD_HEIGHT),
 	m_lower_decrease
@@ -69,7 +69,7 @@
 		 width, height,
 		 g_gr->get_picture(PicMod_UI, "pics/but0.png"),
 		 g_gr->get_picture(PicMod_UI, "pics/scrollbar_down.png"),
-		 &Editor_Tool_Noise_Height_Options_Menu::clicked_lower_decrease, *this,
+		 boost::bind(&Editor_Tool_Noise_Height_Options_Menu::clicked_lower_decrease, boost::ref(*this)),
 		 std::string(),
 		 0 < noise_tool.get_interval().min),
 	m_upper_increase
@@ -82,7 +82,7 @@
 		 width, height,
 		 g_gr->get_picture(PicMod_UI, "pics/but0.png"),
 		 g_gr->get_picture(PicMod_UI, "pics/scrollbar_up.png"),
-		 &Editor_Tool_Noise_Height_Options_Menu::clicked_upper_increase, *this,
+		 boost::bind(&Editor_Tool_Noise_Height_Options_Menu::clicked_upper_increase, boost::ref(*this)),
 		 std::string(),
 		 noise_tool.get_interval().max < MAX_FIELD_HEIGHT),
 	m_upper_decrease
@@ -92,7 +92,7 @@
 		 width, height,
 		 g_gr->get_picture(PicMod_UI, "pics/but0.png"),
 		 g_gr->get_picture(PicMod_Game, "pics/scrollbar_down.png"),
-		 &Editor_Tool_Noise_Height_Options_Menu::clicked_upper_decrease, *this,
+		 boost::bind(&Editor_Tool_Noise_Height_Options_Menu::clicked_upper_decrease, boost::ref(*this)),
 		 std::string(),
 		 0 < noise_tool.get_interval().max),
 	m_set_label
@@ -108,7 +108,7 @@
 		 width, height,
 		 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
 		 g_gr->get_picture(PicMod_Game, "pics/scrollbar_up.png"),
-		 &Editor_Tool_Noise_Height_Options_Menu::clicked_setto_increase, *this,
+		 boost::bind(&Editor_Tool_Noise_Height_Options_Menu::clicked_setto_increase, boost::ref(*this)),
 		 std::string(),
 		 noise_tool.set_tool().get_interval().max < MAX_FIELD_HEIGHT),
 	m_setto_decrease
@@ -116,7 +116,7 @@
 		 get_inner_w() / 2, m_setto_increase.get_y(), width, height,
 		 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
 		 g_gr->get_picture(PicMod_Game, "pics/scrollbar_down.png"),
-		 &Editor_Tool_Noise_Height_Options_Menu::clicked_setto_decrease, *this,
+		 boost::bind(&Editor_Tool_Noise_Height_Options_Menu::clicked_setto_decrease, boost::ref(*this)),
 		 std::string(),
 		 0 < noise_tool.set_tool().get_interval().min)
 {

=== modified file 'src/editor/ui_menus/editor_tool_noise_height_options_menu.h'
--- src/editor/ui_menus/editor_tool_noise_height_options_menu.h	2009-05-06 20:54:01 +0000
+++ src/editor/ui_menus/editor_tool_noise_height_options_menu.h	2010-10-18 21:31:48 +0000
@@ -37,11 +37,10 @@
 private:
 	Editor_Noise_Height_Tool & m_noise_tool;
 	UI::Textarea m_lower_label, m_upper_label;
-	UI::Callback_Button<Editor_Tool_Noise_Height_Options_Menu>
-		m_lower_increase, m_lower_decrease, m_upper_increase, m_upper_decrease;
+	UI::Callback_Button
+		m_lower_increase, m_lower_decrease, m_upper_increase, m_upper_decrease,
+		m_setto_increase, m_setto_decrease;
 	UI::Textarea m_set_label;
-	UI::Callback_Button<Editor_Tool_Noise_Height_Options_Menu>
-		m_setto_increase, m_setto_decrease;
 
 	void clicked_lower_decrease();
 	void clicked_lower_increase();

=== modified file 'src/editor/ui_menus/editor_toolsize_menu.cc'
--- src/editor/ui_menus/editor_toolsize_menu.cc	2010-04-24 20:03:07 +0000
+++ src/editor/ui_menus/editor_toolsize_menu.cc	2010-10-18 21:31:48 +0000
@@ -44,7 +44,7 @@
 		 60, 25, 20, 20,
 		 g_gr->get_picture(PicMod_UI, "pics/but0.png"),
 		 g_gr->get_picture(PicMod_Game, "pics/scrollbar_up.png"),
-		 &Editor_Toolsize_Menu::increase_radius, *this,
+		 boost::bind(&Editor_Toolsize_Menu::increase_radius, boost::ref(*this)),
 		 std::string(),
 		 parent.get_sel_radius() < MAX_TOOL_AREA),
 	m_decrease
@@ -52,7 +52,7 @@
 		 80, 25, 20, 20,
 		 g_gr->get_picture(PicMod_UI, "pics/but0.png"),
 		 g_gr->get_picture(PicMod_Game, "pics/scrollbar_down.png"),
-		 &Editor_Toolsize_Menu::decrease_radius, *this,
+		 boost::bind(&Editor_Toolsize_Menu::decrease_radius, boost::ref(*this)),
 		 std::string(),
 		 0 < parent.get_sel_radius())
 {

=== modified file 'src/editor/ui_menus/editor_toolsize_menu.h'
--- src/editor/ui_menus/editor_toolsize_menu.h	2009-11-01 07:13:59 +0000
+++ src/editor/ui_menus/editor_toolsize_menu.h	2010-10-18 21:31:48 +0000
@@ -39,7 +39,7 @@
 	void increase_radius();
 
 	UI::Textarea                                   m_textarea;
-	UI::Callback_Button<Editor_Toolsize_Menu> m_increase, m_decrease;
+	UI::Callback_Button m_increase, m_decrease;
 };
 
 

=== modified file 'src/ui_basic/button.cc'
--- src/ui_basic/button.cc	2010-06-16 18:43:40 +0000
+++ src/ui_basic/button.cc	2010-10-18 21:31:48 +0000
@@ -43,6 +43,7 @@
 	NamedPanel           (parent, name, x, y, w, h, tooltip_text),
 	m_highlighted   (false),
 	m_pressed       (false),
+	m_permpressed   (false),
 	m_enabled       (_enabled),
 	m_repeating     (false),
 	m_flat          (flat),
@@ -75,6 +76,7 @@
 	NamedPanel      (parent, name, x, y, w, h, tooltip_text),
 	m_highlighted   (false),
 	m_pressed       (false),
+	m_permpressed   (false),
 	m_enabled       (_enabled),
 	m_repeating     (false),
 	m_flat          (flat),
@@ -248,11 +250,15 @@
 	//  stays pressed when it is pressed once
 	RGBAColor black(0, 0, 0, 255);
 
+	// m_permpressed is true, we invert the behaviour on m_pressed
+	bool draw_pressed = m_permpressed ? not (m_pressed and m_highlighted)
+	                                  :     (m_pressed and m_highlighted);
+
 	if (not m_flat) {
 		assert(2 <= get_w());
 		assert(2 <= get_h());
 		//  button is a normal one, not flat
-		if (not m_pressed or not m_highlighted) {
+		if (not draw_pressed) {
 			//  top edge
 			dst->brighten_rect
 				(Rect(Point(0, 0), get_w(), 2), BUTTON_EDGE_BRIGHT_FACTOR);
@@ -385,5 +391,12 @@
 	return true; // We handle this always by lighting up
 }
 
+void Button::set_perm_pressed(bool state) {
+	if (state != m_permpressed) {
+		m_permpressed = state;
+		m_needredraw = true;
+		update();
+	}
+}
 
 }

=== modified file 'src/ui_basic/button.h'
--- src/ui_basic/button.h	2010-05-17 10:21:20 +0000
+++ src/ui_basic/button.h	2010-10-18 21:31:48 +0000
@@ -20,6 +20,9 @@
 #ifndef UI_BUTTON_H
 #define UI_BUTTON_H
 
+#include <boost/bind.hpp>
+#include <boost/function.hpp>
+
 #include "constants.h"
 #include "panel.h"
 #include "m_signal.h"
@@ -82,12 +85,15 @@
 	bool handle_mousepress  (Uint8 btn, int32_t x, int32_t y);
 	bool handle_mouserelease(Uint8 btn, int32_t x, int32_t y);
 	bool handle_mousemove(const Uint8, int32_t, int32_t, int32_t, int32_t);
+	
+	void set_perm_pressed(bool state); // Set the permanently pressed state of the button
 
-private:
+protected:
 	virtual void clicked() = 0; /// Override this to react on the click.
 
 	bool        m_highlighted;    //  mouse is over the button
-	bool        m_pressed;
+	bool        m_pressed;        //  mouse is clicked over the button
+	bool        m_permpressed;    //  button should appear  pressed
 	bool        m_enabled;
 	bool        m_repeating;
 	bool        m_flat;
@@ -110,17 +116,14 @@
 };
 
 
-/// A compatibility/convenience version of Button. Overrides void clicked()
-/// with a function that calls a given callback function (nonstatic member of
-/// T), with the given instance of T as its only parameter.
-template <typename T> struct Callback_Button : public Button {
+/// A verion of Button that uses a function object to the the callback.
+struct Callback_Button : public Button {
 	Callback_Button /// for textual buttons
 		(Panel * const parent,
 		 std::string const & name,
 		 const int32_t x, const int32_t y, const uint32_t w, const uint32_t h,
 		 const PictureID background_pictute_id,
-		 void (T::*callback_function)(),
-		 T & callback_argument_this,
+		 boost::function<void()> callback_function,
 		 const std::string & title_text,
 		 std::string const & tooltip_text = std::string(),
 		 bool const _enabled = true,
@@ -137,8 +140,7 @@
 			 _enabled, flat,
 			 fontname,
 			 fontsize),
-		_callback_function     (callback_function),
-		_callback_argument_this(callback_argument_this)
+		_callback_function     (callback_function)
 	{}
 	Callback_Button /// for pictorial buttons
 		(Panel * const parent,
@@ -146,105 +148,28 @@
 		 const int32_t x, const int32_t y, const uint32_t w, const uint32_t h,
 		 const PictureID background_pictute_id,
 		 const PictureID foreground_picture_id,
-		 void (T::*callback_function)(),
-		 T & callback_argument_this,
-		 std::string const & tooltip_text = std::string(),
-		 bool const _enabled = true,
-		 bool const flat     = false,
-		 const std::string & fontname = UI_FONT_NAME,
-		 const uint32_t      fontsize = UI_FONT_SIZE_SMALL)
-		:
-		Button
-			(parent, name,
-			 x, y, w, h,
-			 background_pictute_id,
-			 foreground_picture_id,
-			 tooltip_text,
-			 _enabled, flat,
-			 fontname,
-			 fontsize),
-		_callback_function     (callback_function),
-		_callback_argument_this(callback_argument_this)
-	{}
-
-protected:
-	void (T::*_callback_function)();
-	T & _callback_argument_this;
-	void clicked() {(_callback_argument_this.*_callback_function)();}
-};
-
-/**
- * A button that calls a callback function with 2 argument when pressed. The
- * second argument is the so called 'id'.
- *
- * T is the type of the target of the 'this' argument of the callback function.
- * ID is the type of the 'id' argument of the callback function.
- */
-template <typename T, typename ID> struct Callback_IDButton : public Button {
-	Callback_IDButton /// for textual buttons
-		(Panel * const parent,
-		 std::string const & name,
-		 const int32_t x, const int32_t y, const uint32_t w, const uint32_t h,
-		 const PictureID background_pictute_id,
-		 void (T::*callback_function)(ID),
-		 T & callback_argument_this,
-		 const ID callback_argument_id,
-		 const std::string & title_text,
-		 std::string const & tooltip_text = std::string(),
-		 bool const _enabled = true,
-		 bool const flat     = false,
-		 const std::string & fontname = UI_FONT_NAME,
-		 const uint32_t      fontsize = UI_FONT_SIZE_SMALL)
-		:
-		Button
-			(parent, name,
-			 x, y, w, h,
-			 background_pictute_id,
-			 title_text,
-			 tooltip_text,
-			 _enabled, flat,
-			 fontname,
-			 fontsize),
-		_callback_function     (callback_function),
-		_callback_argument_this(callback_argument_this),
-		_callback_argument_id  (callback_argument_id)
-	{}
-	Callback_IDButton /// for pictorial buttons
-		(Panel * const parent,
-		 std::string const & name,
-		 const int32_t x, const int32_t y, const uint32_t w, const uint32_t h,
-		 const PictureID background_pictute_id,
-		 const PictureID foreground_picture_id,
-		 void (T::*callback_function)(ID),
-		 T & callback_argument_this,
-		 const ID callback_argument_id,
-		 std::string const & tooltip_text = std::string(),
-		 bool const _enabled = true,
-		 bool const flat     = false,
-		 const std::string & fontname = UI_FONT_NAME,
-		 const uint32_t      fontsize = UI_FONT_SIZE_SMALL)
-		:
-		Button
-			(parent, name,
-			 x, y, w, h,
-			 background_pictute_id,
-			 foreground_picture_id,
-			 tooltip_text,
-			 _enabled, flat,
-			 fontname,
-			 fontsize),
-		_callback_function     (callback_function),
-		_callback_argument_this(callback_argument_this),
-		_callback_argument_id  (callback_argument_id)
-	{}
-
-protected:
-	void (T::*_callback_function)(ID);
-	T & _callback_argument_this;
-	const ID _callback_argument_id;
-	void clicked() {
-		(_callback_argument_this.*_callback_function)(_callback_argument_id);
-	}
+		 boost::function<void()> callback_function,
+		 std::string const & tooltip_text = std::string(),
+		 bool const _enabled = true,
+		 bool const flat     = false,
+		 const std::string & fontname = UI_FONT_NAME,
+		 const uint32_t      fontsize = UI_FONT_SIZE_SMALL)
+		:
+		Button
+			(parent, name,
+			 x, y, w, h,
+			 background_pictute_id,
+			 foreground_picture_id,
+			 tooltip_text,
+			 _enabled, flat,
+			 fontname,
+			 fontsize),
+		_callback_function     (callback_function)
+	{}
+
+protected:
+	boost::function<void()> _callback_function;
+	void clicked() {_callback_function();}
 };
 
 }

=== modified file 'src/ui_basic/icongrid.cc'
--- src/ui_basic/icongrid.cc	2010-06-16 18:43:40 +0000
+++ src/ui_basic/icongrid.cc	2010-10-18 21:31:48 +0000
@@ -30,7 +30,7 @@
 
 namespace UI {
 
-struct IconGridButton : public Callback_IDButton<Icon_Grid, uint32_t> {
+struct IconGridButton : public Callback_Button {
 	IconGridButton
 		(Icon_Grid * const parent,
 		 std::string const & name,
@@ -38,21 +38,24 @@
 		 const PictureID background_pictute_id,
 		 const PictureID foreground_picture_id,
 		 void (Icon_Grid::*callback_function)(uint32_t),
-	    Icon_Grid & callback_argument_this,
+	         Icon_Grid & callback_argument_this,
 		 const uint32_t callback_argument_id,
 		 Textarea * ta, std::string descr)
 		:
-		Callback_IDButton<Icon_Grid, uint32_t>
+		Callback_Button
 			(parent, name, x, y, w, h, background_pictute_id,
-			 foreground_picture_id, callback_function,
-			 callback_argument_this, callback_argument_id, "", true, true),
-			 m_icongrid(parent), m_ta(ta), m_descr(descr)
+			 foreground_picture_id,
+			 boost::bind(callback_function, boost::ref(callback_argument_this), callback_argument_id),
+			 "", true, true),
+			 m_icongrid(parent), m_ta(ta), m_descr(descr),
+			 _callback_argument_id(callback_argument_id)
 		{}
 
 private:
 	Icon_Grid * m_icongrid;
 	Textarea * m_ta;
 	std::string m_descr;
+	const uint32_t _callback_argument_id;
 
 	void handle_mousein(bool inside) {
 		if (inside) {
@@ -62,7 +65,7 @@
 			m_icongrid->mouseout.call(_callback_argument_id);
 			m_ta->set_text("");
 		}
-		Callback_IDButton<Icon_Grid, uint32_t>::handle_mousein(inside);
+		Callback_Button::handle_mousein(inside);
 	}
 };
 

=== modified file 'src/ui_basic/messagebox.cc'
--- src/ui_basic/messagebox.cc	2010-09-24 22:36:40 +0000
+++ src/ui_basic/messagebox.cc	2010-10-18 21:31:48 +0000
@@ -83,25 +83,25 @@
 	d->textarea->set_size(width - 10, height - 50);
 
 	if (type == OK) {
-		new Callback_Button<WLMessageBox>
+		new Callback_Button
 			(this, "ok",
 			 (get_inner_w() - 60) / 2, get_inner_h() - 30, 60, 20,
 			 g_gr->get_picture(PicMod_UI, "pics/but0.png"),
-			 &WLMessageBox::pressedOk, *this,
+			 boost::bind(&WLMessageBox::pressedOk, boost::ref(*this)),
 			 _("OK"));
 	} else if (type == YESNO) {
-		new Callback_Button<WLMessageBox>
+		new Callback_Button
 			(this, "yes",
 			 (get_inner_w() / 2 - 60) / 2, get_inner_h() - 30, 60, 20,
 			 g_gr->get_picture(PicMod_UI, "pics/but0.png"),
-			 &WLMessageBox::pressedYes, *this,
+			 boost::bind(&WLMessageBox::pressedYes, boost::ref(*this)),
 			 _("Yes"));
-		new Callback_Button<WLMessageBox>
+		new Callback_Button
 			(this, "no",
 			 (get_inner_w() / 2 - 60) / 2 + get_inner_w() / 2, get_inner_h() - 30,
 			 60, 20,
 			 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
-			 &WLMessageBox::pressedNo, *this,
+			 boost::bind(&WLMessageBox::pressedNo, boost::ref(*this)),
 			 _("No"));
 	}
 }

=== modified file 'src/ui_basic/spinbox.cc'
--- src/ui_basic/spinbox.cc	2010-04-14 14:09:12 +0000
+++ src/ui_basic/spinbox.cc	2010-10-18 21:31:48 +0000
@@ -64,10 +64,10 @@
 
 	/// The UI parts
 	Textarea * text;
-	Callback_IDButton<SpinBox, int32_t> * butPlus;
-	Callback_IDButton<SpinBox, int32_t> * butMinus;
-	Callback_IDButton<SpinBox, int32_t> * butTenPlus;
-	Callback_IDButton<SpinBox, int32_t> * butTenMinus;
+	Callback_Button * butPlus;
+	Callback_Button * butMinus;
+	Callback_Button * butTenPlus;
+	Callback_Button * butTenMinus;
 };
 
 /**
@@ -117,38 +117,38 @@
 		(this, butw * 16 / 5, 0, textw, h, buf, Align_Center);
 	sbi->text->set_font(sbi->fontname, sbi->fontsize, sbi->fontcolor);
 	sbi->butPlus =
-		new Callback_IDButton<SpinBox, int32_t>
+		new Callback_Button
 			(this, "+",
 			 butw * 21 / 10, 0, butw, butw,
 			 sbi->background,
-			 &SpinBox::changeValue, *this, 1,
+			 boost::bind(&SpinBox::changeValue, boost::ref(*this), 1),
 			 "+", _("Increase the value"),
 			 true, false, sbi->fontname, sbi->fontsize);
 	sbi->butMinus =
-		new Callback_IDButton<SpinBox, int32_t>
+		new Callback_Button
 			(this, "-",
 			 w - butw * 31 / 10, 0, butw, butw,
 			 sbi->background,
-			 &SpinBox::changeValue, *this, -1,
+			 boost::bind(&SpinBox::changeValue, boost::ref(*this), -1),
 			 "-", _("Decrease the value"),
 			 true, false, sbi->fontname, sbi->fontsize);
 	sbi->butPlus->set_repeating(true);
 	sbi->butMinus->set_repeating(true);
 	if (m_big) {
 		sbi->butTenPlus =
-			new Callback_IDButton<SpinBox, int32_t>
+			new Callback_Button
 				(this, "++",
 				 0, 0, butw * 2, butw,
 				 sbi->background,
-				 &SpinBox::changeValue, *this, 10,
+				 boost::bind(&SpinBox::changeValue, boost::ref(*this), 10),
 				 "++", _("Increase the value by 10"),
 				 true, false, sbi->fontname, sbi->fontsize);
 		sbi->butTenMinus =
-			new Callback_IDButton<SpinBox, int32_t>
+			new Callback_Button
 				(this, "--",
 				 w - 2 * butw, 0, butw * 2, butw,
 				 sbi->background,
-				 &SpinBox::changeValue, *this, -10,
+				 boost::bind(&SpinBox::changeValue, boost::ref(*this), -10),
 				 "--", _("Decrease the value by 10"),
 				 true, false, sbi->fontname, sbi->fontsize);
 		sbi->butTenPlus->set_repeating(true);

=== modified file 'src/ui_basic/table.cc'
--- src/ui_basic/table.cc	2010-06-16 18:43:40 +0000
+++ src/ui_basic/table.cc	2010-10-18 21:31:48 +0000
@@ -92,11 +92,11 @@
 		c.btn = 0;
 		if (title.size()) {
 			c.btn =
-				new Callback_IDButton<Table, Columns::size_type>
+				new Callback_Button
 					(this, title,
 					 complete_width, 0, width, m_headerheight,
 					 g_gr->get_picture(PicMod_UI, "pics/but3.png"),
-					 &Table::header_button_clicked, *this, m_columns.size(),
+					 boost::bind(&Table::header_button_clicked, boost::ref(*this), m_columns.size()),
 					 title, "", true, false, m_fontname, m_fontsize);
 		}
 		c.width = width;
@@ -140,11 +140,11 @@
 		for (uint8_t i = 0; i < col; ++i)
 			complete_width += m_columns.at(i).width;
 		column.btn =
-			new Callback_IDButton<Table, Columns::size_type>
+			new Callback_Button
 				(this, title,
 				 complete_width, 0, column.width, m_headerheight,
 				 g_gr->get_picture(PicMod_UI, "pics/but3.png"),
-				 &Table::header_button_clicked, *this, col,
+				 boost::bind(&Table::header_button_clicked, boost::ref(*this), col),
 				 title, "", true, false, m_fontname, m_fontsize);
 	} else if (column.btn and title.empty()) { //  had title before, not now
 		delete column.btn;

=== modified file 'src/ui_basic/table.h'
--- src/ui_basic/table.h	2010-04-27 13:00:38 +0000
+++ src/ui_basic/table.h	2010-10-18 21:31:48 +0000
@@ -33,7 +33,7 @@
 
 namespace UI {
 struct Scrollbar;
-template <typename T, typename ID> struct Callback_IDButton;
+struct Callback_Button;
 
 /// A table with columns and lines. The entries can be sorted by columns by
 /// clicking on the column header button.
@@ -246,7 +246,7 @@
 	struct Column;
 	typedef std::vector<Column> Columns;
 	struct Column {
-		Callback_IDButton<Table, Columns::size_type> * btn;
+		Callback_Button                 * btn;
 		uint32_t                              width;
 		Align                                 alignment;
 		bool                                           is_checkbox_column;

=== modified file 'src/ui_basic/unique_window.cc'
--- src/ui_basic/unique_window.cc	2010-04-24 20:03:07 +0000
+++ src/ui_basic/unique_window.cc	2010-10-18 21:31:48 +0000
@@ -28,6 +28,36 @@
 ==============================================================================
 */
 
+/**
+ * Creates the window, if it does not exist.
+*/
+void UniqueWindow::Registry::create() {
+	if (not window) {
+		constr(*this);
+	}
+}
+
+/**
+ * Destroys the window, if it eixsts.
+*/
+void UniqueWindow::Registry::destroy() {
+	if (window) {
+		delete window;
+	}
+}
+
+/**
+ * Either destroys or creates the window.
+*/
+void UniqueWindow::Registry::toggle() {
+	if (window) {
+		delete window;
+	} else {
+		constr(*this);
+	}
+}
+
+
 
 /**
  * In order to avoid dangling pointers, we need to kill our contained window
@@ -58,6 +88,9 @@
 			set_pos(Point(m_registry->x, m_registry->y));
 			m_usedefaultpos = false;
 		}
+		if (m_registry->onCreate) {
+			m_registry->onCreate();
+		}
 	}
 }
 
@@ -73,6 +106,10 @@
 		m_registry->window = 0;
 		m_registry->x = get_x();
 		m_registry->y = get_y();
+
+		if (m_registry->onDelete) {
+			m_registry->onDelete();
+		}
 	}
 }
 

=== modified file 'src/ui_basic/unique_window.h'
--- src/ui_basic/unique_window.h	2010-04-24 20:03:07 +0000
+++ src/ui_basic/unique_window.h	2010-10-18 21:31:48 +0000
@@ -21,6 +21,10 @@
 #define UI_UNIQUE_WINDOW_H
 
 #include "window.h"
+#include "button.h"
+
+#include <boost/function.hpp>
+
 
 namespace UI {
 struct Panel;
@@ -34,6 +38,14 @@
 
 	struct Registry {
 		UniqueWindow * window;
+		boost::function<void()> onCreate;
+		boost::function<void()> onDelete;
+		boost::function<void(Registry&)> constr;
+
+		void create();
+		void destroy();
+		void toggle();
+
 		int32_t x, y;
 
 		Registry() : window(0), x(-1), y(-1) {}

=== modified file 'src/ui_fsmenu/campaign_select.cc'
--- src/ui_fsmenu/campaign_select.cc	2010-04-14 14:09:12 +0000
+++ src/ui_fsmenu/campaign_select.cc	2010-10-18 21:31:48 +0000
@@ -70,14 +70,14 @@
 		(this, "ok",
 		 m_xres * 71 / 100, m_yres * 9 / 10, m_butw, m_buth,
 		 g_gr->get_picture(PicMod_UI, "pics/but2.png"),
-		 &Fullscreen_Menu_CampaignSelect::clicked_ok, *this,
+		 boost::bind(&Fullscreen_Menu_CampaignSelect::clicked_ok, boost::ref(*this)),
 		 _("OK"), std::string(), false, false,
 		 m_fn, m_fs),
 	back
 		(this, "back",
 		 m_xres * 71 / 100, m_yres * 17 / 20, m_butw, m_buth,
 		 g_gr->get_picture(PicMod_UI, "pics/but0.png"),
-		 &Fullscreen_Menu_CampaignSelect::end_modal, *this, 0,
+		 boost::bind(&Fullscreen_Menu_CampaignSelect::end_modal, boost::ref(*this), 0),
 		 _("Back"), std::string(), true, false,
 		 m_fn, m_fs),
 
@@ -279,14 +279,14 @@
 		(this, "ok",
 		 m_xres * 71 / 100, m_yres * 9 / 10, m_butw, m_buth,
 		 g_gr->get_picture(PicMod_UI, "pics/but2.png"),
-		 &Fullscreen_Menu_CampaignMapSelect::clicked_ok, *this,
+		 boost::bind(&Fullscreen_Menu_CampaignMapSelect::clicked_ok, boost::ref(*this)),
 		 _("OK"), std::string(), false, false,
 		 m_fn, m_fs),
 	back
 		(this, "back",
 		 m_xres * 71 / 100, m_yres * 17 / 20, m_butw, m_buth,
 		 g_gr->get_picture(PicMod_UI, "pics/but0.png"),
-		 &Fullscreen_Menu_CampaignMapSelect::end_modal, *this, 0,
+		 boost::bind(&Fullscreen_Menu_CampaignMapSelect::end_modal, boost::ref(*this), 0),
 		 _("Back"), std::string(), true, false,
 		 m_fn, m_fs),
 

=== modified file 'src/ui_fsmenu/campaign_select.h'
--- src/ui_fsmenu/campaign_select.h	2009-05-07 18:28:35 +0000
+++ src/ui_fsmenu/campaign_select.h	2010-10-18 21:31:48 +0000
@@ -57,8 +57,7 @@
 	UI::Textarea                                      tadifficulty;
 	UI::Textarea                                      label_campdescr;
 	UI::Multiline_Textarea                            tacampdescr;
-	UI::Callback_Button<Fullscreen_Menu_CampaignSelect> b_ok;
-	UI::Callback_IDButton<Fullscreen_Menu_CampaignSelect, int32_t> back;
+	UI::Callback_Button                           b_ok, back;
 	UI::Listselect<const char *>                      m_list;
 
 	/// Variables used for exchange between the two Campaign UIs and
@@ -94,8 +93,7 @@
 	UI::Textarea                                         taauthor;
 	UI::Textarea                                         label_mapdescr;
 	UI::Multiline_Textarea                               tamapdescr;
-	UI::Callback_Button<Fullscreen_Menu_CampaignMapSelect> b_ok;
-	UI::Callback_IDButton<Fullscreen_Menu_CampaignMapSelect, int32_t> back;
+	UI::Callback_Button                              b_ok, back;
 	UI::Listselect<std::string>                          m_list;
 	uint32_t                                             campaign;
 	std::string                                          campmapfile;

=== modified file 'src/ui_fsmenu/editor.cc'
--- src/ui_fsmenu/editor.cc	2010-04-14 14:09:12 +0000
+++ src/ui_fsmenu/editor.cc	2010-10-18 21:31:48 +0000
@@ -39,21 +39,21 @@
 		(this, "new_map",
 		 m_butx, m_yres * 6 / 25, m_butw, m_buth,
 		 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
-		 &Fullscreen_Menu_Editor::end_modal, *this, New_Map,
+		 boost::bind(&Fullscreen_Menu_Editor::end_modal, boost::ref(*this), static_cast<int32_t>(New_Map)),
 		 _("New Map"), std::string(), true, false,
 		 ui_fn(), fs_small()),
 	load_map
 		(this, "load_map",
 		 m_butx, m_yres * 61 / 200, m_butw, m_buth,
 		 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
-		 &Fullscreen_Menu_Editor::end_modal, *this, Load_Map,
+		 boost::bind(&Fullscreen_Menu_Editor::end_modal, boost::ref(*this), static_cast<int32_t>(Load_Map)),
 		 _("Load Map"), std::string(), true, false,
 		 ui_fn(), fs_small()),
 	back
 		(this, "back",
 		 m_butx, m_yres * 3 / 4, m_butw, m_buth,
 		 g_gr->get_picture(PicMod_UI, "pics/but0.png"),
-		 &Fullscreen_Menu_Editor::end_modal, *this, Back,
+		 boost::bind(&Fullscreen_Menu_Editor::end_modal, boost::ref(*this), static_cast<int32_t>(Back)),
 		 _("Back"), std::string(), true, false,
 		 ui_fn(), fs_small())
 {

=== modified file 'src/ui_fsmenu/editor.h'
--- src/ui_fsmenu/editor.h	2009-05-07 18:28:35 +0000
+++ src/ui_fsmenu/editor.h	2010-10-18 21:31:48 +0000
@@ -39,9 +39,9 @@
 	uint32_t                                      m_buth;
 	uint32_t                                      m_butx;
 	UI::Textarea                                  title;
-	UI::Callback_IDButton<Fullscreen_Menu_Editor, int32_t> new_map;
-	UI::Callback_IDButton<Fullscreen_Menu_Editor, int32_t> load_map;
-	UI::Callback_IDButton<Fullscreen_Menu_Editor, int32_t> back;
+	UI::Callback_Button                       new_map;
+	UI::Callback_Button                       load_map;
+	UI::Callback_Button                       back;
 };
 
 #endif

=== modified file 'src/ui_fsmenu/editor_mapselect.cc'
--- src/ui_fsmenu/editor_mapselect.cc	2010-04-14 14:09:12 +0000
+++ src/ui_fsmenu/editor_mapselect.cc	2010-10-18 21:31:48 +0000
@@ -87,14 +87,14 @@
 		(this, "back",
 		 m_xres * 71 / 100, m_yres * 17 / 20, m_butw, m_buth,
 		 g_gr->get_picture(PicMod_UI, "pics/but0.png"),
-		 &Fullscreen_Menu_Editor_MapSelect::end_modal, *this, 0,
+		 boost::bind(&Fullscreen_Menu_Editor_MapSelect::end_modal, boost::ref(*this), 0),
 		 _("Back"), std::string(), true, false,
 		 m_fn, m_fs),
 	m_ok
 		(this, "ok",
 		 m_xres * 71 / 100, m_yres * 9 / 10, m_butw, m_buth,
 		 g_gr->get_picture(PicMod_UI, "pics/but2.png"),
-		 &Fullscreen_Menu_Editor_MapSelect::ok, *this,
+		 boost::bind(&Fullscreen_Menu_Editor_MapSelect::ok, boost::ref(*this)),
 		 _("OK"), std::string(), false, false,
 		 m_fn, m_fs),
 

=== modified file 'src/ui_fsmenu/editor_mapselect.h'
--- src/ui_fsmenu/editor_mapselect.h	2010-01-11 13:35:27 +0000
+++ src/ui_fsmenu/editor_mapselect.h	2010-10-18 21:31:48 +0000
@@ -55,8 +55,7 @@
 	UI::Textarea    m_size,             m_label_world,      m_world;
 	UI::Textarea    m_label_nr_players, m_nr_players,       m_label_descr;
 	UI::Multiline_Textarea              m_descr;
-	UI::Callback_IDButton<Fullscreen_Menu_Editor_MapSelect, int32_t> m_back;
-	UI::Callback_Button<Fullscreen_Menu_Editor_MapSelect>            m_ok;
+	UI::Callback_Button             m_back,             m_ok;
 	UI::Listselect<std::string>                             m_list;
 	std::string     m_parentdir,        m_curdir,           m_basedir;
 	filenameset_t   m_mapfiles;

=== modified file 'src/ui_fsmenu/fileview.cc'
--- src/ui_fsmenu/fileview.cc	2010-04-24 20:03:07 +0000
+++ src/ui_fsmenu/fileview.cc	2010-10-18 21:31:48 +0000
@@ -41,7 +41,7 @@
 		(this, "close",
 		 m_xres * 3 / 8, m_yres * 9 / 10, m_xres / 4, m_yres * 9 / 200,
 		 g_gr->get_picture(PicMod_UI, "pics/but0.png"),
-		 &Fullscreen_Menu_TextView::end_modal, *this, 0,
+		 boost::bind(&Fullscreen_Menu_TextView::end_modal, boost::ref(*this), 0),
 		 _("Close"), std::string(), true, false,
 		 ui_fn(), fs_small())
 {

=== modified file 'src/ui_fsmenu/fileview.h'
--- src/ui_fsmenu/fileview.h	2009-07-08 12:17:26 +0000
+++ src/ui_fsmenu/fileview.h	2010-10-18 21:31:48 +0000
@@ -47,7 +47,7 @@
 private:
 	UI::Textarea                                title;
 	UI::Multiline_Textarea                      textview;
-	UI::Callback_IDButton<Fullscreen_Menu_TextView, int32_t> close_button;
+	UI::Callback_Button                     close_button;
 };
 
 /**

=== modified file 'src/ui_fsmenu/launchgame.cc'
--- src/ui_fsmenu/launchgame.cc	2010-10-02 10:37:52 +0000
+++ src/ui_fsmenu/launchgame.cc	2010-10-18 21:31:48 +0000
@@ -55,35 +55,35 @@
 		(this, "select_map",
 		 m_xres * 7 / 10, m_yres * 3 / 10, m_butw, m_buth,
 		 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
-		 &Fullscreen_Menu_LaunchGame::select_map, *this,
+		 boost::bind(&Fullscreen_Menu_LaunchGame::select_map, boost::ref(*this)),
 		 _("Select map"), std::string(), false, false,
 		 m_fn, m_fs),
 	m_select_save
 		(this, "select_savegame",
 		 m_xres * 7 / 10, m_yres * 7 / 20, m_butw, m_buth,
 		 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
-		 &Fullscreen_Menu_LaunchGame::select_savegame, *this,
+		 boost::bind(&Fullscreen_Menu_LaunchGame::select_savegame, boost::ref(*this)),
 		 _("Select Savegame"), std::string(), false, false,
 		 m_fn, m_fs),
 	m_wincondition
 		(this, "win_condition",
 		 m_xres * 7 / 10, m_yres * 4 / 10, m_butw, m_buth,
 		 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
-		 &Fullscreen_Menu_LaunchGame::win_condition_clicked, *this,
+		 boost::bind(&Fullscreen_Menu_LaunchGame::win_condition_clicked, boost::ref(*this)),
 		 "", std::string(), false, false,
 		 m_fn, m_fs),
 	m_back
 		(this, "back",
 		 m_xres * 7 / 10, m_yres * 9 / 20, m_butw, m_buth,
 		 g_gr->get_picture(PicMod_UI, "pics/but0.png"),
-		 &Fullscreen_Menu_LaunchGame::back_clicked, *this,
+		 boost::bind(&Fullscreen_Menu_LaunchGame::back_clicked, boost::ref(*this)),
 		 _("Back"), std::string(), true, false,
 		 m_fn, m_fs),
 	m_ok
 		(this, "ok",
 		 m_xres * 7 / 10, m_yres * 1 / 2, m_butw, m_buth,
 		 g_gr->get_picture(PicMod_UI, "pics/but2.png"),
-		 &Fullscreen_Menu_LaunchGame::start_clicked, *this,
+		 boost::bind(&Fullscreen_Menu_LaunchGame::start_clicked, boost::ref(*this)),
 		 _("Start game"), std::string(), false, false,
 		 m_fn, m_fs),
 
@@ -159,12 +159,12 @@
 	for (uint32_t i = 0; i < MAX_PLAYERS; ++i) {
 		sprintf(posIco, "pics/fsel_editor_set_player_0%i_pos.png", i + 1);
 		m_pos[i] =
-			new UI::Callback_IDButton<Fullscreen_Menu_LaunchGame, uint8_t>
+			new UI::Callback_Button
 				(this, "switch_to_position",
 				 m_xres / 100, y += m_buth, m_yres * 17 / 500, m_yres * 17 / 500,
 				 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
 				 g_gr->get_picture(PicMod_Game, posIco),
-				 &Fullscreen_Menu_LaunchGame::switch_to_position, *this, i,
+				 boost::bind(&Fullscreen_Menu_LaunchGame::switch_to_position, boost::ref(*this), i),
 				 _("Switch to position"), false);
 		m_players[i] =
 			new PlayerDescriptionGroup

=== modified file 'src/ui_fsmenu/launchgame.h'
--- src/ui_fsmenu/launchgame.h	2010-06-04 19:07:21 +0000
+++ src/ui_fsmenu/launchgame.h	2010-10-18 21:31:48 +0000
@@ -86,10 +86,9 @@
 	uint32_t    m_fs;
 	std::string m_fn;
 
-	UI::Callback_Button<Fullscreen_Menu_LaunchGame> m_select_map, m_select_save;
-	UI::Callback_Button<Fullscreen_Menu_LaunchGame> m_wincondition, m_back, m_ok;
-	UI::Callback_IDButton<Fullscreen_Menu_LaunchGame, uint8_t> *
-		m_pos[MAX_PLAYERS];
+	UI::Callback_Button   m_select_map, m_select_save;
+	UI::Callback_Button   m_wincondition, m_back, m_ok;
+	UI::Callback_Button * m_pos[MAX_PLAYERS];
 	UI::Textarea              m_title, m_mapname, m_lobby;
 	UI::Textarea              m_name, m_type, m_team, m_tribe, m_init, m_ready;
 	UI::Multiline_Textarea    m_notes;

=== modified file 'src/ui_fsmenu/loadgame.cc'
--- src/ui_fsmenu/loadgame.cc	2010-05-04 19:37:15 +0000
+++ src/ui_fsmenu/loadgame.cc	2010-10-18 21:31:48 +0000
@@ -46,21 +46,21 @@
 		(this, "back",
 		 m_xres * 71 / 100, m_yres * 9 / 10, m_butw, m_buth,
 		 g_gr->get_picture(PicMod_UI, "pics/but0.png"),
-		 &Fullscreen_Menu_LoadGame::end_modal, *this, 0,
+		 boost::bind(&Fullscreen_Menu_LoadGame::end_modal, boost::ref(*this), 0),
 		 _("Back"), std::string(), true, false,
 		 m_fn, m_fs),
 	m_ok
 		(this, "ok",
 		 m_xres * 71 / 100, m_yres * 15 / 20, m_butw, m_buth,
 		 g_gr->get_picture(PicMod_UI, "pics/but2.png"),
-		 &Fullscreen_Menu_LoadGame::clicked_ok, *this,
+		 boost::bind(&Fullscreen_Menu_LoadGame::clicked_ok, boost::ref(*this)),
 		 _("OK"), std::string(), false, false,
 		 m_fn, m_fs),
 	m_delete
 		(this, "delete",
 		 m_xres * 71 / 100, m_yres * 17 / 20, m_butw, m_buth,
 		 g_gr->get_picture(PicMod_UI, "pics/but0.png"),
-		 &Fullscreen_Menu_LoadGame::clicked_delete, *this,
+		 boost::bind(&Fullscreen_Menu_LoadGame::clicked_delete, boost::ref(*this)),
 		 _("Delete"), std::string(), false, false,
 		 m_fn, m_fs),
 

=== modified file 'src/ui_fsmenu/loadgame.h'
--- src/ui_fsmenu/loadgame.h	2010-01-11 13:35:27 +0000
+++ src/ui_fsmenu/loadgame.h	2010-10-18 21:31:48 +0000
@@ -57,9 +57,9 @@
 	std::string m_fn;
 
 	Widelands::Game &                               m_game;
-	UI::Callback_IDButton<Fullscreen_Menu_LoadGame, int32_t> m_back;
-	UI::Callback_Button<Fullscreen_Menu_LoadGame>            m_ok;
-	UI::Callback_Button<Fullscreen_Menu_LoadGame>            m_delete;
+	UI::Callback_Button                         m_back;
+	UI::Callback_Button                         m_ok;
+	UI::Callback_Button                         m_delete;
 	UI::Listselect<const char *>                    m_list;
 	UI::Textarea                                    m_title;
 	UI::Textarea                                    m_label_mapname;

=== modified file 'src/ui_fsmenu/loadreplay.cc'
--- src/ui_fsmenu/loadreplay.cc	2010-04-14 14:09:12 +0000
+++ src/ui_fsmenu/loadreplay.cc	2010-10-18 21:31:48 +0000
@@ -40,14 +40,14 @@
 		(this, "back",
 		 m_xres * 71 / 100, m_yres * 17 / 20, m_butw, m_buth,
 		 g_gr->get_picture(PicMod_UI, "pics/but0.png"),
-		 &Fullscreen_Menu_LoadReplay::end_modal, *this, 0,
+		 boost::bind(&Fullscreen_Menu_LoadReplay::end_modal, boost::ref(*this), 0),
 		 _("Back"), std::string(), true, false,
 		 m_fn, m_fs),
 	m_ok
 		(this, "ok",
 		 m_xres * 71 / 100, m_yres * 9 / 10, m_butw, m_buth,
 		 g_gr->get_picture(PicMod_UI, "pics/but2.png"),
-		 &Fullscreen_Menu_LoadReplay::clicked_ok, *this,
+		 boost::bind(&Fullscreen_Menu_LoadReplay::clicked_ok, boost::ref(*this)),
 		 _("OK"), std::string(), false, false,
 		 m_fn, m_fs),
 

=== modified file 'src/ui_fsmenu/loadreplay.h'
--- src/ui_fsmenu/loadreplay.h	2009-07-12 07:34:49 +0000
+++ src/ui_fsmenu/loadreplay.h	2010-10-18 21:31:48 +0000
@@ -46,8 +46,7 @@
 	uint32_t    m_fs;
 	std::string m_fn;
 
-	UI::Callback_IDButton<Fullscreen_Menu_LoadReplay, int32_t> m_back;
-	UI::Callback_Button<Fullscreen_Menu_LoadReplay>            m_ok;
+	UI::Callback_Button m_back, m_ok;
 	UI::Listselect<std::string> m_list;
 	UI::Textarea m_title;
 	std::string m_filename;

=== modified file 'src/ui_fsmenu/main.cc'
--- src/ui_fsmenu/main.cc	2010-04-14 14:09:12 +0000
+++ src/ui_fsmenu/main.cc	2010-10-18 21:31:48 +0000
@@ -38,63 +38,63 @@
 		(this, "play_tutorial",
 		 m_butx, m_yres * 42 / 200, m_butw, m_buth,
 		 g_gr->get_picture(PicMod_UI, "pics/but3.png"),
-		 &Fullscreen_Menu_Main::end_modal, *this, mm_playtutorial,
+		 boost::bind(&Fullscreen_Menu_Main::end_modal, boost::ref(*this), static_cast<int32_t>(mm_playtutorial)),
 		 _("Play Tutorial"), std::string(), true, false,
 		 m_fn, m_fs),
 	singleplayer
 		(this, "single_player",
 		 m_butx, m_yres * 61 / 200, m_butw, m_buth,
 		 g_gr->get_picture(PicMod_UI, "pics/but3.png"),
-		 &Fullscreen_Menu_Main::end_modal, *this, mm_singleplayer,
+		 boost::bind(&Fullscreen_Menu_Main::end_modal, boost::ref(*this), static_cast<int32_t>(mm_singleplayer)),
 		 _("Single Player"), std::string(), true, false,
 		 m_fn, m_fs),
 	multiplayer
 		(this, "multi_player",
 		 m_butx, m_yres * 37 / 100, m_butw, m_buth,
 		 g_gr->get_picture(PicMod_UI, "pics/but3.png"),
-		 &Fullscreen_Menu_Main::end_modal, *this, mm_multiplayer,
+		 boost::bind(&Fullscreen_Menu_Main::end_modal, boost::ref(*this), static_cast<int32_t>(mm_multiplayer)),
 		 _("Multi Player"), std::string(), true, false,
 		 m_fn, m_fs),
 	replay
 		(this, "replay",
 		 m_butx, m_yres * 87 / 200, m_butw, m_buth,
 		 g_gr->get_picture(PicMod_UI, "pics/but3.png"),
-		 &Fullscreen_Menu_Main::end_modal, *this, mm_replay,
+		 boost::bind(&Fullscreen_Menu_Main::end_modal, boost::ref(*this), static_cast<int32_t>(mm_replay)),
 		 _("Watch Replay"), std::string(), true, false,
 		 m_fn, m_fs),
 	editor
 		(this, "editor",
 		 m_butx, m_yres * 100 / 200, m_butw, m_buth,
 		 g_gr->get_picture(PicMod_UI, "pics/but3.png"),
-		 &Fullscreen_Menu_Main::end_modal, *this, mm_editor,
+		 boost::bind(&Fullscreen_Menu_Main::end_modal, boost::ref(*this), static_cast<int32_t>(mm_editor)),
 		 _("Editor"), std::string(), true, false,
 		 m_fn, m_fs),
 	options
 		(this, "options",
 		 m_butx, m_yres * 119 / 200, m_butw, m_buth,
 		 g_gr->get_picture(PicMod_UI, "pics/but3.png"),
-		 &Fullscreen_Menu_Main::end_modal, *this, mm_options,
+		 boost::bind(&Fullscreen_Menu_Main::end_modal, boost::ref(*this), static_cast<int32_t>(mm_options)),
 		 _("Options"), std::string(), true, false,
 		 m_fn, m_fs),
 	readme
 		(this, "readme",
 		 m_butx, m_yres * 138 / 200, m_butw, m_buth,
 		 g_gr->get_picture(PicMod_UI, "pics/but3.png"),
-		 &Fullscreen_Menu_Main::end_modal, *this, mm_readme,
+		 boost::bind(&Fullscreen_Menu_Main::end_modal, boost::ref(*this), static_cast<int32_t>(mm_readme)),
 		 _("View Readme"), std::string(), true, false,
 		 m_fn, m_fs),
 	license
 		(this, "license",
 		 m_butx, m_yres * 151 / 200, m_butw, m_buth,
 		 g_gr->get_picture(PicMod_UI, "pics/but3.png"),
-		 &Fullscreen_Menu_Main::end_modal, *this, mm_license,
+		 boost::bind(&Fullscreen_Menu_Main::end_modal, boost::ref(*this), static_cast<int32_t>(mm_license)),
 		 _("License"), std::string(), true, false,
 		 m_fn, m_fs),
 	exit
 		(this, "exit",
 		 m_butx, m_yres * 178 / 200, m_butw, m_buth,
 		 g_gr->get_picture(PicMod_UI, "pics/but3.png"),
-		 &Fullscreen_Menu_Main::end_modal, *this, mm_exit,
+		 boost::bind(&Fullscreen_Menu_Main::end_modal, boost::ref(*this), static_cast<int32_t>(mm_exit)),
 		 _("Exit Game"), std::string(), true, false,
 		 m_fn, m_fs),
 

=== modified file 'src/ui_fsmenu/main.h'
--- src/ui_fsmenu/main.h	2010-04-14 12:25:55 +0000
+++ src/ui_fsmenu/main.h	2010-10-18 21:31:48 +0000
@@ -49,15 +49,15 @@
 	uint32_t                                    m_fs;
 	std::string                                 m_fn;
 	std::string                                 wlcr;
-	UI::Callback_IDButton<Fullscreen_Menu_Main, int32_t> playtutorial;
-	UI::Callback_IDButton<Fullscreen_Menu_Main, int32_t> singleplayer;
-	UI::Callback_IDButton<Fullscreen_Menu_Main, int32_t> multiplayer;
-	UI::Callback_IDButton<Fullscreen_Menu_Main, int32_t> replay;
-	UI::Callback_IDButton<Fullscreen_Menu_Main, int32_t> editor;
-	UI::Callback_IDButton<Fullscreen_Menu_Main, int32_t> options;
-	UI::Callback_IDButton<Fullscreen_Menu_Main, int32_t> readme;
-	UI::Callback_IDButton<Fullscreen_Menu_Main, int32_t> license;
-	UI::Callback_IDButton<Fullscreen_Menu_Main, int32_t> exit;
+	UI::Callback_Button                     playtutorial;
+	UI::Callback_Button                     singleplayer;
+	UI::Callback_Button                     multiplayer;
+	UI::Callback_Button                     replay;
+	UI::Callback_Button                     editor;
+	UI::Callback_Button                     options;
+	UI::Callback_Button                     readme;
+	UI::Callback_Button                     license;
+	UI::Callback_Button                     exit;
 	UI::Textarea                                version;
 	UI::Textarea                                copyright;
 };

=== modified file 'src/ui_fsmenu/mapselect.cc'
--- src/ui_fsmenu/mapselect.cc	2010-09-21 20:49:46 +0000
+++ src/ui_fsmenu/mapselect.cc	2010-10-18 21:31:48 +0000
@@ -99,14 +99,14 @@
 		(this, "back",
 		 m_xres * 71 / 100, m_yres * 17 / 20, m_butw, m_buth,
 		 g_gr->get_picture(PicMod_UI, "pics/but0.png"),
-		 &Fullscreen_Menu_MapSelect::end_modal, *this, 0,
+		 boost::bind(&Fullscreen_Menu_MapSelect::end_modal, boost::ref(*this), 0),
 		 _("Back"), std::string(), true, false,
 		 m_fn, m_fs),
 	m_ok
 		(this, "ok",
 		 m_xres * 71 / 100, m_yres * 9 / 10, m_butw, m_buth,
 		 g_gr->get_picture(PicMod_UI, "pics/but2.png"),
-		 &Fullscreen_Menu_MapSelect::ok, *this,
+		 boost::bind(&Fullscreen_Menu_MapSelect::ok, boost::ref(*this)),
 		 _("OK"), std::string(), false, false,
 		 m_fn, m_fs),
 

=== modified file 'src/ui_fsmenu/mapselect.h'
--- src/ui_fsmenu/mapselect.h	2010-09-21 20:49:46 +0000
+++ src/ui_fsmenu/mapselect.h	2010-10-18 21:31:48 +0000
@@ -82,8 +82,7 @@
 	UI::Textarea m_label_nr_players, m_nr_players;
 	UI::Textarea m_label_descr;
 	UI::Multiline_Textarea m_descr;
-	UI::Callback_IDButton<Fullscreen_Menu_MapSelect, int32_t> m_back;
-	UI::Callback_Button<Fullscreen_Menu_MapSelect>            m_ok;
+	UI::Callback_Button m_back, m_ok;
 	UI::Checkbox                                     m_load_map_as_scenario;
 	UI::Listselect<MapData>                          m_list;
 	std::string                                      m_curdir, m_basedir;

=== modified file 'src/ui_fsmenu/multiplayer.cc'
--- src/ui_fsmenu/multiplayer.cc	2010-04-14 14:09:12 +0000
+++ src/ui_fsmenu/multiplayer.cc	2010-10-18 21:31:48 +0000
@@ -47,21 +47,21 @@
 		(this, "metaserver",
 		 m_butx, m_yres * 6 / 25, m_butw, m_buth,
 		 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
-		 &Fullscreen_Menu_MultiPlayer::ggzLogin, *this,
+		 boost::bind(&Fullscreen_Menu_MultiPlayer::ggzLogin, boost::ref(*this)),
 		 _("Internet game"), std::string(), true, false,
 		 m_fn, m_fs),
 	lan
 		(this, "lan",
 		 m_butx, m_yres * 61 / 200, m_butw, m_buth,
 		 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
-		 &Fullscreen_Menu_MultiPlayer::end_modal, *this, Lan,
+		 boost::bind(&Fullscreen_Menu_MultiPlayer::end_modal, boost::ref(*this), static_cast<int32_t>(Lan)),
 		 _("LAN / Direct IP"), std::string(), true, false,
 		 m_fn, m_fs),
 	back
 		(this, "back",
 		 m_butx, m_yres * 3 / 4, m_butw, m_buth,
 		 g_gr->get_picture(PicMod_UI, "pics/but0.png"),
-		 &Fullscreen_Menu_MultiPlayer::end_modal, *this, Back,
+		 boost::bind(&Fullscreen_Menu_MultiPlayer::end_modal, boost::ref(*this), static_cast<int32_t>(Back)),
 		 _("Back"), std::string(), true, false,
 		 m_fn, m_fs)
 {
@@ -71,12 +71,12 @@
 	m_auto_log = s.get_bool("auto_log", false);
 	if (m_auto_log)
 		showloginbox =
-			new UI::Callback_Button<Fullscreen_Menu_MultiPlayer>
+			new UI::Callback_Button
 				(this, "login_dialog",
 				 m_butx + m_butw + m_buth / 4, m_yres * 6 / 25, m_buth, m_buth,
 				 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
 				 g_gr->get_picture(PicMod_UI, "pics/continue.png"),
-				 &Fullscreen_Menu_MultiPlayer::showGGZLogin, *this,
+				 boost::bind(&Fullscreen_Menu_MultiPlayer::showGGZLogin, boost::ref(*this)),
 				 _("Show login dialog"), true, false,
 				 m_fn, m_fs);
 }

=== modified file 'src/ui_fsmenu/multiplayer.h'
--- src/ui_fsmenu/multiplayer.h	2010-03-25 17:40:52 +0000
+++ src/ui_fsmenu/multiplayer.h	2010-10-18 21:31:48 +0000
@@ -51,10 +51,10 @@
 	uint32_t                                            m_fs;
 	std::string                                         m_fn;
 	UI::Textarea                                        title;
-	UI::Callback_Button<Fullscreen_Menu_MultiPlayer>    metaserver;
-	UI::Callback_Button<Fullscreen_Menu_MultiPlayer>  * showloginbox;
-	UI::Callback_IDButton<Fullscreen_Menu_MultiPlayer, int32_t> lan;
-	UI::Callback_IDButton<Fullscreen_Menu_MultiPlayer, int32_t> back;
+	UI::Callback_Button                             metaserver;
+	UI::Callback_Button                           * showloginbox;
+	UI::Callback_Button                             lan;
+	UI::Callback_Button                             back;
 
 	// Values from ggz login window
 	std::string m_nickname;

=== modified file 'src/ui_fsmenu/netsetup_ggz.cc'
--- src/ui_fsmenu/netsetup_ggz.cc	2010-08-07 10:16:39 +0000
+++ src/ui_fsmenu/netsetup_ggz.cc	2010-10-18 21:31:48 +0000
@@ -77,21 +77,21 @@
 		(this, "join_game",
 		 m_xres * 17 / 25, m_yres * 55 / 100, m_butw, m_buth,
 		 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
-		 &Fullscreen_Menu_NetSetupGGZ::clicked_joingame, *this,
+		 boost::bind(&Fullscreen_Menu_NetSetupGGZ::clicked_joingame, boost::ref(*this)),
 		 _("Join this game"), std::string(), false, false,
 		 m_fn, m_fs),
 	hostgame
 		(this, "host_game",
 		 m_xres * 17 / 25, m_yres * 81 / 100, m_butw, m_buth,
 		 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
-		 &Fullscreen_Menu_NetSetupGGZ::clicked_hostgame, *this,
+		 boost::bind(&Fullscreen_Menu_NetSetupGGZ::clicked_hostgame, boost::ref(*this)),
 		 _("Open a new game"), std::string(), true, false,
 		 m_fn, m_fs),
 	back
 		(this, "back",
 		 m_xres * 17 / 25, m_yres * 90 / 100, m_butw, m_buth,
 		 g_gr->get_picture(PicMod_UI, "pics/but0.png"),
-		 &Fullscreen_Menu_NetSetupGGZ::end_modal, *this, CANCEL,
+		 boost::bind(&Fullscreen_Menu_NetSetupGGZ::end_modal, boost::ref(*this), (int32_t)CANCEL),
 		 _("Back"), std::string(), true, false,
 		 m_fn, m_fs),
 

=== modified file 'src/ui_fsmenu/netsetup_ggz.h'
--- src/ui_fsmenu/netsetup_ggz.h	2010-04-24 13:53:59 +0000
+++ src/ui_fsmenu/netsetup_ggz.h	2010-10-18 21:31:48 +0000
@@ -70,9 +70,7 @@
 	UI::Textarea                                m_servername;
 	UI::Textarea                                m_maxplayers;
 	UI::SpinBox                                 maxplayers;
-	UI::Callback_Button<Fullscreen_Menu_NetSetupGGZ>            joingame;
-	UI::Callback_Button<Fullscreen_Menu_NetSetupGGZ>            hostgame;
-	UI::Callback_IDButton<Fullscreen_Menu_NetSetupGGZ, int32_t> back;
+	UI::Callback_Button                     joingame, hostgame, back;
 	UI::EditBox                                 servername;
 	UI::Table<const Net_Player * const>         usersonline;
 	UI::Listselect<Net_Open_Game>               opengames;

=== modified file 'src/ui_fsmenu/netsetup_lan.cc'
--- src/ui_fsmenu/netsetup_lan.cc	2010-04-14 14:09:12 +0000
+++ src/ui_fsmenu/netsetup_lan.cc	2010-10-18 21:31:48 +0000
@@ -58,21 +58,21 @@
 		(this, "join_game",
 		 m_xres * 16 / 25, m_yres * 5333 / 10000, m_butw, m_buth,
 		 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
-		 &Fullscreen_Menu_NetSetupLAN::clicked_joingame, *this,
+		 boost::bind(&Fullscreen_Menu_NetSetupLAN::clicked_joingame, boost::ref(*this)),
 		 _("Join this game"), std::string(), true, false,
 		 m_fn, m_fs),
 	hostgame
 		(this, "host_game",
 		 m_xres * 16 / 25, m_yres * 6083 / 10000, m_butw, m_buth,
 		 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
-		 &Fullscreen_Menu_NetSetupLAN::clicked_hostgame, *this,
+		 boost::bind(&Fullscreen_Menu_NetSetupLAN::clicked_hostgame, boost::ref(*this)),
 		 _("Host a new game"), std::string(), true, false,
 		 m_fn, m_fs),
 	back
 		(this, "back",
 		 m_xres * 16 / 25, m_yres * 8333 / 10000, m_butw, m_buth,
 		 g_gr->get_picture(PicMod_UI, "pics/but0.png"),
-		 &Fullscreen_Menu_NetSetupLAN::end_modal, *this, CANCEL,
+		 boost::bind(&Fullscreen_Menu_NetSetupLAN::end_modal, boost::ref(*this), static_cast<int32_t>(CANCEL)),
 		 _("Back"), std::string(), true, false,
 		 m_fn, m_fs),
 	loadlasthost
@@ -80,7 +80,7 @@
 		 m_xres * 171 / 200, m_yres * 19 / 40, m_buth, m_buth,
 		 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
 		 g_gr->get_picture(PicMod_UI, "pics/menu_load_game.png"),
-		 &Fullscreen_Menu_NetSetupLAN::clicked_lasthost, *this,
+		 boost::bind(&Fullscreen_Menu_NetSetupLAN::clicked_lasthost, boost::ref(*this)),
 		 _("Load previous host"), true, false,
 		 m_fn, m_fs),
 

=== modified file 'src/ui_fsmenu/netsetup_lan.h'
--- src/ui_fsmenu/netsetup_lan.h	2009-05-29 17:57:26 +0000
+++ src/ui_fsmenu/netsetup_lan.h	2010-10-18 21:31:48 +0000
@@ -69,10 +69,7 @@
 	std::string                                 m_fn;
 	UI::Textarea                                title, m_opengames;
 	UI::Textarea                                m_playername, m_hostname;
-	UI::Callback_Button<Fullscreen_Menu_NetSetupLAN>        joingame;
-	UI::Callback_Button<Fullscreen_Menu_NetSetupLAN>        hostgame;
-	UI::Callback_IDButton<Fullscreen_Menu_NetSetupLAN, int32_t> back;
-	UI::Callback_Button<Fullscreen_Menu_NetSetupLAN>        loadlasthost;
+	UI::Callback_Button                     joingame, hostgame, back, loadlasthost;
 	UI::EditBox                                 playername;
 	UI::EditBox                                 hostname;
 	UI::Table<const Net_Open_Game * const>      opengames;

=== modified file 'src/ui_fsmenu/options.cc'
--- src/ui_fsmenu/options.cc	2010-10-10 14:03:26 +0000
+++ src/ui_fsmenu/options.cc	2010-10-18 21:31:48 +0000
@@ -50,21 +50,21 @@
 		(this, "advanced_options",
 		 m_xres * 9 / 80, m_yres * 19 / 20, m_butw, m_buth,
 		 g_gr->get_picture(PicMod_UI, "pics/but2.png"),
-		 &Fullscreen_Menu_Options::advanced_options, *this,
+		 boost::bind(&Fullscreen_Menu_Options::advanced_options, boost::ref(*this)),
 		 _("Advanced Options"), std::string(), true, false,
 		 m_fn, m_fs),
 	m_cancel
 		(this, "cancel",
 		 m_xres * 51 / 80, m_yres * 19 / 20, m_butw, m_buth,
 		 g_gr->get_picture(PicMod_UI, "pics/but0.png"),
-		 &Fullscreen_Menu_Options::end_modal, *this, om_cancel,
+		 boost::bind(&Fullscreen_Menu_Options::end_modal, boost::ref(*this), static_cast<int32_t>(om_cancel)),
 		 _("Cancel"), std::string(), true, false,
 		 m_fn, m_fs),
 	m_apply
 		(this, "apply",
 		 m_xres * 3 / 8, m_yres * 19 / 20, m_butw, m_buth,
 		 g_gr->get_picture(PicMod_UI, "pics/but2.png"),
-		 &Fullscreen_Menu_Options::end_modal, *this, om_ok,
+		 boost::bind(&Fullscreen_Menu_Options::end_modal, boost::ref(*this), static_cast<int32_t>(om_ok)),
 		 _("Apply"), std::string(), true, false,
 		 m_fn, m_fs),
 
@@ -387,14 +387,14 @@
 		(this, "cancel",
 		 m_xres * 41 / 80, m_yres * 19 / 20, m_butw, m_buth,
 		 g_gr->get_picture(PicMod_UI, "pics/but0.png"),
-		 &Fullscreen_Menu_Advanced_Options::end_modal, *this, om_cancel,
+		 boost::bind(&Fullscreen_Menu_Advanced_Options::end_modal, boost::ref(*this), static_cast<int32_t>(om_cancel)),
 		 _("Cancel"), std::string(), true, false,
 		 m_fn, m_fs),
 	m_apply
 		(this, "apply",
 		 m_xres / 4,   m_yres * 19 / 20, m_butw, m_buth,
 		 g_gr->get_picture(PicMod_UI, "pics/but2.png"),
-		 &Fullscreen_Menu_Advanced_Options::end_modal, *this, om_ok,
+		 boost::bind(&Fullscreen_Menu_Advanced_Options::end_modal, boost::ref(*this), static_cast<int32_t>(om_ok)),
 		 _("Apply"), std::string(), true, false,
 		 m_fn, m_fs),
 

=== modified file 'src/ui_fsmenu/options.h'
--- src/ui_fsmenu/options.h	2010-10-10 14:03:26 +0000
+++ src/ui_fsmenu/options.h	2010-10-18 21:31:48 +0000
@@ -95,8 +95,7 @@
 	uint32_t                          m_buth;
 	uint32_t                          m_fs;
 	std::string                       m_fn;
-	UI::Callback_Button<Fullscreen_Menu_Options> m_advanced_options;
-	UI::Callback_IDButton<Fullscreen_Menu_Options, int32_t> m_cancel, m_apply;
+	UI::Callback_Button           m_advanced_options, m_cancel, m_apply;
 	UI::SpinBox                       m_sb_maxfps, m_sb_autosave;
 	UI::SpinBox                       m_sb_remove_replays;
 	UI::Textarea                      m_title;
@@ -157,8 +156,7 @@
 	uint32_t                    m_fs;
 	std::string                 m_fn;
 
-	UI::Callback_IDButton<Fullscreen_Menu_Advanced_Options, int32_t> m_cancel;
-	UI::Callback_IDButton<Fullscreen_Menu_Advanced_Options, int32_t> m_apply;
+	UI::Callback_Button     m_cancel, m_apply;
 	UI::SpinBox                 m_sb_speed, m_sb_dis_panel, m_sb_dis_border;
 	UI::Textarea                m_title;
 	UI::Listselect<std::string> m_ui_font_list;

=== modified file 'src/ui_fsmenu/playerdescrgroup.cc'
--- src/ui_fsmenu/playerdescrgroup.cc	2010-09-22 21:30:28 +0000
+++ src/ui_fsmenu/playerdescrgroup.cc	2010-10-18 21:31:48 +0000
@@ -38,10 +38,10 @@
 
 	UI::Textarea     * plr_name;
 	UI::Checkbox     * btnEnablePlayer;
-	UI::Callback_Button<PlayerDescriptionGroup> * btnPlayerTeam;
-	UI::Callback_Button<PlayerDescriptionGroup> * btnPlayerType;
-	UI::Callback_Button<PlayerDescriptionGroup> * btnPlayerTribe;
-	UI::Callback_Button<PlayerDescriptionGroup> * btnPlayerInit;
+	UI::Callback_Button * btnPlayerTeam;
+	UI::Callback_Button * btnPlayerType;
+	UI::Callback_Button * btnPlayerTribe;
+	UI::Callback_Button * btnPlayerInit;
 	UI::Checkbox     * btnReadyPlayer;
 };
 
@@ -69,35 +69,35 @@
 	d->btnEnablePlayer = new UI::Checkbox(this, Point(xplayertype - 23, 0));
 	d->btnEnablePlayer->changedto.set
 		(this, &PlayerDescriptionGroup::enable_player);
-	d->btnPlayerType = new UI::Callback_Button<PlayerDescriptionGroup>
+	d->btnPlayerType = new UI::Callback_Button
 		(this, "player_type",
 		 xplayertype, 0, xplayerteam - xplayertype - 2, h,
 		 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
-		 &PlayerDescriptionGroup::toggle_playertype, *this,
+		 boost::bind(&PlayerDescriptionGroup::toggle_playertype, boost::ref(*this)),
 		 std::string(), std::string(),
 		 true, false,
 		 fname, fsize);
-	d->btnPlayerTeam = new UI::Callback_Button<PlayerDescriptionGroup>
+	d->btnPlayerTeam = new UI::Callback_Button
 		(this, "player_team",
 		 xplayerteam, 0, xplayertribe - xplayerteam - 2, h,
 		 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
-		 &PlayerDescriptionGroup::toggle_playerteam, *this,
+		 boost::bind(&PlayerDescriptionGroup::toggle_playerteam, boost::ref(*this)),
 		 std::string(), std::string(),
 		 true, false,
 		 fname, fsize);
-	d->btnPlayerTribe = new UI::Callback_Button<PlayerDescriptionGroup>
+	d->btnPlayerTribe = new UI::Callback_Button
 		(this, "player_tribe",
 		 xplayertribe, 0, xplayerinit - xplayertribe - 2, h,
 		 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
-		 &PlayerDescriptionGroup::toggle_playertribe, *this,
+		 boost::bind(&PlayerDescriptionGroup::toggle_playertribe, boost::ref(*this)),
 		 std::string(), std::string(),
 		 true, false,
 		 fname, fsize);
-	d->btnPlayerInit = new UI::Callback_Button<PlayerDescriptionGroup>
+	d->btnPlayerInit = new UI::Callback_Button
 		(this, "player_initialization",
 		 xplayerinit, 0, xplayerready - xplayerinit - 2, h,
 		 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
-		 &PlayerDescriptionGroup::toggle_playerinit, *this,
+		 boost::bind(&PlayerDescriptionGroup::toggle_playerinit, boost::ref(*this)),
 		 std::string(), _("Initialization"),
 		 true, false,
 		 fname, fsize);

=== modified file 'src/ui_fsmenu/singleplayer.cc'
--- src/ui_fsmenu/singleplayer.cc	2010-04-14 14:09:12 +0000
+++ src/ui_fsmenu/singleplayer.cc	2010-10-18 21:31:48 +0000
@@ -43,28 +43,28 @@
 		(this, "new_game",
 		 m_butx, m_yres * 6 / 25, m_butw, m_buth,
 		 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
-		 &Fullscreen_Menu_SinglePlayer::end_modal, *this, New_Game,
+		 boost::bind(&Fullscreen_Menu_SinglePlayer::end_modal, boost::ref(*this), static_cast<int32_t>(New_Game)),
 		 _("New Game"), std::string(), true, false,
 		 m_fn, m_fs),
 	campaign
 		(this, "campaigns",
 		 m_butx, m_yres * 61 / 200, m_butw, m_buth,
 		 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
-		 &Fullscreen_Menu_SinglePlayer::end_modal, *this, Campaign,
+		 boost::bind(&Fullscreen_Menu_SinglePlayer::end_modal, boost::ref(*this), static_cast<int32_t>(Campaign)),
 		 _("Campaigns"), std::string(), true, false,
 		 m_fn, m_fs),
 	load_game
 		(this, "load_game",
 		 m_butx, m_yres * 87 / 200, m_butw, m_buth,
 		 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
-		 &Fullscreen_Menu_SinglePlayer::end_modal, *this, Load_Game,
+		 boost::bind(&Fullscreen_Menu_SinglePlayer::end_modal, boost::ref(*this), static_cast<int32_t>(Load_Game)),
 		 _("Load Game"), std::string(), true, false,
 		 m_fn, m_fs),
 	back
 		(this, "back",
 		 m_butx, m_yres * 3 / 4, m_butw, m_buth,
 		 g_gr->get_picture(PicMod_UI, "pics/but0.png"),
-		 &Fullscreen_Menu_SinglePlayer::end_modal, *this, Back,
+		 boost::bind(&Fullscreen_Menu_SinglePlayer::end_modal, boost::ref(*this), static_cast<int32_t>(Back)),
 		 _("Back"), std::string(), true, false,
 		 m_fn, m_fs)
 {

=== modified file 'src/ui_fsmenu/singleplayer.h'
--- src/ui_fsmenu/singleplayer.h	2009-05-07 18:28:35 +0000
+++ src/ui_fsmenu/singleplayer.h	2010-10-18 21:31:48 +0000
@@ -41,10 +41,10 @@
 	uint32_t                                            m_fs;
 	std::string                                         m_fn;
 	UI::Textarea                                        title;
-	UI::Callback_IDButton<Fullscreen_Menu_SinglePlayer, int32_t> new_game;
-	UI::Callback_IDButton<Fullscreen_Menu_SinglePlayer, int32_t> campaign;
-	UI::Callback_IDButton<Fullscreen_Menu_SinglePlayer, int32_t> load_game;
-	UI::Callback_IDButton<Fullscreen_Menu_SinglePlayer, int32_t> back;
+	UI::Callback_Button                             new_game;
+	UI::Callback_Button                             campaign;
+	UI::Callback_Button                             load_game;
+	UI::Callback_Button                             back;
 };
 
 #endif

=== modified file 'src/wui/attack_box.cc'
--- src/wui/attack_box.cc	2010-05-25 18:40:43 +0000
+++ src/wui/attack_box.cc	2010-10-18 21:31:48 +0000
@@ -101,19 +101,18 @@
 	return result;
 }
 
-UI::Callback_Button<AttackBox> & AttackBox::add_button
+UI::Callback_Button & AttackBox::add_button
 	(UI::Box           & parent,
 	 char        const * const text,
 	 void         (AttackBox::*fn)(),
 	 std::string const & tooltip_text)
 {
-	UI::Callback_Button<AttackBox> & button =
-		*new UI::Callback_Button<AttackBox>
+	UI::Callback_Button & button =
+		*new UI::Callback_Button
 			(&parent, text,
 			 8, 8, 26, 26,
 			 g_gr->get_picture(PicMod_UI, "pics/but2.png"),
-			 fn,
-			 *this,
+			 boost::bind(fn, boost::ref(*this)),
 			 text,
 			 tooltip_text);
 	parent.add(&button, Box::AlignCenter);

=== modified file 'src/wui/attack_box.h'
--- src/wui/attack_box.h	2010-04-17 19:57:53 +0000
+++ src/wui/attack_box.h	2010-10-18 21:31:48 +0000
@@ -69,7 +69,7 @@
 			 uint32_t            alignment = UI::Box::AlignTop,
 			 std::string const & fontname = UI_FONT_NAME,
 			 uint32_t            fontsize = UI_FONT_SIZE_SMALL);
-		UI::Callback_Button<AttackBox> & add_button
+		UI::Callback_Button & add_button
 			(UI::Box           & parent,
 			 char const * picname,
 			 void (AttackBox::*fn)(),
@@ -89,8 +89,8 @@
 		UI::Textarea          * m_text_soldiers;
 		UI::Textarea          * m_text_retreat;
 
-		UI::Callback_Button<AttackBox> * m_less_soldiers;
-		UI::Callback_Button<AttackBox> * m_add_soldiers;
+		UI::Callback_Button * m_less_soldiers;
+		UI::Callback_Button * m_add_soldiers;
 };
 
 #endif

=== modified file 'src/wui/building_statistics_menu.cc'
--- src/wui/building_statistics_menu.cc	2010-06-16 20:29:34 +0000
+++ src/wui/building_statistics_menu.cc	2010-10-18 21:31:48 +0000
@@ -123,62 +123,62 @@
 	m_progbar.set_total(100);
 
 	m_btn[Prev_Owned] =
-		new UI::Callback_IDButton<Building_Statistics_Menu, Jump_Targets>
+		new UI::Callback_Button
 			(this, "previous_owned",
 			 JUMP_PREV_BUTTON_X, OWNED_Y, 24, 24,
 			 g_gr->get_picture(PicMod_UI, "pics/but4.png"),
 			 g_gr->get_picture(PicMod_UI, "pics/scrollbar_left.png"),
-			 &Building_Statistics_Menu::clicked_jump, *this, Prev_Owned,
+			 boost::bind(&Building_Statistics_Menu::clicked_jump, boost::ref(*this), Prev_Owned),
 			 _("Show previous"),
 			 false);
 
 	m_btn[Next_Owned] =
-		new UI::Callback_IDButton<Building_Statistics_Menu, Jump_Targets>
+		new UI::Callback_Button
 			(this, "next_owned",
 			 JUMP_NEXT_BUTTON_X, OWNED_Y, 24, 24,
 			 g_gr->get_picture(PicMod_UI, "pics/but4.png"),
 			 g_gr->get_picture(PicMod_UI, "pics/scrollbar_right.png"),
-			 &Building_Statistics_Menu::clicked_jump, *this, Next_Owned,
+			 boost::bind(&Building_Statistics_Menu::clicked_jump, boost::ref(*this), Next_Owned),
 			 _("Show next"),
 			 false);
 
 	m_btn[Prev_Construction] =
-		new UI::Callback_IDButton<Building_Statistics_Menu, Jump_Targets>
+		new UI::Callback_Button
 			(this, "previous_constructed",
 			 JUMP_PREV_BUTTON_X, IN_BUILD_Y, 24, 24,
 			 g_gr->get_picture(PicMod_UI, "pics/but4.png"),
 			 g_gr->get_picture(PicMod_UI, "pics/scrollbar_left.png"),
-			 &Building_Statistics_Menu::clicked_jump, *this, Prev_Construction,
+			 boost::bind(&Building_Statistics_Menu::clicked_jump, boost::ref(*this), Prev_Construction),
 			 _("Show previous"),
 			 false);
 
 	m_btn[Next_Construction] =
-		new UI::Callback_IDButton<Building_Statistics_Menu, Jump_Targets>
+		new UI::Callback_Button
 			(this, "next_constructed",
 			 JUMP_NEXT_BUTTON_X, IN_BUILD_Y, 24, 24,
 			 g_gr->get_picture(PicMod_UI, "pics/but4.png"),
 			 g_gr->get_picture(PicMod_UI, "pics/scrollbar_right.png"),
-			 &Building_Statistics_Menu::clicked_jump, *this, Next_Construction,
+			 boost::bind(&Building_Statistics_Menu::clicked_jump, boost::ref(*this), Next_Construction),
 			 _("Show next"),
 			 false);
 
 	m_btn[Prev_Unproductive] =
-		new UI::Callback_IDButton<Building_Statistics_Menu, Jump_Targets>
+		new UI::Callback_Button
 			(this, "previous_unproductive",
 			 JUMP_PREV_BUTTON_X, UNPRODUCTIVE_Y, 24, 24,
 			 g_gr->get_picture(PicMod_UI, "pics/but4.png"),
 			 g_gr->get_picture(PicMod_UI, "pics/scrollbar_left.png"),
-			 &Building_Statistics_Menu::clicked_jump, *this, Prev_Unproductive,
+			 boost::bind(&Building_Statistics_Menu::clicked_jump, boost::ref(*this), Prev_Unproductive),
 			 _("Show previous"),
 			 false);
 
 	m_btn[Next_Unproductive] =
-		new UI::Callback_IDButton<Building_Statistics_Menu, Jump_Targets>
+		new UI::Callback_Button
 			(this, "next_unproductive",
 			 JUMP_NEXT_BUTTON_X, UNPRODUCTIVE_Y, 24, 24,
 			 g_gr->get_picture(PicMod_UI, "pics/but4.png"),
 			 g_gr->get_picture(PicMod_UI, "pics/scrollbar_right.png"),
-			 &Building_Statistics_Menu::clicked_jump, *this, Next_Unproductive,
+			 boost::bind(&Building_Statistics_Menu::clicked_jump, boost::ref(*this), Next_Unproductive),
 			 _("Show next"),
 			 false);
 }

=== modified file 'src/wui/building_statistics_menu.h'
--- src/wui/building_statistics_menu.h	2010-04-20 19:20:58 +0000
+++ src/wui/building_statistics_menu.h	2010-10-18 21:31:48 +0000
@@ -28,7 +28,7 @@
 namespace Widelands {struct Building_Descr;}
 struct Interactive_Player;
 namespace UI {
-template <typename T, typename ID> struct Callback_IDButton;
+struct Callback_Button;
 struct Progress_Bar;
 struct Textarea;
 }
@@ -62,7 +62,7 @@
 	uint32_t                  m_anim;
 	uint32_t                  m_lastupdate;
 	uint32_t                  m_end_of_table_y;
-	UI::Callback_IDButton<Building_Statistics_Menu, Jump_Targets> * m_btn[6];
+	UI::Callback_Button * m_btn[6];
 	int32_t                   m_last_building_index;
 
 	void clicked_help();

=== modified file 'src/wui/buildingwindow.cc'
--- src/wui/buildingwindow.cc	2010-09-27 15:56:07 +0000
+++ src/wui/buildingwindow.cc	2010-10-18 21:31:48 +0000
@@ -152,14 +152,14 @@
 			if (not dynamic_cast<Widelands::MilitarySite const *>(productionsite)) {
 				bool const is_stopped = productionsite->is_stopped();
 				capsbuttons->add
-					(new UI::Callback_Button<Building_Window>
+					(new UI::Callback_Button
 						(capsbuttons, is_stopped ? "continue" : "stop",
 						 0, 0, 34, 34,
 						 g_gr->get_picture(PicMod_UI, "pics/but4.png"),
 						 g_gr->get_picture
 						 	(PicMod_Game,
 						 	 (is_stopped ? "pics/continue.png" : "pics/stop.png")),
-						 &Building_Window::act_start_stop, *this,
+						 boost::bind(&Building_Window::act_start_stop, boost::ref(*this)),
 						 is_stopped ? _("Continue") : _("Stop")),
 					 UI::Box::AlignCenter);
 			}
@@ -177,13 +177,12 @@
 						(buffer, sizeof(buffer),
 						 _("Enhance to %s"), building_descr.descname().c_str());
 					capsbuttons->add
-						(new UI::Callback_IDButton<Building_Window, Widelands::Building_Index>
+						(new UI::Callback_Button
 							(capsbuttons, "enhance",
 							 0, 0, 34, 34,
 							 g_gr->get_picture(PicMod_UI, "pics/but4.png"),
 							 building_descr.get_buildicon(),
-							 &Building_Window::act_enhance, *this,
-							 *i.current, //  button id = building id
+							 boost::bind(&Building_Window::act_enhance, boost::ref(*this), boost::ref(*i.current)), //  button id = building id)
 							 buffer),
 						 UI::Box::AlignCenter);
 				}
@@ -191,12 +190,12 @@
 
 		if (m_capscache & (1 << Widelands::Building::PCap_Bulldoze)) {
 			capsbuttons->add
-				(new UI::Callback_Button<Building_Window>
+				(new UI::Callback_Button
 					(capsbuttons, "destroy",
 					 0, 0, 34, 34,
 					 g_gr->get_picture(PicMod_UI, "pics/but4.png"),
 					 g_gr->get_picture(PicMod_Game, pic_bulldoze),
-					 &Building_Window::act_bulldoze, *this,
+					 boost::bind(&Building_Window::act_bulldoze, boost::ref(*this)),
 					 _("Destroy")),
 				 UI::Box::AlignCenter);
 		}
@@ -204,12 +203,12 @@
 
 	if (can_see) {
 		if (m_building.descr().m_workarea_info.size()) {
-			m_toggle_workarea = new UI::Callback_Button<Building_Window>
+			m_toggle_workarea = new UI::Callback_Button
 				(capsbuttons, "workarea",
 				 0, 0, 34, 34,
 				 g_gr->get_picture(PicMod_UI, "pics/but4.png"),
 				 g_gr->get_picture(PicMod_Game,  "pics/workarea3cumulative.png"),
-				 &Building_Window::toggle_workarea, *this,
+				 boost::bind(&Building_Window::toggle_workarea, boost::ref(*this)),
 				 _("Hide workarea"));
 			capsbuttons->add(m_toggle_workarea, UI::Box::AlignCenter);
 			set_fastclick_panel(m_toggle_workarea);
@@ -217,23 +216,23 @@
 
 		if (igbase().get_display_flag(Interactive_Base::dfDebug)) {
 			capsbuttons->add
-				(new UI::Callback_Button<Building_Window>
+				(new UI::Callback_Button
 					(capsbuttons, "debug",
 					 0, 0, 34, 34,
 					 g_gr->get_picture(PicMod_UI, "pics/but4.png"),
 					 g_gr->get_picture(PicMod_Game,  pic_debug),
-					 &Building_Window::act_debug, *this,
+					 boost::bind(&Building_Window::act_debug, boost::ref(*this)),
 					 _("Debug")),
 				 UI::Box::AlignCenter);
 		}
 
 		capsbuttons->add
-			(new UI::Callback_Button<Building_Window>
+			(new UI::Callback_Button
 				(capsbuttons, "goto",
 				 0, 0, 34, 34,
 				 g_gr->get_picture(PicMod_UI, "pics/but4.png"),
 				 g_gr->get_picture(PicMod_Game, "pics/menu_goto.png"),
-				 &Building_Window::clicked_goto, *this),
+				 boost::bind(&Building_Window::clicked_goto, boost::ref(*this))),
 			 UI::Box::AlignCenter);
 	}
 }

=== modified file 'src/wui/buildingwindow.h'
--- src/wui/buildingwindow.h	2010-09-27 15:56:07 +0000
+++ src/wui/buildingwindow.h	2010-10-18 21:31:48 +0000
@@ -77,7 +77,7 @@
 	UI::Tab_Panel * m_tabs;
 
 	UI::Box * m_capsbuttons; ///< \ref UI::Box that contains capabilities buttons
-	UI::Callback_Button<Building_Window> * m_toggle_workarea;
+	UI::Callback_Button * m_toggle_workarea;
 
 	//  capabilities that were last used in setting up the caps panel
 	uint32_t m_capscache;

=== modified file 'src/wui/fieldaction.cc'
--- src/wui/fieldaction.cc	2010-09-27 16:06:04 +0000
+++ src/wui/fieldaction.cc	2010-10-18 21:31:48 +0000
@@ -630,13 +630,13 @@
 	 std::string const & tooltip_text,
 	 bool                const repeating)
 {
-	UI::Callback_Button<FieldActionWindow> & button =
-		*new UI::Callback_Button<FieldActionWindow>
+	UI::Callback_Button & button =
+		*new UI::Callback_Button
 			(box, name,
 			 0, 0, 34, 34,
 			 g_gr->get_picture(PicMod_UI, "pics/but2.png"),
 			 g_gr->get_picture(PicMod_Game, picname),
-			 fn, *this, tooltip_text);
+			 boost::bind(fn, boost::ref(*this)), tooltip_text);
 	button.set_repeating(repeating);
 	box->add
 		(&button, UI::Box::AlignTop);

=== modified file 'src/wui/game_debug_ui.cc'
--- src/wui/game_debug_ui.cc	2010-05-24 18:42:55 +0000
+++ src/wui/game_debug_ui.cc	2010-10-18 21:31:48 +0000
@@ -225,7 +225,7 @@
 	Widelands::FCoords const     m_coords;
 
 	UI::Multiline_Textarea       m_ui_field;
-	UI::Callback_Button<FieldDebugWindow> m_ui_immovable;
+	UI::Callback_Button m_ui_immovable;
 	UI::Listselect<intptr_t>    m_ui_bobs;
 };
 
@@ -244,7 +244,7 @@
 		(this, "immovable",
 		 0, 280, 214, 24,
 		 g_gr->get_picture(PicMod_UI, "pics/but0.png"),
-		 &FieldDebugWindow::open_immovable, *this,
+		 boost::bind(&FieldDebugWindow::open_immovable, boost::ref(*this)),
 		 ""),
 
 	m_ui_bobs(this, 0, 304, 214, 96)

=== modified file 'src/wui/game_main_menu.cc'
--- src/wui/game_main_menu.cc	2010-04-24 20:03:07 +0000
+++ src/wui/game_main_menu.cc	2010-10-18 21:31:48 +0000
@@ -17,6 +17,11 @@
  *
  */
 
+#include <boost/bind.hpp>
+#include <boost/type_traits.hpp>
+#include <boost/lambda/construct.hpp>
+#include <boost/lambda/bind.hpp>
+
 #include "game_main_menu.h"
 
 #include "building_statistics_menu.h"
@@ -43,56 +48,45 @@
 	 posx(0, 4), posy(0, 3), buttonw(4), buttonh(1),
 	 g_gr->get_picture(PicMod_UI, "pics/but4.png"),
 	 g_gr->get_picture(PicMod_Game, "pics/menu_general_stats.png"),
-	 &GameMainMenu::clicked_general_stats, *this,
+	 boost::bind(&UI::UniqueWindow::Registry::toggle, boost::ref(m_windows.general_stats)),
 	 _("General Statistics")),
 ware_stats
 	(this, "ware_stats",
 	 posx(1, 4), posy(0, 3), buttonw(4), buttonh(1),
 	 g_gr->get_picture(PicMod_UI, "pics/but4.png"),
 	 g_gr->get_picture(PicMod_Game, "pics/menu_ware_stats.png"),
-	 &GameMainMenu::clicked_ware_stats, *this,
+	 boost::bind(&UI::UniqueWindow::Registry::toggle, boost::ref(m_windows.ware_stats)),
 	 _("Ware Statistics")),
 building_stats
 	(this, "building_stats",
 	 posx(2, 4), posy(0, 3), buttonw(4), buttonh(1),
 	 g_gr->get_picture(PicMod_UI, "pics/but4.png"),
 	 g_gr->get_picture(PicMod_Game, "pics/menu_building_stats.png"),
-	 &GameMainMenu::clicked_building_stats, *this,
+	 boost::bind(&UI::UniqueWindow::Registry::toggle, boost::ref(m_windows.building_stats)),
 	 _("Building Statistics")),
 stock
 	(this, "stock",
 	 posx(3, 4), posy(0, 3), buttonw(4), buttonh(1),
 	 g_gr->get_picture(PicMod_UI, "pics/but4.png"),
 	 g_gr->get_picture(PicMod_Game, "pics/menu_stock.png"),
-	 &GameMainMenu::clicked_stock, *this,
+	 boost::bind(&UI::UniqueWindow::Registry::toggle, boost::ref(m_windows.stock)),
 	 _("Stock"))
 {
+#define INIT_BTN_HOOKS(registry, btn)                                        \
+ registry.onCreate = boost::bind(&UI::Button::set_perm_pressed,&btn, true);  \
+ registry.onDelete = boost::bind(&UI::Button::set_perm_pressed,&btn, false); \
+ if (registry.window) btn.set_perm_pressed(true);                            \
+
+	INIT_BTN_HOOKS(m_windows.general_stats, general_stats)
+	INIT_BTN_HOOKS(m_windows.ware_stats, ware_stats)
+	INIT_BTN_HOOKS(m_windows.building_stats, building_stats)
+	INIT_BTN_HOOKS(m_windows.stock, stock)
+	
+	m_windows.general_stats.constr = boost::lambda::bind(boost::lambda::new_ptr<General_Statistics_Menu>(), boost::ref(m_player), boost::lambda::_1);
+	m_windows.ware_stats.constr = boost::lambda::bind(boost::lambda::new_ptr<Ware_Statistics_Menu>(), boost::ref(m_player), boost::lambda::_1);
+	m_windows.building_stats.constr = boost::lambda::bind(boost::lambda::new_ptr<Building_Statistics_Menu>(), boost::ref(m_player), boost::lambda::_1);
+	m_windows.stock.constr = boost::lambda::bind(boost::lambda::new_ptr<Stock_Menu>(), boost::ref(m_player), boost::lambda::_1);
+
 	if (get_usedefaultpos())
 		center_to_parent();
 }
-
-
-void GameMainMenu::clicked_general_stats() {
-	if (m_windows.general_stats.window)
-		delete m_windows.general_stats.window;
-	else
-		new General_Statistics_Menu(m_player, m_windows.general_stats);
-}
-void GameMainMenu::clicked_ware_stats() {
-	if (m_windows.ware_stats.window)
-		delete m_windows.ware_stats.window;
-	else
-		new Ware_Statistics_Menu(m_player, m_windows.ware_stats);
-}
-void GameMainMenu::clicked_building_stats() {
-	if (m_windows.building_stats.window)
-		delete m_windows.building_stats.window;
-	else
-		new Building_Statistics_Menu(m_player, m_windows.building_stats);
-}
-void GameMainMenu::clicked_stock() {
-	if (m_windows.stock.window)
-		delete m_windows.stock.window;
-	else
-		new Stock_Menu(m_player, m_windows.stock);
-}

=== modified file 'src/wui/game_main_menu.h'
--- src/wui/game_main_menu.h	2009-07-08 12:17:26 +0000
+++ src/wui/game_main_menu.h	2010-10-18 21:31:48 +0000
@@ -34,10 +34,10 @@
 private:
 	Interactive_Player                         & m_player;
 	Interactive_Player::Game_Main_Menu_Windows & m_windows;
-	UI::Callback_Button<GameMainMenu> general_stats;
-	UI::Callback_Button<GameMainMenu> ware_stats;
-	UI::Callback_Button<GameMainMenu> building_stats;
-	UI::Callback_Button<GameMainMenu> stock;
+	UI::Callback_Button general_stats;
+	UI::Callback_Button ware_stats;
+	UI::Callback_Button building_stats;
+	UI::Callback_Button stock;
 
 	/** Returns the horizontal/vertical spacing between buttons. */
 	uint32_t hspacing() const {return 5;};
@@ -68,11 +68,6 @@
 	uint32_t posy(uint32_t const nr, uint32_t const nr_rows) const {
 		return vmargin() + nr * (buttonh(nr_rows) + vspacing());
 	}
-
-	void clicked_general_stats ();
-	void clicked_ware_stats    ();
-	void clicked_building_stats();
-	void clicked_stock         ();
 };
 
 #endif

=== modified file 'src/wui/game_message_menu.cc'
--- src/wui/game_message_menu.cc	2010-05-16 15:56:35 +0000
+++ src/wui/game_message_menu.cc	2010-10-18 21:31:48 +0000
@@ -54,6 +54,8 @@
 	center_main_mapview_on_location     (*this),
 	mode                                (Inbox)
 {
+	printf("GameMessageMenu::GameMessageMenu\n");
+
 	if (get_usedefaultpos())
 		center_to_parent();
 
@@ -63,6 +65,7 @@
 
 	set_can_focus(true);
 	focus();
+	printf("GameMessageMenu::GameMessageMenu 2\n");
 }
 
 /**

=== modified file 'src/wui/game_objectives_menu.h'
--- src/wui/game_objectives_menu.h	2009-09-30 18:31:29 +0000
+++ src/wui/game_objectives_menu.h	2010-10-18 21:31:48 +0000
@@ -45,7 +45,7 @@
 	typedef UI::Listselect<Widelands::Objective &> list_type;
 	list_type              list;
 	UI::Multiline_Textarea objectivetext;
-	//UI::Callback_Button<GameObjectivesMenu> m_claim_victory, m_restart_mission;
+	//UI::Callback_Button m_claim_victory, m_restart_mission;
 public:
 	bool victorious(bool const v = false) {
 		static bool m_victory = v;

=== modified file 'src/wui/game_options_menu.cc'
--- src/wui/game_options_menu.cc	2010-04-24 20:03:07 +0000
+++ src/wui/game_options_menu.cc	2010-10-18 21:31:48 +0000
@@ -17,6 +17,11 @@
  *
  */
 
+#include <boost/bind.hpp>
+#include <boost/type_traits.hpp>
+#include <boost/lambda/bind.hpp>
+#include <boost/lambda/construct.hpp>
+
 #include "game_options_menu.h"
 
 #include "ui_fsmenu/fileview.h"
@@ -48,7 +53,7 @@
 		 vmargin() + 0 * (20 + vspacing()) + 0 * vgap(),
 		 buttonw(1), 20,
 		 g_gr->get_picture(PicMod_UI, "pics/but4.png"),
-		 &GameOptionsMenu::clicked_readme, *this,
+		 boost::bind(&UI::UniqueWindow::Registry::toggle, boost::ref(m_windows.readme)),
 		 _("README")),
 	license
 		(this, "license",
@@ -56,7 +61,7 @@
 		 vmargin() + 1 * (20 + vspacing()) + 0 * vgap(),
 		 buttonw(1), 20,
 		 g_gr->get_picture(PicMod_UI, "pics/but4.png"),
-		 &GameOptionsMenu::clicked_license, *this,
+		 boost::bind(&UI::UniqueWindow::Registry::toggle, boost::ref(m_windows.license)),
 		 _("License")),
 	authors
 		(this, "authors",
@@ -64,7 +69,7 @@
 		 vmargin() + 2 * (20 + vspacing()) + 0 * vgap(),
 		 buttonw(1), 20,
 		 g_gr->get_picture(PicMod_UI, "pics/but4.png"),
-		 &GameOptionsMenu::clicked_authors, *this,
+		 boost::bind(&UI::UniqueWindow::Registry::toggle, boost::ref(m_windows.authors)),
 		 _("Authors")),
 	sound
 		(this, "sound_options",
@@ -72,7 +77,7 @@
 		 vmargin() + 3 * (20 + vspacing()) + 1 * vgap(),
 		 buttonw(1), 20,
 		 g_gr->get_picture(PicMod_UI, "pics/but4.png"),
-		 &GameOptionsMenu::clicked_sound, *this,
+		 boost::bind(&GameOptionsMenu::clicked_sound, boost::ref(*this)),
 		 _("Sound Options")),
 	save_game
 		(this, "save_game",
@@ -81,7 +86,7 @@
 		 buttonw(1), 35,
 		 g_gr->get_picture(PicMod_UI, "pics/but4.png"),
 		 g_gr->get_picture(PicMod_Game, "pics/menu_save_game.png"),
-		 &GameOptionsMenu::clicked_save_game, *this,
+		 boost::bind(&GameOptionsMenu::clicked_save_game, boost::ref(*this)),
 		 _("Save Game")),
 	exit_game
 		(this, "exit_game",
@@ -91,9 +96,28 @@
 		 buttonw(1), 35,
 		 g_gr->get_picture(PicMod_UI, "pics/but4.png"),
 		 g_gr->get_picture(PicMod_Game, "pics/menu_exit_game.png"),
-		 &GameOptionsMenu::clicked_exit_game, *this,
+		 boost::bind(&GameOptionsMenu::clicked_exit_game, boost::ref(*this)),
 		 _("Exit Game"))
 {
+
+	m_windows.readme.constr = boost::bind(&fileview_window, boost::ref(m_gb), _1, "txts/README");
+	m_windows.license.constr = boost::bind(&fileview_window, boost::ref(m_gb), _1, "txts/COPYING");
+	m_windows.authors.constr = boost::bind(&fileview_window, boost::ref(m_gb), _1, "txts/developers");
+	// For some reason the latter does not work. It seemms that
+	// boost::lambda::bind is less powerful than boost::bind, but the
+	// latter does not work with boost::lamda::new_ptr
+	// m_windows.sound_options.constr = boost::lambda::bind(boost::lambda::new_ptr<GameOptionsSoundMenu>(), boost::ref(m_gb),_1);
+
+#define INIT_BTN_HOOKS(registry, btn)                                        \
+ registry.onCreate = boost::bind(&UI::Button::set_perm_pressed,&btn, true);  \
+ registry.onDelete = boost::bind(&UI::Button::set_perm_pressed,&btn, false); \
+ if (registry.window) btn.set_perm_pressed(true);                            \
+
+	INIT_BTN_HOOKS(m_windows.readme, readme)
+	INIT_BTN_HOOKS(m_windows.license, license)
+	INIT_BTN_HOOKS(m_windows.authors, authors)
+	INIT_BTN_HOOKS(m_windows.sound_options, sound)
+	
 	set_inner_size
 		(hmargin() + hmargin() +
 		 std::max(static_cast<int32_t>(get_inner_w()), readme.get_w()),
@@ -102,19 +126,6 @@
 		center_to_parent();
 }
 
-
-void GameOptionsMenu::clicked_readme() {
-	fileview_window(m_gb, m_windows.readme,  "txts/README");
-}
-
-void GameOptionsMenu::clicked_license() {
-	fileview_window(m_gb, m_windows.license, "txts/COPYING");
-}
-
-void GameOptionsMenu::clicked_authors() {
-	fileview_window(m_gb, m_windows.authors, "txts/developers");
-}
-
 void GameOptionsMenu::clicked_sound() {
 	if (m_windows.sound_options.window)
 		delete m_windows.sound_options.window;

=== modified file 'src/wui/game_options_menu.h'
--- src/wui/game_options_menu.h	2009-07-08 12:17:26 +0000
+++ src/wui/game_options_menu.h	2010-10-18 21:31:48 +0000
@@ -36,12 +36,12 @@
 private:
 	Interactive_GameBase                         & m_gb;
 	Interactive_GameBase::Game_Main_Menu_Windows & m_windows;
-	UI::Callback_Button<GameOptionsMenu> readme;
-	UI::Callback_Button<GameOptionsMenu> license;
-	UI::Callback_Button<GameOptionsMenu> authors;
-	UI::Callback_Button<GameOptionsMenu> sound;
-	UI::Callback_Button<GameOptionsMenu> save_game;
-	UI::Callback_Button<GameOptionsMenu> exit_game;
+	UI::Callback_Button readme;
+	UI::Callback_Button license;
+	UI::Callback_Button authors;
+	UI::Callback_Button sound;
+	UI::Callback_Button save_game;
+	UI::Callback_Button exit_game;
 
 	/** Returns the horizontal/vertical spacing between buttons. */
 	uint32_t hspacing() const {return 5;};
@@ -65,9 +65,6 @@
 		return hmargin() + nr * (buttonw(nr_buttons) + hspacing());
 	}
 
-	void clicked_readme   ();
-	void clicked_license  ();
-	void clicked_authors  ();
 	void clicked_sound    ();
 	void clicked_save_game();
 	void clicked_exit_game();

=== modified file 'src/wui/general_statistics_menu.cc'
--- src/wui/general_statistics_menu.cc	2010-09-04 13:50:09 +0000
+++ src/wui/general_statistics_menu.cc	2010-10-18 21:31:48 +0000
@@ -236,75 +236,75 @@
 	pos.x = spacing;
 	pos.y += spacing + spacing;
 
-	new UI::Callback_IDButton<WUIPlot_Area, WUIPlot_Area::TIME>
+	new UI::Callback_Button
 		(this, "15m",
 		 pos.x, pos.y, button_size, 25,
 		 g_gr->get_picture(PicMod_UI, "pics/but4.png"),
-		 &WUIPlot_Area::set_time, m_plot, WUIPlot_Area::TIME_15_MINS,
+		 boost::bind(&WUIPlot_Area::set_time, boost::ref(m_plot), WUIPlot_Area::TIME_15_MINS),
 		 _("15 m"));
 
 	pos.x += button_size + spacing;
 
-	new UI::Callback_IDButton<WUIPlot_Area, WUIPlot_Area::TIME>
+	new UI::Callback_Button
 		(this, "30m",
 		 pos.x, pos.y, button_size, 25,
 		 g_gr->get_picture(PicMod_UI, "pics/but4.png"),
-		 &WUIPlot_Area::set_time, m_plot, WUIPlot_Area::TIME_30_MINS,
+		 boost::bind(&WUIPlot_Area::set_time, boost::ref(m_plot), WUIPlot_Area::TIME_30_MINS),
 		 _("30 m"));
 
 	pos.x += button_size + spacing;
 
-	new UI::Callback_IDButton<WUIPlot_Area, WUIPlot_Area::TIME>
+	new UI::Callback_Button
 		(this, "1h",
 		 pos.x, pos.y, button_size, 25,
 		 g_gr->get_picture(PicMod_UI, "pics/but4.png"),
-		 &WUIPlot_Area::set_time, m_plot, WUIPlot_Area::TIME_ONE_HOUR,
+		 boost::bind(&WUIPlot_Area::set_time, boost::ref(m_plot), WUIPlot_Area::TIME_ONE_HOUR),
 		 _("1 h"));
 
 	pos.x += button_size + spacing;
 
-	new UI::Callback_IDButton<WUIPlot_Area, WUIPlot_Area::TIME>
+	new UI::Callback_Button
 		(this, "2h",
 		 pos.x, pos.y, button_size, 25,
 		 g_gr->get_picture(PicMod_UI, "pics/but4.png"),
-		 &WUIPlot_Area::set_time, m_plot, WUIPlot_Area::TIME_TWO_HOURS,
+		 boost::bind(&WUIPlot_Area::set_time, boost::ref(m_plot), WUIPlot_Area::TIME_TWO_HOURS),
 		 _("2 h"));
 
 	pos.y += 25 + spacing;
 	pos.x = spacing;
 
-	new UI::Callback_Button<General_Statistics_Menu>
+	new UI::Callback_Button
 		(this, "help",
 		 pos.x, pos.y, 32, 32,
 		 g_gr->get_picture(PicMod_UI, "pics/but4.png"),
 		 g_gr->get_picture(PicMod_Game, "pics/menu_help.png"),
-		 &General_Statistics_Menu::clicked_help, *this,
+		 boost::bind(&General_Statistics_Menu::clicked_help, boost::ref(*this)),
 		 _("Help"));
 
 	pos.x += button_size + spacing;
 
-	new UI::Callback_IDButton<WUIPlot_Area, WUIPlot_Area::TIME>
+	new UI::Callback_Button
 		(this, "4h",
 		 pos.x, pos.y, button_size, 25,
 		 g_gr->get_picture(PicMod_UI, "pics/but4.png"),
-		 &WUIPlot_Area::set_time, m_plot, WUIPlot_Area::TIME_FOUR_HOURS,
+		 boost::bind(&WUIPlot_Area::set_time, boost::ref(m_plot), WUIPlot_Area::TIME_FOUR_HOURS),
 		 _("4 h"));
 	pos.x += button_size + spacing;
 
-	new UI::Callback_IDButton<WUIPlot_Area, WUIPlot_Area::TIME>
+	new UI::Callback_Button
 		(this, "8h",
 		 pos.x, pos.y, button_size, 25,
 		 g_gr->get_picture(PicMod_UI, "pics/but4.png"),
-		 &WUIPlot_Area::set_time, m_plot, WUIPlot_Area::TIME_EIGHT_HOURS,
+		 boost::bind(&WUIPlot_Area::set_time, boost::ref(m_plot), WUIPlot_Area::TIME_EIGHT_HOURS),
 		 _("8 h"));
 
 	pos.x += button_size + spacing;
 
-	new UI::Callback_IDButton<WUIPlot_Area, WUIPlot_Area::TIME>
+	new UI::Callback_Button
 		(this, "16h",
 		 pos.x, pos.y, button_size, 25,
 		 g_gr->get_picture(PicMod_UI, "pics/but4.png"),
-		 &WUIPlot_Area::set_time, m_plot, WUIPlot_Area::TIME_16_HOURS,
+		 boost::bind(&WUIPlot_Area::set_time, boost::ref(m_plot), WUIPlot_Area::TIME_16_HOURS),
 		 _("16 h"));
 
 	pos.x += button_size + spacing;

=== modified file 'src/wui/interactive_base.cc'
--- src/wui/interactive_base.cc	2010-10-10 14:03:26 +0000
+++ src/wui/interactive_base.cc	2010-10-18 21:31:48 +0000
@@ -493,7 +493,6 @@
 	}
 }
 
-
 /**
  * Hide the minimap if it is currently shown; otherwise, do nothing.
  */
@@ -502,6 +501,16 @@
 	delete m->minimap.window;
 }
 
+/**
+===========
+Interactive_Base::minimap_registry()
+
+Exposes the Registry object of the minimap to derived classes
+===========
+*/
+UI::UniqueWindow::Registry &Interactive_Base::minimap_registry() {
+	return m->minimap;
+}
 
 /*
 ===============

=== modified file 'src/wui/interactive_base.h'
--- src/wui/interactive_base.h	2010-05-12 19:52:39 +0000
+++ src/wui/interactive_base.h	2010-10-18 21:31:48 +0000
@@ -158,6 +158,7 @@
 protected:
 	void toggle_minimap();
 	void hide_minimap();
+	UI::UniqueWindow::Registry &minimap_registry();
 
 	void mainview_move(int32_t x, int32_t y);
 	void minimap_warp(int32_t x, int32_t y);

=== modified file 'src/wui/interactive_dedicated_server.cc'
--- src/wui/interactive_dedicated_server.cc	2010-05-24 18:42:55 +0000
+++ src/wui/interactive_dedicated_server.cc	2010-10-18 21:31:48 +0000
@@ -46,7 +46,7 @@
 #define INIT_BTN(picture, name, callback, tooltip)                            \
  TOOLBAR_BUTTON_COMMON_PARAMETERS(name),                                      \
  g_gr->get_picture(PicMod_Game, "pics/" picture ".png"),                      \
- &Interactive_DServer::callback, *this,                                       \
+ boost::bind(&Interactive_DServer::callback, boost::ref(*this)),              \
  tooltip                                                                      \
 
 	m_toggle_chat

=== modified file 'src/wui/interactive_dedicated_server.h'
--- src/wui/interactive_dedicated_server.h	2009-09-30 18:31:29 +0000
+++ src/wui/interactive_dedicated_server.h	2010-10-18 21:31:48 +0000
@@ -54,9 +54,9 @@
 	virtual void node_action();
 
 private:
-	UI::Callback_Button<Interactive_DServer> m_toggle_chat;
-	UI::Callback_Button<Interactive_DServer> m_toggle_options_menu;
-	UI::Callback_Button<Interactive_DServer> m_toggle_statistics;
+	UI::Callback_Button m_toggle_chat;
+	UI::Callback_Button m_toggle_options_menu;
+	UI::Callback_Button m_toggle_statistics;
 
 	UI::UniqueWindow::Registry m_chat;
 	UI::UniqueWindow::Registry m_options;

=== modified file 'src/wui/interactive_player.cc'
--- src/wui/interactive_player.cc	2010-09-24 23:30:25 +0000
+++ src/wui/interactive_player.cc	2010-10-18 21:31:48 +0000
@@ -20,6 +20,9 @@
 #include "interactive_player.h"
 
 #include <boost/bind.hpp>
+#include <boost/type_traits.hpp>
+#include <boost/lambda/construct.hpp>
+#include <boost/lambda/bind.hpp>
 #include <boost/lexical_cast.hpp>
 #include <boost/format.hpp>
 #include <libintl.h>
@@ -164,39 +167,46 @@
 	m_auto_roadbuild_mode(global_s.get_bool("auto_roadbuild_mode", true)),
 m_flag_to_connect(Widelands::Coords::Null()),
 
-#define INIT_BTN(picture, name, callback, tooltip)                            \
+// Chat is different, as m_chatProvider needs to be checked when toggling
+// Buildhelp is different as it does not toggle a UniqueWindow
+// Minimap is different as it warps and stuff
+#define INIT_BTN_this(picture, name, callback, tooltip)                       \
  TOOLBAR_BUTTON_COMMON_PARAMETERS(name),                                      \
  g_gr->get_picture(PicMod_Game, "pics/" picture ".png"),                      \
- &Interactive_Player::callback, *this,                                        \
+ boost::bind(&Interactive_Player::callback, boost::ref(*this)),               \
  tooltip                                                                      \
 
+m_toggle_buildhelp
+	(INIT_BTN_this
+	 	("menu_toggle_buildhelp", "buildhelp", toggle_buildhelp, _("Buildhelp"))),
 m_toggle_chat
-	(INIT_BTN
+	(INIT_BTN_this
 	 	("menu_chat", "chat", toggle_chat, _("Chat"))),
+m_toggle_minimap
+	(INIT_BTN_this
+	 	("menu_toggle_minimap", "minimap", toggle_minimap, _("Minimap"))),
+
+#define INIT_BTN(picture, name, registry, tooltip)                            \
+ TOOLBAR_BUTTON_COMMON_PARAMETERS(name),                                      \
+ g_gr->get_picture(PicMod_Game, "pics/" picture ".png"),                      \
+ boost::bind(&UI::UniqueWindow::Registry::toggle, boost::ref(registry)),      \
+ tooltip                                                                      \
+
 m_toggle_options_menu
 	(INIT_BTN
-	 	("menu_options_menu", "options_menu", toggle_options_menu, _("Options"))),
+	 	("menu_options_menu", "options_menu", m_options, _("Options"))),
 m_toggle_statistics_menu
 	(INIT_BTN
-	 	("menu_toggle_menu", "statistics_menu", toggle_statistics_menu,
-		 _("Statistics"))),
+	 	("menu_toggle_menu", "statistics_menu", m_statisticsmenu, _("Statistics"))),
 m_toggle_objectives
 	(INIT_BTN
-	 	("menu_objectives", "objectives", toggle_objectives, _("Objectives"))),
-m_toggle_minimap
-	(INIT_BTN
-	 	("menu_toggle_minimap", "minimap", toggle_minimap, _("Minimap"))),
-m_toggle_buildhelp
-	(INIT_BTN
-	 	("menu_toggle_buildhelp", "buildhelp", toggle_buildhelp, _("Buildhelp"))),
+	 	("menu_objectives", "objectives", m_objectives, _("Objectives"))),
 m_toggle_message_menu
 	(INIT_BTN
-	 	("menu_toggle_oldmessage_menu", "messages", toggle_message_menu,
-		  _("Messages"))
-	),
+	 	("menu_toggle_oldmessage_menu", "messages", m_message_menu, _("Messages"))),
 m_toggle_help
 	(INIT_BTN
-	 	("menu_help", "help", toggle_help, _("Ware help")))
+	 	("menu_help", "help", m_encyclopedia, _("Ware help")))
 {
 	// TODO : instead of making unneeded buttons invisible after generation,
 	// they should not at all be generated. -> implement more dynamic toolbar UI
@@ -225,6 +235,25 @@
 	adjust_toolbar_position();
 
 	set_display_flag(dfSpeed, true);
+	
+#define INIT_BTN_HOOKS(registry, btn)                                        \
+ registry.onCreate = boost::bind(&UI::Button::set_perm_pressed,&btn, true);  \
+ registry.onDelete = boost::bind(&UI::Button::set_perm_pressed,&btn, false); \
+ if (registry.window) btn.set_perm_pressed(true);                            \
+
+	INIT_BTN_HOOKS(m_chat, m_toggle_chat)
+	INIT_BTN_HOOKS(m_options, m_toggle_options_menu)
+	INIT_BTN_HOOKS(m_statisticsmenu, m_toggle_statistics_menu)
+	INIT_BTN_HOOKS(minimap_registry(), m_toggle_minimap)
+	INIT_BTN_HOOKS(m_objectives, m_toggle_objectives)
+	INIT_BTN_HOOKS(m_encyclopedia, m_toggle_help)
+	INIT_BTN_HOOKS(m_message_menu, m_toggle_message_menu)
+
+	m_encyclopedia.constr = boost::lambda::bind(boost::lambda::new_ptr<EncyclopediaWindow>(), boost::ref(*this), boost::lambda::_1);
+	m_options.constr = boost::lambda::bind(boost::lambda::new_ptr<GameOptionsMenu>(), boost::ref(*this), boost::lambda::_1, boost::ref(m_mainm_windows));
+	m_statisticsmenu.constr = boost::lambda::bind(boost::lambda::new_ptr<GameMainMenu>(), boost::ref(*this), boost::lambda::_1, boost::ref(m_mainm_windows));
+	m_objectives.constr = boost::lambda::bind(boost::lambda::new_ptr<GameObjectivesMenu>(), boost::ref(*this), boost::lambda::_1);
+	m_message_menu.constr = boost::lambda::bind(boost::lambda::new_ptr<GameMessageMenu>(), boost::ref(*this), boost::lambda::_1);
 
 #ifdef DEBUG //  only in debug builds
 	addCommand
@@ -306,6 +335,12 @@
 	overlay_manager.show_buildhelp(false);
 	overlay_manager.register_overlay_callback_function
 			(&Int_Player_overlay_callback_function, static_cast<void *>(this));
+	
+	// Connect buildhelp button to reflect build help state. Needs to be
+	// done here rather than in the constructor as the map is not present then.
+	egbase().map().overlay_manager().onBuildHelpToggle =
+		boost::bind(&UI::Button::set_perm_pressed,&m_toggle_buildhelp,_1);
+	m_toggle_buildhelp.set_perm_pressed(buildhelp());
 
 	// Recalc whole map for changed owner stuff
 	map.recalc_whole_map();
@@ -321,8 +356,7 @@
 void Interactive_Player::popup_message
 	(Widelands::Message_Id const id, Widelands::Message const & message)
 {
-	if (not m_message_menu.window)
-		new GameMessageMenu(*this, m_message_menu);
+	m_message_menu.create();
 	ref_cast<GameMessageMenu, UI::UniqueWindow>(*m_message_menu.window)
 	.show_new_message(id, message);
 }
@@ -335,40 +369,6 @@
 	else if (m_chatProvider)
 		new GameChatMenu(this, m_chat, *m_chatProvider);
 }
-void Interactive_Player::toggle_options_menu() {
-	if (m_options.window)
-		delete m_options.window;
-	else
-		new GameOptionsMenu(*this, m_options, m_mainm_windows);
-}
-void Interactive_Player::toggle_statistics_menu() {
-	if (m_statisticsmenu.window)
-		delete m_statisticsmenu.window;
-	else
-		new GameMainMenu(*this, m_statisticsmenu, m_mainm_windows);
-}
-void Interactive_Player::toggle_objectives() {
-	if (m_objectives.window)
-		delete m_objectives.window;
-	else
-		new GameObjectivesMenu(*this, m_objectives);
-}
-void Interactive_Player::toggle_message_menu() {
-	if (m_message_menu.window)
-		delete m_message_menu.window;
-	else
-		new GameMessageMenu(*this, m_message_menu);
-}
-
-void Interactive_Player::toggle_resources   () {
-}
-void Interactive_Player::toggle_help        () {
-	if (m_encyclopedia.window)
-		delete m_encyclopedia.window;
-	else
-		new EncyclopediaWindow(*this, m_encyclopedia);
-}
-
 
 bool Interactive_Player::can_see(Widelands::Player_Number const p) const
 {
@@ -426,11 +426,11 @@
 			return true;
 
 		case SDLK_n:
-			toggle_message_menu();
+			m_message_menu.toggle();
 			return true;
 
 		case SDLK_o:
-			toggle_objectives();
+			m_objectives.toggle();
 			return true;
 
 		case SDLK_c:

=== modified file 'src/wui/interactive_player.h'
--- src/wui/interactive_player.h	2010-04-25 18:47:42 +0000
+++ src/wui/interactive_player.h	2010-10-18 21:31:48 +0000
@@ -54,14 +54,7 @@
 
 	void start();
 
-	void toggle_statistics_menu();
 	void toggle_chat        ();
-	void toggle_options_menu();
-	void toggle_objectives();
-
-	void toggle_resources ();
-	void toggle_help      ();
-	void toggle_message_menu();
 
 	virtual bool can_see(Widelands::Player_Number) const;
 	virtual bool can_act(Widelands::Player_Number) const;
@@ -100,14 +93,14 @@
 	bool                     m_auto_roadbuild_mode;
 	Widelands::Coords        m_flag_to_connect;
 
-	UI::Callback_Button<Interactive_Player> m_toggle_chat;
-	UI::Callback_Button<Interactive_Player> m_toggle_options_menu;
-	UI::Callback_Button<Interactive_Player> m_toggle_statistics_menu;
-	UI::Callback_Button<Interactive_Player> m_toggle_objectives;
-	UI::Callback_Button<Interactive_Player> m_toggle_minimap;
-	UI::Callback_Button<Interactive_Player> m_toggle_buildhelp;
-	UI::Callback_Button<Interactive_Player> m_toggle_message_menu;
-	UI::Callback_Button<Interactive_Player> m_toggle_help;
+	UI::Callback_Button m_toggle_chat;
+	UI::Callback_Button m_toggle_options_menu;
+	UI::Callback_Button m_toggle_statistics_menu;
+	UI::Callback_Button m_toggle_objectives;
+	UI::Callback_Button m_toggle_minimap;
+	UI::Callback_Button m_toggle_buildhelp;
+	UI::Callback_Button m_toggle_message_menu;
+	UI::Callback_Button m_toggle_help;
 
 	UI::UniqueWindow::Registry m_chat;
 	UI::UniqueWindow::Registry m_options;

=== modified file 'src/wui/interactive_spectator.cc'
--- src/wui/interactive_spectator.cc	2010-05-24 18:42:55 +0000
+++ src/wui/interactive_spectator.cc	2010-10-18 21:31:48 +0000
@@ -47,7 +47,7 @@
 #define INIT_BTN(picture, name, callback, tooltip)                            \
  TOOLBAR_BUTTON_COMMON_PARAMETERS(name),                                      \
  g_gr->get_picture(PicMod_Game, "pics/" picture ".png"),                      \
- &Interactive_Spectator::callback, *this,                                     \
+ boost::bind(&Interactive_Spectator::callback, boost::ref(*this)),            \
  tooltip                                                                      \
 
 	m_toggle_chat

=== modified file 'src/wui/interactive_spectator.h'
--- src/wui/interactive_spectator.h	2009-09-30 18:31:29 +0000
+++ src/wui/interactive_spectator.h	2010-10-18 21:31:48 +0000
@@ -56,12 +56,12 @@
 	virtual void node_action();
 
 private:
-	UI::Callback_Button<Interactive_Spectator> m_toggle_chat;
-	UI::Callback_Button<Interactive_Spectator> m_exit;
-	UI::Callback_Button<Interactive_Spectator> m_save;
-	UI::Callback_Button<Interactive_Spectator> m_toggle_options_menu;
-	UI::Callback_Button<Interactive_Spectator> m_toggle_statistics;
-	UI::Callback_Button<Interactive_Spectator> m_toggle_minimap;
+	UI::Callback_Button m_toggle_chat;
+	UI::Callback_Button m_exit;
+	UI::Callback_Button m_save;
+	UI::Callback_Button m_toggle_options_menu;
+	UI::Callback_Button m_toggle_statistics;
+	UI::Callback_Button m_toggle_minimap;
 
 
 	UI::UniqueWindow::Registry m_chat;

=== modified file 'src/wui/login_box.cc'
--- src/wui/login_box.cc	2010-04-24 20:03:07 +0000
+++ src/wui/login_box.cc	2010-10-18 21:31:48 +0000
@@ -56,17 +56,17 @@
 		(this, 40, 135,
 		 _("Automatically use this login information from now on."));
 
-	new UI::Callback_Button<LoginBox>
+	new UI::Callback_Button
 		(this, "login",
 		 (get_inner_w() / 2 - 200) / 2, 175, 200, 20,
 		 g_gr->get_picture(PicMod_UI, "pics/but0.png"),
-		 &LoginBox::pressedLogin, *this,
+		 boost::bind(&LoginBox::pressedLogin, boost::ref(*this)),
 		 _("Login"));
-	new UI::Callback_Button<LoginBox>
+	new UI::Callback_Button
 		(this, "cancel",
 		 (get_inner_w() / 2 - 200) / 2 + get_inner_w() / 2, 175, 200, 20,
 		 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
-		 &LoginBox::pressedCancel, *this,
+		 boost::bind(&LoginBox::pressedCancel, boost::ref(*this)),
 		 _("Cancel"));
 
 	Section & s = g_options.pull_section("global");

=== modified file 'src/wui/military_box.cc'
--- src/wui/military_box.cc	2010-06-28 15:48:40 +0000
+++ src/wui/military_box.cc	2010-10-18 21:31:48 +0000
@@ -83,20 +83,19 @@
 	return result;
 }
 
-UI::Callback_Button<MilitaryBox> & MilitaryBox::add_button
+UI::Callback_Button & MilitaryBox::add_button
 	(UI::Box           & parent,
 	 char        const * const name,
 	 char        const * const text,
 	 void         (MilitaryBox::*fn)(),
 	 std::string const & tooltip_text)
 {
-	UI::Callback_Button<MilitaryBox> & button =
-		*new UI::Callback_Button<MilitaryBox>
+	UI::Callback_Button & button =
+		*new UI::Callback_Button
 			(&parent, name,
 			 8, 8, 26, 26,
 			 g_gr->get_picture(PicMod_UI, "pics/but2.png"),
-			 fn,
-			 *this,
+			 boost::bind(fn,boost::ref(*this)),
 			 text,
 			 tooltip_text);
 	parent.add(&button, Box::AlignTop);

=== modified file 'src/wui/military_box.h'
--- src/wui/military_box.h	2010-04-18 17:18:52 +0000
+++ src/wui/military_box.h	2010-10-18 21:31:48 +0000
@@ -60,7 +60,7 @@
 			 uint32_t            alignment = UI::Box::AlignTop,
 			 std::string const & fontname = UI_FONT_NAME,
 			 uint32_t            fontsize = UI_FONT_SIZE_SMALL);
-		UI::Callback_Button<MilitaryBox> & add_button
+		UI::Callback_Button & add_button
 			(UI::Box           & parent,
 			 char const *,
 			 char const *,

=== modified file 'src/wui/minimap.cc'
--- src/wui/minimap.cc	2010-05-17 10:21:20 +0000
+++ src/wui/minimap.cc	2010-10-18 21:31:48 +0000
@@ -143,42 +143,42 @@
 		 but_w() * 0, m_view.get_h() + but_h() * 0, but_w(), but_h(),
 		 g_gr->get_picture(PicMod_UI, "pics/but0.png"),
 		 g_gr->get_picture(PicMod_UI, "pics/button_terrn.png"),
-		 &MiniMap::toggle, *this, Terrn,
+		 boost::bind(&MiniMap::toggle, boost::ref(*this), Terrn),
 		 _("Terrain")),
 	button_owner
 		(this, "owner",
 		 but_w() * 1, m_view.get_h() + but_h() * 0, but_w(), but_h(),
 		 g_gr->get_picture(PicMod_UI, "pics/but0.png"),
 		 g_gr->get_picture(PicMod_UI, "pics/button_owner.png"),
-		 &MiniMap::toggle, *this, Owner,
+		 boost::bind(&MiniMap::toggle, boost::ref(*this), Owner),
 		 _("Owner")),
 	button_flags
 		(this, "flags",
 		 but_w() * 2, m_view.get_h() + but_h() * 0, but_w(), but_h(),
 		 g_gr->get_picture(PicMod_UI, "pics/but0.png"),
 		 g_gr->get_picture(PicMod_UI, "pics/button_flags.png"),
-		 &MiniMap::toggle, *this, Flags,
+		 boost::bind(&MiniMap::toggle, boost::ref(*this), Flags),
 		 _("Flags")),
 	button_roads
 		(this, "roads",
 		 but_w() * 0, m_view.get_h() + but_h() * 1, but_w(), but_h(),
 		 g_gr->get_picture(PicMod_UI, "pics/but0.png"),
 		 g_gr->get_picture(PicMod_UI, "pics/button_roads.png"),
-		 &MiniMap::toggle, *this, Roads,
+		 boost::bind(&MiniMap::toggle, boost::ref(*this), Roads),
 		 _("Roads")),
 	button_bldns
 		(this, "buildings",
 		 but_w() * 1, m_view.get_h() + but_h() * 1, but_w(), but_h(),
 		 g_gr->get_picture(PicMod_UI, "pics/but0.png"),
 		 g_gr->get_picture(PicMod_UI, "pics/button_bldns.png"),
-		 &MiniMap::toggle, *this, Bldns,
+		 boost::bind(&MiniMap::toggle, boost::ref(*this), Bldns),
 		 _("Buildings")),
 	button_zoom
 		(this, "zoom",
 		 but_w() * 2, m_view.get_h() + but_h() * 1, but_w(), but_h(),
 		 g_gr->get_picture(PicMod_UI, "pics/but0.png"),
 		 g_gr->get_picture(PicMod_UI, "pics/button_zoom.png"),
-		 &MiniMap::toggle, *this, Zoom2,
+		 boost::bind(&MiniMap::toggle, boost::ref(*this), Zoom2),
 		 _("Zoom"))
 {
 	resize();

=== modified file 'src/wui/minimap.h'
--- src/wui/minimap.h	2009-12-31 15:09:37 +0000
+++ src/wui/minimap.h	2010-10-18 21:31:48 +0000
@@ -85,12 +85,12 @@
 	uint32_t but_h                    () const;
 
 	View     m_view;
-	UI::Callback_IDButton<MiniMap, Layers> button_terrn;
-	UI::Callback_IDButton<MiniMap, Layers> button_owner;
-	UI::Callback_IDButton<MiniMap, Layers> button_flags;
-	UI::Callback_IDButton<MiniMap, Layers> button_roads;
-	UI::Callback_IDButton<MiniMap, Layers> button_bldns;
-	UI::Callback_IDButton<MiniMap, Layers> button_zoom;
+	UI::Callback_Button button_terrn;
+	UI::Callback_Button button_owner;
+	UI::Callback_Button button_flags;
+	UI::Callback_Button button_roads;
+	UI::Callback_Button button_bldns;
+	UI::Callback_Button button_zoom;
 };
 
 #endif

=== modified file 'src/wui/overlay_manager.h'
--- src/wui/overlay_manager.h	2010-04-12 15:11:28 +0000
+++ src/wui/overlay_manager.h	2010-10-18 21:31:48 +0000
@@ -20,6 +20,8 @@
 #ifndef OVERLAY_MANAGER_H
 #define OVERLAY_MANAGER_H
 
+#include "boost/bind.hpp"
+#include "boost/function.hpp"
 #include "logic/field.h"
 #include "logic/widelands_geometry.h"
 #include "graphic/graphic.h"
@@ -132,9 +134,18 @@
 	uint8_t get_overlays(Widelands::FCoords c, Overlay_Info *) const;
 	uint8_t get_overlays(Widelands::TCoords<>, Overlay_Info *) const;
 
+	boost::function<void(bool)> onBuildHelpToggle;
 	bool buildhelp(void) {return m_showbuildhelp;}
-	void show_buildhelp(bool const t) {m_showbuildhelp = t;}
-	void toggle_buildhelp() {m_showbuildhelp = !m_showbuildhelp;}
+	void show_buildhelp(bool const t) {
+		if (m_showbuildhelp != t) {
+			m_showbuildhelp = t;
+			if (onBuildHelpToggle) onBuildHelpToggle(m_showbuildhelp);
+		}
+	}
+	void toggle_buildhelp() {
+		m_showbuildhelp = !m_showbuildhelp;
+		if (onBuildHelpToggle) onBuildHelpToggle(m_showbuildhelp);
+	}
 
 	void recalc_field_overlays(Widelands::FCoords);
 

=== modified file 'src/wui/soldiercapacitycontrol.cc'
--- src/wui/soldiercapacitycontrol.cc	2010-06-16 20:29:34 +0000
+++ src/wui/soldiercapacitycontrol.cc	2010-10-18 21:31:48 +0000
@@ -49,8 +49,8 @@
 	Interactive_GameBase & m_igb;
 	Widelands::Building & m_building;
 
-	UI::Callback_Button<SoldierCapacityControl> m_decrease;
-	UI::Callback_Button<SoldierCapacityControl> m_increase;
+	UI::Callback_Button m_decrease;
+	UI::Callback_Button m_increase;
 	UI::Textarea m_value;
 };
 
@@ -65,12 +65,12 @@
 	(this, "increase", 0, 0, 24, 24,
 	 g_gr->get_picture(PicMod_UI, "pics/but4.png"),
 	 g_gr->get_picture(PicMod_Game, pic_down_train),
-	 &SoldierCapacityControl::click_decrease, *this),
+	 boost::bind(&SoldierCapacityControl::click_decrease, boost::ref(*this))),
 m_increase
 	(this, "decrease", 0, 0, 24, 24,
 	 g_gr->get_picture(PicMod_UI, "pics/but4.png"),
 	 g_gr->get_picture(PicMod_Game, pic_up_train),
-	 &SoldierCapacityControl::click_increase, *this),
+	 boost::bind(&SoldierCapacityControl::click_increase, boost::ref(*this))),
 m_value(this, "", UI::Align_Center)
 {
 	add(new UI::Textarea(this, _("Capacity")), AlignCenter);

=== modified file 'src/wui/story_message_box.cc'
--- src/wui/story_message_box.cc	2010-04-24 20:03:07 +0000
+++ src/wui/story_message_box.cc	2010-10-18 21:31:48 +0000
@@ -60,11 +60,12 @@
 	posx = spacing;
 	posy = get_inner_h() - 30;
 	posx += space;
-	new UI::Callback_IDButton<Story_Message_Box, int32_t>
+	new UI::Callback_Button
 		(this, "ok",
 		 posx, posy, but_width, 20,
 		 g_gr->get_picture(PicMod_UI, "pics/but0.png"),
-		 &Story_Message_Box::clicked_ok, *this, 0, button_text);
+		 boost::bind(&Story_Message_Box::clicked_ok, boost::ref(*this), 0),
+		 button_text);
 		posx += but_width;
 
 	center_to_parent();

=== modified file 'src/wui/ware_statistics_menu.cc'
--- src/wui/ware_statistics_menu.cc	2010-04-24 20:03:07 +0000
+++ src/wui/ware_statistics_menu.cc	2010-10-18 21:31:48 +0000
@@ -413,76 +413,76 @@
 	pos.x  = spacing;
 	pos.y += spacing + spacing;
 
-	new UI::Callback_IDButton<WUIPlot_Area, WUIPlot_Area::TIME>
+	new UI::Callback_Button
 		(this, "15m",
 		 pos.x, pos.y, button_size, 25,
 		 g_gr->get_picture(PicMod_UI, "pics/but4.png"),
-		 &WUIPlot_Area::set_time, *m_plot, WUIPlot_Area::TIME_15_MINS,
+		 boost::bind(&WUIPlot_Area::set_time, boost::ref(*m_plot), WUIPlot_Area::TIME_15_MINS),
 		 _("15 m"));
 
 	pos.x += button_size + spacing;
 
-	new UI::Callback_IDButton<WUIPlot_Area, WUIPlot_Area::TIME>
+	new UI::Callback_Button
 		(this, "30m",
 		 pos.x, pos.y, button_size, 25,
 		 g_gr->get_picture(PicMod_UI, "pics/but4.png"),
-		 &WUIPlot_Area::set_time, *m_plot, WUIPlot_Area::TIME_30_MINS,
+		 boost::bind(&WUIPlot_Area::set_time, boost::ref(*m_plot), WUIPlot_Area::TIME_30_MINS),
 		 _("30 m"));
 
 	pos.x += button_size + spacing;
 
-	new UI::Callback_IDButton<WUIPlot_Area, WUIPlot_Area::TIME>
+	new UI::Callback_Button
 		(this, "1h",
 		 pos.x, pos.y, button_size, 25,
 		 g_gr->get_picture(PicMod_UI, "pics/but4.png"),
-		 &WUIPlot_Area::set_time, *m_plot, WUIPlot_Area::TIME_ONE_HOUR,
+		 boost::bind(&WUIPlot_Area::set_time, boost::ref(*m_plot), WUIPlot_Area::TIME_ONE_HOUR),
 		 _("1 h"));
 
 	pos.x += button_size + spacing;
 
-	new UI::Callback_IDButton<WUIPlot_Area, WUIPlot_Area::TIME>
+	new UI::Callback_Button
 		(this, "2h",
 		 pos.x, pos.y, button_size, 25,
 		 g_gr->get_picture(PicMod_UI, "pics/but4.png"),
-		 &WUIPlot_Area::set_time, *m_plot, WUIPlot_Area::TIME_TWO_HOURS,
+		 boost::bind(&WUIPlot_Area::set_time, boost::ref(*m_plot), WUIPlot_Area::TIME_TWO_HOURS),
 		 _("2 h"));
 
 	pos.y += 25 + spacing;
 	pos.x  =      spacing;
 
-	new UI::Callback_Button<Ware_Statistics_Menu>
+	new UI::Callback_Button
 		(this, "help",
 		 pos.x, pos.y, 32, 32,
 		 g_gr->get_picture(PicMod_UI, "pics/but4.png"),
 		 g_gr->get_picture(PicMod_Game, "pics/menu_help.png"),
-		 &Ware_Statistics_Menu::clicked_help, *this,
+		 boost::bind(&Ware_Statistics_Menu::clicked_help, boost::ref(*this)),
 		 _("Help"));
 
 	pos.x += button_size + spacing;
 
-	new UI::Callback_IDButton<WUIPlot_Area, WUIPlot_Area::TIME>
+	new UI::Callback_Button
 		(this, "4h",
 		 pos.x, pos.y, button_size, 25,
 		 g_gr->get_picture(PicMod_UI, "pics/but4.png"),
-		 &WUIPlot_Area::set_time, *m_plot, WUIPlot_Area::TIME_FOUR_HOURS,
+		 boost::bind(&WUIPlot_Area::set_time, boost::ref(*m_plot), WUIPlot_Area::TIME_FOUR_HOURS),
 		 _("4 h"));
 
 	pos.x += button_size + spacing;
 
-	new UI::Callback_IDButton<WUIPlot_Area, WUIPlot_Area::TIME>
+	new UI::Callback_Button
 		(this, "8h",
 		 pos.x, pos.y, button_size, 25,
 		 g_gr->get_picture(PicMod_UI, "pics/but4.png"),
-		 &WUIPlot_Area::set_time, *m_plot, WUIPlot_Area::TIME_EIGHT_HOURS,
+		 boost::bind(&WUIPlot_Area::set_time, boost::ref(*m_plot), WUIPlot_Area::TIME_EIGHT_HOURS),
 		 _("8 h"));
 
 	pos.x += button_size + spacing;
 
-	new UI::Callback_IDButton<WUIPlot_Area, WUIPlot_Area::TIME>
+	new UI::Callback_Button
 		(this, "16h",
 		 pos.x, pos.y, button_size, 25,
 		 g_gr->get_picture(PicMod_UI, "pics/but4.png"),
-		 &WUIPlot_Area::set_time, *m_plot, WUIPlot_Area::TIME_16_HOURS,
+		 boost::bind(&WUIPlot_Area::set_time, boost::ref(*m_plot), WUIPlot_Area::TIME_16_HOURS),
 		 _("16 h"));
 
 	pos += Point(button_size + spacing, 32 + spacing);