summaryrefslogtreecommitdiffstats
blob: ebc9912c41db4820dc588b54ca51d87d807935bd (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
#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();
		xmlConsoleWidget_->activate();
	}
}

}