Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
UI|Client: Added stub for SliderWidget
- Loading branch information
Showing
3 changed files
with
156 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); | ||
} |