diff options
author | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-09 23:31:13 +0000 |
---|---|---|
committer | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-09 23:31:13 +0000 |
commit | 041b2e4c8aceac7914c9fb26e33b99895f3624c9 (patch) | |
tree | 8681219caa7c159badc283dafae297aefa797dbf /views/controls/menu/menu_win.cc | |
parent | 49c019da6f601df69b7759717e4455912a027e08 (diff) | |
download | chromium_src-041b2e4c8aceac7914c9fb26e33b99895f3624c9.zip chromium_src-041b2e4c8aceac7914c9fb26e33b99895f3624c9.tar.gz chromium_src-041b2e4c8aceac7914c9fb26e33b99895f3624c9.tar.bz2 |
Use base::WindowImpl instead of CWindowImpl to remove a dependency on ATL.
BUG=5027
TEST=none
Review URL: http://codereview.chromium.org/199070
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25817 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/controls/menu/menu_win.cc')
-rw-r--r-- | views/controls/menu/menu_win.cc | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/views/controls/menu/menu_win.cc b/views/controls/menu/menu_win.cc index f83773e..68cc8ff 100644 --- a/views/controls/menu/menu_win.cc +++ b/views/controls/menu/menu_win.cc @@ -4,12 +4,6 @@ #include "views/controls/menu/menu_win.h" -#include <atlbase.h> -#include <atlapp.h> -#include <atlwin.h> -#include <atlcrack.h> -#include <atlframe.h> -#include <atlmisc.h> #include <string> #include "app/gfx/canvas.h" @@ -20,6 +14,7 @@ #include "base/logging.h" #include "base/stl_util-inl.h" #include "base/string_util.h" +#include "base/window_impl.h" #include "views/accelerator.h" namespace views { @@ -51,7 +46,7 @@ struct MenuWin::ItemData { namespace { static int ChromeGetMenuItemID(HMENU hMenu, int pos) { - // The built-in Windows ::GetMenuItemID doesn't work for submenus, + // The built-in Windows GetMenuItemID doesn't work for submenus, // so here's our own implementation. MENUITEMINFO mii = {0}; mii.cbSize = sizeof(mii); @@ -66,8 +61,7 @@ static int ChromeGetMenuItemID(HMENU hMenu, int pos) { // to intercept right clicks on the HMENU and notify the delegate as well as // for drawing icons. // -class MenuHostWindow : public CWindowImpl<MenuHostWindow, CWindow, - CWinTraits<WS_CHILD>> { +class MenuHostWindow : public base::WindowImpl { public: MenuHostWindow(MenuWin* menu, HWND parent_window) : menu_(menu) { int extended_style = 0; @@ -76,15 +70,16 @@ class MenuHostWindow : public CWindowImpl<MenuHostWindow, CWindow, // underlying HWND. if (menu_->delegate()->IsRightToLeftUILayout()) extended_style |= l10n_util::GetExtendedStyles(); - Create(parent_window, gfx::Rect().ToRECT(), 0, 0, extended_style); + set_window_style(WS_CHILD); + set_window_ex_style(extended_style); + Init(parent_window, gfx::Rect()); } ~MenuHostWindow() { - DestroyWindow(); + DestroyWindow(hwnd()); } - DECLARE_FRAME_WND_CLASS(L"MenuHostWindow", NULL); - BEGIN_MSG_MAP(MenuHostWindow); + BEGIN_MSG_MAP_EX(MenuHostWindow); MSG_WM_RBUTTONUP(OnRButtonUp) MSG_WM_MEASUREITEM(OnMeasureItem) MSG_WM_DRAWITEM(OnDrawItem) @@ -367,7 +362,7 @@ void MenuWin::RunMenuAt(int x, int y) { active_host_window = new MenuHostWindow(this, owner_); } UINT selected_id = - TrackPopupMenuEx(menu_, flags, x, y, active_host_window->m_hWnd, NULL); + TrackPopupMenuEx(menu_, flags, x, y, active_host_window->hwnd(), NULL); if (created_host) { delete active_host_window; active_host_window = NULL; |