Nux

Merge lp:~gordallott/nux/nux-fixes-07-04 into lp:nux

Proposed by Gord Allott
Status: Merged
Merge reported by: Gord Allott
Merged at revision: not available
Proposed branch: lp:~gordallott/nux/nux-fixes-07-04
Merge into: lp:nux
Diff against target: 186 lines (+48/-38)
4 files modified
Nux/Focusable.cpp (+1/-0)
Nux/GridHLayout.cpp (+42/-35)
Nux/GridHLayout.h (+4/-2)
Nux/TextEntry.cpp (+1/-1)
To merge this branch: bzr merge lp:~gordallott/nux/nux-fixes-07-04
Reviewer Review Type Date Requested Status
Jay Taoko (community) Approve
Review via email: mp+56771@code.launchpad.net

Description of the change

fixes some bugs, attached

To post a comment you must log in.
Revision history for this message
Jay Taoko (jaytaoko) wrote :

Shouldn't the same thing be done for GridVLayout?

Approved

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'Nux/Focusable.cpp'
--- Nux/Focusable.cpp 2011-03-23 06:46:46 +0000
+++ Nux/Focusable.cpp 2011-04-07 13:47:29 +0000
@@ -53,6 +53,7 @@
53 switch (keysym)53 switch (keysym)
54 {54 {
55 case NUX_VK_ENTER:55 case NUX_VK_ENTER:
56 case NUX_KP_ENTER:
56 type = FOCUS_EVENT_ACTIVATE;57 type = FOCUS_EVENT_ACTIVATE;
57 //g_debug ("focus key activated");58 //g_debug ("focus key activated");
58 break;59 break;
5960
=== modified file 'Nux/GridHLayout.cpp'
--- Nux/GridHLayout.cpp 2011-04-06 21:54:09 +0000
+++ Nux/GridHLayout.cpp 2011-04-07 13:47:29 +0000
@@ -97,6 +97,33 @@
97 return NULL;97 return NULL;
98 }98 }
9999
100 long GridHLayout::DoFocusNext (IEvent &ievent, long TraverseInfo, long ProcessEventInfo)
101 {
102 Area *parent = GetParentObject ();
103 if (parent != NULL)
104 {
105 return SendEventToArea (parent, ievent, TraverseInfo, ProcessEventInfo);
106 }
107 else
108 {
109 Layout::DoFocusNext (ievent, TraverseInfo, ProcessEventInfo);
110 }
111
112 return ProcessEventInfo;
113 }
114
115 long GridHLayout::DoFocusPrev (IEvent &ievent, long TraverseInfo, long ProcessEventInfo)
116 {
117 Area *parent = GetParentObject ();
118 if (parent != NULL)
119 return SendEventToArea (parent, ievent, TraverseInfo, ProcessEventInfo);
120 else
121 Layout::DoFocusPrev (ievent, TraverseInfo, ProcessEventInfo);
122
123 return ProcessEventInfo;
124 }
125
126
100 long GridHLayout::DoFocusLeft (IEvent &ievent, long TraverseInfo, long ProcessEventInfo)127 long GridHLayout::DoFocusLeft (IEvent &ievent, long TraverseInfo, long ProcessEventInfo)
101 {128 {
102 // if we are left on an edge, then send up129 // if we are left on an edge, then send up
@@ -106,13 +133,12 @@
106133
107 if (parent == NULL || position % GetNumColumn ())134 if (parent == NULL || position % GetNumColumn ())
108 {135 {
109 return Layout::DoFocusLeft (ievent, TraverseInfo, ProcessEventInfo);136 //inside container
110 }137 return Layout::DoFocusPrev (ievent, TraverseInfo, ProcessEventInfo);
111 else138 }
112 {139
113 // left edge140
114 return SendEventToArea (parent, ievent, TraverseInfo, ProcessEventInfo);141 return TraverseInfo;
115 }
116 }142 }
117143
118 long GridHLayout::DoFocusRight (IEvent &ievent, long TraverseInfo, long ProcessEventInfo)144 long GridHLayout::DoFocusRight (IEvent &ievent, long TraverseInfo, long ProcessEventInfo)
@@ -124,13 +150,11 @@
124150
125 if (parent == NULL || (position + 1) % GetNumColumn ())151 if (parent == NULL || (position + 1) % GetNumColumn ())
126 {152 {
127 return Layout::DoFocusRight (ievent, TraverseInfo, ProcessEventInfo);153 // inside container
128 }154 return Layout::DoFocusNext (ievent, TraverseInfo, ProcessEventInfo);
129 else155 }
130 {156
131 // Right Edge157 return TraverseInfo;
132 return SendEventToArea (parent, ievent, TraverseInfo, ProcessEventInfo);
133 }
134 }158 }
135159
136 //up and down should pass event to parent160 //up and down should pass event to parent
@@ -139,34 +163,25 @@
139 Area* focused_child = GetFocusedChild ();163 Area* focused_child = GetFocusedChild ();
140 int position = GetChildPos (focused_child);164 int position = GetChildPos (focused_child);
141 Area *parent = GetParentObject ();165 Area *parent = GetParentObject ();
142 166 if (focused_child == NULL)
143 if (focused_child == NULL || position < GetNumColumn ())
144 {167 {
145
146 if (parent != NULL)168 if (parent != NULL)
169 {
147 return SendEventToArea (parent, ievent, TraverseInfo, ProcessEventInfo);170 return SendEventToArea (parent, ievent, TraverseInfo, ProcessEventInfo);
171 }
148 else172 else
149 FocusFirstChild ();173 FocusFirstChild ();
150
151 }174 }
152 else175 else
153 {176 {
154 // so hacky, but its cheap!177 // so hacky, but its cheap!
155 // just focus the child position - numcolumns178 // just focus the child position - numcolumns
156 //focused_child->SetFocused (false);
157 focused_child = GetChildAtPosition (position - GetNumColumn ());179 focused_child = GetChildAtPosition (position - GetNumColumn ());
158 if (focused_child)180 if (focused_child)
159 {181 {
160 focused_child->SetFocused (true);182 focused_child->SetFocused (true);
161 ChildFocusChanged.emit (this, focused_child);183 ChildFocusChanged.emit (this, focused_child);
162 }184 }
163 else
164 {
165 if (parent != NULL)
166 return SendEventToArea (parent, ievent, TraverseInfo, ProcessEventInfo);
167 else
168 FocusFirstChild ();
169 }
170 }185 }
171186
172 return TraverseInfo;187 return TraverseInfo;
@@ -177,7 +192,7 @@
177 int position = GetChildPos (focused_child);192 int position = GetChildPos (focused_child);
178 Area *parent = GetParentObject ();193 Area *parent = GetParentObject ();
179 194
180 if (focused_child == NULL || position > GetNumColumn () * (GetNumRow () - 1))195 if (focused_child == NULL)
181 {196 {
182 if (parent != NULL)197 if (parent != NULL)
183 return SendEventToArea (parent, ievent, TraverseInfo, ProcessEventInfo);198 return SendEventToArea (parent, ievent, TraverseInfo, ProcessEventInfo);
@@ -188,20 +203,12 @@
188 {203 {
189 // so hacky, but its cheap!204 // so hacky, but its cheap!
190 // just focus the child position - numcolumns205 // just focus the child position - numcolumns
191 //focused_child->SetFocused (false);
192 focused_child = GetChildAtPosition (position + GetNumColumn ());206 focused_child = GetChildAtPosition (position + GetNumColumn ());
193 if (focused_child)207 if (focused_child)
194 {208 {
195 focused_child->SetFocused (true);209 focused_child->SetFocused (true);
196 ChildFocusChanged.emit (this, focused_child);210 ChildFocusChanged.emit (this, focused_child);
197 }211 }
198 else
199 {
200 if (parent != NULL)
201 return SendEventToArea (parent, ievent, TraverseInfo, ProcessEventInfo);
202 else
203 FocusLastChild ();
204 }
205 }212 }
206213
207 return TraverseInfo;214 return TraverseInfo;
208215
=== modified file 'Nux/GridHLayout.h'
--- Nux/GridHLayout.h 2011-04-06 21:54:09 +0000
+++ Nux/GridHLayout.h 2011-04-07 13:47:29 +0000
@@ -107,8 +107,10 @@
107 protected:107 protected:
108 int GetChildPos (Area *child);108 int GetChildPos (Area *child);
109 Area* GetChildAtPosition (int pos);109 Area* GetChildAtPosition (int pos);
110 virtual long DoFocusUp (IEvent &ievent, long TraverseInfo, long ProcessEventInfo);110 virtual long DoFocusNext (IEvent &ievent, long TraverseInfo, long ProcessEventInfo);
111 virtual long DoFocusDown (IEvent &ievent, long TraverseInfo, long ProcessEventInfo);111 virtual long DoFocusPrev (IEvent &ievent, long TraverseInfo, long ProcessEventInfo);
112 virtual long DoFocusUp (IEvent &ievent, long TraverseInfo, long ProcessEventInfo);
113 virtual long DoFocusDown (IEvent &ievent, long TraverseInfo, long ProcessEventInfo);
112 virtual long DoFocusLeft (IEvent &ievent, long TraverseInfo, long ProcessEventInfo);114 virtual long DoFocusLeft (IEvent &ievent, long TraverseInfo, long ProcessEventInfo);
113 virtual long DoFocusRight (IEvent &ievent, long TraverseInfo, long ProcessEventInfo);115 virtual long DoFocusRight (IEvent &ievent, long TraverseInfo, long ProcessEventInfo);
114 116
115117
=== modified file 'Nux/TextEntry.cpp'
--- Nux/TextEntry.cpp 2011-04-07 11:01:32 +0000
+++ Nux/TextEntry.cpp 2011-04-07 13:47:29 +0000
@@ -374,7 +374,7 @@
374 if (keysym == NUX_VK_TAB)374 if (keysym == NUX_VK_TAB)
375 return;375 return;
376376
377 if (keysym == NUX_VK_ENTER)377 if (keysym == NUX_VK_ENTER || NUX_KP_ENTER)
378 {378 {
379 activated.emit ();379 activated.emit ();
380 return;380 return;

Subscribers

People subscribed via source and target branches