/* * Copyright (c) 2012 Catalin Badea * Licensed under the simplified BSD license. * See Documentation/Licenses/BSD-simplified.txt for more information. */ #include #include #include namespace Swift { HistoryController::HistoryController(UIEventStream* uiEventStream, HistoryWindowFactory* historyWindowFactory) : uiEventStream_(uiEventStream), historyWindowFactory_(historyWindowFactory), historyWindow_(NULL) { uiEventStream_->onUIEvent.connect(boost::bind(&HistoryController::handleUIEvent, this, _1)); } HistoryController::~HistoryController() { uiEventStream_->onUIEvent.disconnect(boost::bind(&HistoryController::handleUIEvent, this, _1)); delete historyWindow_; } void HistoryController::handleUIEvent(boost::shared_ptr rawEvent) { boost::shared_ptr event = boost::dynamic_pointer_cast(rawEvent); if (event != NULL) { if (historyWindow_ == NULL) { historyWindow_ = historyWindowFactory_->createHistoryWindow(); } historyWindow_->activate(); } } }