Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 UI_VIEWS_VIEW_H_ | 5 #ifndef UI_VIEWS_VIEW_H_ |
| 6 #define UI_VIEWS_VIEW_H_ | 6 #define UI_VIEWS_VIEW_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 111 // TODO(beng): delete | 111 // TODO(beng): delete |
| 112 // Returns whether the view is hot-tracked. | 112 // Returns whether the view is hot-tracked. |
| 113 virtual bool IsHotTracked() const; | 113 virtual bool IsHotTracked() const; |
| 114 | 114 |
| 115 // Creation and lifetime ----------------------------------------------------- | 115 // Creation and lifetime ----------------------------------------------------- |
| 116 | 116 |
| 117 View(); | 117 View(); |
| 118 virtual ~View(); | 118 virtual ~View(); |
| 119 | 119 |
| 120 // By default a View is owned by its parent unless specified otherwise here. | 120 // By default a View is owned by its parent unless specified otherwise here. |
| 121 bool parent_owned() const { return parent_owned_; } | 121 bool owned_by_parent() const { return owned_by_parent_; } |
|
Ben Goodger (Google)
2012/05/10 16:51:20
is this accessor used by anyone outside of View? s
| |
| 122 void set_parent_owned(bool parent_owned) { parent_owned_ = parent_owned; } | 122 void set_not_owned_by_parent() { owned_by_parent_ = false; } |
|
Ben Goodger (Google)
2012/05/10 16:51:20
this function name feels awkward to me (though so
| |
| 123 | 123 |
| 124 // Tree operations ----------------------------------------------------------- | 124 // Tree operations ----------------------------------------------------------- |
| 125 | 125 |
| 126 // Get the Widget that hosts this View, if any. | 126 // Get the Widget that hosts this View, if any. |
| 127 virtual const Widget* GetWidget() const; | 127 virtual const Widget* GetWidget() const; |
| 128 virtual Widget* GetWidget(); | 128 virtual Widget* GetWidget(); |
| 129 | 129 |
| 130 // Adds |view| as a child of this view, optionally at |index|. | 130 // Adds |view| as a child of this view, optionally at |index|. |
| 131 void AddChildView(View* view); | 131 void AddChildView(View* view); |
| 132 void AddChildViewAt(View* view, int index); | 132 void AddChildViewAt(View* view, int index); |
| (...skipping 1192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1325 // Starts a drag and drop operation originating from this view. This invokes | 1325 // Starts a drag and drop operation originating from this view. This invokes |
| 1326 // WriteDragData to write the data and GetDragOperations to determine the | 1326 // WriteDragData to write the data and GetDragOperations to determine the |
| 1327 // supported drag operations. When done, OnDragDone is invoked. |press_pt| is | 1327 // supported drag operations. When done, OnDragDone is invoked. |press_pt| is |
| 1328 // in the view's coordinate system. | 1328 // in the view's coordinate system. |
| 1329 void DoDrag(const LocatedEvent& event, const gfx::Point& press_pt); | 1329 void DoDrag(const LocatedEvent& event, const gfx::Point& press_pt); |
| 1330 | 1330 |
| 1331 ////////////////////////////////////////////////////////////////////////////// | 1331 ////////////////////////////////////////////////////////////////////////////// |
| 1332 | 1332 |
| 1333 // Creation and lifetime ----------------------------------------------------- | 1333 // Creation and lifetime ----------------------------------------------------- |
| 1334 | 1334 |
| 1335 // True if the hierarchy (i.e. the parent View) is responsible for deleting | 1335 // True if this views is owned by its parent - i.e. it will be deleted by its |
| 1336 // this View. Default is true. | 1336 // parent during its parents destruction. True is the default. |
| 1337 bool parent_owned_; | 1337 bool owned_by_parent_; |
| 1338 | 1338 |
| 1339 // Attributes ---------------------------------------------------------------- | 1339 // Attributes ---------------------------------------------------------------- |
| 1340 | 1340 |
| 1341 // The id of this View. Used to find this View. | 1341 // The id of this View. Used to find this View. |
| 1342 int id_; | 1342 int id_; |
| 1343 | 1343 |
| 1344 // The group of this view. Some view subclasses use this id to find other | 1344 // The group of this view. Some view subclasses use this id to find other |
| 1345 // views of the same group. For example radio button uses this information | 1345 // views of the same group. For example radio button uses this information |
| 1346 // to find other radio buttons. | 1346 // to find other radio buttons. |
| 1347 int group_; | 1347 int group_; |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1471 base::win::ScopedComPtr<NativeViewAccessibilityWin> | 1471 base::win::ScopedComPtr<NativeViewAccessibilityWin> |
| 1472 native_view_accessibility_win_; | 1472 native_view_accessibility_win_; |
| 1473 #endif | 1473 #endif |
| 1474 | 1474 |
| 1475 DISALLOW_COPY_AND_ASSIGN(View); | 1475 DISALLOW_COPY_AND_ASSIGN(View); |
| 1476 }; | 1476 }; |
| 1477 | 1477 |
| 1478 } // namespace views | 1478 } // namespace views |
| 1479 | 1479 |
| 1480 #endif // UI_VIEWS_VIEW_H_ | 1480 #endif // UI_VIEWS_VIEW_H_ |
| OLD | NEW |