summaryrefslogtreecommitdiff
path: root/src/gui/widgets/slider.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-10-04 03:00:44 +0300
committerAndrei Karas <akaras@inbox.ru>2016-10-04 03:22:35 +0300
commit6c3f20764fcf9e3d03185c1e92e8a678499c744a (patch)
tree71c422338303142b68a59bba09a27370abbe0e0f /src/gui/widgets/slider.cpp
parenta23406a755012f6d938193e4cfc6244d2027646a (diff)
downloadmv-6c3f20764fcf9e3d03185c1e92e8a678499c744a.tar.gz
mv-6c3f20764fcf9e3d03185c1e92e8a678499c744a.tar.bz2
mv-6c3f20764fcf9e3d03185c1e92e8a678499c744a.tar.xz
mv-6c3f20764fcf9e3d03185c1e92e8a678499c744a.zip
Move slidergrid enum into enums directory.
Diffstat (limited to 'src/gui/widgets/slider.cpp')
-rw-r--r--src/gui/widgets/slider.cpp91
1 files changed, 48 insertions, 43 deletions
diff --git a/src/gui/widgets/slider.cpp b/src/gui/widgets/slider.cpp
index ee649947a..86089fb9a 100644
--- a/src/gui/widgets/slider.cpp
+++ b/src/gui/widgets/slider.cpp
@@ -166,8 +166,8 @@ void Slider::init()
mInstances++;
- if (buttons[0].grid[HGRIP])
- setMarkerLength(buttons[0].grid[HGRIP]->getWidth());
+ if (buttons[0].grid[SliderGrid::HGRIP])
+ setMarkerLength(buttons[0].grid[SliderGrid::HGRIP]->getWidth());
}
void Slider::updateAlpha()
@@ -180,7 +180,7 @@ void Slider::updateAlpha()
mAlpha = alpha;
for (int f = 0; f < 2; f ++)
{
- for (int d = 0; d < SLIDER_MAX; d ++)
+ for (int d = 0; d < SliderGrid::SLIDER_MAX; d ++)
{
if (buttons[f].grid[d])
buttons[f].grid[d]->setAlpha(mAlpha);
@@ -192,8 +192,9 @@ void Slider::updateAlpha()
void Slider::draw(Graphics *const graphics)
{
BLOCK_START("Slider::draw")
- if (!buttons[0].grid[HSTART] || !buttons[1].grid[HSTART]
- || !buttons[0].grid[HEND])
+ if (!buttons[0].grid[SliderGrid::HSTART] ||
+ !buttons[1].grid[SliderGrid::HSTART] ||
+ !buttons[0].grid[SliderGrid::HEND])
{
BLOCK_END("Slider::draw")
return;
@@ -201,8 +202,9 @@ void Slider::draw(Graphics *const graphics)
int w = getWidth();
const int h = getHeight();
- const int y = mHasMouse ? (h - buttons[1].grid[HSTART]->getHeight()) / 2 :
- (h - buttons[0].grid[HSTART]->getHeight()) / 2;
+ const int y = mHasMouse ?
+ (h - buttons[1].grid[SliderGrid::HSTART]->getHeight()) / 2 :
+ (h - buttons[0].grid[SliderGrid::HSTART]->getHeight()) / 2;
updateAlpha();
@@ -214,15 +216,16 @@ void Slider::draw(Graphics *const graphics)
if (!mHasMouse)
{
graphics->calcTileCollection(mVertexes,
- buttons[0].grid[HSTART], x, y);
+ buttons[0].grid[SliderGrid::HSTART],
+ x, y);
- const int width = buttons[0].grid[HSTART]->getWidth();
- w -= width + buttons[0].grid[HEND]->getWidth();
+ const int width = buttons[0].grid[SliderGrid::HSTART]->getWidth();
+ w -= width + buttons[0].grid[SliderGrid::HEND]->getWidth();
x += width;
- if (buttons[0].grid[HMID])
+ if (buttons[0].grid[SliderGrid::HMID])
{
- const Image *const hMid = buttons[0].grid[HMID];
+ const Image *const hMid = buttons[0].grid[SliderGrid::HMID];
graphics->calcPattern(mVertexes,
hMid,
x, y,
@@ -231,10 +234,10 @@ void Slider::draw(Graphics *const graphics)
x += w;
graphics->calcTileCollection(mVertexes,
- buttons[0].grid[HEND],
+ buttons[0].grid[SliderGrid::HEND],
x, y);
- const Image *const img = buttons[0].grid[HGRIP];
+ const Image *const img = buttons[0].grid[SliderGrid::HGRIP];
if (img)
{
graphics->calcTileCollection(mVertexes,
@@ -246,18 +249,18 @@ void Slider::draw(Graphics *const graphics)
else
{
graphics->calcTileCollection(mVertexes,
- buttons[1].grid[HSTART],
+ buttons[1].grid[SliderGrid::HSTART],
x, y);
- const int width = buttons[1].grid[HSTART]->getWidth();
+ const int width = buttons[1].grid[SliderGrid::HSTART]->getWidth();
w -= width;
- if (buttons[1].grid[HEND])
- w -= buttons[1].grid[HEND]->getWidth();
+ if (buttons[1].grid[SliderGrid::HEND])
+ w -= buttons[1].grid[SliderGrid::HEND]->getWidth();
x += width;
- if (buttons[1].grid[HMID])
+ if (buttons[1].grid[SliderGrid::HMID])
{
- const Image *const hMid = buttons[1].grid[HMID];
+ const Image *const hMid = buttons[1].grid[SliderGrid::HMID];
graphics->calcPattern(mVertexes,
hMid,
x, y,
@@ -265,13 +268,13 @@ void Slider::draw(Graphics *const graphics)
}
x += w;
- if (buttons[1].grid[HEND])
+ if (buttons[1].grid[SliderGrid::HEND])
{
graphics->calcTileCollection(mVertexes,
- buttons[1].grid[HEND], x, y);
+ buttons[1].grid[SliderGrid::HEND], x, y);
}
- const Image *const img = buttons[1].grid[HGRIP];
+ const Image *const img = buttons[1].grid[SliderGrid::HGRIP];
if (img)
{
graphics->calcTileCollection(mVertexes,
@@ -290,8 +293,9 @@ void Slider::draw(Graphics *const graphics)
void Slider::safeDraw(Graphics *const graphics)
{
BLOCK_START("Slider::draw")
- if (!buttons[0].grid[HSTART] || !buttons[1].grid[HSTART]
- || !buttons[0].grid[HEND])
+ if (!buttons[0].grid[SliderGrid::HSTART] ||
+ !buttons[1].grid[SliderGrid::HSTART] ||
+ !buttons[0].grid[SliderGrid::HEND])
{
BLOCK_END("Slider::draw")
return;
@@ -300,28 +304,29 @@ void Slider::safeDraw(Graphics *const graphics)
int w = getWidth();
const int h = getHeight();
int x = 0;
- const int y = mHasMouse ? (h - buttons[1].grid[HSTART]->getHeight()) / 2 :
- (h - buttons[0].grid[HSTART]->getHeight()) / 2;
+ const int y = mHasMouse ?
+ (h - buttons[1].grid[SliderGrid::HSTART]->getHeight()) / 2 :
+ (h - buttons[0].grid[SliderGrid::HSTART]->getHeight()) / 2;
updateAlpha();
if (!mHasMouse)
{
- graphics->drawImage(buttons[0].grid[HSTART], x, y);
- const int width = buttons[0].grid[HSTART]->getWidth();
- w -= width + buttons[0].grid[HEND]->getWidth();
+ graphics->drawImage(buttons[0].grid[SliderGrid::HSTART], x, y);
+ const int width = buttons[0].grid[SliderGrid::HSTART]->getWidth();
+ w -= width + buttons[0].grid[SliderGrid::HEND]->getWidth();
x += width;
- if (buttons[0].grid[HMID])
+ if (buttons[0].grid[SliderGrid::HMID])
{
- const Image *const hMid = buttons[0].grid[HMID];
+ const Image *const hMid = buttons[0].grid[SliderGrid::HMID];
graphics->drawPattern(hMid, x, y, w, hMid->getHeight());
}
x += w;
- graphics->drawImage(buttons[0].grid[HEND], x, y);
+ graphics->drawImage(buttons[0].grid[SliderGrid::HEND], x, y);
- const Image *const img = buttons[0].grid[HGRIP];
+ const Image *const img = buttons[0].grid[SliderGrid::HGRIP];
if (img)
{
graphics->drawImage(img, getMarkerPosition(),
@@ -330,25 +335,25 @@ void Slider::safeDraw(Graphics *const graphics)
}
else
{
- graphics->drawImage(buttons[1].grid[HSTART], x, y);
+ graphics->drawImage(buttons[1].grid[SliderGrid::HSTART], x, y);
- const int width = buttons[1].grid[HSTART]->getWidth();
+ const int width = buttons[1].grid[SliderGrid::HSTART]->getWidth();
w -= width;
- if (buttons[1].grid[HEND])
- w -= buttons[1].grid[HEND]->getWidth();
+ if (buttons[1].grid[SliderGrid::HEND])
+ w -= buttons[1].grid[SliderGrid::HEND]->getWidth();
x += width;
- if (buttons[1].grid[HMID])
+ if (buttons[1].grid[SliderGrid::HMID])
{
- const Image *const hMid = buttons[1].grid[HMID];
+ const Image *const hMid = buttons[1].grid[SliderGrid::HMID];
graphics->drawPattern(hMid, x, y, w, hMid->getHeight());
}
x += w;
- if (buttons[1].grid[HEND])
- graphics->drawImage(buttons[1].grid[HEND], x, y);
+ if (buttons[1].grid[SliderGrid::HEND])
+ graphics->drawImage(buttons[1].grid[SliderGrid::HEND], x, y);
- const Image *const img = buttons[1].grid[HGRIP];
+ const Image *const img = buttons[1].grid[SliderGrid::HGRIP];
if (img)
{
graphics->drawImage(img, getMarkerPosition(),