Chromium Code Reviews| 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 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 313 | 313 |
| 314 // Set top and bottom margins in pixels. If no margin is set or a | 314 // Set top and bottom margins in pixels. If no margin is set or a |
| 315 // negative margin is specified then MenuConfig values are used. | 315 // negative margin is specified then MenuConfig values are used. |
| 316 void SetMargins(int top_margin, int bottom_margin); | 316 void SetMargins(int top_margin, int bottom_margin); |
| 317 | 317 |
| 318 // Suppress the right margin if this is set to false. | 318 // Suppress the right margin if this is set to false. |
| 319 void set_use_right_margin(bool use_right_margin) { | 319 void set_use_right_margin(bool use_right_margin) { |
| 320 use_right_margin_ = use_right_margin; | 320 use_right_margin_ = use_right_margin; |
| 321 } | 321 } |
| 322 | 322 |
| 323 // Sets MenuConfig to be used instead of default one. | |
| 324 void set_menu_config(const MenuConfig* menu_config) { | |
| 325 menu_config_ = menu_config; | |
| 326 } | |
| 327 | |
| 328 // Returns a reference to MenuConfig to be used with this menu. | |
| 329 const MenuConfig& GetMenuConfig() const; | |
| 330 | |
| 323 protected: | 331 protected: |
| 324 // Creates a MenuItemView. This is used by the various AddXXX methods. | 332 // Creates a MenuItemView. This is used by the various AddXXX methods. |
| 325 MenuItemView(MenuItemView* parent, int command, Type type); | 333 MenuItemView(MenuItemView* parent, int command, Type type); |
| 326 | 334 |
| 327 // MenuRunner owns MenuItemView and should be the only one deleting it. | 335 // MenuRunner owns MenuItemView and should be the only one deleting it. |
| 328 virtual ~MenuItemView(); | 336 virtual ~MenuItemView(); |
| 329 | 337 |
| 330 virtual void ChildPreferredSizeChanged(View* child) OVERRIDE; | 338 virtual void ChildPreferredSizeChanged(View* child) OVERRIDE; |
| 331 | 339 |
| 332 virtual std::string GetClassName() const OVERRIDE; | 340 virtual std::string GetClassName() const OVERRIDE; |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 493 // |menu_position_| is the requested position with respect to the bounds. | 501 // |menu_position_| is the requested position with respect to the bounds. |
| 494 // |actual_menu_position_| is used by the controller to cache the | 502 // |actual_menu_position_| is used by the controller to cache the |
| 495 // position of the menu being shown. | 503 // position of the menu being shown. |
| 496 MenuPosition requested_menu_position_; | 504 MenuPosition requested_menu_position_; |
| 497 MenuPosition actual_menu_position_; | 505 MenuPosition actual_menu_position_; |
| 498 | 506 |
| 499 // If set to false, the right margin will be removed for menu lines | 507 // If set to false, the right margin will be removed for menu lines |
| 500 // containing other elements. | 508 // containing other elements. |
| 501 bool use_right_margin_; | 509 bool use_right_margin_; |
| 502 | 510 |
| 511 // |menu_config_| to replace default one, could be NULL, | |
| 512 // applies to root menu item only. | |
| 513 const MenuConfig* menu_config_; | |
|
sky
2012/10/08 21:32:26
scoped_ptr
yefimt
2012/10/08 22:32:01
Done.
| |
| 514 | |
| 503 DISALLOW_COPY_AND_ASSIGN(MenuItemView); | 515 DISALLOW_COPY_AND_ASSIGN(MenuItemView); |
| 504 }; | 516 }; |
| 505 | 517 |
| 506 } // namespace views | 518 } // namespace views |
| 507 | 519 |
| 508 #endif // UI_VIEWS_CONTROLS_MENU_MENU_ITEM_VIEW_H_ | 520 #endif // UI_VIEWS_CONTROLS_MENU_MENU_ITEM_VIEW_H_ |
| OLD | NEW |