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 |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 287 void PaintExpandControl(gfx::Canvas* canvas, | 287 void PaintExpandControl(gfx::Canvas* canvas, |
| 288 const gfx::Rect& node_bounds, | 288 const gfx::Rect& node_bounds, |
| 289 bool expanded); | 289 bool expanded); |
| 290 | 290 |
| 291 // Returns the InternalNode for a model node. |create_type| indicates wheter | 291 // Returns the InternalNode for a model node. |create_type| indicates wheter |
| 292 // this should load InternalNode or not. | 292 // this should load InternalNode or not. |
| 293 InternalNode* GetInternalNodeForModelNode( | 293 InternalNode* GetInternalNodeForModelNode( |
| 294 ui::TreeModelNode* model_node, | 294 ui::TreeModelNode* model_node, |
| 295 GetInternalNodeCreateType create_type); | 295 GetInternalNodeCreateType create_type); |
| 296 | 296 |
| 297 // Returns the bounds for a node. | 297 // Returns the bounds for a node's background. |
| 298 gfx::Rect GetBoundsForNode(InternalNode* node); | 298 gfx::Rect GetBackgroundBoundsForNode(InternalNode* node); |
| 299 | 299 |
| 300 // Implementation of GetBoundsForNode. Separated out as some callers already | 300 // Return the bounds for a node's foreground, which is the part containing the |
| 301 // know the row/depth. | 301 // expand/collapse symbol (if any), the icon (if any), and the text label. |
| 302 gfx::Rect GetBoundsForNodeImpl(InternalNode* node, int row, int depth); | 302 gfx::Rect GetForegroundBoundsForNode(InternalNode* node); |
| 303 | |
| 304 // Returns the bounds for a node's text label. | |
| 305 gfx::Rect GetTextBoundsForNode(InternalNode* node); | |
| 306 | |
| 307 // Implementation of GetTextBoundsForNode. Separated out as some callers | |
| 308 // already know the row/depth. | |
| 309 gfx::Rect GetForegroundBoundsForNodeImpl(InternalNode* node, | |
| 310 int row, | |
| 311 int depth); | |
| 303 | 312 |
| 304 // Returns the row and depth of a node. | 313 // Returns the row and depth of a node. |
| 305 int GetRowForInternalNode(InternalNode* node, int* depth); | 314 int GetRowForInternalNode(InternalNode* node, int* depth); |
| 306 | 315 |
| 307 // Returns the row and depth of the specified node. | 316 // Returns the row and depth of the specified node. |
| 308 InternalNode* GetNodeByRow(int row, int* depth); | 317 InternalNode* GetNodeByRow(int row, int* depth); |
| 309 | 318 |
| 310 // Implementation of GetNodeByRow. |curent_row| is updated as we iterate. | 319 // Implementation of GetNodeByRow. |curent_row| is updated as we iterate. |
| 311 InternalNode* GetNodeByRowImpl(InternalNode* node, | 320 InternalNode* GetNodeByRowImpl(InternalNode* node, |
| 312 int target_row, | 321 int target_row, |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 324 // If the selected node is collapsed, it's expanded. Otherwise the first child | 333 // If the selected node is collapsed, it's expanded. Otherwise the first child |
| 325 // is seleected. | 334 // is seleected. |
| 326 void ExpandOrSelectChild(); | 335 void ExpandOrSelectChild(); |
| 327 | 336 |
| 328 // Implementation of Expand(). Returns true if at least one node was expanded | 337 // Implementation of Expand(). Returns true if at least one node was expanded |
| 329 // that previously wasn't. | 338 // that previously wasn't. |
| 330 bool ExpandImpl(ui::TreeModelNode* model_node); | 339 bool ExpandImpl(ui::TreeModelNode* model_node); |
| 331 | 340 |
| 332 PrefixSelector* GetPrefixSelector(); | 341 PrefixSelector* GetPrefixSelector(); |
| 333 | 342 |
| 343 // Returns the InternalNode (if any) lying under |point|. If no node lies | |
| 344 // under |point|, this function returns nullptr. | |
| 345 InternalNode* NodeAtPoint(const gfx::Point& point); | |
|
sky
2016/06/16 17:34:39
GetNodeAtPoint and put above GetNodeByRow. Also ma
Elly Fong-Jones
2016/06/23 19:47:13
Done.
| |
| 346 | |
| 347 // Returns whether |point| is in the bounds of |node|'s expand/collapse arrow. | |
| 348 bool HitsNodeArrow(InternalNode* node, const gfx::Point& point); | |
|
sky
2016/06/16 17:34:39
nit: arrow refers to a specific rendering and isn'
Elly Fong-Jones
2016/06/23 19:47:13
Done.
| |
| 349 | |
| 334 // The model, may be null. | 350 // The model, may be null. |
| 335 ui::TreeModel* model_; | 351 ui::TreeModel* model_; |
| 336 | 352 |
| 337 // Default icons for closed/open. | 353 // Default icons for closed/open. |
| 338 gfx::ImageSkia closed_icon_; | 354 gfx::ImageSkia closed_icon_; |
| 339 gfx::ImageSkia open_icon_; | 355 gfx::ImageSkia open_icon_; |
| 340 | 356 |
| 341 // Icons from the model. | 357 // Icons from the model. |
| 342 std::vector<gfx::ImageSkia> icons_; | 358 std::vector<gfx::ImageSkia> icons_; |
| 343 | 359 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 387 int text_offset_; | 403 int text_offset_; |
| 388 | 404 |
| 389 std::unique_ptr<PrefixSelector> selector_; | 405 std::unique_ptr<PrefixSelector> selector_; |
| 390 | 406 |
| 391 DISALLOW_COPY_AND_ASSIGN(TreeView); | 407 DISALLOW_COPY_AND_ASSIGN(TreeView); |
| 392 }; | 408 }; |
| 393 | 409 |
| 394 } // namespace views | 410 } // namespace views |
| 395 | 411 |
| 396 #endif // UI_VIEWS_CONTROLS_TREE_TREE_VIEW_VIEWS_H_ | 412 #endif // UI_VIEWS_CONTROLS_TREE_TREE_VIEW_VIEWS_H_ |
| OLD | NEW |