summaryrefslogtreecommitdiff
path: root/src/gui/widgets
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-10-04 02:45:32 +0300
committerAndrei Karas <akaras@inbox.ru>2016-10-04 03:22:35 +0300
commita23406a755012f6d938193e4cfc6244d2027646a (patch)
tree6df3e08e7c27a2d7bbde7e9185767d8d2cd01358 /src/gui/widgets
parentc0739f1da1865cc1c9f54ba09fe23ac95bc99f7e (diff)
downloadplus-a23406a755012f6d938193e4cfc6244d2027646a.tar.gz
plus-a23406a755012f6d938193e4cfc6244d2027646a.tar.bz2
plus-a23406a755012f6d938193e4cfc6244d2027646a.tar.xz
plus-a23406a755012f6d938193e4cfc6244d2027646a.zip
Move orientation enum into enums directory.
Diffstat (limited to 'src/gui/widgets')
-rw-r--r--src/gui/widgets/slider.cpp14
-rw-r--r--src/gui/widgets/slider.h18
2 files changed, 12 insertions, 20 deletions
diff --git a/src/gui/widgets/slider.cpp b/src/gui/widgets/slider.cpp
index 5d8e47d2c..ee649947a 100644
--- a/src/gui/widgets/slider.cpp
+++ b/src/gui/widgets/slider.cpp
@@ -101,7 +101,7 @@ Slider::Slider(Widget2 *const widget,
mStepLength(stepLength),
mScaleStart(0),
mScaleEnd(scaleEnd),
- mOrientation(HORIZONTAL),
+ mOrientation(Orientation::HORIZONTAL),
mVertexes(new ImageCollection),
mMarkerLength(10),
mHasMouse(false)
@@ -120,7 +120,7 @@ Slider::Slider(Widget2 *const widget,
mStepLength(stepLength),
mScaleStart(scaleStart),
mScaleEnd(scaleEnd),
- mOrientation(HORIZONTAL),
+ mOrientation(Orientation::HORIZONTAL),
mVertexes(new ImageCollection),
mMarkerLength(10),
mHasMouse(false)
@@ -382,7 +382,7 @@ void Slider::mousePressed(MouseEvent &event)
&& x >= 0 && x <= width && y >= 0 && y <= height)
{
event.consume();
- if (mOrientation == HORIZONTAL)
+ if (mOrientation == Orientation::HORIZONTAL)
setValue(markerPositionToValue(x - mMarkerLength / 2));
else
setValue(markerPositionToValue(height - y - mMarkerLength / 2));
@@ -392,7 +392,7 @@ void Slider::mousePressed(MouseEvent &event)
void Slider::mouseDragged(MouseEvent &event)
{
- if (mOrientation == HORIZONTAL)
+ if (mOrientation == Orientation::HORIZONTAL)
{
setValue(markerPositionToValue(event.getX() - mMarkerLength / 2));
}
@@ -425,7 +425,7 @@ void Slider::keyPressed(KeyEvent& event)
{
const InputActionT action = event.getActionId();
- if (mOrientation == HORIZONTAL)
+ if (mOrientation == Orientation::HORIZONTAL)
{
if (action == InputAction::GUI_RIGHT)
{
@@ -479,7 +479,7 @@ void Slider::setValue(const double value)
double Slider::markerPositionToValue(const int v) const
{
int w;
- if (mOrientation == HORIZONTAL)
+ if (mOrientation == Orientation::HORIZONTAL)
w = mDimension.width;
else
w = mDimension.height;
@@ -491,7 +491,7 @@ double Slider::markerPositionToValue(const int v) const
int Slider::valueToMarkerPosition(const double value) const
{
int v;
- if (mOrientation == HORIZONTAL)
+ if (mOrientation == Orientation::HORIZONTAL)
v = mDimension.width;
else
v = mDimension.height;
diff --git a/src/gui/widgets/slider.h b/src/gui/widgets/slider.h
index b6d065634..b70f3f000 100644
--- a/src/gui/widgets/slider.h
+++ b/src/gui/widgets/slider.h
@@ -66,6 +66,8 @@
#ifndef GUI_WIDGETS_SLIDER_H
#define GUI_WIDGETS_SLIDER_H
+#include "enums/gui/orientation.h"
+
#include "listeners/keylistener.h"
#include "listeners/mouselistener.h"
@@ -86,16 +88,6 @@ class Slider final : public Widget,
{
public:
/**
- * Draw orientations for the slider. A slider can be drawn vertically or
- * horizontally.
- */
- enum Orientation
- {
- HORIZONTAL = 0,
- VERTICAL
- };
-
- /**
* Constructor with scale start equal to 0.
*/
Slider(Widget2 *const widget,
@@ -236,7 +228,7 @@ class Slider final : public Widget,
* @param orientation The orientation of the slider.
* @see getOrientation
*/
- void setOrientation(const Orientation orientation)
+ void setOrientation(const OrientationT orientation)
{ mOrientation = orientation; }
/**
@@ -246,7 +238,7 @@ class Slider final : public Widget,
* @return The orientation of the slider.
* @see setOrientation
*/
- Orientation getOrientation() const
+ OrientationT getOrientation() const
{ return mOrientation; }
/**
@@ -343,7 +335,7 @@ class Slider final : public Widget,
* Holds the orientation of the slider. A slider can be drawn
* vertically or horizontally.
*/
- Orientation mOrientation;
+ OrientationT mOrientation;
ImageCollection *mVertexes A_NONNULLPOINTER;