Merge lp:~unity-team/nux/nux.setkeyfocusarea into lp:nux/2.0
- nux.setkeyfocusarea
- Merge into 2.0
Proposed by
Jay Taoko
Status: | Merged |
---|---|
Approved by: | Jay Taoko |
Approved revision: | 583 |
Merged at revision: | 578 |
Proposed branch: | lp:~unity-team/nux/nux.setkeyfocusarea |
Merge into: | lp:nux/2.0 |
Diff against target: |
754 lines (+199/-95) 20 files modified
Nux/Area.cpp (+0/-8) Nux/Area.h (+20/-12) Nux/InputArea.cpp (+8/-11) Nux/InputArea.h (+2/-3) Nux/ProgramFramework/TestView.cpp (+23/-1) Nux/ProgramFramework/TestView.h (+8/-0) Nux/WindowCompositor.cpp (+26/-17) Nux/WindowCompositor.h (+5/-2) configure.ac (+1/-1) tests/Makefile.am (+2/-0) tests/gtest-nux-windowcompositor.cpp (+64/-0) tests/xtest-focus-on-mouse-down.cpp (+4/-4) tests/xtest-focus-on-mouse-enter.cpp (+4/-4) tests/xtest-hgrid-key-navigation.cpp (+6/-6) tests/xtest-hlayout-key-navigation.cpp (+6/-6) tests/xtest-keynav-directions.cpp (+8/-8) tests/xtest-mouse-buttons.cpp (+2/-2) tests/xtest-mouse-events.cpp (+2/-2) tests/xtest-scrollbar.cpp (+2/-2) tests/xtest-vlayout-key-navigation.cpp (+6/-6) |
To merge this branch: | bzr merge lp:~unity-team/nux/nux.setkeyfocusarea |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Andrea Azzarone (community) | Approve | ||
Review via email: mp+93724@code.launchpad.net |
Commit message
Description of the change
* Updated nux_abi_version.
* Moved Area::AcceptKey
* Remove the calls to Area::EmitStart
* WindowComposito
* Prevent WindowComposito
To post a comment you must log in.
Revision history for this message
Andrea Azzarone (azzar1) wrote : | # |
> Looks good to me.
>
> Later we can ass an SetAcceptKeyNav
Add :)
Revision history for this message
Jay Taoko (jaytaoko) wrote : | # |
hahaha! :)
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'Nux/Area.cpp' |
2 | --- Nux/Area.cpp 2012-02-17 20:46:05 +0000 |
3 | +++ Nux/Area.cpp 2012-02-20 02:53:17 +0000 |
4 | @@ -999,14 +999,6 @@ |
5 | return false; |
6 | } |
7 | |
8 | - bool Area::AcceptKeyNavFocus() |
9 | - { |
10 | - if (GetInputEventSensitivity() == false) |
11 | - return false; |
12 | - |
13 | - return true; |
14 | - } |
15 | - |
16 | Area* Area::KeyNavIteration(KeyNavDirection direction) |
17 | { |
18 | return NULL; |
19 | |
20 | === modified file 'Nux/Area.h' |
21 | --- Nux/Area.h 2012-02-17 20:46:05 +0000 |
22 | +++ Nux/Area.h 2012-02-20 02:53:17 +0000 |
23 | @@ -496,8 +496,21 @@ |
24 | unsigned long x11_key_code, |
25 | unsigned long special_keys_state); |
26 | |
27 | + /*! |
28 | + Mark the path from this area to its top level parent as the one to follow \n |
29 | + to get to the area that has the keyboard. |
30 | + */ |
31 | void SetPathToKeyFocusArea(); |
32 | + |
33 | + /*! |
34 | + Erase the path from this area to the child area that has the keyboard. |
35 | + */ |
36 | void ResetDownwardPathToKeyFocusArea(); |
37 | + |
38 | + /*! |
39 | + Erase the path that marks this object as part of the keyboard focus chain, \n |
40 | + from this area to its top level parent. |
41 | + */ |
42 | void ResetUpwardPathToKeyFocusArea(); |
43 | |
44 | //! Return True if the the area knows what to do with the key event. |
45 | @@ -514,8 +527,6 @@ |
46 | unsigned int keysym, |
47 | const char* character); |
48 | |
49 | - virtual bool AcceptKeyNavFocus(); |
50 | - |
51 | virtual Area* KeyNavIteration(KeyNavDirection direction); |
52 | |
53 | bool HasKeyFocus() const; |
54 | @@ -593,17 +604,14 @@ |
55 | //! Return the absolute geometry starting with a relative geometry passed as argument. |
56 | void InnerGetRootGeometry(Geometry &geometry); |
57 | |
58 | -// //! Add a "secondary" child to this Area. The |
59 | -// /*! |
60 | -// @return True if the child has been added; False otherwise; |
61 | -// */ |
62 | -// bool Secondary(Area *child); |
63 | - |
64 | bool on_geometry_change_reconfigure_parent_layout_; |
65 | |
66 | - bool has_key_focus_; |
67 | - |
68 | - Area *next_object_to_key_focus_area_; |
69 | + //! If this variable is true, then this area has the keyboard focus. |
70 | + bool has_key_focus_; |
71 | + |
72 | + //! If this variable is not NULL, then this area is part of the keyboard focus chain. |
73 | + Area* next_object_to_key_focus_area_; |
74 | + |
75 | private: |
76 | void ReconfigureParentLayout(Area *child = 0); |
77 | void CheckMinSize(); |
78 | @@ -619,7 +627,7 @@ |
79 | An object of the class Layout may have a parent of the class Layout or View as parent. |
80 | A Area cannot have children(that may change later). |
81 | */ |
82 | - Area *parent_area_; |
83 | + Area* parent_area_; |
84 | |
85 | bool visible_; //!< Visible state of the area. |
86 | bool sensitive_; //!< Input sensitive state of the area |
87 | |
88 | === modified file 'Nux/InputArea.cpp' |
89 | --- Nux/InputArea.cpp 2012-02-17 20:46:05 +0000 |
90 | +++ Nux/InputArea.cpp 2012-02-20 02:53:17 +0000 |
91 | @@ -350,17 +350,6 @@ |
92 | mouse_double_click.emit(x, y, mouse_button_state, special_keys_state); |
93 | } |
94 | |
95 | - |
96 | - void InputArea::EmitStartKeyboardFocus() |
97 | - { |
98 | - begin_key_focus.emit(); |
99 | - } |
100 | - |
101 | - void InputArea::EmitEndKeyboardFocus() |
102 | - { |
103 | - end_key_focus.emit(); |
104 | - } |
105 | - |
106 | void InputArea::EmitMouseDownOutsideArea(int x, int y, unsigned long mouse_button_state, unsigned long special_keys_state) |
107 | { |
108 | mouse_down_outside_pointer_grab_area.emit(x, y, mouse_button_state, special_keys_state); |
109 | @@ -414,5 +403,13 @@ |
110 | { |
111 | accept_key_nav_focus_on_mouse_enter_ = accept; |
112 | } |
113 | + |
114 | + bool InputArea::AcceptKeyNavFocus() const |
115 | + { |
116 | + if (GetInputEventSensitivity() == false) |
117 | + return false; |
118 | + |
119 | + return true; |
120 | + } |
121 | } |
122 | |
123 | |
124 | === modified file 'Nux/InputArea.h' |
125 | --- Nux/InputArea.h 2012-02-17 20:46:05 +0000 |
126 | +++ Nux/InputArea.h 2012-02-20 02:53:17 +0000 |
127 | @@ -69,6 +69,8 @@ |
128 | unsigned long x11_key_code, |
129 | unsigned long special_keys_state); |
130 | |
131 | + virtual bool AcceptKeyNavFocus() const; |
132 | + |
133 | protected: |
134 | |
135 | private: |
136 | @@ -337,9 +339,6 @@ |
137 | virtual void EmitMouseClickSignal (int x, int y, unsigned long mouse_button_state, unsigned long special_keys_state); |
138 | virtual void EmitMouseDoubleClickSignal(int x, int y, unsigned long mouse_button_state, unsigned long special_keys_state); |
139 | |
140 | - virtual void EmitStartKeyboardFocus(); |
141 | - virtual void EmitEndKeyboardFocus(); |
142 | - |
143 | virtual void EmitMouseDownOutsideArea (int x, int y, unsigned long mouse_button_state, unsigned long special_keys_state); |
144 | |
145 | friend class WindowCompositor; |
146 | |
147 | === modified file 'Nux/ProgramFramework/TestView.cpp' |
148 | --- Nux/ProgramFramework/TestView.cpp 2012-01-30 08:43:49 +0000 |
149 | +++ Nux/ProgramFramework/TestView.cpp 2012-02-20 02:53:17 +0000 |
150 | @@ -26,7 +26,7 @@ |
151 | This class is a Nux view that processes all mouse events that it receives. It is meant for testing simulated |
152 | mouse events. |
153 | */ |
154 | - |
155 | +namespace nux { |
156 | NUX_IMPLEMENT_OBJECT_TYPE(TestView); |
157 | |
158 | TestView::TestView(NUX_FILE_LINE_DECL) |
159 | @@ -34,6 +34,7 @@ |
160 | , can_focus_(true) |
161 | { |
162 | ResetEvents(); |
163 | + ResetKeyFocusEvents(); |
164 | |
165 | key_nav_direction_ = nux::KEY_NAV_NONE; |
166 | normal_color_ = nux::color::Green; |
167 | @@ -58,6 +59,9 @@ |
168 | mouse_enter.connect(sigc::mem_fun(this, &TestView::OnMouseEnter)); |
169 | mouse_leave.connect(sigc::mem_fun(this, &TestView::OnMouseLeave)); |
170 | key_nav_focus_change.connect(sigc::mem_fun(this, &TestView::OnKeyNavFocusChange)); |
171 | + begin_key_focus.connect(sigc::mem_fun(this, &TestView::OnBeginKeyFocus)); |
172 | + end_key_focus.connect(sigc::mem_fun(this, &TestView::OnEndKeyFocus)); |
173 | + |
174 | } |
175 | |
176 | TestView::~TestView() |
177 | @@ -80,6 +84,12 @@ |
178 | |
179 | } |
180 | |
181 | +void TestView::ResetKeyFocusEvents() |
182 | +{ |
183 | + registered_begin_keynav_focus_ = false; |
184 | + registered_end_keynav_focus_ = false; |
185 | +} |
186 | + |
187 | nux::Color TestView::GetColor() const |
188 | { |
189 | return current_color_; |
190 | @@ -167,3 +177,15 @@ |
191 | key_nav_direction_ = direction; |
192 | QueueDraw(); |
193 | } |
194 | + |
195 | +void TestView::OnBeginKeyFocus() |
196 | +{ |
197 | + registered_begin_keynav_focus_ = true; |
198 | +} |
199 | + |
200 | +void TestView::OnEndKeyFocus() |
201 | +{ |
202 | + registered_end_keynav_focus_ = true; |
203 | +} |
204 | + |
205 | +} |
206 | |
207 | === modified file 'Nux/ProgramFramework/TestView.h' |
208 | --- Nux/ProgramFramework/TestView.h 2012-01-30 08:43:49 +0000 |
209 | +++ Nux/ProgramFramework/TestView.h 2012-02-20 02:53:17 +0000 |
210 | @@ -23,6 +23,7 @@ |
211 | |
212 | #include "Nux/TextureArea.h" |
213 | |
214 | +namespace nux { |
215 | class TestView: public nux::View |
216 | { |
217 | NUX_DECLARE_OBJECT_TYPE(TestView, View); |
218 | @@ -34,6 +35,7 @@ |
219 | bool AcceptKeyNavFocus() {return can_focus_;} |
220 | |
221 | void ResetEvents(); |
222 | + void ResetKeyFocusEvents(); |
223 | |
224 | bool can_focus_; |
225 | |
226 | @@ -46,6 +48,9 @@ |
227 | bool registered_mouse_move_; |
228 | bool registered_mouse_enter_; |
229 | bool registered_mouse_leave_; |
230 | + |
231 | + bool registered_begin_keynav_focus_; |
232 | + bool registered_end_keynav_focus_; |
233 | |
234 | nux::KeyNavDirection key_nav_direction_; //!< The key nav direction received when the view obtained the focus. |
235 | |
236 | @@ -71,9 +76,12 @@ |
237 | void OnMouseEnter(int x, int y, unsigned long button_flags, unsigned long key_flags); |
238 | void OnMouseLeave(int x, int y, unsigned long button_flags, unsigned long key_flags); |
239 | void OnKeyNavFocusChange(nux::Area* area, bool has_focus, nux::KeyNavDirection direction); |
240 | + void OnBeginKeyFocus(); |
241 | + void OnEndKeyFocus(); |
242 | |
243 | void Draw(nux::GraphicsEngine& graphics_engine, bool force_draw); |
244 | }; |
245 | |
246 | +} |
247 | #endif // TEST_VIEW_H |
248 | |
249 | |
250 | === modified file 'Nux/WindowCompositor.cpp' |
251 | --- Nux/WindowCompositor.cpp 2012-02-17 13:40:03 +0000 |
252 | +++ Nux/WindowCompositor.cpp 2012-02-20 02:53:17 +0000 |
253 | @@ -1844,7 +1844,7 @@ |
254 | } |
255 | } |
256 | |
257 | - void WindowCompositor::SetKeyFocusArea(InputArea* area, KeyNavDirection direction) |
258 | + bool WindowCompositor::SetKeyFocusArea(InputArea* area, KeyNavDirection direction) |
259 | { |
260 | InputArea* keyboard_grab_area = GetKeyboardGrabArea(); |
261 | |
262 | @@ -1853,22 +1853,28 @@ |
263 | // There is a keyboard grab pending. Only an area that is a child of the area that has |
264 | // the keyboard grab can be set to receive keyboard events. |
265 | nuxDebugMsg("[WindowCompositor::SetKeyFocusArea] There is a keyboard grab pending. Cannot change the keyboard event receiver."); |
266 | - return; |
267 | + return false; |
268 | } |
269 | |
270 | if (key_focus_area_ == area) |
271 | { |
272 | - return; |
273 | + // Already has the keyboard focus. |
274 | + return true; |
275 | } |
276 | |
277 | if (area && (area->AcceptKeyNavFocus() == false)) |
278 | { |
279 | - return; |
280 | + // Area does not want the keyboard focus. |
281 | + return false; |
282 | } |
283 | |
284 | if (key_focus_area_) |
285 | { |
286 | - key_focus_area_->EmitEndKeyboardFocus(); |
287 | + // This is the area that has the keyboard focus. Emit the signal 'end_key_focus'. |
288 | + key_focus_area_->end_key_focus.emit(); |
289 | + |
290 | + // From the area that has the keyboard focus to the top level parent, delete the path that |
291 | + // leads to the keyboard focus area. |
292 | key_focus_area_->ResetUpwardPathToKeyFocusArea(); |
293 | |
294 | if (key_focus_area_->Type().IsDerivedFromType(InputArea::StaticObjectType)) |
295 | @@ -1889,8 +1895,12 @@ |
296 | { |
297 | key_focus_area_ = area; |
298 | |
299 | + // From the area that has the keyboard focus to the top level parent, mark the path that |
300 | + // leads to the keyboard focus area. |
301 | key_focus_area_->SetPathToKeyFocusArea(); |
302 | - key_focus_area_->EmitStartKeyboardFocus(); |
303 | + |
304 | + // Emit the signal 'begin_key_focus'. |
305 | + key_focus_area_->begin_key_focus.emit(); |
306 | |
307 | if (key_focus_area_->Type().IsDerivedFromType(InputArea::StaticObjectType)) |
308 | { |
309 | @@ -1913,20 +1923,19 @@ |
310 | key_focus_area_ = NULL; |
311 | } |
312 | |
313 | - // Even if the the area parameter cannot receive keyboard events, it will get the |
314 | - // keyboard navigatiuon focus. |
315 | - |
316 | - if (key_focus_area_) |
317 | - { |
318 | - key_focus_area_->begin_key_focus.emit(); |
319 | - } |
320 | - |
321 | - |
322 | key_focus_area_connection_.disconnect(); |
323 | + |
324 | if (area) |
325 | { |
326 | key_focus_area_connection_ = area->object_destroyed.connect(sigc::mem_fun(this, &WindowCompositor::OnKeyNavFocusDestroyed)); |
327 | } |
328 | + |
329 | + if (key_focus_area_ == NULL) |
330 | + { |
331 | + return false; |
332 | + } |
333 | + |
334 | + return true; |
335 | } |
336 | |
337 | InputArea* WindowCompositor::GetKeyFocusArea() |
338 | @@ -2189,7 +2198,7 @@ |
339 | // If there is any area with the key focus, cancel it. |
340 | if (key_focus_area_) |
341 | { |
342 | - key_focus_area_->EmitEndKeyboardFocus(); |
343 | + key_focus_area_->end_key_focus.emit(); |
344 | key_focus_area_->ResetUpwardPathToKeyFocusArea(); |
345 | |
346 | if (key_focus_area_->Type().IsDerivedFromType(InputArea::StaticObjectType)) |
347 | @@ -2260,7 +2269,7 @@ |
348 | // If there is any area with the key focus, cancel it. |
349 | if (key_focus_area_) |
350 | { |
351 | - key_focus_area_->EmitEndKeyboardFocus(); |
352 | + key_focus_area_->end_key_focus.emit(); |
353 | key_focus_area_->ResetUpwardPathToKeyFocusArea(); |
354 | |
355 | if (key_focus_area_->Type().IsDerivedFromType(InputArea::StaticObjectType)) |
356 | |
357 | === modified file 'Nux/WindowCompositor.h' |
358 | --- Nux/WindowCompositor.h 2012-01-28 01:05:44 +0000 |
359 | +++ Nux/WindowCompositor.h 2012-02-20 02:53:17 +0000 |
360 | @@ -85,12 +85,15 @@ |
361 | |
362 | //! Set the area that has the keyboard focus. |
363 | /*! |
364 | - Set the area that has the keyboard focus. |
365 | + Set the area that has the keyboard focus. If the \i area parameter is NULL, \n |
366 | + the area that has the keyboard focus looses it and the function returns false. |
367 | |
368 | @param The area that that gets the keyboard focus. |
369 | @param The key nav direction that initiated the focus to the provided area. |
370 | + |
371 | + @return True if the area succeeded to get the keyboard focus or it already has it. |
372 | */ |
373 | - void SetKeyFocusArea(InputArea* area, KeyNavDirection direction = KEY_NAV_NONE); |
374 | + bool SetKeyFocusArea(InputArea* area, KeyNavDirection direction = KEY_NAV_NONE); |
375 | |
376 | //! Return the area that has the keyboard focus. |
377 | /*! |
378 | |
379 | === modified file 'configure.ac' |
380 | --- configure.ac 2012-02-19 06:58:01 +0000 |
381 | +++ configure.ac 2012-02-20 02:53:17 +0000 |
382 | @@ -22,7 +22,7 @@ |
383 | # The number format is : year/month/day |
384 | # e.g.: december 5th, 2011 is: 20111205 |
385 | # To make more than one API change in a day, add a number to the date. Like 20111205.xx |
386 | -m4_define([nux_abi_version], [20120218.02]) |
387 | +m4_define([nux_abi_version], [20120219.01]) |
388 | |
389 | m4_define([nux_version], |
390 | [nux_major_version.nux_minor_version.nux_micro_version]) |
391 | |
392 | === modified file 'tests/Makefile.am' |
393 | --- tests/Makefile.am 2012-02-17 13:18:35 +0000 |
394 | +++ tests/Makefile.am 2012-02-20 02:53:17 +0000 |
395 | @@ -84,8 +84,10 @@ |
396 | test-nux-main.cpp \ |
397 | test-nux-metrics.cpp \ |
398 | test-nux-statictext.cpp \ |
399 | + gtest-nux-windowcompositor.cpp \ |
400 | test-nux-windowthread.cpp |
401 | |
402 | + |
403 | gtest_nux_CPPFLAGS = \ |
404 | -I$(srcdir) \ |
405 | -I$(top_srcdir) \ |
406 | |
407 | === added file 'tests/gtest-nux-windowcompositor.cpp' |
408 | --- tests/gtest-nux-windowcompositor.cpp 1970-01-01 00:00:00 +0000 |
409 | +++ tests/gtest-nux-windowcompositor.cpp 2012-02-20 02:53:17 +0000 |
410 | @@ -0,0 +1,64 @@ |
411 | +#include <string> |
412 | +#include <fstream> |
413 | + |
414 | +#include <iostream> |
415 | +#include <gmock/gmock.h> |
416 | +#include <boost/filesystem.hpp> |
417 | +#include <glib.h> |
418 | + |
419 | +#include "Nux/Nux.h" |
420 | +#include "Nux/HLayout.h" |
421 | +#include "Nux/ProgramFramework/TestView.h" |
422 | + |
423 | +using namespace testing; |
424 | + |
425 | +namespace { |
426 | + |
427 | +TEST(TestWindowCompositor, TestSetKeyFocusArea) |
428 | +{ |
429 | + nux::NuxInitialize(0); |
430 | + nux::WindowThread *wnd_thread = nux::CreateNuxWindow("Nux Window", 300, 200, |
431 | + nux::WINDOWSTYLE_NORMAL, NULL, false, NULL, NULL); |
432 | + |
433 | + nux::TestView* test_view0 = new nux::TestView(); |
434 | + nux::TestView* test_view1 = new nux::TestView(); |
435 | + |
436 | + nux::HLayout* layout = new nux::HLayout(); |
437 | + |
438 | + layout->AddView(test_view0, 1); |
439 | + layout->AddView(test_view1, 1); |
440 | + |
441 | + wnd_thread->SetLayout(layout); |
442 | + |
443 | + // Set keyboard focus on test_view0 |
444 | + { |
445 | + wnd_thread->GetWindowCompositor().SetKeyFocusArea(test_view0); |
446 | + |
447 | + // Check that test_view0 has registered a keynav focus event |
448 | + EXPECT_EQ(test_view0->registered_begin_keynav_focus_, true); |
449 | + EXPECT_EQ(test_view0->registered_end_keynav_focus_, false); |
450 | + |
451 | + EXPECT_EQ(test_view1->registered_begin_keynav_focus_, false); |
452 | + EXPECT_EQ(test_view1->registered_end_keynav_focus_, false); |
453 | + |
454 | + test_view0->ResetKeyFocusEvents(); |
455 | + } |
456 | + |
457 | + // Set keyboard focus on test_view1 |
458 | + { |
459 | + wnd_thread->GetWindowCompositor().SetKeyFocusArea(test_view1); |
460 | + |
461 | + EXPECT_EQ(test_view0->registered_begin_keynav_focus_, false); |
462 | + // Check that test_view0 has loast the keynav focus. |
463 | + EXPECT_EQ(test_view0->registered_end_keynav_focus_, true); |
464 | + |
465 | + // Check that test_view1 has registered a keynav focus event |
466 | + EXPECT_EQ(test_view1->registered_begin_keynav_focus_, true); |
467 | + EXPECT_EQ(test_view1->registered_end_keynav_focus_, false); |
468 | + } |
469 | + |
470 | + delete wnd_thread; |
471 | +} |
472 | + |
473 | + |
474 | +} |
475 | |
476 | === modified file 'tests/xtest-focus-on-mouse-down.cpp' |
477 | --- tests/xtest-focus-on-mouse-down.cpp 2012-01-27 22:37:13 +0000 |
478 | +++ tests/xtest-focus-on-mouse-down.cpp 2012-02-20 02:53:17 +0000 |
479 | @@ -35,8 +35,8 @@ |
480 | |
481 | virtual void UserInterfaceSetup(); |
482 | |
483 | - TestView* focus_view_; |
484 | - TestView* no_focus_view_; |
485 | + nux::TestView* focus_view_; |
486 | + nux::TestView* no_focus_view_; |
487 | }; |
488 | |
489 | FocusOnMouseDownTest::FocusOnMouseDownTest(const char* program_name, |
490 | @@ -59,12 +59,12 @@ |
491 | main_layout->SetSpaceBetweenChildren(10); |
492 | main_layout->SetPadding(10, 10); |
493 | |
494 | - focus_view_ = new TestView(NUX_TRACKER_LOCATION); |
495 | + focus_view_ = new nux::TestView(NUX_TRACKER_LOCATION); |
496 | focus_view_->can_focus_ = true; |
497 | focus_view_->SetAcceptKeyNavFocusOnMouseDown(true); |
498 | main_layout->AddView(focus_view_, 1, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL); |
499 | |
500 | - no_focus_view_ = new TestView(NUX_TRACKER_LOCATION); |
501 | + no_focus_view_ = new nux::TestView(NUX_TRACKER_LOCATION); |
502 | no_focus_view_->can_focus_ = true; |
503 | no_focus_view_->SetAcceptKeyNavFocusOnMouseDown(false); |
504 | main_layout->AddView(no_focus_view_, 1, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL); |
505 | |
506 | === modified file 'tests/xtest-focus-on-mouse-enter.cpp' |
507 | --- tests/xtest-focus-on-mouse-enter.cpp 2012-02-17 13:43:55 +0000 |
508 | +++ tests/xtest-focus-on-mouse-enter.cpp 2012-02-20 02:53:17 +0000 |
509 | @@ -35,8 +35,8 @@ |
510 | |
511 | virtual void UserInterfaceSetup(); |
512 | |
513 | - TestView* focus_view_; |
514 | - TestView* no_focus_view_; |
515 | + nux::TestView* focus_view_; |
516 | + nux::TestView* no_focus_view_; |
517 | }; |
518 | |
519 | FocusOnMouseEnterTest::FocusOnMouseEnterTest(const char* program_name, |
520 | @@ -58,12 +58,12 @@ |
521 | main_layout->SetSpaceBetweenChildren(10); |
522 | main_layout->SetPadding(10, 10); |
523 | |
524 | - no_focus_view_ = new TestView(NUX_TRACKER_LOCATION); |
525 | + no_focus_view_ = new nux::TestView(NUX_TRACKER_LOCATION); |
526 | no_focus_view_->can_focus_ = true; |
527 | no_focus_view_->SetAcceptKeyNavFocusOnMouseEnter(false); |
528 | main_layout->AddView(no_focus_view_, 1, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL); |
529 | |
530 | - focus_view_ = new TestView(NUX_TRACKER_LOCATION); |
531 | + focus_view_ = new nux::TestView(NUX_TRACKER_LOCATION); |
532 | focus_view_->can_focus_ = true; |
533 | focus_view_->SetAcceptKeyNavFocusOnMouseEnter(true); |
534 | main_layout->AddView(focus_view_, 1, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL); |
535 | |
536 | === modified file 'tests/xtest-hgrid-key-navigation.cpp' |
537 | --- tests/xtest-hgrid-key-navigation.cpp 2012-02-13 11:21:48 +0000 |
538 | +++ tests/xtest-hgrid-key-navigation.cpp 2012-02-20 02:53:17 +0000 |
539 | @@ -40,11 +40,11 @@ |
540 | |
541 | virtual void UserInterfaceSetup(); |
542 | |
543 | - TestView* CreateTile(); |
544 | - void AddTile(TestView* tile); |
545 | + nux::TestView* CreateTile(); |
546 | + void AddTile(nux::TestView* tile); |
547 | |
548 | nux::GridHLayout* grid_layout_; |
549 | - TestView* tiles_[11]; |
550 | + nux::TestView* tiles_[11]; |
551 | }; |
552 | |
553 | HGridKeyNavigationTest::HGridKeyNavigationTest(const char* program_name, |
554 | @@ -59,13 +59,13 @@ |
555 | { |
556 | } |
557 | |
558 | -TestView* HGridKeyNavigationTest::CreateTile() |
559 | +nux::TestView* HGridKeyNavigationTest::CreateTile() |
560 | { |
561 | - TestView* tile = new TestView(); |
562 | + nux::TestView* tile = new nux::TestView(); |
563 | return tile; |
564 | } |
565 | |
566 | -void HGridKeyNavigationTest::AddTile(TestView* tile) |
567 | +void HGridKeyNavigationTest::AddTile(nux::TestView* tile) |
568 | { |
569 | grid_layout_->AddView(tile, 1); |
570 | } |
571 | |
572 | === modified file 'tests/xtest-hlayout-key-navigation.cpp' |
573 | --- tests/xtest-hlayout-key-navigation.cpp 2012-01-27 22:37:13 +0000 |
574 | +++ tests/xtest-hlayout-key-navigation.cpp 2012-02-20 02:53:17 +0000 |
575 | @@ -38,11 +38,11 @@ |
576 | |
577 | virtual void UserInterfaceSetup(); |
578 | |
579 | - TestView* CreateView(); |
580 | - void AddView(TestView* view); |
581 | + nux::TestView* CreateView(); |
582 | + void AddView(nux::TestView* view); |
583 | |
584 | nux::HLayout* hlayout_; |
585 | - TestView* views_[NUM_VIEWS]; |
586 | + nux::TestView* views_[NUM_VIEWS]; |
587 | }; |
588 | |
589 | HLayoutKeyNavigationTest::HLayoutKeyNavigationTest(const char* program_name, |
590 | @@ -57,13 +57,13 @@ |
591 | { |
592 | } |
593 | |
594 | -TestView* HLayoutKeyNavigationTest::CreateView() |
595 | +nux::TestView* HLayoutKeyNavigationTest::CreateView() |
596 | { |
597 | - TestView* view = new TestView(); |
598 | + nux::TestView* view = new nux::TestView(); |
599 | return view; |
600 | } |
601 | |
602 | -void HLayoutKeyNavigationTest::AddView(TestView* view) |
603 | +void HLayoutKeyNavigationTest::AddView(nux::TestView* view) |
604 | { |
605 | hlayout_->AddView(view, 1); |
606 | } |
607 | |
608 | === modified file 'tests/xtest-keynav-directions.cpp' |
609 | --- tests/xtest-keynav-directions.cpp 2012-01-30 08:43:49 +0000 |
610 | +++ tests/xtest-keynav-directions.cpp 2012-02-20 02:53:17 +0000 |
611 | @@ -35,10 +35,10 @@ |
612 | |
613 | virtual void UserInterfaceSetup(); |
614 | |
615 | - TestView* view0_; |
616 | - TestView* view1_; |
617 | - TestView* view2_; |
618 | - TestView* view3_; |
619 | + nux::TestView* view0_; |
620 | + nux::TestView* view1_; |
621 | + nux::TestView* view2_; |
622 | + nux::TestView* view3_; |
623 | |
624 | }; |
625 | |
626 | @@ -69,22 +69,22 @@ |
627 | layout0->SetSpaceBetweenChildren(10); |
628 | layout1->SetSpaceBetweenChildren(10); |
629 | |
630 | - view0_ = new TestView(NUX_TRACKER_LOCATION); |
631 | + view0_ = new nux::TestView(NUX_TRACKER_LOCATION); |
632 | view0_->can_focus_ = true; |
633 | view0_->SetAcceptKeyNavFocusOnMouseDown(true); |
634 | layout0->AddView(view0_, 1, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL); |
635 | |
636 | - view1_ = new TestView(NUX_TRACKER_LOCATION); |
637 | + view1_ = new nux::TestView(NUX_TRACKER_LOCATION); |
638 | view1_->can_focus_ = true; |
639 | view1_->SetAcceptKeyNavFocusOnMouseDown(true); |
640 | layout0->AddView(view1_, 1, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL); |
641 | |
642 | - view2_ = new TestView(NUX_TRACKER_LOCATION); |
643 | + view2_ = new nux::TestView(NUX_TRACKER_LOCATION); |
644 | view2_->can_focus_ = true; |
645 | view2_->SetAcceptKeyNavFocusOnMouseDown(true); |
646 | layout1->AddView(view2_, 1, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL); |
647 | |
648 | - view3_ = new TestView(NUX_TRACKER_LOCATION); |
649 | + view3_ = new nux::TestView(NUX_TRACKER_LOCATION); |
650 | view3_->can_focus_ = true; |
651 | view3_->SetAcceptKeyNavFocusOnMouseDown(true); |
652 | layout1->AddView(view3_, 1, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL); |
653 | |
654 | === modified file 'tests/xtest-mouse-buttons.cpp' |
655 | --- tests/xtest-mouse-buttons.cpp 2012-01-27 22:37:13 +0000 |
656 | +++ tests/xtest-mouse-buttons.cpp 2012-02-20 02:53:17 +0000 |
657 | @@ -37,7 +37,7 @@ |
658 | virtual void UserInterfaceSetup(); |
659 | |
660 | void ResetEvents(); |
661 | - TestView* test_view_; |
662 | + nux::TestView* test_view_; |
663 | }; |
664 | |
665 | ButtonEventsTest::ButtonEventsTest(const char* program_name, |
666 | @@ -64,7 +64,7 @@ |
667 | void ButtonEventsTest::UserInterfaceSetup() |
668 | { |
669 | nux::VLayout* main_layout = new nux::VLayout(NUX_TRACKER_LOCATION); |
670 | - test_view_ = new TestView(NUX_TRACKER_LOCATION); |
671 | + test_view_ = new nux::TestView(NUX_TRACKER_LOCATION); |
672 | |
673 | main_layout->AddView(test_view_, 1, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL); |
674 | main_layout->SetPadding(10, 10); |
675 | |
676 | === modified file 'tests/xtest-mouse-events.cpp' |
677 | --- tests/xtest-mouse-events.cpp 2012-01-27 22:37:13 +0000 |
678 | +++ tests/xtest-mouse-events.cpp 2012-02-20 02:53:17 +0000 |
679 | @@ -38,7 +38,7 @@ |
680 | virtual void UserInterfaceSetup(); |
681 | |
682 | void ResetEvents(); |
683 | - TestView* test_view_; |
684 | + nux::TestView* test_view_; |
685 | }; |
686 | |
687 | EventsTest::EventsTest(const char* program_name, |
688 | @@ -65,7 +65,7 @@ |
689 | void EventsTest::UserInterfaceSetup() |
690 | { |
691 | nux::VLayout* main_layout = new nux::VLayout(NUX_TRACKER_LOCATION); |
692 | - test_view_ = new TestView(NUX_TRACKER_LOCATION); |
693 | + test_view_ = new nux::TestView(NUX_TRACKER_LOCATION); |
694 | |
695 | main_layout->AddView(test_view_, 1, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL); |
696 | main_layout->SetPadding(10, 10); |
697 | |
698 | === modified file 'tests/xtest-scrollbar.cpp' |
699 | --- tests/xtest-scrollbar.cpp 2012-01-27 22:37:13 +0000 |
700 | +++ tests/xtest-scrollbar.cpp 2012-02-20 02:53:17 +0000 |
701 | @@ -39,7 +39,7 @@ |
702 | nux::VLayout* layout_; |
703 | TestScrollView* scroll_view_; |
704 | nux::VLayout* in_layout_; |
705 | - TestView* test_view_; |
706 | + nux::TestView* test_view_; |
707 | }; |
708 | |
709 | ScrollBarTest::ScrollBarTest(const char* program_name, |
710 | @@ -65,7 +65,7 @@ |
711 | in_layout_ = new nux::VLayout(NUX_TRACKER_LOCATION); |
712 | scroll_view_->SetLayout(in_layout_); |
713 | |
714 | - test_view_ = new TestView(); |
715 | + test_view_ = new nux::TestView(); |
716 | test_view_->SetMinimumHeight(1000); |
717 | in_layout_->AddView(test_view_); |
718 | |
719 | |
720 | === modified file 'tests/xtest-vlayout-key-navigation.cpp' |
721 | --- tests/xtest-vlayout-key-navigation.cpp 2012-01-27 22:37:13 +0000 |
722 | +++ tests/xtest-vlayout-key-navigation.cpp 2012-02-20 02:53:17 +0000 |
723 | @@ -38,11 +38,11 @@ |
724 | |
725 | virtual void UserInterfaceSetup(); |
726 | |
727 | - TestView* CreateView(); |
728 | - void AddView(TestView* view); |
729 | + nux::TestView* CreateView(); |
730 | + void AddView(nux::TestView* view); |
731 | |
732 | nux::VLayout* vlayout_; |
733 | - TestView* views_[NUM_VIEWS]; |
734 | + nux::TestView* views_[NUM_VIEWS]; |
735 | }; |
736 | |
737 | VLayoutKeyNavigationTest::VLayoutKeyNavigationTest(const char* program_name, |
738 | @@ -57,13 +57,13 @@ |
739 | { |
740 | } |
741 | |
742 | -TestView* VLayoutKeyNavigationTest::CreateView() |
743 | +nux::TestView* VLayoutKeyNavigationTest::CreateView() |
744 | { |
745 | - TestView* view = new TestView(); |
746 | + nux::TestView* view = new nux::TestView(); |
747 | return view; |
748 | } |
749 | |
750 | -void VLayoutKeyNavigationTest::AddView(TestView* view) |
751 | +void VLayoutKeyNavigationTest::AddView(nux::TestView* view) |
752 | { |
753 | vlayout_->AddView(view, 1); |
754 | } |
Looks good to me.
Later we can ass an SetAcceptKeyNav Focus function.