| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_MENU_MENU_ITEM_VIEW_H_ | 5 #ifndef VIEWS_CONTROLS_MENU_MENU_ITEM_VIEW_H_ |
| 6 #define VIEWS_CONTROLS_MENU_MENU_ITEM_VIEW_H_ | 6 #define VIEWS_CONTROLS_MENU_MENU_ITEM_VIEW_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 // Returns the amount of space needed to accomodate the accelerator. The | 315 // Returns the amount of space needed to accomodate the accelerator. The |
| 316 // space needed for the accelerator is NOT included in the preferred width. | 316 // space needed for the accelerator is NOT included in the preferred width. |
| 317 int GetAcceleratorTextWidth(); | 317 int GetAcceleratorTextWidth(); |
| 318 | 318 |
| 319 // Returns true if the menu has mnemonics. This only useful on the root menu | 319 // Returns true if the menu has mnemonics. This only useful on the root menu |
| 320 // item. | 320 // item. |
| 321 bool has_mnemonics() const { return has_mnemonics_; } | 321 bool has_mnemonics() const { return has_mnemonics_; } |
| 322 | 322 |
| 323 // Set top and bottom margins in pixels. If no margin is set or a | 323 // Set top and bottom margins in pixels. If no margin is set or a |
| 324 // negative margin is specified then MenuConfig values are used. | 324 // negative margin is specified then MenuConfig values are used. |
| 325 void set_margins(int top_margin, int bottom_margin) { | 325 void SetMargins(int top_margin, int bottom_margin); |
| 326 top_margin_ = top_margin; | |
| 327 bottom_margin_ = bottom_margin; | |
| 328 } | |
| 329 | 326 |
| 330 // Set the position of the menu with respect to the bounds (top | 327 // Set the position of the menu with respect to the bounds (top |
| 331 // level only). | 328 // level only). |
| 332 void set_menu_position(MenuPosition menu_position) { | 329 void set_menu_position(MenuPosition menu_position) { |
| 333 requested_menu_position_ = menu_position; | 330 requested_menu_position_ = menu_position; |
| 334 } | 331 } |
| 335 | 332 |
| 336 protected: | 333 protected: |
| 337 // Creates a MenuItemView. This is used by the various AddXXX methods. | 334 // Creates a MenuItemView. This is used by the various AddXXX methods. |
| 338 MenuItemView(MenuItemView* parent, int command, Type type); | 335 MenuItemView(MenuItemView* parent, int command, Type type); |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 493 // position of the menu being shown. | 490 // position of the menu being shown. |
| 494 MenuPosition requested_menu_position_; | 491 MenuPosition requested_menu_position_; |
| 495 MenuPosition actual_menu_position_; | 492 MenuPosition actual_menu_position_; |
| 496 | 493 |
| 497 DISALLOW_COPY_AND_ASSIGN(MenuItemView); | 494 DISALLOW_COPY_AND_ASSIGN(MenuItemView); |
| 498 }; | 495 }; |
| 499 | 496 |
| 500 } // namespace views | 497 } // namespace views |
| 501 | 498 |
| 502 #endif // VIEWS_CONTROLS_MENU_MENU_ITEM_VIEW_H_ | 499 #endif // VIEWS_CONTROLS_MENU_MENU_ITEM_VIEW_H_ |
| OLD | NEW |