| 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 <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 // receive notification of selection changes and restrict editing. | 29 // receive notification of selection changes and restrict editing. |
| 30 // | 30 // |
| 31 // Note on implementation. This implementation doesn't scale well. In particular | 31 // Note on implementation. This implementation doesn't scale well. In particular |
| 32 // it does not store any row information, but instead calculates it as | 32 // it does not store any row information, but instead calculates it as |
| 33 // necessary. But it's more than adequate for current uses. | 33 // necessary. But it's more than adequate for current uses. |
| 34 class VIEWS_EXPORT TreeView : public ui::TreeModelObserver, | 34 class VIEWS_EXPORT TreeView : public ui::TreeModelObserver, |
| 35 public TextfieldController, | 35 public TextfieldController, |
| 36 public FocusChangeListener, | 36 public FocusChangeListener, |
| 37 public PrefixDelegate { | 37 public PrefixDelegate { |
| 38 public: | 38 public: |
| 39 // The tree view's class name. |
| 40 static const char kViewClassName[]; |
| 41 |
| 39 TreeView(); | 42 TreeView(); |
| 40 virtual ~TreeView(); | 43 virtual ~TreeView(); |
| 41 | 44 |
| 42 // Returns new ScrollPane that contains the receiver. | 45 // Returns new ScrollPane that contains the receiver. |
| 43 View* CreateParentIfNecessary(); | 46 View* CreateParentIfNecessary(); |
| 44 | 47 |
| 45 // Sets the model. TreeView does not take ownership of the model. | 48 // Sets the model. TreeView does not take ownership of the model. |
| 46 void SetModel(ui::TreeModel* model); | 49 void SetModel(ui::TreeModel* model); |
| 47 ui::TreeModel* model() const { return model_; } | 50 ui::TreeModel* model() const { return model_; } |
| 48 | 51 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 // View overrides: | 118 // View overrides: |
| 116 virtual void Layout() OVERRIDE; | 119 virtual void Layout() OVERRIDE; |
| 117 virtual gfx::Size GetPreferredSize() OVERRIDE; | 120 virtual gfx::Size GetPreferredSize() OVERRIDE; |
| 118 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE; | 121 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE; |
| 119 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; | 122 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; |
| 120 virtual ui::TextInputClient* GetTextInputClient() OVERRIDE; | 123 virtual ui::TextInputClient* GetTextInputClient() OVERRIDE; |
| 121 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; | 124 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; |
| 122 virtual void ShowContextMenu(const gfx::Point& p, | 125 virtual void ShowContextMenu(const gfx::Point& p, |
| 123 ui::MenuSourceType source_type) OVERRIDE; | 126 ui::MenuSourceType source_type) OVERRIDE; |
| 124 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; | 127 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; |
| 128 virtual const char* GetClassName() const OVERRIDE; |
| 125 | 129 |
| 126 // TreeModelObserver overrides: | 130 // TreeModelObserver overrides: |
| 127 virtual void TreeNodesAdded(ui::TreeModel* model, | 131 virtual void TreeNodesAdded(ui::TreeModel* model, |
| 128 ui::TreeModelNode* parent, | 132 ui::TreeModelNode* parent, |
| 129 int start, | 133 int start, |
| 130 int count) OVERRIDE; | 134 int count) OVERRIDE; |
| 131 virtual void TreeNodesRemoved(ui::TreeModel* model, | 135 virtual void TreeNodesRemoved(ui::TreeModel* model, |
| 132 ui::TreeModelNode* parent, | 136 ui::TreeModelNode* parent, |
| 133 int start, | 137 int start, |
| 134 int count) OVERRIDE; | 138 int count) OVERRIDE; |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 int text_offset_; | 387 int text_offset_; |
| 384 | 388 |
| 385 scoped_ptr<PrefixSelector> selector_; | 389 scoped_ptr<PrefixSelector> selector_; |
| 386 | 390 |
| 387 DISALLOW_COPY_AND_ASSIGN(TreeView); | 391 DISALLOW_COPY_AND_ASSIGN(TreeView); |
| 388 }; | 392 }; |
| 389 | 393 |
| 390 } // namespace views | 394 } // namespace views |
| 391 | 395 |
| 392 #endif // UI_VIEWS_CONTROLS_TREE_TREE_VIEW_VIEWS_H_ | 396 #endif // UI_VIEWS_CONTROLS_TREE_TREE_VIEW_VIEWS_H_ |
| OLD | NEW |