Search and stamps scolling with mouse wheel, Esc to exit

This commit is contained in:
Simon Robertshaw 2012-04-03 18:12:32 +01:00
parent 838a612026
commit 299c1da9ae
7 changed files with 43 additions and 0 deletions

View File

@ -97,6 +97,8 @@ public:
{
cc->gameModel->SetStamp(cc->stamps->GetStamp());
}
else
cc->gameModel->SetStamp(NULL);
}
};

View File

@ -717,6 +717,10 @@ void GameView::OnKeyRelease(int key, Uint16 character, bool shift, bool ctrl, bo
void GameView::OnTick(float dt)
{
if(selectMode==PlaceStamp && !stampThumb)
selectMode = SelectNone;
if(selectMode==PlaceClipboard&& !clipboardThumb)
selectMode = SelectNone;
if(zoomEnabled && !zoomCursorFixed)
c->SetZoomPosition(currentMouse);
if(drawMode == DrawPoints)

View File

@ -9,6 +9,7 @@
#define KEY_TAB SDLK_TAB
#define KEY_RETURN SDLK_RETURN
#define KEY_ENTER SDLK_KP_ENTER
#define KEY_ESCAPE SDLK_ESCAPE
#define KEY_CTRL SDLK_LCTRL
#define KEY_ALT SDLK_LALT

View File

@ -241,3 +241,19 @@ void SearchView::OnTick(float dt)
{
c->Update();
}
void SearchView::OnMouseWheel(int x, int y, int d)
{
if(!d)
return;
if(d<0)
c->NextPage();
else
c->PrevPage();
}
void SearchView::OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool alt)
{
if(key==KEY_ESCAPE)
c->Exit();
}

View File

@ -37,6 +37,9 @@ public:
virtual ~SearchView();
void AttachController(SearchController * _c) { c = _c; }
virtual void OnTick(float dt);
virtual void OnMouseWheel(int x, int y, int d);
virtual void OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool alt);
};
#endif // SEARCHVIEW_H

View File

@ -133,6 +133,21 @@ void StampsView::NotifyStampsListChanged(StampsModel * sender)
}
}
void StampsView::OnMouseWheel(int x, int y, int d)
{
if(!d)
return;
if(d<0)
c->NextPage();
else
c->PrevPage();
}
void StampsView::OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool alt)
{
if(key==KEY_ESCAPE)
c->Exit();
}
StampsView::~StampsView() {
// TODO Auto-generated destructor stub
}

View File

@ -29,6 +29,8 @@ public:
void AttachController(StampsController * c_) { c = c_; };
void NotifyPageChanged(StampsModel * sender);
void NotifyStampsListChanged(StampsModel * sender);
virtual void OnMouseWheel(int x, int y, int d);
virtual void OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool alt);
virtual ~StampsView();
};