Skip to content

Commit

Permalink
UI|Client: Added stub for SliderWidget
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Aug 28, 2013
1 parent dbf8aa0 commit bdd65d7
Show file tree
Hide file tree
Showing 3 changed files with 156 additions and 0 deletions.
2 changes: 2 additions & 0 deletions doomsday/client/client.pro
Expand Up @@ -380,6 +380,7 @@ DENG_HEADERS += \
include/ui/widgets/progresswidget.h \
include/ui/widgets/scrollareawidget.h \
include/ui/widgets/sequentiallayout.h \
include/ui/widgets/sliderwidget.h \
include/ui/widgets/submenuitem.h \
include/ui/widgets/styledlogsinkformatter.h \
include/ui/widgets/taskbarwidget.h \
Expand Down Expand Up @@ -695,6 +696,7 @@ SOURCES += \
src/ui/widgets/popupwidget.cpp \
src/ui/widgets/proceduralimage.cpp \
src/ui/widgets/progresswidget.cpp \
src/ui/widgets/sliderwidget.cpp \
src/ui/widgets/scrollareawidget.cpp \
src/ui/widgets/sequentiallayout.cpp \
src/ui/widgets/styledlogsinkformatter.cpp \
Expand Down
60 changes: 60 additions & 0 deletions doomsday/client/include/ui/widgets/sliderwidget.h
@@ -0,0 +1,60 @@
/** @file sliderwidget.h Slider to pick a value within a range.
*
* @authors Copyright (c) 2013 Jaakko Keränen <jaakko.keranen@iki.fi>
*
* @par License
* GPL: http://www.gnu.org/licenses/gpl.html
*
* <small>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 (at your
* option) 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</small>
*/

#ifndef DENG_CLIENT_SLIDERWIDGET_H
#define DENG_CLIENT_SLIDERWIDGET_H

#include "guiwidget.h"

#include <de/Range>

/**
* Slider to pick a value within a range.
*
* The value can also be entered as text by right clicking on the slider.
*/
class SliderWidget : public GuiWidget
{
Q_OBJECT

public:
SliderWidget(de::String const &name = "");

void setRange(de::Rangei const &intRange, int step = 0);
void setRange(de::Rangef const &floatRange, float step = 0);
void setValue(float value);

de::Rangef range() const;
float value() const;

// Events.
bool handleEvent(de::Event const &event);

signals:
void valueChanged(float value);
void valueChangedByUser(float value);

protected:
void glInit();


private:
DENG2_PRIVATE(d)
};

#endif // DENG_CLIENT_SLIDERWIDGET_H
94 changes: 94 additions & 0 deletions doomsday/client/src/ui/widgets/sliderwidget.cpp
@@ -0,0 +1,94 @@
/** @file sliderwidget.cpp Slider to pick a value within a range.
*
* @authors Copyright (c) 2013 Jaakko Keränen <jaakko.keranen@iki.fi>
*
* @par License
* GPL: http://www.gnu.org/licenses/gpl.html
*
* <small>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 (at your
* option) 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</small>
*/

#include "ui/widgets/sliderwidget.h"

#include <de/Drawable>

using namespace de;
using namespace ui;

DENG2_PIMPL(SliderWidget)
{
float value;
Rangef range;
float step;

Instance(Public *i)
: Base(i),
value(0),
range(0, 0),
step(0)
{}

void glInit()
{

}

void glDeinit()
{

}
};

SliderWidget::SliderWidget(String const &name)
: GuiWidget(name), d(new Instance(this))
{}

void SliderWidget::setRange(Rangei const &intRange, int step)
{

}

void SliderWidget::setRange(Rangef const &floatRange, float step)
{

}

void SliderWidget::setValue(float value)
{

}

Rangef SliderWidget::range() const
{
return d->range;
}

float SliderWidget::value() const
{
return d->value;
}

bool SliderWidget::handleEvent(Event const &event)
{


return GuiWidget::handleEvent(event);
}

void SliderWidget::glInit()
{
d->glInit();
}

void SliderWidget::glDeinit()
{
d->glDeinit();
}

0 comments on commit bdd65d7

Please sign in to comment.