diff options
Diffstat (limited to 'src/stamps/StampsController.cpp')
| -rw-r--r-- | src/stamps/StampsController.cpp | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/src/stamps/StampsController.cpp b/src/stamps/StampsController.cpp new file mode 100644 index 0000000..07c1efd --- /dev/null +++ b/src/stamps/StampsController.cpp @@ -0,0 +1,69 @@ +/* + * StampsController.cpp + * + * Created on: Mar 29, 2012 + * Author: Simon + */ + +#include "StampsController.h" +#include "interface/Engine.h" + +#include "StampsModel.h" +#include "StampsView.h" + +StampsController::StampsController(ControllerCallback * callback): + HasDone(false) +{ + stampsModel = new StampsModel(); + stampsView = new StampsView(); + stampsView->AttachController(this); + stampsModel->AddObserver(stampsView); + + this->callback = callback; + + stampsModel->UpdateStampsList(1); +} + +void StampsController::OpenStamp(Save * stamp) +{ + stampsModel->SetStamp(stamp); +} + +Save * StampsController::GetStamp() +{ + return stampsModel->GetStamp(); +} + +void StampsController::NextPage() +{ + if(stampsModel->GetPageNum()>1) + stampsModel->UpdateStampsList(stampsModel->GetPageNum()-1); +} + +void StampsController::PrevPage() +{ + if(stampsModel->GetPageNum() <= stampsModel->GetPageCount()) + stampsModel->UpdateStampsList(stampsModel->GetPageNum()+1); +} + +void StampsController::Update() +{ + if(stampsModel->GetStamp()) + { + Exit(); + } +} + +void StampsController::Exit() +{ + if(ui::Engine::Ref().GetWindow() == stampsView) + ui::Engine::Ref().CloseWindow(); + if(callback) + callback->ControllerExit(); + HasDone = true; +} + +StampsController::~StampsController() { + // TODO Auto-generated destructor stub +} + |
