diff options
| author | Simon Robertshaw <simon@hardwired.org.uk> | 2012-04-06 23:45:24 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2012-04-06 23:45:24 (GMT) |
| commit | bbfbb81086897d50b67bf1494ac150eb607add72 (patch) | |
| tree | 80bab3ddb1f62f847f12947bc81fac2c091669b8 /src/interface/SaveButton.cpp | |
| parent | 8f8de875c6f7a68a3e47252a8653abb72fd398c1 (diff) | |
| download | powder-bbfbb81086897d50b67bf1494ac150eb607add72.zip powder-bbfbb81086897d50b67bf1494ac150eb607add72.tar.gz | |
Confirmation Dialogue, Save selection and multi-delete
Diffstat (limited to 'src/interface/SaveButton.cpp')
| -rw-r--r-- | src/interface/SaveButton.cpp | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/src/interface/SaveButton.cpp b/src/interface/SaveButton.cpp index d044ef6..338ef96 100644 --- a/src/interface/SaveButton.cpp +++ b/src/interface/SaveButton.cpp @@ -17,7 +17,9 @@ SaveButton::SaveButton(Point position, Point size, Save * save): isMouseInside(false), isButtonDown(false), actionCallback(NULL), - voteColour(255, 0, 0) + voteColour(255, 0, 0), + selectable(false), + selected(false) { if(save->votesUp==0) voteRatio = 0.0f; @@ -93,6 +95,11 @@ void SaveButton::Draw(const Point& screenPos) float scaleFactor; ui::Point thumbBoxSize(0, 0); + if(selected && selectable) + { + g->fillrect(screenPos.X, screenPos.Y, Size.X, Size.Y, 100, 170, 255, 100); + } + if(thumbnail) { thumbBoxSize = ui::Point(thumbnail->Size.X, thumbnail->Size.Y); @@ -136,6 +143,14 @@ void SaveButton::Draw(const Point& screenPos) g->drawtext(screenPos.X+(Size.X-Graphics::textwidth((char *)save->name.c_str()))/2, screenPos.Y+Size.Y - 21, save->name, 180, 180, 180, 255); g->drawtext(screenPos.X+(Size.X-Graphics::textwidth((char *)save->userName.c_str()))/2, screenPos.Y+Size.Y - 10, save->userName, 100, 130, 160, 255); } + + if(isMouseInside && selectable) + { + g->clearrect(screenPos.X+(Size.X-20), screenPos.Y+6, 14, 14); + g->drawrect(screenPos.X+(Size.X-20), screenPos.Y+6, 14, 14, 255, 255, 255, 255); + if(selected) + g->fillrect(screenPos.X+(Size.X-18), screenPos.Y+8, 10, 10, 255, 255, 255, 255); + } } void SaveButton::OnMouseUnclick(int x, int y, unsigned int button) @@ -145,6 +160,13 @@ void SaveButton::OnMouseUnclick(int x, int y, unsigned int button) return; //left click only! } + if(x>=Size.X-20 && y>=6 && y<=20 && x<=Size.X-6 && selectable) + { + selected = !selected; + DoSelection(); + return; + } + if(isButtonDown) { DoAction(); @@ -155,7 +177,13 @@ void SaveButton::OnMouseUnclick(int x, int y, unsigned int button) void SaveButton::OnMouseClick(int x, int y, unsigned int button) { + if(button !=1 && selectable) + { + selected = !selected; + DoSelection(); + } if(button != 1) return; //left click only! + isButtonDown = true; } @@ -175,6 +203,12 @@ void SaveButton::DoAction() actionCallback->ActionCallback(this); } +void SaveButton::DoSelection() +{ + if(selectable) + actionCallback->SelectedCallback(this); +} + void SaveButton::SetActionCallback(SaveButtonAction * action) { actionCallback = action; |
