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

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

Issue 3337006: Revert 58388 - Revert 58215 - Revert 58186 - Move the keyboard files from bas... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 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 | Annotate | Revision Log
« no previous file with comments | « views/controls/textfield/textfield.cc ('k') | 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 VIEWS_CONTROLS_TREE_TREE_VIEW_H_ 5 #ifndef VIEWS_CONTROLS_TREE_TREE_VIEW_H_
6 #define VIEWS_CONTROLS_TREE_TREE_VIEW_H_ 6 #define VIEWS_CONTROLS_TREE_TREE_VIEW_H_
7 #pragma once 7 #pragma once
8 8
9 #include <windows.h> 9 #include <windows.h>
10 #include <commctrl.h> 10 #include <commctrl.h>
11 11
12 #include <map> 12 #include <map>
13 13
14 #include "app/keyboard_codes.h"
15 #include "app/tree_model.h" 14 #include "app/tree_model.h"
16 #include "base/basictypes.h" 15 #include "base/basictypes.h"
16 #include "base/keyboard_codes.h"
17 #include "views/controls/native_control.h" 17 #include "views/controls/native_control.h"
18 18
19 namespace views { 19 namespace views {
20 20
21 class TreeView; 21 class TreeView;
22 22
23 // TreeViewController --------------------------------------------------------- 23 // TreeViewController ---------------------------------------------------------
24 24
25 // Controller for the treeview. 25 // Controller for the treeview.
26 class TreeViewController { 26 class TreeViewController {
27 public: 27 public:
28 // Notification that the selection of the tree view has changed. Use 28 // Notification that the selection of the tree view has changed. Use
29 // GetSelectedNode to find the current selection. 29 // GetSelectedNode to find the current selection.
30 virtual void OnTreeViewSelectionChanged(TreeView* tree_view) = 0; 30 virtual void OnTreeViewSelectionChanged(TreeView* tree_view) = 0;
31 31
32 // Returns true if the node can be edited. This is only used if the 32 // Returns true if the node can be edited. This is only used if the
33 // TreeView is editable. 33 // TreeView is editable.
34 virtual bool CanEdit(TreeView* tree_view, TreeModelNode* node) { 34 virtual bool CanEdit(TreeView* tree_view, TreeModelNode* node) {
35 return true; 35 return true;
36 } 36 }
37 37
38 // Invoked when a key is pressed on the tree view. 38 // Invoked when a key is pressed on the tree view.
39 virtual void OnTreeViewKeyDown(app::KeyboardCode keycode) {} 39 virtual void OnTreeViewKeyDown(base::KeyboardCode keycode) {}
40 }; 40 };
41 41
42 // TreeView ------------------------------------------------------------------- 42 // TreeView -------------------------------------------------------------------
43 43
44 // TreeView displays hierarchical data as returned from a TreeModel. The user 44 // TreeView displays hierarchical data as returned from a TreeModel. The user
45 // can expand, collapse and edit the items. A Controller may be attached to 45 // can expand, collapse and edit the items. A Controller may be attached to
46 // receive notification of selection changes and restrict editing. 46 // receive notification of selection changes and restrict editing.
47 class TreeView : public NativeControl, TreeModelObserver { 47 class TreeView : public NativeControl, TreeModelObserver {
48 public: 48 public:
49 TreeView(); 49 TreeView();
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 // Creates and configures the tree_view. 174 // Creates and configures the tree_view.
175 virtual HWND CreateNativeControl(HWND parent_container); 175 virtual HWND CreateNativeControl(HWND parent_container);
176 176
177 // Invoked when the native control sends a WM_NOTIFY message to its parent. 177 // Invoked when the native control sends a WM_NOTIFY message to its parent.
178 // Handles a variety of potential TreeView messages. 178 // Handles a variety of potential TreeView messages.
179 virtual LRESULT OnNotify(int w_param, LPNMHDR l_param); 179 virtual LRESULT OnNotify(int w_param, LPNMHDR l_param);
180 180
181 // We pay attention to key down for two reasons: to circumvent VK_ENTER from 181 // We pay attention to key down for two reasons: to circumvent VK_ENTER from
182 // toggling the expaned state when processes_enter_ is false, and to have F2 182 // toggling the expaned state when processes_enter_ is false, and to have F2
183 // start editting. 183 // start editting.
184 virtual bool OnKeyDown(app::KeyboardCode virtual_key_code); 184 virtual bool OnKeyDown(base::KeyboardCode virtual_key_code);
185 185
186 virtual void OnContextMenu(const POINT& location); 186 virtual void OnContextMenu(const POINT& location);
187 187
188 // Returns the TreeModelNode for |tree_item|. 188 // Returns the TreeModelNode for |tree_item|.
189 TreeModelNode* GetNodeForTreeItem(HTREEITEM tree_item); 189 TreeModelNode* GetNodeForTreeItem(HTREEITEM tree_item);
190 190
191 // Returns the tree item for |node|. 191 // Returns the tree item for |node|.
192 HTREEITEM GetTreeItemForNode(TreeModelNode* node); 192 HTREEITEM GetTreeItemForNode(TreeModelNode* node);
193 193
194 private: 194 private:
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 bool has_custom_icons_; 319 bool has_custom_icons_;
320 320
321 HIMAGELIST image_list_; 321 HIMAGELIST image_list_;
322 322
323 DISALLOW_COPY_AND_ASSIGN(TreeView); 323 DISALLOW_COPY_AND_ASSIGN(TreeView);
324 }; 324 };
325 325
326 } // namespace views 326 } // namespace views
327 327
328 #endif // VIEWS_CONTROLS_TREE_TREE_VIEW_H_ 328 #endif // VIEWS_CONTROLS_TREE_TREE_VIEW_H_
OLDNEW
« no previous file with comments | « views/controls/textfield/textfield.cc ('k') | views/controls/tree/tree_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698