summaryrefslogtreecommitdiff
path: root/src
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
parentc0739f1da1865cc1c9f54ba09fe23ac95bc99f7e (diff)
downloadmanaverse-a23406a755012f6d938193e4cfc6244d2027646a.tar.gz
manaverse-a23406a755012f6d938193e4cfc6244d2027646a.tar.bz2
manaverse-a23406a755012f6d938193e4cfc6244d2027646a.tar.xz
manaverse-a23406a755012f6d938193e4cfc6244d2027646a.zip
Move orientation enum into enums directory.
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt1
-rw-r--r--src/Makefile.am1
-rw-r--r--src/enums/gui/orientation.h78
-rw-r--r--src/gui/widgets/slider.cpp14
-rw-r--r--src/gui/widgets/slider.h18
5 files changed, 92 insertions, 20 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index d71075615..b60a9f195 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1325,6 +1325,7 @@ SET(SRCS
enums/gui/dialogtype.h
enums/gui/gradienttype.h
enums/gui/itemamountwindowusage.h
+ enums/gui/orientation.h
enums/gui/progresscolorid.h
enums/gui/serverdialogdonwloadstatus.h
enums/gui/shoplistboxtype.h
diff --git a/src/Makefile.am b/src/Makefile.am
index 15a8d2865..5f6baeba7 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -126,6 +126,7 @@ SRC += events/actionevent.h \
enums/gui/dialogtype.h \
enums/gui/gradienttype.h \
enums/gui/itemamountwindowusage.h \
+ enums/gui/orientation.h \
enums/gui/progresscolorid.h \
enums/gui/serverdialogdonwloadstatus.h \
enums/gui/shoplistboxtype.h \
diff --git a/src/enums/gui/orientation.h b/src/enums/gui/orientation.h
new file mode 100644
index 000000000..81c3f305b
--- /dev/null
+++ b/src/enums/gui/orientation.h
@@ -0,0 +1,78 @@
+/*
+ * The ManaPlus Client
+ * Copyright (C) 2004-2009 The Mana World Development Team
+ * Copyright (C) 2009-2010 The Mana Developers
+ * Copyright (C) 2011-2016 The ManaPlus Developers
+ *
+ * This file is part of The ManaPlus Client.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/* _______ __ __ __ ______ __ __ _______ __ __
+ * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
+ * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
+ * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
+ * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
+ * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
+ * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
+ *
+ * Copyright (c) 2004 - 2008 Olof Naessén and Per Larsson
+ *
+ *
+ * Per Larsson a.k.a finalman
+ * Olof Naessén a.k.a jansem/yakslem
+ *
+ * Visit: http://guichan.sourceforge.net
+ *
+ * License: (BSD)
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name of Guichan nor the names of its contributors may
+ * be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+ * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ENUMS_GUI_ORIENTATION_H
+#define ENUMS_GUI_ORIENTATION_H
+
+#include "enums/simpletypes/enumdefines.h"
+
+enumStart(Orientation)
+{
+ HORIZONTAL = 0,
+ VERTICAL
+}
+enumEnd(Orientation);
+
+#endif // ENUMS_GUI_ORIENTATION_H
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;