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_CONTROLS_TREE_TREE_VIEW_VIEWS_H_ | 5 #ifndef UI_VIEWS_CONTROLS_TREE_TREE_VIEW_VIEWS_H_ |
| 6 #define UI_VIEWS_CONTROLS_TREE_TREE_VIEW_VIEWS_H_ | 6 #define UI_VIEWS_CONTROLS_TREE_TREE_VIEW_VIEWS_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "ui/base/models/tree_node_model.h" | 13 #include "ui/base/models/tree_node_model.h" |
| 14 #include "ui/gfx/font_list.h" | 14 #include "ui/gfx/font_list.h" |
| 15 #include "ui/gfx/image/image_skia.h" | 15 #include "ui/gfx/image/image_skia.h" |
| 16 #include "ui/views/controls/prefix_delegate.h" | 16 #include "ui/views/controls/prefix_delegate.h" |
| 17 #include "ui/views/controls/textfield/textfield_controller.h" | 17 #include "ui/views/controls/textfield/textfield_controller.h" |
| 18 #include "ui/views/focus/focus_manager.h" | 18 #include "ui/views/focus/focus_manager.h" |
| 19 #include "ui/views/view.h" | 19 #include "ui/views/view.h" |
| 20 | 20 |
| 21 namespace gfx { | 21 namespace gfx { |
| 22 class Rect; | 22 class Rect; |
| 23 } // namespace gfx | 23 } // namespace gfx |
| 24 | 24 |
| 25 namespace views { | 25 namespace views { |
| 26 | 26 |
| 27 class PrefixSelector; | |
| 28 class ScrollView; | |
| 27 class Textfield; | 29 class Textfield; |
| 28 class TreeViewController; | 30 class TreeViewController; |
| 29 class PrefixSelector; | |
| 30 | 31 |
| 31 // TreeView displays hierarchical data as returned from a TreeModel. The user | 32 // TreeView displays hierarchical data as returned from a TreeModel. The user |
| 32 // can expand, collapse and edit the items. A Controller may be attached to | 33 // can expand, collapse and edit the items. A Controller may be attached to |
| 33 // receive notification of selection changes and restrict editing. | 34 // receive notification of selection changes and restrict editing. |
| 34 // | 35 // |
| 35 // Note on implementation. This implementation doesn't scale well. In particular | 36 // Note on implementation. This implementation doesn't scale well. In particular |
| 36 // it does not store any row information, but instead calculates it as | 37 // it does not store any row information, but instead calculates it as |
| 37 // necessary. But it's more than adequate for current uses. | 38 // necessary. But it's more than adequate for current uses. |
| 38 class VIEWS_EXPORT TreeView : public View, | 39 class VIEWS_EXPORT TreeView : public View, |
| 39 public ui::TreeModelObserver, | 40 public ui::TreeModelObserver, |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 342 // Implementation of Expand(). Returns true if at least one node was expanded | 343 // Implementation of Expand(). Returns true if at least one node was expanded |
| 343 // that previously wasn't. | 344 // that previously wasn't. |
| 344 bool ExpandImpl(ui::TreeModelNode* model_node); | 345 bool ExpandImpl(ui::TreeModelNode* model_node); |
| 345 | 346 |
| 346 PrefixSelector* GetPrefixSelector(); | 347 PrefixSelector* GetPrefixSelector(); |
| 347 | 348 |
| 348 // Returns whether |point| is in the bounds of |node|'s expand/collapse | 349 // Returns whether |point| is in the bounds of |node|'s expand/collapse |
| 349 // control. | 350 // control. |
| 350 bool IsPointInExpandControl(InternalNode* node, const gfx::Point& point); | 351 bool IsPointInExpandControl(InternalNode* node, const gfx::Point& point); |
| 351 | 352 |
| 353 // Returns the View that the focus ring for this TreeView should be drawn | |
| 354 // around. | |
| 355 ScrollView* FindFocusRingView(); | |
|
sky
2016/10/12 23:58:01
This function is mildly confusing as based on name
Elly Fong-Jones
2016/10/13 11:14:56
It is gone now and its logic moved into TreeView::
| |
| 356 | |
| 352 // The model, may be null. | 357 // The model, may be null. |
| 353 ui::TreeModel* model_; | 358 ui::TreeModel* model_; |
| 354 | 359 |
| 355 // Default icons for closed/open. | 360 // Default icons for closed/open. |
| 356 gfx::ImageSkia closed_icon_; | 361 gfx::ImageSkia closed_icon_; |
| 357 gfx::ImageSkia open_icon_; | 362 gfx::ImageSkia open_icon_; |
| 358 | 363 |
| 359 // Icons from the model. | 364 // Icons from the model. |
| 360 std::vector<gfx::ImageSkia> icons_; | 365 std::vector<gfx::ImageSkia> icons_; |
| 361 | 366 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 405 int text_offset_; | 410 int text_offset_; |
| 406 | 411 |
| 407 std::unique_ptr<PrefixSelector> selector_; | 412 std::unique_ptr<PrefixSelector> selector_; |
| 408 | 413 |
| 409 DISALLOW_COPY_AND_ASSIGN(TreeView); | 414 DISALLOW_COPY_AND_ASSIGN(TreeView); |
| 410 }; | 415 }; |
| 411 | 416 |
| 412 } // namespace views | 417 } // namespace views |
| 413 | 418 |
| 414 #endif // UI_VIEWS_CONTROLS_TREE_TREE_VIEW_VIEWS_H_ | 419 #endif // UI_VIEWS_CONTROLS_TREE_TREE_VIEW_VIEWS_H_ |
| OLD | NEW |