1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
|
/*!
@file
@author Albert Semenov
@date 08/2009
*/
#ifndef GRAPH_NODE_EVENT_H_
#define GRAPH_NODE_EVENT_H_
#include <MyGUI.h>
#include "BaseAnimationNode.h"
#include "EventController.h"
namespace demo
{
class GraphNodeEventController :
public BaseAnimationNode
{
public:
GraphNodeEventController(const std::string& _name) :
BaseAnimationNode("GraphNodeEvent.layout", "EventController", _name),
mConnectionOut(nullptr),
mButtonEvent(nullptr)
{
}
private:
virtual void initialise()
{
mMainWidget->castType<MyGUI::Window>()->setCaption(getName());
assignBase(mConnectionOut, "ConnectionOut");
assignWidget(mButtonEvent, "ButtonEvent");
mButtonEvent->eventMouseButtonClick += MyGUI::newDelegate(this, &GraphNodeEventController::notifyMouseButtonClick);
}
virtual void shutdown()
{
}
void notifyMouseButtonClick(MyGUI::Widget* _sender)
{
onEvent();
}
void onEvent()
{
animation::EventController* controller = dynamic_cast<animation::EventController*>(getAnimationNode());
if (controller)
controller->generateEvent();
}
private:
wraps::BaseGraphConnection* mConnectionOut;
MyGUI::Button* mButtonEvent;
};
} // namespace demo
#endif // GRAPH_NODE_EVENT_H_
|