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

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

Issue 3165064: Move the keyboard files from base/ to app/. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: latest merge Created 10 years, 4 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 | « 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"
14 #include "app/tree_model.h" 15 #include "app/tree_model.h"
15 #include "base/basictypes.h" 16 #include "base/basictypes.h"
16 #include "base/keyboard_codes.h"
17 #include "base/logging.h" 17 #include "base/logging.h"
18 #include "views/controls/native_control.h" 18 #include "views/controls/native_control.h"
19 19
20 namespace views { 20 namespace views {
21 21
22 class TreeView; 22 class TreeView;
23 23
24 // TreeViewController --------------------------------------------------------- 24 // TreeViewController ---------------------------------------------------------
25 25
26 // Controller for the treeview. 26 // Controller for the treeview.
27 class TreeViewController { 27 class TreeViewController {
28 public: 28 public:
29 // Notification that the selection of the tree view has changed. Use 29 // Notification that the selection of the tree view has changed. Use
30 // GetSelectedNode to find the current selection. 30 // GetSelectedNode to find the current selection.
31 virtual void OnTreeViewSelectionChanged(TreeView* tree_view) = 0; 31 virtual void OnTreeViewSelectionChanged(TreeView* tree_view) = 0;
32 32
33 // Returns true if the node can be edited. This is only used if the 33 // Returns true if the node can be edited. This is only used if the
34 // TreeView is editable. 34 // TreeView is editable.
35 virtual bool CanEdit(TreeView* tree_view, TreeModelNode* node) { 35 virtual bool CanEdit(TreeView* tree_view, TreeModelNode* node) {
36 return true; 36 return true;
37 } 37 }
38 38
39 // Invoked when a key is pressed on the tree view. 39 // Invoked when a key is pressed on the tree view.
40 virtual void OnTreeViewKeyDown(base::KeyboardCode keycode) {} 40 virtual void OnTreeViewKeyDown(app::KeyboardCode keycode) {}
41 }; 41 };
42 42
43 // TreeView ------------------------------------------------------------------- 43 // TreeView -------------------------------------------------------------------
44 44
45 // TreeView displays hierarchical data as returned from a TreeModel. The user 45 // TreeView displays hierarchical data as returned from a TreeModel. The user
46 // can expand, collapse and edit the items. A Controller may be attached to 46 // can expand, collapse and edit the items. A Controller may be attached to
47 // receive notification of selection changes and restrict editing. 47 // receive notification of selection changes and restrict editing.
48 class TreeView : public NativeControl, TreeModelObserver { 48 class TreeView : public NativeControl, TreeModelObserver {
49 public: 49 public:
50 TreeView(); 50 TreeView();
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 // Creates and configures the tree_view. 175 // Creates and configures the tree_view.
176 virtual HWND CreateNativeControl(HWND parent_container); 176 virtual HWND CreateNativeControl(HWND parent_container);
177 177
178 // Invoked when the native control sends a WM_NOTIFY message to its parent. 178 // Invoked when the native control sends a WM_NOTIFY message to its parent.
179 // Handles a variety of potential TreeView messages. 179 // Handles a variety of potential TreeView messages.
180 virtual LRESULT OnNotify(int w_param, LPNMHDR l_param); 180 virtual LRESULT OnNotify(int w_param, LPNMHDR l_param);
181 181
182 // We pay attention to key down for two reasons: to circumvent VK_ENTER from 182 // We pay attention to key down for two reasons: to circumvent VK_ENTER from
183 // toggling the expaned state when processes_enter_ is false, and to have F2 183 // toggling the expaned state when processes_enter_ is false, and to have F2
184 // start editting. 184 // start editting.
185 virtual bool OnKeyDown(base::KeyboardCode virtual_key_code); 185 virtual bool OnKeyDown(app::KeyboardCode virtual_key_code);
186 186
187 virtual void OnContextMenu(const POINT& location); 187 virtual void OnContextMenu(const POINT& location);
188 188
189 // Returns the TreeModelNode for |tree_item|. 189 // Returns the TreeModelNode for |tree_item|.
190 TreeModelNode* GetNodeForTreeItem(HTREEITEM tree_item); 190 TreeModelNode* GetNodeForTreeItem(HTREEITEM tree_item);
191 191
192 // Returns the tree item for |node|. 192 // Returns the tree item for |node|.
193 HTREEITEM GetTreeItemForNode(TreeModelNode* node); 193 HTREEITEM GetTreeItemForNode(TreeModelNode* node);
194 194
195 private: 195 private:
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 bool has_custom_icons_; 327 bool has_custom_icons_;
328 328
329 HIMAGELIST image_list_; 329 HIMAGELIST image_list_;
330 330
331 DISALLOW_COPY_AND_ASSIGN(TreeView); 331 DISALLOW_COPY_AND_ASSIGN(TreeView);
332 }; 332 };
333 333
334 } // namespace views 334 } // namespace views
335 335
336 #endif // VIEWS_CONTROLS_TREE_TREE_VIEW_H_ 336 #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