| 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_NATIVE_MENU_WIN_H_ | 5 #ifndef UI_VIEWS_CONTROLS_MENU_NATIVE_MENU_WIN_H_ |
| 6 #define UI_VIEWS_CONTROLS_MENU_NATIVE_MENU_WIN_H_ | 6 #define UI_VIEWS_CONTROLS_MENU_NATIVE_MENU_WIN_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 | 67 |
| 68 // Sets the state of the item at the specified index. | 68 // Sets the state of the item at the specified index. |
| 69 void SetMenuItemState(int menu_index, | 69 void SetMenuItemState(int menu_index, |
| 70 bool enabled, | 70 bool enabled, |
| 71 bool checked, | 71 bool checked, |
| 72 bool is_default); | 72 bool is_default); |
| 73 | 73 |
| 74 // Sets the label of the item at the specified index. | 74 // Sets the label of the item at the specified index. |
| 75 void SetMenuItemLabel(int menu_index, | 75 void SetMenuItemLabel(int menu_index, |
| 76 int model_index, | 76 int model_index, |
| 77 const string16& label); | 77 const base::string16& label); |
| 78 | 78 |
| 79 // Updates the local data structure with the correctly formatted version of | 79 // Updates the local data structure with the correctly formatted version of |
| 80 // |label| at the specified model_index, and adds string data to |mii| if | 80 // |label| at the specified model_index, and adds string data to |mii| if |
| 81 // the menu is not owner-draw. That's a mouthful. This function exists because | 81 // the menu is not owner-draw. That's a mouthful. This function exists because |
| 82 // of the peculiarities of the Windows menu API. | 82 // of the peculiarities of the Windows menu API. |
| 83 void UpdateMenuItemInfoForString(MENUITEMINFO* mii, | 83 void UpdateMenuItemInfoForString(MENUITEMINFO* mii, |
| 84 int model_index, | 84 int model_index, |
| 85 const string16& label); | 85 const base::string16& label); |
| 86 | 86 |
| 87 // Returns the alignment flags to be passed to TrackPopupMenuEx, based on the | 87 // Returns the alignment flags to be passed to TrackPopupMenuEx, based on the |
| 88 // supplied alignment and the UI text direction. | 88 // supplied alignment and the UI text direction. |
| 89 UINT GetAlignmentFlags(int alignment) const; | 89 UINT GetAlignmentFlags(int alignment) const; |
| 90 | 90 |
| 91 // Resets the native menu stored in |menu_| by destroying any old menu then | 91 // Resets the native menu stored in |menu_| by destroying any old menu then |
| 92 // creating a new empty one. | 92 // creating a new empty one. |
| 93 void ResetNativeMenu(); | 93 void ResetNativeMenu(); |
| 94 | 94 |
| 95 // Creates the host window that receives notifications from the menu. | 95 // Creates the host window that receives notifications from the menu. |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 // has a menu open, because our hook function that receives keyboard | 160 // has a menu open, because our hook function that receives keyboard |
| 161 // events doesn't have a mechanism to get a user data pointer. | 161 // events doesn't have a mechanism to get a user data pointer. |
| 162 static NativeMenuWin* open_native_menu_win_; | 162 static NativeMenuWin* open_native_menu_win_; |
| 163 | 163 |
| 164 DISALLOW_COPY_AND_ASSIGN(NativeMenuWin); | 164 DISALLOW_COPY_AND_ASSIGN(NativeMenuWin); |
| 165 }; | 165 }; |
| 166 | 166 |
| 167 } // namespace views | 167 } // namespace views |
| 168 | 168 |
| 169 #endif // UI_VIEWS_CONTROLS_MENU_NATIVE_MENU_WIN_H_ | 169 #endif // UI_VIEWS_CONTROLS_MENU_NATIVE_MENU_WIN_H_ |
| OLD | NEW |