summaryrefslogtreecommitdiffstats
blob: 810e8a693ec8c02d3eebbbad4134f211b9950a28 (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
#include "Swift/Controllers/XMLConsoleController.h"

#include "Swift/Controllers/UIInterfaces/XMLConsoleWidgetFactory.h"

#include "Swift/Controllers/UIEvents/RequestXMLConsoleUIEvent.h"

namespace Swift {
XMLConsoleController::XMLConsoleController(UIEventStream* uiEventStream, XMLConsoleWidgetFactory* xmlConsoleWidgetFactory) {
	uiEventStream_ = uiEventStream;
	xmlConsoleWidgetFactory_ = xmlConsoleWidgetFactory;
	uiEventStream_->onUIEvent.connect(boost::bind(&XMLConsoleController::handleUIEvent, this, _1));
	xmlConsoleWidget_ = NULL;
}

void XMLConsoleController::handleUIEvent(boost::shared_ptr<UIEvent> rawEvent) {
	boost::shared_ptr<RequestXMLConsoleUIEvent> event = boost::dynamic_pointer_cast<RequestXMLConsoleUIEvent>(rawEvent);
	if (event != NULL) {
		if (xmlConsoleWidget_ == NULL) {
			xmlConsoleWidget_ = xmlConsoleWidgetFactory_->createXMLConsoleWidget();
		}
		xmlConsoleWidget_->show();
	}
}

}