diff options
author | sky@google.com <sky@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-24 22:58:08 +0000 |
---|---|---|
committer | sky@google.com <sky@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-24 22:58:08 +0000 |
commit | 62ca321dd5cd95b7e4fc9de922c2ca0703971361 (patch) | |
tree | ce782f196bd0933352bffae1130fd365a626ce25 /chrome/views/tree_view.h | |
parent | 9d6326fae66278988d0eb3f9d5b44e7d9f31870e (diff) | |
download | chromium_src-62ca321dd5cd95b7e4fc9de922c2ca0703971361.zip chromium_src-62ca321dd5cd95b7e4fc9de922c2ca0703971361.tar.gz chromium_src-62ca321dd5cd95b7e4fc9de922c2ca0703971361.tar.bz2 |
Handful of changes to NativeControl, TreeView and TableView I'm going
to need for the bookmark manager. Specifically:
. NativeController now delegates OnContextMenu to the
ContextMenuController.
. TableView allows a NULL model.
. TableView::SetColumns was buggy.
. Added a method that TableView invokes after painting.
. Added methods to TreeView for getting various state information.
BUG=674
TEST=make sure the various places in the UI we uses trees and table
work fine: cookies table, passwords table, task manager, bookmark
editor, search engines.
Review URL: http://codereview.chromium.org/8145
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@3956 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/views/tree_view.h')
-rw-r--r-- | chrome/views/tree_view.h | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/chrome/views/tree_view.h b/chrome/views/tree_view.h index 09d046a3..a219f52 100644 --- a/chrome/views/tree_view.h +++ b/chrome/views/tree_view.h @@ -95,13 +95,18 @@ class TreeViewController { // TreeView displays hierarchical data as returned from a TreeModel. The user // can expand, collapse and edit the items. A Controller may be attached to // receive notification of selection changes and restrict editing. -class TreeView : public NativeControl, public TreeModelObserver { +class TreeView : public NativeControl, TreeModelObserver { public: TreeView(); virtual ~TreeView(); + // Is dragging enabled? The default is false. + void set_drag_enabled(bool drag_enabled) { drag_enabled_ = drag_enabled; } + bool drag_enabled() const { return drag_enabled_; } + // Sets the model. TreeView does not take ownership of the model. void SetModel(TreeModel* model); + TreeModel* model() const { return model_; } // Sets whether the user can edit the nodes. The default is true. If true, // the Controller is queried to determine if a particular node can be edited. @@ -133,6 +138,9 @@ class TreeView : public NativeControl, public TreeModelObserver { // Convenience to expand ALL nodes in the tree. void ExpandAll(); + // Returns true if the specified node is expanded. + bool IsExpanded(TreeModelNode* node); + // Sets whether the root is shown. If true, the root node of the tree is // shown, if false only the children of the root are shown. The default is // true. @@ -200,6 +208,12 @@ class TreeView : public NativeControl, public TreeModelObserver { virtual void OnContextMenu(const CPoint& location); + // Returns the TreeModelNode for |tree_item|. + TreeModelNode* GetNodeForTreeItem(HTREEITEM tree_item); + + // Returns the tree item for |node|. + HTREEITEM GetTreeItemForNode(TreeModelNode* node); + private: // See notes in TableView::TableViewWrapper for why this is needed. struct TreeViewWrapper { @@ -319,10 +333,11 @@ class TreeView : public NativeControl, public TreeModelObserver { // Original handler installed on the TreeView. WNDPROC original_handler_; - DISALLOW_EVIL_CONSTRUCTORS(TreeView); + bool drag_enabled_; + + DISALLOW_COPY_AND_ASSIGN(TreeView); }; } // namespace views #endif // CHROME_VIEWS_TREE_VIEW_H__ - |