OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 VIEWS_VIEW_H_ | 5 #ifndef VIEWS_VIEW_H_ |
6 #define VIEWS_VIEW_H_ | 6 #define VIEWS_VIEW_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <map> | 10 #include <map> |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 // | 136 // |
137 // It is up to the subclass to implement Painting and storage of subclass - | 137 // It is up to the subclass to implement Painting and storage of subclass - |
138 // specific properties and functionality. | 138 // specific properties and functionality. |
139 // | 139 // |
140 // Unless otherwise documented, views is not thread safe and should only be | 140 // Unless otherwise documented, views is not thread safe and should only be |
141 // accessed from the main thread. | 141 // accessed from the main thread. |
142 // | 142 // |
143 ///////////////////////////////////////////////////////////////////////////// | 143 ///////////////////////////////////////////////////////////////////////////// |
144 class View : public AcceleratorTarget { | 144 class View : public AcceleratorTarget { |
145 public: | 145 public: |
| 146 typedef std::vector<View*> ViewVector; |
| 147 |
146 #if defined(TOUCH_UI) | 148 #if defined(TOUCH_UI) |
147 enum TouchStatus { | 149 enum TouchStatus { |
148 TOUCH_STATUS_UNKNOWN = 0, // Unknown touch status. This is used to indicate | 150 TOUCH_STATUS_UNKNOWN = 0, // Unknown touch status. This is used to indicate |
149 // that the touch event was not handled. | 151 // that the touch event was not handled. |
150 TOUCH_STATUS_START, // The touch event initiated a touch sequence. | 152 TOUCH_STATUS_START, // The touch event initiated a touch sequence. |
151 TOUCH_STATUS_CONTINUE, // The touch event is part of a previously | 153 TOUCH_STATUS_CONTINUE, // The touch event is part of a previously |
152 // started touch sequence. | 154 // started touch sequence. |
153 TOUCH_STATUS_END, // The touch event ended the touch sequence. | 155 TOUCH_STATUS_END, // The touch event ended the touch sequence. |
154 TOUCH_STATUS_CANCEL, // The touch event was cancelled, but didn't | 156 TOUCH_STATUS_CANCEL, // The touch event was cancelled, but didn't |
155 // terminate the touch sequence. | 157 // terminate the touch sequence. |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
443 int GetGroup() const; | 445 int GetGroup() const; |
444 | 446 |
445 // If this returns true, the views from the same group can each be focused | 447 // If this returns true, the views from the same group can each be focused |
446 // when moving focus with the Tab/Shift-Tab key. If this returns false, | 448 // when moving focus with the Tab/Shift-Tab key. If this returns false, |
447 // only the selected view from the group (obtained with | 449 // only the selected view from the group (obtained with |
448 // GetSelectedViewForGroup()) is focused. | 450 // GetSelectedViewForGroup()) is focused. |
449 virtual bool IsGroupFocusTraversable() const; | 451 virtual bool IsGroupFocusTraversable() const; |
450 | 452 |
451 // Fills the provided vector with all the available views which belong to the | 453 // Fills the provided vector with all the available views which belong to the |
452 // provided group. | 454 // provided group. |
453 void GetViewsWithGroup(int group_id, std::vector<View*>* out); | 455 void GetViewsWithGroup(int group_id, ViewVector* out); |
454 | 456 |
455 // Return the View that is currently selected in the specified group. | 457 // Return the View that is currently selected in the specified group. |
456 // The default implementation simply returns the first View found for that | 458 // The default implementation simply returns the first View found for that |
457 // group. | 459 // group. |
458 virtual View* GetSelectedViewForGroup(int group_id); | 460 virtual View* GetSelectedViewForGroup(int group_id); |
459 | 461 |
460 // Coordinate conversion ----------------------------------------------------- | 462 // Coordinate conversion ----------------------------------------------------- |
461 | 463 |
462 // Note that the utility coordinate conversions functions always operate on | 464 // Note that the utility coordinate conversions functions always operate on |
463 // the mirrored position of the child Views if the parent View uses a | 465 // the mirrored position of the child Views if the parent View uses a |
(...skipping 843 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1307 // views of the same group. For example radio button uses this information | 1309 // views of the same group. For example radio button uses this information |
1308 // to find other radio buttons. | 1310 // to find other radio buttons. |
1309 int group_; | 1311 int group_; |
1310 | 1312 |
1311 // Tree operations ----------------------------------------------------------- | 1313 // Tree operations ----------------------------------------------------------- |
1312 | 1314 |
1313 // This view's parent. | 1315 // This view's parent. |
1314 View* parent_; | 1316 View* parent_; |
1315 | 1317 |
1316 // This view's children. | 1318 // This view's children. |
1317 typedef std::vector<View*> ViewVector; | |
1318 ViewVector children_; | 1319 ViewVector children_; |
1319 | 1320 |
1320 // Size and disposition ------------------------------------------------------ | 1321 // Size and disposition ------------------------------------------------------ |
1321 | 1322 |
1322 // This View's bounds in the parent coordinate system. | 1323 // This View's bounds in the parent coordinate system. |
1323 gfx::Rect bounds_; | 1324 gfx::Rect bounds_; |
1324 | 1325 |
1325 // Whether this view is visible. | 1326 // Whether this view is visible. |
1326 bool is_visible_; | 1327 bool is_visible_; |
1327 | 1328 |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1439 // The Windows-specific accessibility implementation for this View. | 1440 // The Windows-specific accessibility implementation for this View. |
1440 scoped_refptr<NativeViewAccessibilityWin> native_view_accessibility_win_; | 1441 scoped_refptr<NativeViewAccessibilityWin> native_view_accessibility_win_; |
1441 #endif | 1442 #endif |
1442 | 1443 |
1443 DISALLOW_COPY_AND_ASSIGN(View); | 1444 DISALLOW_COPY_AND_ASSIGN(View); |
1444 }; | 1445 }; |
1445 | 1446 |
1446 } // namespace views | 1447 } // namespace views |
1447 | 1448 |
1448 #endif // VIEWS_VIEW_H_ | 1449 #endif // VIEWS_VIEW_H_ |
OLD | NEW |