OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this |
2 // source code is governed by a BSD-style license that can be found in the | 2 // source code is governed by a BSD-style license that can be found in the |
3 // LICENSE file. | 3 // LICENSE file. |
4 | 4 |
5 #ifndef VIEWS_CONTROLS_MENU_NATIVE_MENU_WIN_H_ | 5 #ifndef VIEWS_CONTROLS_MENU_NATIVE_MENU_WIN_H_ |
6 #define VIEWS_CONTROLS_MENU_NATIVE_MENU_WIN_H_ | 6 #define VIEWS_CONTROLS_MENU_NATIVE_MENU_WIN_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/scoped_ptr.h" | 10 #include "base/scoped_ptr.h" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 const std::wstring& label); | 64 const std::wstring& label); |
65 | 65 |
66 // Updates the local data structure with the correctly formatted version of | 66 // Updates the local data structure with the correctly formatted version of |
67 // |label| at the specified model_index, and adds string data to |mii| if | 67 // |label| at the specified model_index, and adds string data to |mii| if |
68 // the menu is not owner-draw. That's a mouthful. This function exists because | 68 // the menu is not owner-draw. That's a mouthful. This function exists because |
69 // of the peculiarities of the Windows menu API. | 69 // of the peculiarities of the Windows menu API. |
70 void UpdateMenuItemInfoForString(MENUITEMINFO* mii, | 70 void UpdateMenuItemInfoForString(MENUITEMINFO* mii, |
71 int model_index, | 71 int model_index, |
72 const std::wstring& label); | 72 const std::wstring& label); |
73 | 73 |
74 // Returns the NativeMenuWin object that contains an item with the specified | |
75 // command id. This function must only be called from RunMenuAt! | |
76 NativeMenuWin* GetMenuForCommandId(UINT command_id) const; | |
77 | |
78 // Returns the alignment flags to be passed to TrackPopupMenuEx, based on the | 74 // Returns the alignment flags to be passed to TrackPopupMenuEx, based on the |
79 // supplied alignment and the UI text direction. | 75 // supplied alignment and the UI text direction. |
80 UINT GetAlignmentFlags(int alignment) const; | 76 UINT GetAlignmentFlags(int alignment) const; |
81 | 77 |
82 // Resets the native menu stored in |menu_| by destroying any old menu then | 78 // Resets the native menu stored in |menu_| by destroying any old menu then |
83 // creating a new empty one. | 79 // creating a new empty one. |
84 void ResetNativeMenu(); | 80 void ResetNativeMenu(); |
85 | 81 |
86 // Creates the host window that receives notifications from the menu. | 82 // Creates the host window that receives notifications from the menu. |
87 void CreateHostWindow(); | 83 void CreateHostWindow(); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 // Overridden from SimpleMenuModel: | 125 // Overridden from SimpleMenuModel: |
130 virtual int FlipIndex(int index) const { return GetItemCount() - index - 1; } | 126 virtual int FlipIndex(int index) const { return GetItemCount() - index - 1; } |
131 | 127 |
132 private: | 128 private: |
133 DISALLOW_COPY_AND_ASSIGN(SystemMenuModel); | 129 DISALLOW_COPY_AND_ASSIGN(SystemMenuModel); |
134 }; | 130 }; |
135 | 131 |
136 } // namespace views | 132 } // namespace views |
137 | 133 |
138 #endif // VIEWS_CONTROLS_MENU_NATIVE_MENU_WIN_H_ | 134 #endif // VIEWS_CONTROLS_MENU_NATIVE_MENU_WIN_H_ |
OLD | NEW |