summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPiotr Dziwinski <piotrdz@gmail.com>2012-09-19 21:45:41 +0200
committerPiotr Dziwinski <piotrdz@gmail.com>2012-09-19 21:45:41 +0200
commit1a79137e904eb07c17df2596e6b8aa9310ff22bd (patch)
tree8f43f58dc8fce59875d9829d1c15b26e1a519be2 /src
parent10c9d92cd2581448d76548efb20957a7a1c24478 (diff)
downloadcolobot-1a79137e904eb07c17df2596e6b8aa9310ff22bd.tar.gz
colobot-1a79137e904eb07c17df2596e6b8aa9310ff22bd.tar.bz2
colobot-1a79137e904eb07c17df2596e6b8aa9310ff22bd.zip
Mouse wheel fixes
Diffstat (limited to 'src')
-rw-r--r--src/ui/edit.cpp10
-rw-r--r--src/ui/editvalue.cpp10
-rw-r--r--src/ui/list.cpp4
-rw-r--r--src/ui/scroll.cpp16
-rw-r--r--src/ui/slider.cpp16
5 files changed, 28 insertions, 28 deletions
diff --git a/src/ui/edit.cpp b/src/ui/edit.cpp
index 123f985..6323885 100644
--- a/src/ui/edit.cpp
+++ b/src/ui/edit.cpp
@@ -238,16 +238,16 @@ bool CEdit::EventProcess(const Event &event)
if ( (m_state & STATE_VISIBLE) == 0 ) return true;
- if ( event.type == EVENT_KEY_DOWN &&
- event.mouseButton.button == 5 &&
+ if (event.type == EVENT_MOUSE_WHEEL &&
+ event.mouseWheel.dir == WHEEL_UP &&
Detect(event.pos) )
{
Scroll(m_lineFirst-3, true);
return true;
}
- if ( event.type == EVENT_KEY_DOWN &&
- event.mouseButton.button == 4 && // TODO
- Detect(event.pos) )
+ if (event.type == EVENT_KEY_DOWN &&
+ event.mouseWheel.dir == WHEEL_DOWN &&
+ Detect(event.mouseWheel.pos) )
{
Scroll(m_lineFirst+3, true);
return true;
diff --git a/src/ui/editvalue.cpp b/src/ui/editvalue.cpp
index 1188903..0ee41b3 100644
--- a/src/ui/editvalue.cpp
+++ b/src/ui/editvalue.cpp
@@ -189,9 +189,9 @@ bool CEditValue::EventProcess(const Event &event)
if ( !m_buttonDown->EventProcess(event) ) return false;
}
- if ( event.type == EVENT_KEY_DOWN &&
- event.mouseButton.button == 4 &&
- Detect(event.pos) )
+ if (event.type == EVENT_MOUSE_WHEEL &&
+ event.mouseWheel.dir == WHEEL_UP &&
+ Detect(event.mouseWheel.pos))
{
value = GetValue()+m_stepValue;
if ( value > m_maxValue ) value = m_maxValue;
@@ -199,8 +199,8 @@ bool CEditValue::EventProcess(const Event &event)
HiliteValue(event);
}
if ( event.type == EVENT_KEY_DOWN &&
- event.mouseButton.button == 5 &&
- Detect(event.pos) )
+ event.mouseWheel.dir == WHEEL_DOWN &&
+ Detect(event.mouseWheel.pos))
{
value = GetValue()-m_stepValue;
if ( value < m_minValue ) value = m_minValue;
diff --git a/src/ui/list.cpp b/src/ui/list.cpp
index 4e6ca38..06eaf37 100644
--- a/src/ui/list.cpp
+++ b/src/ui/list.cpp
@@ -257,7 +257,7 @@ bool CList::EventProcess(const Event &event)
if ((m_state & STATE_ENABLE) == 0)
return true;
- if (event.type == EVENT_KEY_DOWN && event.mouseButton.button == 5 && Detect(event.pos)) {
+ if (event.type == EVENT_MOUSE_WHEEL && event.mouseWheel.dir == WHEEL_UP && Detect(event.mouseWheel.pos)) {
if (m_firstLine > 0)
m_firstLine--;
UpdateScroll();
@@ -265,7 +265,7 @@ bool CList::EventProcess(const Event &event)
return true;
}
- if (event.type == EVENT_KEY_DOWN && event.mouseButton.button == 4 && Detect(event.pos)) {
+ if (event.type == EVENT_MOUSE_WHEEL && event.mouseWheel.dir == WHEEL_DOWN && Detect(event.mouseWheel.pos)) {
if (m_firstLine < m_totalLine - m_displayLine)
m_firstLine++;
UpdateScroll();
diff --git a/src/ui/scroll.cpp b/src/ui/scroll.cpp
index 41240ca..38379a5 100644
--- a/src/ui/scroll.cpp
+++ b/src/ui/scroll.cpp
@@ -292,19 +292,19 @@ bool CScroll::EventProcess(const Event &event)
m_bCapture = false;
}
- if ( event.type == EVENT_KEY_DOWN &&
- event.mouseButton.button == 4 &&
- Detect(event.pos) &&
- m_buttonUp != 0 )
+ if (event.type == EVENT_MOUSE_WHEEL &&
+ event.mouseWheel.dir == WHEEL_UP &&
+ Detect(event.mouseWheel.pos) &&
+ m_buttonUp != 0)
{
Event newEvent = event;
newEvent.type = m_buttonUp->GetEventType();
m_event->AddEvent(newEvent);
}
- if ( event.type == EVENT_KEY_DOWN &&
- event.mouseButton.button == 5 &&
- Detect(event.pos) &&
- m_buttonDown != 0 )
+ if (event.type == EVENT_MOUSE_WHEEL &&
+ event.mouseWheel.dir == WHEEL_DOWN &&
+ Detect(event.mouseWheel.pos) &&
+ m_buttonDown != 0)
{
Event newEvent = event;
newEvent.type = m_buttonDown->GetEventType();
diff --git a/src/ui/slider.cpp b/src/ui/slider.cpp
index 185ee35..175a6fe 100644
--- a/src/ui/slider.cpp
+++ b/src/ui/slider.cpp
@@ -356,20 +356,20 @@ bool CSlider::EventProcess(const Event &event)
m_bCapture = false;
}
- if ( event.type == EVENT_KEY_DOWN &&
- event.mouseButton.button == 4 &&
- Detect(event.pos) &&
- m_buttonLeft != 0 )
+ if (event.type == EVENT_MOUSE_WHEEL &&
+ event.mouseWheel.dir == WHEEL_UP &&
+ Detect(event.mouseWheel.pos) &&
+ m_buttonLeft != 0)
{
Event newEvent = event;
newEvent.type = m_buttonLeft->GetEventType();
m_event->AddEvent(newEvent);
}
- if ( event.type == EVENT_KEY_DOWN &&
- event.mouseButton.button == 5 &&
- Detect(event.pos) &&
- m_buttonRight != 0 )
+ if (event.type == EVENT_MOUSE_WHEEL &&
+ event.mouseButton.button == WHEEL_DOWN &&
+ Detect(event.mouseWheel.pos) &&
+ m_buttonRight != 0)
{
Event newEvent = event;
newEvent.type = m_buttonRight->GetEventType();