all callbacks must go through dispatcher

This commit is contained in:
Eduardo Bart 2011-04-16 22:07:03 -03:00
parent 9dfb33f2ed
commit 16a7747393
1 changed files with 4 additions and 2 deletions

View File

@ -23,6 +23,7 @@
#include "uibutton.h"
#include "core/dispatcher.h"
void UIButton::onInputEvent(const InputEvent& event)
{
@ -31,8 +32,9 @@ void UIButton::onInputEvent(const InputEvent& event)
} else if(event.type == EV_MOUSE_LUP && m_state == UI::ButtonDown) {
m_state = UI::ButtonUp;
if(getRect().contains(event.mousePos)) {
if(m_buttonClickCallback)
m_buttonClickCallback();
if(m_buttonClickCallback) {
g_dispatcher.addTask(m_buttonClickCallback);
}
}
}
}