Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(357)

Side by Side Diff: ui/views/controls/tree/tree_view.h

Issue 2050813002: MacViews: support backgrounds for selected rows (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: placate msvc Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | ui/views/controls/tree/tree_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
316 // Returns the InternalNode (if any) whose foreground bounds contain |point|.
317 // If no node's foreground contains |point|, this function returns nullptr.
318 InternalNode* GetNodeAtPoint(const gfx::Point& point);
319
307 // Returns the row and depth of the specified node. 320 // Returns the row and depth of the specified node.
308 InternalNode* GetNodeByRow(int row, int* depth); 321 InternalNode* GetNodeByRow(int row, int* depth);
309 322
310 // Implementation of GetNodeByRow. |curent_row| is updated as we iterate. 323 // Implementation of GetNodeByRow. |curent_row| is updated as we iterate.
311 InternalNode* GetNodeByRowImpl(InternalNode* node, 324 InternalNode* GetNodeByRowImpl(InternalNode* node,
312 int target_row, 325 int target_row,
313 int current_depth, 326 int current_depth,
314 int* current_row, 327 int* current_row,
315 int* node_depth); 328 int* node_depth);
316 329
317 // Increments the selection. Invoked in response to up/down arrow. 330 // Increments the selection. Invoked in response to up/down arrow.
318 void IncrementSelection(IncrementType type); 331 void IncrementSelection(IncrementType type);
319 332
320 // If the current node is expanded, it's collapsed, otherwise selection is 333 // If the current node is expanded, it's collapsed, otherwise selection is
321 // moved to the parent. 334 // moved to the parent.
322 void CollapseOrSelectParent(); 335 void CollapseOrSelectParent();
323 336
324 // If the selected node is collapsed, it's expanded. Otherwise the first child 337 // If the selected node is collapsed, it's expanded. Otherwise the first child
325 // is seleected. 338 // is seleected.
326 void ExpandOrSelectChild(); 339 void ExpandOrSelectChild();
327 340
328 // Implementation of Expand(). Returns true if at least one node was expanded 341 // Implementation of Expand(). Returns true if at least one node was expanded
329 // that previously wasn't. 342 // that previously wasn't.
330 bool ExpandImpl(ui::TreeModelNode* model_node); 343 bool ExpandImpl(ui::TreeModelNode* model_node);
331 344
332 PrefixSelector* GetPrefixSelector(); 345 PrefixSelector* GetPrefixSelector();
333 346
347 // Returns whether |point| is in the bounds of |node|'s expand/collapse
348 // control.
349 bool IsPointInExpandControl(InternalNode* node, const gfx::Point& point);
350
334 // The model, may be null. 351 // The model, may be null.
335 ui::TreeModel* model_; 352 ui::TreeModel* model_;
336 353
337 // Default icons for closed/open. 354 // Default icons for closed/open.
338 gfx::ImageSkia closed_icon_; 355 gfx::ImageSkia closed_icon_;
339 gfx::ImageSkia open_icon_; 356 gfx::ImageSkia open_icon_;
340 357
341 // Icons from the model. 358 // Icons from the model.
342 std::vector<gfx::ImageSkia> icons_; 359 std::vector<gfx::ImageSkia> icons_;
343 360
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 int text_offset_; 404 int text_offset_;
388 405
389 std::unique_ptr<PrefixSelector> selector_; 406 std::unique_ptr<PrefixSelector> selector_;
390 407
391 DISALLOW_COPY_AND_ASSIGN(TreeView); 408 DISALLOW_COPY_AND_ASSIGN(TreeView);
392 }; 409 };
393 410
394 } // namespace views 411 } // namespace views
395 412
396 #endif // UI_VIEWS_CONTROLS_TREE_TREE_VIEW_VIEWS_H_ 413 #endif // UI_VIEWS_CONTROLS_TREE_TREE_VIEW_VIEWS_H_
OLDNEW
« no previous file with comments | « no previous file | ui/views/controls/tree/tree_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698