| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 // Returns the icon. | 242 // Returns the icon. |
| 243 const SkBitmap& GetIcon() const { return icon_; } | 243 const SkBitmap& GetIcon() const { return icon_; } |
| 244 | 244 |
| 245 // Sets the command id of this menu item. | 245 // Sets the command id of this menu item. |
| 246 void SetCommand(int command) { command_ = command; } | 246 void SetCommand(int command) { command_ = command; } |
| 247 | 247 |
| 248 // Returns the command id of this item. | 248 // Returns the command id of this item. |
| 249 int GetCommand() const { return command_; } | 249 int GetCommand() const { return command_; } |
| 250 | 250 |
| 251 // Paints the menu item. | 251 // Paints the menu item. |
| 252 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; | 252 virtual void OnPaint(gfx::CanvasSkia* canvas) OVERRIDE; |
| 253 | 253 |
| 254 // Returns the preferred size of this item. | 254 // Returns the preferred size of this item. |
| 255 virtual gfx::Size GetPreferredSize() OVERRIDE; | 255 virtual gfx::Size GetPreferredSize() OVERRIDE; |
| 256 | 256 |
| 257 // Returns the object responsible for controlling showing the menu. | 257 // Returns the object responsible for controlling showing the menu. |
| 258 MenuController* GetMenuController(); | 258 MenuController* GetMenuController(); |
| 259 const MenuController* GetMenuController() const; | 259 const MenuController* GetMenuController() const; |
| 260 | 260 |
| 261 // Returns the delegate. This returns the delegate of the root menu item. | 261 // Returns the delegate. This returns the delegate of the root menu item. |
| 262 MenuDelegate* GetDelegate(); | 262 MenuDelegate* GetDelegate(); |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 // Undoes the work of AddEmptyMenus. | 348 // Undoes the work of AddEmptyMenus. |
| 349 void RemoveEmptyMenus(); | 349 void RemoveEmptyMenus(); |
| 350 | 350 |
| 351 // Given bounds within our View, this helper routine mirrors the bounds if | 351 // Given bounds within our View, this helper routine mirrors the bounds if |
| 352 // necessary. | 352 // necessary. |
| 353 void AdjustBoundsForRTLUI(gfx::Rect* rect) const; | 353 void AdjustBoundsForRTLUI(gfx::Rect* rect) const; |
| 354 | 354 |
| 355 // Actual paint implementation. If mode is PB_FOR_DRAG, portions of the menu | 355 // Actual paint implementation. If mode is PB_FOR_DRAG, portions of the menu |
| 356 // are not rendered. | 356 // are not rendered. |
| 357 enum PaintButtonMode { PB_NORMAL, PB_FOR_DRAG }; | 357 enum PaintButtonMode { PB_NORMAL, PB_FOR_DRAG }; |
| 358 void PaintButton(gfx::Canvas* canvas, PaintButtonMode mode); | 358 void PaintButton(gfx::CanvasSkia* canvas, PaintButtonMode mode); |
| 359 | 359 |
| 360 #if defined(OS_WIN) | 360 #if defined(OS_WIN) |
| 361 enum SelectionState { SELECTED, UNSELECTED }; | 361 enum SelectionState { SELECTED, UNSELECTED }; |
| 362 | 362 |
| 363 // Paints the check/radio button indicator. | 363 // Paints the check/radio button indicator. |
| 364 void PaintCheck(gfx::Canvas* canvas, | 364 void PaintCheck(gfx::CanvasSkia* canvas, |
| 365 gfx::NativeTheme::State state, | 365 gfx::NativeTheme::State state, |
| 366 SelectionState selection_state, | 366 SelectionState selection_state, |
| 367 const MenuConfig& config); | 367 const MenuConfig& config); |
| 368 #endif | 368 #endif |
| 369 | 369 |
| 370 // Paints the accelerator. | 370 // Paints the accelerator. |
| 371 void PaintAccelerator(gfx::Canvas* canvas); | 371 void PaintAccelerator(gfx::CanvasSkia* canvas); |
| 372 | 372 |
| 373 // Destroys the window used to display this menu and recursively destroys | 373 // Destroys the window used to display this menu and recursively destroys |
| 374 // the windows used to display all descendants. | 374 // the windows used to display all descendants. |
| 375 void DestroyAllMenuHosts(); | 375 void DestroyAllMenuHosts(); |
| 376 | 376 |
| 377 // Returns the accelerator text. | 377 // Returns the accelerator text. |
| 378 string16 GetAcceleratorText(); | 378 string16 GetAcceleratorText(); |
| 379 | 379 |
| 380 // Returns the various margins. | 380 // Returns the various margins. |
| 381 int GetTopMargin(); | 381 int GetTopMargin(); |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 470 // position of the menu being shown. | 470 // position of the menu being shown. |
| 471 MenuPosition requested_menu_position_; | 471 MenuPosition requested_menu_position_; |
| 472 MenuPosition actual_menu_position_; | 472 MenuPosition actual_menu_position_; |
| 473 | 473 |
| 474 DISALLOW_COPY_AND_ASSIGN(MenuItemView); | 474 DISALLOW_COPY_AND_ASSIGN(MenuItemView); |
| 475 }; | 475 }; |
| 476 | 476 |
| 477 } // namespace views | 477 } // namespace views |
| 478 | 478 |
| 479 #endif // UI_VIEWS_CONTROLS_MENU_MENU_ITEM_VIEW_H_ | 479 #endif // UI_VIEWS_CONTROLS_MENU_MENU_ITEM_VIEW_H_ |
| OLD | NEW |