| 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 UI_VIEWS_CONTROLS_MENU_MENU_WIN_H_ | 5 #ifndef UI_VIEWS_CONTROLS_MENU_MENU_WIN_H_ |
| 6 #define UI_VIEWS_CONTROLS_MENU_MENU_WIN_H_ | 6 #define UI_VIEWS_CONTROLS_MENU_MENU_WIN_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <windows.h> | 9 #include <windows.h> |
| 10 | 10 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 // HMENU. This can be used to use the convenience methods to insert | 43 // HMENU. This can be used to use the convenience methods to insert |
| 44 // menu items and manage label string ownership. However this kind of | 44 // menu items and manage label string ownership. However this kind of |
| 45 // Menu object cannot use the delegate. | 45 // Menu object cannot use the delegate. |
| 46 explicit MenuWin(HMENU hmenu); | 46 explicit MenuWin(HMENU hmenu); |
| 47 virtual ~MenuWin(); | 47 virtual ~MenuWin(); |
| 48 | 48 |
| 49 // Overridden from Menu: | 49 // Overridden from Menu: |
| 50 virtual void AddMenuItemWithIcon(int index, | 50 virtual void AddMenuItemWithIcon(int index, |
| 51 int item_id, | 51 int item_id, |
| 52 const string16& label, | 52 const string16& label, |
| 53 const SkBitmap& icon) OVERRIDE; | 53 const gfx::ImageSkia& icon) OVERRIDE; |
| 54 virtual Menu* AddSubMenuWithIcon(int index, | 54 virtual Menu* AddSubMenuWithIcon(int index, |
| 55 int item_id, | 55 int item_id, |
| 56 const string16& label, | 56 const string16& label, |
| 57 const SkBitmap& icon) OVERRIDE; | 57 const gfx::ImageSkia& icon) OVERRIDE; |
| 58 virtual void AddSeparator(int index) OVERRIDE; | 58 virtual void AddSeparator(int index) OVERRIDE; |
| 59 virtual void EnableMenuItemByID(int item_id, bool enabled) OVERRIDE; | 59 virtual void EnableMenuItemByID(int item_id, bool enabled) OVERRIDE; |
| 60 virtual void EnableMenuItemAt(int index, bool enabled) OVERRIDE; | 60 virtual void EnableMenuItemAt(int index, bool enabled) OVERRIDE; |
| 61 virtual void SetMenuLabel(int item_id, const string16& label) OVERRIDE; | 61 virtual void SetMenuLabel(int item_id, const string16& label) OVERRIDE; |
| 62 virtual bool SetIcon(const SkBitmap& icon, int item_id) OVERRIDE; | 62 virtual bool SetIcon(const gfx::ImageSkia& icon, int item_id) OVERRIDE; |
| 63 virtual void RunMenuAt(int x, int y) OVERRIDE; | 63 virtual void RunMenuAt(int x, int y) OVERRIDE; |
| 64 virtual void Cancel() OVERRIDE; | 64 virtual void Cancel() OVERRIDE; |
| 65 virtual int ItemCount() OVERRIDE; | 65 virtual int ItemCount() OVERRIDE; |
| 66 | 66 |
| 67 virtual HMENU GetMenuHandle() const { | 67 virtual HMENU GetMenuHandle() const { |
| 68 return menu_; | 68 return menu_; |
| 69 } | 69 } |
| 70 | 70 |
| 71 // Gets the Win32 TPM alignment flags for the specified AnchorPoint. | 71 // Gets the Win32 TPM alignment flags for the specified AnchorPoint. |
| 72 DWORD GetTPMAlignFlags() const; | 72 DWORD GetTPMAlignFlags() const; |
| 73 | 73 |
| 74 protected: | 74 protected: |
| 75 virtual void AddMenuItemInternal(int index, | 75 virtual void AddMenuItemInternal(int index, |
| 76 int item_id, | 76 int item_id, |
| 77 const string16& label, | 77 const string16& label, |
| 78 const SkBitmap& icon, | 78 const gfx::ImageSkia& icon, |
| 79 MenuItemType type) OVERRIDE; | 79 MenuItemType type) OVERRIDE; |
| 80 | 80 |
| 81 private: | 81 private: |
| 82 friend class MenuHostWindow; | 82 friend class MenuHostWindow; |
| 83 | 83 |
| 84 // The data of menu items needed to display. | 84 // The data of menu items needed to display. |
| 85 struct ItemData; | 85 struct ItemData; |
| 86 | 86 |
| 87 void AddMenuItemInternal(int index, | 87 void AddMenuItemInternal(int index, |
| 88 int item_id, | 88 int item_id, |
| 89 const string16& label, | 89 const string16& label, |
| 90 const SkBitmap& icon, | 90 const gfx::ImageSkia& icon, |
| 91 HMENU submenu, | 91 HMENU submenu, |
| 92 MenuItemType type); | 92 MenuItemType type); |
| 93 | 93 |
| 94 explicit MenuWin(MenuWin* parent); | 94 explicit MenuWin(MenuWin* parent); |
| 95 | 95 |
| 96 // Sets menu information before displaying, including sub-menus. | 96 // Sets menu information before displaying, including sub-menus. |
| 97 void SetMenuInfo(); | 97 void SetMenuInfo(); |
| 98 | 98 |
| 99 // Get all the state flags for the |fState| field of MENUITEMINFO for the | 99 // Get all the state flags for the |fState| field of MENUITEMINFO for the |
| 100 // item with the specified id. |delegate| is consulted if non-NULL about | 100 // item with the specified id. |delegate| is consulted if non-NULL about |
| (...skipping 30 matching lines...) Expand all Loading... |
| 131 | 131 |
| 132 // Whether the menu is visible. | 132 // Whether the menu is visible. |
| 133 bool is_menu_visible_; | 133 bool is_menu_visible_; |
| 134 | 134 |
| 135 DISALLOW_COPY_AND_ASSIGN(MenuWin); | 135 DISALLOW_COPY_AND_ASSIGN(MenuWin); |
| 136 }; | 136 }; |
| 137 | 137 |
| 138 } // namespace views | 138 } // namespace views |
| 139 | 139 |
| 140 #endif // UI_VIEWS_CONTROLS_MENU_MENU_WIN_H_ | 140 #endif // UI_VIEWS_CONTROLS_MENU_MENU_WIN_H_ |
| OLD | NEW |