Convert a button callback to a signal handler.

Just a proof of concept change, the rest of the callbacks will be
changed post 1.8.
This commit is contained in:
Mark de Wever 2009-10-11 15:08:39 +00:00
parent cf70494c46
commit e8649fa9d4

View file

@ -26,6 +26,8 @@
#include "gui/widgets/scroll_label.hpp"
#include "gui/widgets/toggle_button.hpp"
#include <boost/bind.hpp>
namespace gui2 {
namespace {
@ -107,6 +109,7 @@ void tmp_server_list::post_show(twindow& window)
}
}
#ifdef GUI2_OLD_EVENT_HANDLING
void callback_view_list_button(twidget* caller)
{
assert(caller);
@ -118,6 +121,7 @@ void callback_view_list_button(twidget* caller)
mp_connect->show_server_list(*window);
}
#endif
} // namespace
@ -159,8 +163,16 @@ void tmp_connect::pre_show(CVideo& video, twindow& window)
// Set view list callback button.
if(tbutton* button = find_widget<tbutton>(&window, "list", false, false)) {
#ifdef GUI2_OLD_EVENT_HANDLING
button->set_callback_mouse_left_click(callback_view_list_button);
#else
button->connect_signal_mouse_left_click(boost::bind(
&tmp_connect::show_server_list
, this
, boost::ref(window)));
#endif
}
}
void tmp_connect::post_show(twindow& /*window*/)