Nux

Merge lp:~gordallott/nux/enable-mousewheel-in-scrollview into lp:nux

Proposed by Gord Allott
Status: Merged
Approved by: Neil J. Patel
Approved revision: 257
Merged at revision: 256
Proposed branch: lp:~gordallott/nux/enable-mousewheel-in-scrollview
Merge into: lp:nux
Diff against target: 93 lines (+23/-4)
2 files modified
Nux/ScrollView.cpp (+20/-2)
Nux/ScrollView.h (+3/-2)
To merge this branch: bzr merge lp:~gordallott/nux/enable-mousewheel-in-scrollview
Reviewer Review Type Date Requested Status
Mirco Müller Pending
Review via email: mp+52221@code.launchpad.net

Description of the change

checks for scrollwheel events in scroll view, scrolls accordingly. fixes lp:721447

To post a comment you must log in.
257. By Gord Allott

removed a debug

Revision history for this message
Mirco Müller (macslow) wrote :

Since there are all these issues with the project-renaming, we'll leave this for the moment and wait for the "dust to settle".

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Nux/ScrollView.cpp'
2--- Nux/ScrollView.cpp 2011-02-28 06:33:08 +0000
3+++ Nux/ScrollView.cpp 2011-03-04 16:46:40 +0000
4@@ -58,11 +58,14 @@
5 setTopBorder (4);
6 setBorder (4);
7
8+ m_MouseWheelScrollSize = 32;
9+
10 m_ViewContentLeftMargin = 0;
11 m_ViewContentRightMargin = 0;
12 m_ViewContentTopMargin = 0;
13 m_ViewContentBottomMargin = 0;
14 FormatContent();
15+
16 }
17
18 ScrollView::~ScrollView()
19@@ -77,7 +80,6 @@
20 long ret = TraverseInfo;
21 long ProcEvInfo = 0;
22
23-
24 if (event.e_event == NUX_MOUSE_PRESSED)
25 {
26 // Verify that the mouse down event falls inside the of the ScrollView.
27@@ -87,6 +89,20 @@
28 }
29 }
30
31+ if (event.e_event == NUX_MOUSEWHEEL)
32+ {
33+ // nux can't tell the difference between horizontal and vertical mouse wheel events
34+ // so we are only going to support vertical
35+ if (event.e_wheeldelta > 0)
36+ {
37+ ScrollDown (abs (event.e_wheeldelta / NUX_MOUSEWHEEL_DELTA), m_MouseWheelScrollSize);
38+ }
39+ else
40+ {
41+ ScrollUp (abs (event.e_wheeldelta / NUX_MOUSEWHEEL_DELTA), m_MouseWheelScrollSize);
42+ }
43+ }
44+
45 if (m_vertical_scrollbar_enable)
46 ret = vscrollbar->ProcessEvent (event, ret, ProcEvInfo);
47
48@@ -116,6 +132,8 @@
49 ret = m_CompositionLayout->ProcessEvent (mod_event, ret, ProcEvInfo);
50 }
51
52+
53+
54 ret = PostProcessEvent2 (event, ret, 0);
55 return ret;
56 }
57@@ -833,7 +851,7 @@
58 _delta_x = 0;
59 }
60
61-
62+
63
64 hscrollbar->SetContentOffset (_delta_x, _delta_y);
65 hscrollbar->NeedRedraw();
66
67=== modified file 'Nux/ScrollView.h'
68--- Nux/ScrollView.h 2011-02-23 14:14:29 +0000
69+++ Nux/ScrollView.h 2011-03-04 16:46:40 +0000
70@@ -84,6 +84,8 @@
71 virtual void ResetScrollToUp();
72 virtual void ResetScrollToDown();
73
74+ // amount to scroll by for each mouse wheel event
75+ int m_MouseWheelScrollSize;
76
77 // Geometry of the layout that encompass the child layouts.
78 //! X Position of the content
79@@ -197,7 +199,6 @@
80 //! Vertical scrollbar offsets.
81 int _delta_y;
82
83-
84 void FormatContent ();
85 virtual void PreLayoutManagement ();
86 virtual long PostLayoutManagement (long LayoutResult);
87@@ -219,4 +220,4 @@
88 };
89 }
90
91-#endif // SCROLLVIEW_H
92\ No newline at end of file
93+#endif // SCROLLVIEW_H

Subscribers

People subscribed via source and target branches