diff -ur ScummVM-cvs20021008/scummvm/backends/sdl/sdl-common.cpp ScummVM-cvs20021008+hack/scummvm/backends/sdl/sdl-common.cpp
old
|
new
|
|
586 | 586 | event->event_code = EVENT_LBUTTONDOWN; |
587 | 587 | else if (ev.button.button == SDL_BUTTON_RIGHT) |
588 | 588 | event->event_code = EVENT_RBUTTONDOWN; |
| 589 | #if defined(SDL_BUTTON_WHEELUP) && defined(SDL_BUTTON_WHEELDOWN) |
| 590 | else if (ev.button.button == SDL_BUTTON_WHEELUP) |
| 591 | event->event_code = EVENT_WHEELUP; |
| 592 | else if (ev.button.button == SDL_BUTTON_WHEELDOWN) |
| 593 | event->event_code = EVENT_WHEELDOWN; |
| 594 | #endif |
589 | 595 | else |
590 | 596 | break; |
591 | 597 | km.x = event->mouse.x = ev.motion.x; |
diff -ur ScummVM-cvs20021008/scummvm/common/system.h ScummVM-cvs20021008+hack/scummvm/common/system.h
old
|
new
|
|
54 | 54 | EVENT_LBUTTONUP = 5, |
55 | 55 | EVENT_RBUTTONDOWN = 6, |
56 | 56 | EVENT_RBUTTONUP = 7, |
| 57 | EVENT_WHEELUP = 8, |
| 58 | EVENT_WHEELDOWN = 9, |
57 | 59 | }; |
58 | 60 | |
59 | 61 | enum { |
diff -ur ScummVM-cvs20021008/scummvm/gui/ListWidget.cpp ScummVM-cvs20021008+hack/scummvm/gui/ListWidget.cpp
old
|
new
|
|
85 | 85 | } |
86 | 86 | } |
87 | 87 | |
| 88 | void ListWidget::handleMouseWheel(int x, int y, int direction) |
| 89 | { |
| 90 | _scrollBar->handleMouseWheel(x, y, direction); |
| 91 | } |
| 92 | |
88 | 93 | bool ListWidget::handleKeyDown(char key, int modifiers) |
89 | 94 | { |
90 | 95 | bool handled = true; |
diff -ur ScummVM-cvs20021008/scummvm/gui/ListWidget.h ScummVM-cvs20021008+hack/scummvm/gui/ListWidget.h
old
|
new
|
|
68 | 68 | |
69 | 69 | virtual void handleMouseDown(int x, int y, int button, int clickCount); |
70 | 70 | virtual void handleMouseUp(int x, int y, int button, int clickCount); |
| 71 | virtual void handleMouseWheel(int x, int y, int direction); |
71 | 72 | virtual bool handleKeyDown(char key, int modifiers); |
72 | 73 | virtual bool handleKeyUp(char key, int modifiers); |
73 | 74 | virtual void handleCommand(CommandSender *sender, uint32 cmd, uint32 data); |
diff -ur ScummVM-cvs20021008/scummvm/gui/ScrollBarWidget.cpp ScummVM-cvs20021008+hack/scummvm/gui/ScrollBarWidget.cpp
old
|
new
|
|
31 | 31 | * - Allow for a horizontal scrollbar, too? |
32 | 32 | * - If there are less items than fit on one pages, no scrolling can be done |
33 | 33 | * and we thus should not highlight the arrows/slider. |
| 34 | * - Allow the mouse wheel to scroll more than one line at a time |
34 | 35 | */ |
35 | 36 | |
36 | 37 | #define UP_DOWN_BOX_HEIGHT 10 |
… |
… |
|
104 | 105 | _draggingPart = kNoPart; |
105 | 106 | } |
106 | 107 | |
| 108 | void ScrollBarWidget::handleMouseWheel(int x, int y, int direction) |
| 109 | { |
| 110 | int old_pos = _currentPos; |
| 111 | |
| 112 | if (_numEntries < _entriesPerPage) |
| 113 | return; |
| 114 | |
| 115 | if (direction < 0) { |
| 116 | _currentPos--; |
| 117 | } else { |
| 118 | _currentPos++; |
| 119 | } |
| 120 | |
| 121 | // Make sure that _currentPos is still inside the bounds |
| 122 | checkBounds(old_pos); |
| 123 | } |
| 124 | |
107 | 125 | void ScrollBarWidget::handleMouseMoved(int x, int y, int button) |
108 | 126 | { |
109 | 127 | // Do nothing if there are less items than fit on one page |
diff -ur ScummVM-cvs20021008/scummvm/gui/ScrollBarWidget.h ScummVM-cvs20021008+hack/scummvm/gui/ScrollBarWidget.h
old
|
new
|
|
61 | 61 | |
62 | 62 | void handleMouseDown(int x, int y, int button, int clickCount); |
63 | 63 | void handleMouseUp(int x, int y, int button, int clickCount); |
| 64 | void handleMouseWheel(int x, int y, int direction); |
64 | 65 | void handleMouseMoved(int x, int y, int button); |
65 | 66 | void handleMouseEntered(int button) { setFlags(WIDGET_HILITED); } |
66 | 67 | void handleMouseLeft(int button) { clearFlags(WIDGET_HILITED); _part = kNoPart; draw(); } |
diff -ur ScummVM-cvs20021008/scummvm/gui/dialog.cpp ScummVM-cvs20021008+hack/scummvm/gui/dialog.cpp
old
|
new
|
|
139 | 139 | w->handleMouseUp(x - w->_x, y - w->_y, button, clickCount); |
140 | 140 | } |
141 | 141 | |
| 142 | void Dialog::handleMouseWheel(int x, int y, int direction) |
| 143 | { |
| 144 | Widget *w; |
| 145 | |
| 146 | // This may look a bit backwards, but I think it makes more sense for |
| 147 | // the mouse wheel to primarily affect the widget the mouse is at than |
| 148 | // the widget that happens to be focused. |
| 149 | |
| 150 | w = findWidget(x, y); |
| 151 | if (!w) |
| 152 | w = _focusedWidget; |
| 153 | if (w) |
| 154 | w->handleMouseWheel(x, y, direction); |
| 155 | } |
| 156 | |
142 | 157 | void Dialog::handleKeyDown(char key, int modifiers) |
143 | 158 | { |
144 | 159 | if (_focusedWidget) { |
diff -ur ScummVM-cvs20021008/scummvm/gui/dialog.h ScummVM-cvs20021008+hack/scummvm/gui/dialog.h
old
|
new
|
|
58 | 58 | virtual void handleTickle(); // Called periodically (in every guiloop() ) |
59 | 59 | virtual void handleMouseDown(int x, int y, int button, int clickCount); |
60 | 60 | virtual void handleMouseUp(int x, int y, int button, int clickCount); |
| 61 | virtual void handleMouseWheel(int x, int y, int direction); |
61 | 62 | virtual void handleKeyDown(char key, int modifiers); |
62 | 63 | virtual void handleKeyUp(char key, int modifiers); |
63 | 64 | virtual void handleMouseMoved(int x, int y, int button); |
diff -ur ScummVM-cvs20021008/scummvm/gui/newgui.cpp ScummVM-cvs20021008+hack/scummvm/gui/newgui.cpp
old
|
new
|
|
174 | 174 | case OSystem::EVENT_RBUTTONUP: |
175 | 175 | activeDialog->handleMouseUp(event.mouse.x - activeDialog->_x, event.mouse.y - activeDialog->_y, 1, _lastClick.count); |
176 | 176 | break; |
| 177 | case OSystem::EVENT_WHEELUP: |
| 178 | activeDialog->handleMouseWheel(event.mouse.x - activeDialog->_x, event.mouse.y - activeDialog->_y, -1); |
| 179 | break; |
| 180 | case OSystem::EVENT_WHEELDOWN: |
| 181 | activeDialog->handleMouseWheel(event.mouse.x - activeDialog->_x, event.mouse.y - activeDialog->_y, 1); |
| 182 | break; |
177 | 183 | } |
178 | 184 | } |
179 | 185 | |
diff -ur ScummVM-cvs20021008/scummvm/gui/widget.h ScummVM-cvs20021008+hack/scummvm/gui/widget.h
old
|
new
|
|
96 | 96 | virtual void handleMouseEntered(int button) {} |
97 | 97 | virtual void handleMouseLeft(int button) {} |
98 | 98 | virtual void handleMouseMoved(int x, int y, int button) {} |
| 99 | virtual void handleMouseWheel(int x, int y, int direction) {} |
99 | 100 | virtual bool handleKeyDown(char key, int modifiers) { return false; } // Return true if the event was handled |
100 | 101 | virtual bool handleKeyUp(char key, int modifiers) { return false; } // Return true if the event was handled |
101 | 102 | virtual void handleTickle() {} |