OLD | NEW |
---|---|
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_MENU_ITEM_VIEW_H_ | 5 #ifndef UI_VIEWS_CONTROLS_MENU_MENU_ITEM_VIEW_H_ |
6 #define UI_VIEWS_CONTROLS_MENU_MENU_ITEM_VIEW_H_ | 6 #define UI_VIEWS_CONTROLS_MENU_MENU_ITEM_VIEW_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
258 | 258 |
259 // Returns the command id of this item. | 259 // Returns the command id of this item. |
260 int GetCommand() const { return command_; } | 260 int GetCommand() const { return command_; } |
261 | 261 |
262 // Paints the menu item. | 262 // Paints the menu item. |
263 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; | 263 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; |
264 | 264 |
265 // Returns the preferred size of this item. | 265 // Returns the preferred size of this item. |
266 virtual gfx::Size GetPreferredSize() const OVERRIDE; | 266 virtual gfx::Size GetPreferredSize() const OVERRIDE; |
267 | 267 |
268 // Gets the preferred height for the given |width|. This is only different | |
269 // from GetPreferredSize().width() if the item has a child view with flexible | |
270 // dimensions. | |
271 virtual int GetHeightForWidth(int width) const OVERRIDE; | |
272 | |
268 // Return the preferred dimensions of the item in pixel. | 273 // Return the preferred dimensions of the item in pixel. |
269 const MenuItemDimensions& GetDimensions() const; | 274 const MenuItemDimensions& GetDimensions() const; |
270 | 275 |
271 // Returns the object responsible for controlling showing the menu. | 276 // Returns the object responsible for controlling showing the menu. |
272 MenuController* GetMenuController(); | 277 MenuController* GetMenuController(); |
273 const MenuController* GetMenuController() const; | 278 const MenuController* GetMenuController() const; |
274 | 279 |
275 // Returns the delegate. This returns the delegate of the root menu item. | 280 // Returns the delegate. This returns the delegate of the root menu item. |
276 MenuDelegate* GetDelegate(); | 281 MenuDelegate* GetDelegate(); |
277 const MenuDelegate* GetDelegate() const; | 282 const MenuDelegate* GetDelegate() const; |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
412 | 417 |
413 // Returns number of child views excluding icon_view. | 418 // Returns number of child views excluding icon_view. |
414 int NonIconChildViewsCount() const; | 419 int NonIconChildViewsCount() const; |
415 | 420 |
416 // Returns the max icon width; recurses over submenus. | 421 // Returns the max icon width; recurses over submenus. |
417 int GetMaxIconViewWidth() const; | 422 int GetMaxIconViewWidth() const; |
418 | 423 |
419 // Returns true if the menu has items with a checkbox or a radio button. | 424 // Returns true if the menu has items with a checkbox or a radio button. |
420 bool HasChecksOrRadioButtons() const; | 425 bool HasChecksOrRadioButtons() const; |
421 | 426 |
422 void invalidate_dimensions() { dimensions_.height = 0; } | 427 void invalidate_dimensions() const { dimensions_.height = 0; } |
sky
2014/09/12 20:09:37
This shouldn't be const. It's modifying a member.
Devlin
2014/09/12 22:41:37
|dimensions_| are mutable, because it's just a val
| |
423 bool is_dimensions_valid() const { return dimensions_.height > 0; } | 428 bool is_dimensions_valid() const { return dimensions_.height > 0; } |
424 | 429 |
425 // The delegate. This is only valid for the root menu item. You shouldn't | 430 // The delegate. This is only valid for the root menu item. You shouldn't |
426 // use this directly, instead use GetDelegate() which walks the tree as | 431 // use this directly, instead use GetDelegate() which walks the tree as |
427 // as necessary. | 432 // as necessary. |
428 MenuDelegate* delegate_; | 433 MenuDelegate* delegate_; |
429 | 434 |
430 // The controller for the run operation, or NULL if the menu isn't showing. | 435 // The controller for the run operation, or NULL if the menu isn't showing. |
431 MenuController* controller_; | 436 MenuController* controller_; |
432 | 437 |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
511 // If set to false, the right margin will be removed for menu lines | 516 // If set to false, the right margin will be removed for menu lines |
512 // containing other elements. | 517 // containing other elements. |
513 bool use_right_margin_; | 518 bool use_right_margin_; |
514 | 519 |
515 DISALLOW_COPY_AND_ASSIGN(MenuItemView); | 520 DISALLOW_COPY_AND_ASSIGN(MenuItemView); |
516 }; | 521 }; |
517 | 522 |
518 } // namespace views | 523 } // namespace views |
519 | 524 |
520 #endif // UI_VIEWS_CONTROLS_MENU_MENU_ITEM_VIEW_H_ | 525 #endif // UI_VIEWS_CONTROLS_MENU_MENU_ITEM_VIEW_H_ |
OLD | NEW |