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
=== modified file 'Nux/ScrollView.cpp'
--- Nux/ScrollView.cpp 2011-02-28 06:33:08 +0000
+++ Nux/ScrollView.cpp 2011-03-04 16:46:40 +0000
@@ -58,11 +58,14 @@
58 setTopBorder (4);58 setTopBorder (4);
59 setBorder (4);59 setBorder (4);
6060
61 m_MouseWheelScrollSize = 32;
62
61 m_ViewContentLeftMargin = 0;63 m_ViewContentLeftMargin = 0;
62 m_ViewContentRightMargin = 0;64 m_ViewContentRightMargin = 0;
63 m_ViewContentTopMargin = 0;65 m_ViewContentTopMargin = 0;
64 m_ViewContentBottomMargin = 0;66 m_ViewContentBottomMargin = 0;
65 FormatContent();67 FormatContent();
68
66 }69 }
6770
68 ScrollView::~ScrollView()71 ScrollView::~ScrollView()
@@ -77,7 +80,6 @@
77 long ret = TraverseInfo;80 long ret = TraverseInfo;
78 long ProcEvInfo = 0;81 long ProcEvInfo = 0;
7982
80
81 if (event.e_event == NUX_MOUSE_PRESSED)83 if (event.e_event == NUX_MOUSE_PRESSED)
82 {84 {
83 // Verify that the mouse down event falls inside the of the ScrollView.85 // Verify that the mouse down event falls inside the of the ScrollView.
@@ -87,6 +89,20 @@
87 }89 }
88 }90 }
8991
92 if (event.e_event == NUX_MOUSEWHEEL)
93 {
94 // nux can't tell the difference between horizontal and vertical mouse wheel events
95 // so we are only going to support vertical
96 if (event.e_wheeldelta > 0)
97 {
98 ScrollDown (abs (event.e_wheeldelta / NUX_MOUSEWHEEL_DELTA), m_MouseWheelScrollSize);
99 }
100 else
101 {
102 ScrollUp (abs (event.e_wheeldelta / NUX_MOUSEWHEEL_DELTA), m_MouseWheelScrollSize);
103 }
104 }
105
90 if (m_vertical_scrollbar_enable)106 if (m_vertical_scrollbar_enable)
91 ret = vscrollbar->ProcessEvent (event, ret, ProcEvInfo);107 ret = vscrollbar->ProcessEvent (event, ret, ProcEvInfo);
92108
@@ -116,6 +132,8 @@
116 ret = m_CompositionLayout->ProcessEvent (mod_event, ret, ProcEvInfo);132 ret = m_CompositionLayout->ProcessEvent (mod_event, ret, ProcEvInfo);
117 }133 }
118134
135
136
119 ret = PostProcessEvent2 (event, ret, 0);137 ret = PostProcessEvent2 (event, ret, 0);
120 return ret;138 return ret;
121 }139 }
@@ -833,7 +851,7 @@
833 _delta_x = 0;851 _delta_x = 0;
834 }852 }
835853
836 854
837855
838 hscrollbar->SetContentOffset (_delta_x, _delta_y);856 hscrollbar->SetContentOffset (_delta_x, _delta_y);
839 hscrollbar->NeedRedraw();857 hscrollbar->NeedRedraw();
840858
=== modified file 'Nux/ScrollView.h'
--- Nux/ScrollView.h 2011-02-23 14:14:29 +0000
+++ Nux/ScrollView.h 2011-03-04 16:46:40 +0000
@@ -84,6 +84,8 @@
84 virtual void ResetScrollToUp();84 virtual void ResetScrollToUp();
85 virtual void ResetScrollToDown();85 virtual void ResetScrollToDown();
8686
87 // amount to scroll by for each mouse wheel event
88 int m_MouseWheelScrollSize;
8789
88 // Geometry of the layout that encompass the child layouts.90 // Geometry of the layout that encompass the child layouts.
89 //! X Position of the content91 //! X Position of the content
@@ -197,7 +199,6 @@
197 //! Vertical scrollbar offsets.199 //! Vertical scrollbar offsets.
198 int _delta_y;200 int _delta_y;
199201
200
201 void FormatContent ();202 void FormatContent ();
202 virtual void PreLayoutManagement ();203 virtual void PreLayoutManagement ();
203 virtual long PostLayoutManagement (long LayoutResult);204 virtual long PostLayoutManagement (long LayoutResult);
@@ -219,4 +220,4 @@
219 };220 };
220}221}
221222
222#endif // SCROLLVIEW_H
223\ No newline at end of file223\ No newline at end of file
224#endif // SCROLLVIEW_H

Subscribers

People subscribed via source and target branches