Added additional dialog callback helper function by iceiceice
This commit is contained in:
parent
352bd1cae2
commit
0135b70272
1 changed files with 18 additions and 0 deletions
|
@ -17,6 +17,8 @@
|
|||
|
||||
#include "gui/widgets/window.hpp"
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
namespace gui2
|
||||
{
|
||||
|
||||
|
@ -35,6 +37,22 @@ void dialog_callback(twidget& caller)
|
|||
(dialog->*fptr)(*window);
|
||||
}
|
||||
|
||||
typedef boost::function<void(twindow &)> dialog_member_func_type;
|
||||
|
||||
inline void make_dialog_callback_helper(const dialog_member_func_type & t,
|
||||
twidget & caller)
|
||||
{
|
||||
twindow * window = dynamic_cast<twindow *>(caller.get_window());
|
||||
assert(window);
|
||||
t(*window);
|
||||
}
|
||||
|
||||
inline boost::function<void(twidget &)> make_dialog_callback(
|
||||
dialog_member_func_type func)
|
||||
{
|
||||
return boost::bind(make_dialog_callback_helper, func, _1);
|
||||
}
|
||||
|
||||
} // namespace gui2
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Reference in a new issue