diff options
| author | Simon Robertshaw <simon@hardwired.org.uk> | 2012-04-02 16:01:28 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2012-04-02 16:01:28 (GMT) |
| commit | efddc12e5d2aadc5eee1927245ad38b9dee89aed (patch) | |
| tree | cf7ad38119f0734609944158e33bbb944925c777 /src/stamps/StampsController.cpp | |
| parent | 289556ac7078963b6af361f5812dd62e6712359f (diff) | |
| download | powder-efddc12e5d2aadc5eee1927245ad38b9dee89aed.zip powder-efddc12e5d2aadc5eee1927245ad38b9dee89aed.tar.gz | |
Stamps browser, placement + clipboard sampling and placement - No clipboard or stamp thumbnail generation, needs thumbnail generator from SaveLoader
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 +} + |
