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

Side by Side Diff: ui/views/controls/menu/submenu_view.h

Issue 683563002: Standardize usage of virtual/override/final specifiers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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 | « ui/views/controls/menu/menu_separator.h ('k') | no next file » | 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_MENU_SUBMENU_VIEW_H_ 5 #ifndef UI_VIEWS_CONTROLS_MENU_SUBMENU_VIEW_H_
6 #define UI_VIEWS_CONTROLS_MENU_SUBMENU_VIEW_H_ 6 #define UI_VIEWS_CONTROLS_MENU_SUBMENU_VIEW_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 25 matching lines...) Expand all
36 // screen allows. If the SubmenuView is taller than the screen, scroll buttons 36 // screen allows. If the SubmenuView is taller than the screen, scroll buttons
37 // are provided that allow the user to see all the menu items. 37 // are provided that allow the user to see all the menu items.
38 class VIEWS_EXPORT SubmenuView : public PrefixDelegate, 38 class VIEWS_EXPORT SubmenuView : public PrefixDelegate,
39 public ScrollDelegate { 39 public ScrollDelegate {
40 public: 40 public:
41 // The submenu's class name. 41 // The submenu's class name.
42 static const char kViewClassName[]; 42 static const char kViewClassName[];
43 43
44 // Creates a SubmenuView for the specified menu item. 44 // Creates a SubmenuView for the specified menu item.
45 explicit SubmenuView(MenuItemView* parent); 45 explicit SubmenuView(MenuItemView* parent);
46 virtual ~SubmenuView(); 46 ~SubmenuView() override;
47 47
48 // Returns the number of child views that are MenuItemViews. 48 // Returns the number of child views that are MenuItemViews.
49 // MenuItemViews are identified by ID. 49 // MenuItemViews are identified by ID.
50 int GetMenuItemCount(); 50 int GetMenuItemCount();
51 51
52 // Returns the MenuItemView at the specified index. 52 // Returns the MenuItemView at the specified index.
53 MenuItemView* GetMenuItemAt(int index); 53 MenuItemView* GetMenuItemAt(int index);
54 54
55 // Positions and sizes the child views. This tiles the views vertically, 55 // Positions and sizes the child views. This tiles the views vertically,
56 // giving each child the available width. 56 // giving each child the available width.
57 virtual void Layout() override; 57 void Layout() override;
58 virtual gfx::Size GetPreferredSize() const override; 58 gfx::Size GetPreferredSize() const override;
59 59
60 // Override from View. 60 // Override from View.
61 virtual void GetAccessibleState(ui::AXViewState* state) override; 61 void GetAccessibleState(ui::AXViewState* state) override;
62 virtual ui::TextInputClient* GetTextInputClient() override; 62 ui::TextInputClient* GetTextInputClient() override;
63 63
64 // Painting. 64 // Painting.
65 virtual void PaintChildren(gfx::Canvas* canvas, 65 void PaintChildren(gfx::Canvas* canvas,
66 const views::CullSet& cull_view) override; 66 const views::CullSet& cull_view) override;
67 67
68 // Drag and drop methods. These are forwarded to the MenuController. 68 // Drag and drop methods. These are forwarded to the MenuController.
69 virtual bool GetDropFormats( 69 bool GetDropFormats(
70 int* formats, 70 int* formats,
71 std::set<OSExchangeData::CustomFormat>* custom_formats) override; 71 std::set<OSExchangeData::CustomFormat>* custom_formats) override;
72 virtual bool AreDropTypesRequired() override; 72 bool AreDropTypesRequired() override;
73 virtual bool CanDrop(const OSExchangeData& data) override; 73 bool CanDrop(const OSExchangeData& data) override;
74 virtual void OnDragEntered(const ui::DropTargetEvent& event) override; 74 void OnDragEntered(const ui::DropTargetEvent& event) override;
75 virtual int OnDragUpdated(const ui::DropTargetEvent& event) override; 75 int OnDragUpdated(const ui::DropTargetEvent& event) override;
76 virtual void OnDragExited() override; 76 void OnDragExited() override;
77 virtual int OnPerformDrop(const ui::DropTargetEvent& event) override; 77 int OnPerformDrop(const ui::DropTargetEvent& event) override;
78 78
79 // Scrolls on menu item boundaries. 79 // Scrolls on menu item boundaries.
80 virtual bool OnMouseWheel(const ui::MouseWheelEvent& e) override; 80 bool OnMouseWheel(const ui::MouseWheelEvent& e) override;
81 81
82 // Overridden from ui::EventHandler. 82 // Overridden from ui::EventHandler.
83 // Scrolls on menu item boundaries. 83 // Scrolls on menu item boundaries.
84 virtual void OnGestureEvent(ui::GestureEvent* event) override; 84 void OnGestureEvent(ui::GestureEvent* event) override;
85 85
86 // Overridden from PrefixDelegate. 86 // Overridden from PrefixDelegate.
87 virtual int GetRowCount() override; 87 int GetRowCount() override;
88 virtual int GetSelectedRow() override; 88 int GetSelectedRow() override;
89 virtual void SetSelectedRow(int row) override; 89 void SetSelectedRow(int row) override;
90 virtual base::string16 GetTextForRow(int row) override; 90 base::string16 GetTextForRow(int row) override;
91 91
92 // Returns true if the menu is showing. 92 // Returns true if the menu is showing.
93 bool IsShowing(); 93 bool IsShowing();
94 94
95 // Shows the menu at the specified location. Coordinates are in screen 95 // Shows the menu at the specified location. Coordinates are in screen
96 // coordinates. max_width gives the max width the view should be. 96 // coordinates. max_width gives the max width the view should be.
97 void ShowAt(Widget* parent, const gfx::Rect& bounds, bool do_capture); 97 void ShowAt(Widget* parent, const gfx::Rect& bounds, bool do_capture);
98 98
99 // Resets the bounds of the submenu to |bounds|. 99 // Resets the bounds of the submenu to |bounds|.
100 void Reposition(const gfx::Rect& bounds); 100 void Reposition(const gfx::Rect& bounds);
(...skipping 10 matching lines...) Expand all
111 // being processed by the host, so that host is on the stack when we need to 111 // being processed by the host, so that host is on the stack when we need to
112 // close the window. If we closed the window immediately (and deleted it), 112 // close the window. If we closed the window immediately (and deleted it),
113 // when control returned back to host we would crash as host was deleted. 113 // when control returned back to host we would crash as host was deleted.
114 void Hide(); 114 void Hide();
115 115
116 // If mouse capture was grabbed, it is released. Does nothing if mouse was 116 // If mouse capture was grabbed, it is released. Does nothing if mouse was
117 // not captured. 117 // not captured.
118 void ReleaseCapture(); 118 void ReleaseCapture();
119 119
120 // Overriden from View to prevent tab from doing anything. 120 // Overriden from View to prevent tab from doing anything.
121 virtual bool SkipDefaultKeyEventProcessing(const ui::KeyEvent& e) override; 121 bool SkipDefaultKeyEventProcessing(const ui::KeyEvent& e) override;
122 122
123 // Returns the parent menu item we're showing children for. 123 // Returns the parent menu item we're showing children for.
124 MenuItemView* GetMenuItem() const; 124 MenuItemView* GetMenuItem() const;
125 125
126 // Set the drop item and position. 126 // Set the drop item and position.
127 void SetDropMenuItem(MenuItemView* item, 127 void SetDropMenuItem(MenuItemView* item,
128 MenuDelegate::DropPosition position); 128 MenuDelegate::DropPosition position);
129 129
130 // Returns whether the selection should be shown for the specified item. 130 // Returns whether the selection should be shown for the specified item.
131 // The selection is NOT shown during drag and drop when the drop is over 131 // The selection is NOT shown during drag and drop when the drop is over
(...skipping 19 matching lines...) Expand all
151 } 151 }
152 152
153 // Automatically resize menu if a subview's preferred size changes. 153 // Automatically resize menu if a subview's preferred size changes.
154 bool resize_open_menu() const { return resize_open_menu_; } 154 bool resize_open_menu() const { return resize_open_menu_; }
155 void set_resize_open_menu(bool resize_open_menu) { 155 void set_resize_open_menu(bool resize_open_menu) {
156 resize_open_menu_ = resize_open_menu; 156 resize_open_menu_ = resize_open_menu;
157 } 157 }
158 158
159 protected: 159 protected:
160 // Overridden from View: 160 // Overridden from View:
161 virtual const char* GetClassName() const override; 161 const char* GetClassName() const override;
162 162
163 // View method. Overridden to schedule a paint. We do this so that when 163 // View method. Overridden to schedule a paint. We do this so that when
164 // scrolling occurs, everything is repainted correctly. 164 // scrolling occurs, everything is repainted correctly.
165 virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) override; 165 void OnBoundsChanged(const gfx::Rect& previous_bounds) override;
166 166
167 virtual void ChildPreferredSizeChanged(View* child) override; 167 void ChildPreferredSizeChanged(View* child) override;
168 168
169 private: 169 private:
170 // Paints the drop indicator. This is only invoked if item is non-NULL and 170 // Paints the drop indicator. This is only invoked if item is non-NULL and
171 // position is not DROP_NONE. 171 // position is not DROP_NONE.
172 void PaintDropIndicator(gfx::Canvas* canvas, 172 void PaintDropIndicator(gfx::Canvas* canvas,
173 MenuItemView* item, 173 MenuItemView* item,
174 MenuDelegate::DropPosition position); 174 MenuDelegate::DropPosition position);
175 175
176 void SchedulePaintForDropIndicator(MenuItemView* item, 176 void SchedulePaintForDropIndicator(MenuItemView* item,
177 MenuDelegate::DropPosition position); 177 MenuDelegate::DropPosition position);
178 178
179 // Calculates the location of th edrop indicator. 179 // Calculates the location of th edrop indicator.
180 gfx::Rect CalculateDropIndicatorBounds(MenuItemView* item, 180 gfx::Rect CalculateDropIndicatorBounds(MenuItemView* item,
181 MenuDelegate::DropPosition position); 181 MenuDelegate::DropPosition position);
182 182
183 // Implementation of ScrollDelegate 183 // Implementation of ScrollDelegate
184 virtual bool OnScroll(float dx, float dy) override; 184 bool OnScroll(float dx, float dy) override;
185 185
186 // Parent menu item. 186 // Parent menu item.
187 MenuItemView* parent_menu_item_; 187 MenuItemView* parent_menu_item_;
188 188
189 // Widget subclass used to show the children. This is deleted when we invoke 189 // Widget subclass used to show the children. This is deleted when we invoke
190 // |DestroyMenuHost|, or |MenuHostDestroyed| is invoked back on us. 190 // |DestroyMenuHost|, or |MenuHostDestroyed| is invoked back on us.
191 MenuHost* host_; 191 MenuHost* host_;
192 192
193 // If non-null, indicates a drop is in progress and drop_item is the item 193 // If non-null, indicates a drop is in progress and drop_item is the item
194 // the drop is over. 194 // the drop is over.
(...skipping 24 matching lines...) Expand all
219 float roundoff_error_; 219 float roundoff_error_;
220 220
221 PrefixSelector prefix_selector_; 221 PrefixSelector prefix_selector_;
222 222
223 DISALLOW_COPY_AND_ASSIGN(SubmenuView); 223 DISALLOW_COPY_AND_ASSIGN(SubmenuView);
224 }; 224 };
225 225
226 } // namespace views 226 } // namespace views
227 227
228 #endif // UI_VIEWS_CONTROLS_MENU_SUBMENU_VIEW_H_ 228 #endif // UI_VIEWS_CONTROLS_MENU_SUBMENU_VIEW_H_
OLDNEW
« no previous file with comments | « ui/views/controls/menu/menu_separator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698