| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 // FocusChangeListener overrides: | 134 // FocusChangeListener overrides: |
| 135 virtual void OnWillChangeFocus(View* focused_before, | 135 virtual void OnWillChangeFocus(View* focused_before, |
| 136 View* focused_now) OVERRIDE; | 136 View* focused_now) OVERRIDE; |
| 137 virtual void OnDidChangeFocus(View* focused_before, | 137 virtual void OnDidChangeFocus(View* focused_before, |
| 138 View* focused_now) OVERRIDE; | 138 View* focused_now) OVERRIDE; |
| 139 | 139 |
| 140 protected: | 140 protected: |
| 141 // View overrides: | 141 // View overrides: |
| 142 virtual gfx::Point GetKeyboardContextMenuLocation() OVERRIDE; | 142 virtual gfx::Point GetKeyboardContextMenuLocation() OVERRIDE; |
| 143 virtual bool OnKeyPressed(const KeyEvent& event) OVERRIDE; | 143 virtual bool OnKeyPressed(const KeyEvent& event) OVERRIDE; |
| 144 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; | 144 virtual void OnPaint(gfx::CanvasSkia* canvas) OVERRIDE; |
| 145 virtual void OnFocus() OVERRIDE; | 145 virtual void OnFocus() OVERRIDE; |
| 146 virtual void OnBlur() OVERRIDE; | 146 virtual void OnBlur() OVERRIDE; |
| 147 | 147 |
| 148 private: | 148 private: |
| 149 friend class TreeViewViewsTest; | 149 friend class TreeViewViewsTest; |
| 150 | 150 |
| 151 // InternalNode is used to track information about the set of nodes displayed | 151 // InternalNode is used to track information about the set of nodes displayed |
| 152 // by TreeViewViews. | 152 // by TreeViewViews. |
| 153 class InternalNode : public ui::TreeNode<InternalNode> { | 153 class InternalNode : public ui::TreeNode<InternalNode> { |
| 154 public: | 154 public: |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 | 238 |
| 239 // Positions |editor_|. | 239 // Positions |editor_|. |
| 240 void LayoutEditor(); | 240 void LayoutEditor(); |
| 241 | 241 |
| 242 // Schedules a paint for |node|. | 242 // Schedules a paint for |node|. |
| 243 void SchedulePaintForNode(InternalNode* node); | 243 void SchedulePaintForNode(InternalNode* node); |
| 244 | 244 |
| 245 // Recursively paints rows from |min_row| to |max_row|. |node| is the node for | 245 // Recursively paints rows from |min_row| to |max_row|. |node| is the node for |
| 246 // the row |*row|. |row| is updated as this walks the tree. Depth is the depth | 246 // the row |*row|. |row| is updated as this walks the tree. Depth is the depth |
| 247 // of |*row|. | 247 // of |*row|. |
| 248 void PaintRows(gfx::Canvas* canvas, | 248 void PaintRows(gfx::CanvasSkia* canvas, |
| 249 int min_row, | 249 int min_row, |
| 250 int max_row, | 250 int max_row, |
| 251 InternalNode* node, | 251 InternalNode* node, |
| 252 int depth, | 252 int depth, |
| 253 int* row); | 253 int* row); |
| 254 | 254 |
| 255 // Invoked to paint a single node. | 255 // Invoked to paint a single node. |
| 256 void PaintRow(gfx::Canvas* canvas, | 256 void PaintRow(gfx::CanvasSkia* canvas, |
| 257 InternalNode* node, | 257 InternalNode* node, |
| 258 int row, | 258 int row, |
| 259 int depth); | 259 int depth); |
| 260 | 260 |
| 261 // Paints the expand control given the specified nodes bounds. | 261 // Paints the expand control given the specified nodes bounds. |
| 262 void PaintExpandControl(gfx::Canvas* canvas, | 262 void PaintExpandControl(gfx::CanvasSkia* canvas, |
| 263 const gfx::Rect& node_bounds, | 263 const gfx::Rect& node_bounds, |
| 264 bool expanded); | 264 bool expanded); |
| 265 | 265 |
| 266 // Returns the InternalNode for a model node. |create_type| indicates wheter | 266 // Returns the InternalNode for a model node. |create_type| indicates wheter |
| 267 // this should load InternalNode or not. | 267 // this should load InternalNode or not. |
| 268 InternalNode* GetInternalNodeForModelNode( | 268 InternalNode* GetInternalNodeForModelNode( |
| 269 ui::TreeModelNode* model_node, | 269 ui::TreeModelNode* model_node, |
| 270 GetInternalNodeCreateType create_type); | 270 GetInternalNodeCreateType create_type); |
| 271 | 271 |
| 272 // Returns the bounds for a node. | 272 // Returns the bounds for a node. |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 // Offset the text is drawn at. This accounts for the size of the expand | 360 // Offset the text is drawn at. This accounts for the size of the expand |
| 361 // control, icon and offsets. | 361 // control, icon and offsets. |
| 362 int text_offset_; | 362 int text_offset_; |
| 363 | 363 |
| 364 DISALLOW_COPY_AND_ASSIGN(TreeView); | 364 DISALLOW_COPY_AND_ASSIGN(TreeView); |
| 365 }; | 365 }; |
| 366 | 366 |
| 367 } // namespace views | 367 } // namespace views |
| 368 | 368 |
| 369 #endif // UI_VIEWS_CONTROLS_TREE_TREE_VIEW_VIEWS_H_ | 369 #endif // UI_VIEWS_CONTROLS_TREE_TREE_VIEW_VIEWS_H_ |
| OLD | NEW |