summaryrefslogtreecommitdiffstats
blob: 1d18287a1525ccb21479d7ab20a817d159ec8d9e (plain)
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
#include "Swift/Controllers/EventWindowController.h"

#include <boost/bind.hpp>

namespace Swift {

EventWindowController::EventWindowController(EventController* eventController, EventWindowFactory* windowFactory) {
	eventController_ = eventController;
	windowFactory_ = windowFactory;
	window_ = windowFactory_->createEventWindow();
	eventController_->onEventQueueEventAdded.connect(boost::bind(&EventWindowController::handleEventQueueEventAdded, this, _1));
}

EventWindowController::~EventWindowController() {
	delete window_;
}

void EventWindowController::handleEventQueueEventAdded(boost::shared_ptr<StanzaEvent> event) {
	event->onConclusion.connect(boost::bind(&EventWindowController::handleEventConcluded, this, event));
	window_->addEvent(event, true);
}

void EventWindowController::handleEventConcluded(boost::shared_ptr<StanzaEvent> event) {
	window_->removeEvent(event);
	window_->addEvent(event, false);
}

}