OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_ANDROID_VR_SHELL_UI_ELEMENTS_UI_ELEMENT_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_VR_SHELL_UI_ELEMENTS_UI_ELEMENT_H_ |
6 #define CHROME_BROWSER_ANDROID_VR_SHELL_UI_ELEMENTS_UI_ELEMENT_H_ | 6 #define CHROME_BROWSER_ANDROID_VR_SHELL_UI_ELEMENTS_UI_ELEMENT_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "chrome/browser/android/vr_shell/ui_elements/ui_element_identifiers.h" | |
13 #include "device/vr/vr_types.h" | 14 #include "device/vr/vr_types.h" |
14 | 15 |
15 namespace base { | 16 namespace base { |
16 class TimeTicks; | 17 class TimeTicks; |
17 } | 18 } |
18 | 19 |
19 namespace vr_shell { | 20 namespace vr_shell { |
20 | 21 |
21 class Animation; | 22 class Animation; |
22 class VrShellRenderer; | 23 class VrShellRenderer; |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
224 return inheritable_transform_; | 225 return inheritable_transform_; |
225 } | 226 } |
226 void set_inheritable_transform(const Transform& transform) { | 227 void set_inheritable_transform(const Transform& transform) { |
227 inheritable_transform_ = transform; | 228 inheritable_transform_ = transform; |
228 } | 229 } |
229 | 230 |
230 // A flag usable during transformation calculates to avoid duplicate work. | 231 // A flag usable during transformation calculates to avoid duplicate work. |
231 bool dirty() const { return dirty_; } | 232 bool dirty() const { return dirty_; } |
232 void set_dirty(bool dirty) { dirty_ = dirty; } | 233 void set_dirty(bool dirty) { dirty_ = dirty; } |
233 | 234 |
235 // A flag usable during transformation calculates to avoid duplicate work. | |
236 UiElementIdentifier identifier() const { return identifier_; } | |
237 void set_identifier(UiElementIdentifier identifier) { | |
238 identifier_ = identifier; | |
239 } | |
240 | |
234 // By default, sets an element to be visible or not. This may be overridden to | 241 // By default, sets an element to be visible or not. This may be overridden to |
235 // allow finer control of element visibility. | 242 // allow finer control of element visibility. |
236 virtual void SetEnabled(bool enabled); | 243 virtual void SetEnabled(bool enabled); |
237 | 244 |
238 private: | 245 private: |
239 // Valid IDs are non-negative. | 246 // Valid IDs are non-negative. |
240 int id_ = -1; | 247 int id_ = -1; |
241 | 248 |
242 // If a non-negative parent ID is specified, applicable transformations | 249 // If a non-negative parent ID is specified, applicable transformations |
243 // are applied relative to the parent, rather than absolutely. | 250 // are applied relative to the parent, rather than absolutely. |
244 int parent_id_ = -1; | 251 int parent_id_ = -1; |
245 | 252 |
246 // If true, this object will be visible. | 253 // If true, this object will be visible. |
247 bool visible_ = true; | 254 bool visible_ = false; |
248 | 255 |
249 // If false, the reticle will not hit the element, even if visible. | 256 // If false, the reticle will not hit the element, even if visible. |
250 bool hit_testable_ = true; | 257 bool hit_testable_ = true; |
251 | 258 |
252 // If true, transformations will be applied relative to the field of view, | 259 // If true, transformations will be applied relative to the field of view, |
253 // rather than the world. | 260 // rather than the world. |
254 bool lock_to_fov_ = false; | 261 bool lock_to_fov_ = false; |
255 | 262 |
256 // The computed lock to the FoV, incorporating lock of parent objects. | 263 // The computed lock to the FoV, incorporating lock of parent objects. |
257 bool computed_lock_to_fov_ = false; | 264 bool computed_lock_to_fov_ = false; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
292 int gridline_count_ = 1; | 299 int gridline_count_ = 1; |
293 | 300 |
294 int draw_phase_ = 1; | 301 int draw_phase_ = 1; |
295 | 302 |
296 // This transform can be used by children to derive position of its parent. | 303 // This transform can be used by children to derive position of its parent. |
297 Transform inheritable_transform_; | 304 Transform inheritable_transform_; |
298 | 305 |
299 // A flag usable during transformation calculates to avoid duplicate work. | 306 // A flag usable during transformation calculates to avoid duplicate work. |
300 bool dirty_ = false; | 307 bool dirty_ = false; |
301 | 308 |
309 // An identifier used for testing and debugging, in lieu of a string. | |
310 UiElementIdentifier identifier_ = UiElementIdentifier::kNone; | |
Ian Vollick
2017/05/19 14:42:32
If it's for debugging, could we wrap with #ifndef
cjgrant
2017/05/19 15:10:40
We originally wanted to use strings for this, but
| |
311 | |
302 Transform transform_; | 312 Transform transform_; |
303 | 313 |
304 DISALLOW_COPY_AND_ASSIGN(UiElement); | 314 DISALLOW_COPY_AND_ASSIGN(UiElement); |
305 }; | 315 }; |
306 | 316 |
307 } // namespace vr_shell | 317 } // namespace vr_shell |
308 | 318 |
309 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_UI_ELEMENTS_UI_ELEMENT_H_ | 319 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_UI_ELEMENTS_UI_ELEMENT_H_ |
OLD | NEW |