A click on a slider now properly sets the position.
This commit is contained in:
parent
e4ea7dcfc3
commit
a9f7e7571c
5 changed files with 34 additions and 0 deletions
|
@ -23,6 +23,7 @@ Version 1.7.0+svn:
|
|||
* Objectives now use pango markup
|
||||
* Replace the campaign dialog with a new gui one (debian bug #497655)
|
||||
* Removed the hidden option to disable the tips of the day
|
||||
* A click on a slider now properly sets the position
|
||||
* WML Engine:
|
||||
* Made new turn, turn X, side turn and turn refresh events synchronous.
|
||||
(bug #10603)
|
||||
|
|
|
@ -22,6 +22,7 @@ Version 1.7.0+svn:
|
|||
* Improved the layout to take less space in certain cases.
|
||||
* Increase the lineheight in the new dialogs.
|
||||
* The campaign dialog is redesigned.
|
||||
* A click on a slider now properly sets the position.
|
||||
|
||||
* Miscellaneous and bugfixes
|
||||
* Fixed a crash in some storyscreens.
|
||||
|
|
|
@ -31,6 +31,8 @@ namespace gui2 {
|
|||
*/
|
||||
class tscrollbar_ : public tcontrol
|
||||
{
|
||||
/** @todo Abstract the code so this friend is no longer needed. */
|
||||
friend class tslider;
|
||||
public:
|
||||
|
||||
tscrollbar_() :
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "foreach.hpp"
|
||||
#include "formatter.hpp"
|
||||
#include "gui/auxiliary/log.hpp"
|
||||
#include "gui/widgets/event_handler.hpp"
|
||||
#include "sound.hpp"
|
||||
|
||||
namespace gui2 {
|
||||
|
@ -119,6 +120,32 @@ void tslider::set_maximum_value(const int maximum_value)
|
|||
}
|
||||
}
|
||||
|
||||
void tslider::mouse_left_button_down(tevent_handler& event)
|
||||
{
|
||||
tpoint mouse = event.get_mouse();
|
||||
mouse.x -= get_x();
|
||||
mouse.y -= get_y();
|
||||
|
||||
DBG_GUI_E << "Slider: mouse down at " << mouse << ".\n";
|
||||
|
||||
if(on_positioner(mouse)) {
|
||||
mouse_ = mouse;
|
||||
event.mouse_capture();
|
||||
set_state(PRESSED);
|
||||
return;
|
||||
}
|
||||
|
||||
const int bar = on_bar(mouse);
|
||||
if(bar != 0) {
|
||||
const int distance = mouse.x - get_positioner_offset();
|
||||
move_positioner(distance);
|
||||
|
||||
if(callback_positioner_move_) {
|
||||
callback_positioner_move_(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
t_string tslider::get_value_label() const
|
||||
{
|
||||
if(!value_labels_.empty()) {
|
||||
|
|
|
@ -65,6 +65,9 @@ public:
|
|||
// The number of items needs to include the begin and end so count - 1.
|
||||
{ return minimum_value_ + get_item_count() - 1; }
|
||||
|
||||
/** Inherited from tscroll_bar_. */
|
||||
void mouse_left_button_down(tevent_handler& event);
|
||||
|
||||
/***** ***** ***** setters / getters for members ***** ****** *****/
|
||||
|
||||
void set_best_slider_length(const unsigned length)
|
||||
|
|
Loading…
Add table
Reference in a new issue