| 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 public ui::AcceleratorTarget { | 99 public ui::AcceleratorTarget { |
| 100 public: | 100 public: |
| 101 typedef std::vector<View*> Views; | 101 typedef std::vector<View*> Views; |
| 102 | 102 |
| 103 // Creation and lifetime ----------------------------------------------------- | 103 // Creation and lifetime ----------------------------------------------------- |
| 104 | 104 |
| 105 View(); | 105 View(); |
| 106 virtual ~View(); | 106 virtual ~View(); |
| 107 | 107 |
| 108 // By default a View is owned by its parent unless specified otherwise here. | 108 // By default a View is owned by its parent unless specified otherwise here. |
| 109 bool parent_owned() const { return parent_owned_; } | 109 void set_owned_by_client() { owned_by_client_ = true; } |
| 110 void set_parent_owned(bool parent_owned) { parent_owned_ = parent_owned; } | |
| 111 | 110 |
| 112 // Tree operations ----------------------------------------------------------- | 111 // Tree operations ----------------------------------------------------------- |
| 113 | 112 |
| 114 // Get the Widget that hosts this View, if any. | 113 // Get the Widget that hosts this View, if any. |
| 115 virtual const Widget* GetWidget() const; | 114 virtual const Widget* GetWidget() const; |
| 116 virtual Widget* GetWidget(); | 115 virtual Widget* GetWidget(); |
| 117 | 116 |
| 118 // Adds |view| as a child of this view, optionally at |index|. | 117 // Adds |view| as a child of this view, optionally at |index|. |
| 119 void AddChildView(View* view); | 118 void AddChildView(View* view); |
| 120 void AddChildViewAt(View* view, int index); | 119 void AddChildViewAt(View* view, int index); |
| (...skipping 1192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1313 // Starts a drag and drop operation originating from this view. This invokes | 1312 // Starts a drag and drop operation originating from this view. This invokes |
| 1314 // WriteDragData to write the data and GetDragOperations to determine the | 1313 // WriteDragData to write the data and GetDragOperations to determine the |
| 1315 // supported drag operations. When done, OnDragDone is invoked. |press_pt| is | 1314 // supported drag operations. When done, OnDragDone is invoked. |press_pt| is |
| 1316 // in the view's coordinate system. | 1315 // in the view's coordinate system. |
| 1317 void DoDrag(const LocatedEvent& event, const gfx::Point& press_pt); | 1316 void DoDrag(const LocatedEvent& event, const gfx::Point& press_pt); |
| 1318 | 1317 |
| 1319 ////////////////////////////////////////////////////////////////////////////// | 1318 ////////////////////////////////////////////////////////////////////////////// |
| 1320 | 1319 |
| 1321 // Creation and lifetime ----------------------------------------------------- | 1320 // Creation and lifetime ----------------------------------------------------- |
| 1322 | 1321 |
| 1323 // True if the hierarchy (i.e. the parent View) is responsible for deleting | 1322 // False if this View is owned by its parent - i.e. it will be deleted by its |
| 1324 // this View. Default is true. | 1323 // parent during its parents destruction. False is the default. |
| 1325 bool parent_owned_; | 1324 bool owned_by_client_; |
| 1326 | 1325 |
| 1327 // Attributes ---------------------------------------------------------------- | 1326 // Attributes ---------------------------------------------------------------- |
| 1328 | 1327 |
| 1329 // The id of this View. Used to find this View. | 1328 // The id of this View. Used to find this View. |
| 1330 int id_; | 1329 int id_; |
| 1331 | 1330 |
| 1332 // The group of this view. Some view subclasses use this id to find other | 1331 // The group of this view. Some view subclasses use this id to find other |
| 1333 // views of the same group. For example radio button uses this information | 1332 // views of the same group. For example radio button uses this information |
| 1334 // to find other radio buttons. | 1333 // to find other radio buttons. |
| 1335 int group_; | 1334 int group_; |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1459 base::win::ScopedComPtr<NativeViewAccessibilityWin> | 1458 base::win::ScopedComPtr<NativeViewAccessibilityWin> |
| 1460 native_view_accessibility_win_; | 1459 native_view_accessibility_win_; |
| 1461 #endif | 1460 #endif |
| 1462 | 1461 |
| 1463 DISALLOW_COPY_AND_ASSIGN(View); | 1462 DISALLOW_COPY_AND_ASSIGN(View); |
| 1464 }; | 1463 }; |
| 1465 | 1464 |
| 1466 } // namespace views | 1465 } // namespace views |
| 1467 | 1466 |
| 1468 #endif // UI_VIEWS_VIEW_H_ | 1467 #endif // UI_VIEWS_VIEW_H_ |
| OLD | NEW |