mirror of
https://github.com/wesnoth/wesnoth
synced 2025-04-27 08:52:55 +00:00
Wire in the first public widget signal handler.
These signals should replace the callbacks, but this project will be done post 1.8. But it shows the design idea.
This commit is contained in:
parent
99bd003b89
commit
cf70494c46
@ -43,6 +43,18 @@ tbutton::tbutton()
|
||||
&tbutton::signal_handler_left_button_click, this, _2, _3));
|
||||
}
|
||||
|
||||
void tbutton::connect_signal_mouse_left_click(
|
||||
const event::tsignal_function& signal)
|
||||
{
|
||||
connect_signal<event::LEFT_BUTTON_CLICK>( signal);
|
||||
}
|
||||
|
||||
void tbutton::disconnect_signal_mouse_left_click(
|
||||
const event::tsignal_function& signal)
|
||||
{
|
||||
disconnect_signal<event::LEFT_BUTTON_CLICK>(signal);
|
||||
}
|
||||
|
||||
#ifdef GUI2_OLD_EVENT_HANDLING
|
||||
void tbutton::mouse_enter(tevent_handler&)
|
||||
{
|
||||
|
@ -27,9 +27,31 @@ class tbutton : public tcontrol
|
||||
public:
|
||||
tbutton();
|
||||
|
||||
/** @deprecated use (dis)connect_signal_mouse_left_click instead. */
|
||||
void set_callback_mouse_left_click(void (*callback) (twidget*))
|
||||
{ callback_mouse_left_click_ = callback; }
|
||||
|
||||
/**
|
||||
* Connects a signal handler for a left mouse button click.
|
||||
*
|
||||
* @todo Implement everywhere.
|
||||
*
|
||||
* The signal should be used for all common cases (which now have
|
||||
* set_callback_xxx). The those set functions can be removed.
|
||||
*
|
||||
* @param signal The signal to connect.
|
||||
*/
|
||||
void connect_signal_mouse_left_click(const event::tsignal_function& signal);
|
||||
|
||||
/**
|
||||
* Disconnects a signal handler for a left mouse button click.
|
||||
*
|
||||
* @param signal The signal to disconnect (should be the same
|
||||
* as send to the connect call.
|
||||
*/
|
||||
void disconnect_signal_mouse_left_click(
|
||||
const event::tsignal_function& signal);
|
||||
|
||||
/***** ***** ***** ***** Inherited ***** ***** ***** *****/
|
||||
|
||||
#ifdef GUI2_OLD_EVENT_HANDLING
|
||||
|
Loading…
x
Reference in New Issue
Block a user