diff options
author | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-14 23:09:11 +0000 |
---|---|---|
committer | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-14 23:09:11 +0000 |
commit | 0d62def999bb7ffe731256a98cdb6be184e067b2 (patch) | |
tree | 7a449bb520e67921a7a5257a1e4627e48c1e4e13 /chrome/views | |
parent | bb69e9b391b68274089c5a6148548683af54bb19 (diff) | |
download | chromium_src-0d62def999bb7ffe731256a98cdb6be184e067b2.zip chromium_src-0d62def999bb7ffe731256a98cdb6be184e067b2.tar.gz chromium_src-0d62def999bb7ffe731256a98cdb6be184e067b2.tar.bz2 |
Hook up the system menu in new frames.
BUG=1319684
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@908 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/views')
-rw-r--r-- | chrome/views/custom_frame_window.cc | 5 | ||||
-rw-r--r-- | chrome/views/hwnd_view_container.h | 6 | ||||
-rw-r--r-- | chrome/views/menu.cc | 4 | ||||
-rw-r--r-- | chrome/views/menu.h | 3 |
4 files changed, 18 insertions, 0 deletions
diff --git a/chrome/views/custom_frame_window.cc b/chrome/views/custom_frame_window.cc index 5dc425a..2a96cb9 100644 --- a/chrome/views/custom_frame_window.cc +++ b/chrome/views/custom_frame_window.cc @@ -1180,6 +1180,11 @@ void CustomFrameWindow::OnSize(UINT param, const CSize& size) { // CustomFrameWindow, private: void CustomFrameWindow::RunSystemMenu(const CPoint& point) { + // We need to reset and clean up any currently created system menu objects. + // We need to call this otherwise there's a small chance that we aren't going + // to get a system menu. We also can't take the return value of this + // function. We need to call it *again* to get a valid HMENU. + ::GetSystemMenu(GetHWND(), TRUE); HMENU system_menu = ::GetSystemMenu(GetHWND(), FALSE); int id = ::TrackPopupMenu(system_menu, TPM_LEFTBUTTON | TPM_RIGHTBUTTON | TPM_RETURNCMD, diff --git a/chrome/views/hwnd_view_container.h b/chrome/views/hwnd_view_container.h index 1ce41f2..3c792d1 100644 --- a/chrome/views/hwnd_view_container.h +++ b/chrome/views/hwnd_view_container.h @@ -193,9 +193,11 @@ class HWNDViewContainer : public ViewContainer, MSG_WM_DESTROY(OnDestroy) MSG_WM_ERASEBKGND(OnEraseBkgnd) MSG_WM_ENDSESSION(OnEndSession) + MSG_WM_EXITMENULOOP(OnExitMenuLoop) MSG_WM_GETMINMAXINFO(OnGetMinMaxInfo) MSG_WM_HSCROLL(OnHScroll) MSG_WM_INITMENU(OnInitMenu) + MSG_WM_INITMENUPOPUP(OnInitMenuPopup) MSG_WM_KEYDOWN(OnKeyDown) MSG_WM_KEYUP(OnKeyUp) MSG_WM_LBUTTONDBLCLK(OnLButtonDblClk) @@ -351,6 +353,7 @@ class HWNDViewContainer : public ViewContainer, // leak a few things. virtual void OnDestroy(); virtual void OnEndSession(BOOL ending, UINT logoff) { SetMsgHandled(FALSE); } + virtual void OnExitMenuLoop(BOOL is_track_popup_menu) { SetMsgHandled(FALSE); } virtual LRESULT OnEraseBkgnd(HDC dc); virtual void OnGetMinMaxInfo(LPMINMAXINFO mm_info) { } virtual LRESULT OnGetObject(UINT uMsg, WPARAM w_param, LPARAM l_param); @@ -358,6 +361,9 @@ class HWNDViewContainer : public ViewContainer, SetMsgHandled(FALSE); } virtual void OnInitMenu(HMENU menu) { SetMsgHandled(FALSE); } + virtual void OnInitMenuPopup(HMENU menu, UINT position, BOOL is_system_menu) { + SetMsgHandled(FALSE); + } virtual void OnKeyDown(TCHAR c, UINT rep_cnt, UINT flags); virtual void OnKeyUp(TCHAR c, UINT rep_cnt, UINT flags); virtual void OnLButtonDblClk(UINT flags, const CPoint& point); diff --git a/chrome/views/menu.cc b/chrome/views/menu.cc index d36ba76..0b3b72f 100644 --- a/chrome/views/menu.cc +++ b/chrome/views/menu.cc @@ -582,3 +582,7 @@ void Menu::Cancel() { DCHECK(is_menu_visible_); EndMenu(); } + +int Menu::ItemCount() { + return GetMenuItemCount(menu_); +} diff --git a/chrome/views/menu.h b/chrome/views/menu.h index 3894a5b..44a69c2 100644 --- a/chrome/views/menu.h +++ b/chrome/views/menu.h @@ -316,6 +316,9 @@ class Menu { // Cancels the menu. virtual void Cancel(); + // Returns the number of menu items. + int ItemCount(); + protected: // The delegate that is being used to get information about the presentation. Delegate* delegate_; |