Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(90)

Side by Side Diff: views/controls/menu/native_menu_win.cc

Issue 6254011: Move UI-relevant Windows files to ui/base. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « views/controls/menu/menu_win.cc ('k') | views/controls/native_control.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #include "views/controls/menu/native_menu_win.h" 5 #include "views/controls/menu/native_menu_win.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "app/l10n_util_win.h" 8 #include "app/l10n_util_win.h"
9 #include "app/win/hwnd_util.h"
10 #include "base/logging.h" 9 #include "base/logging.h"
11 #include "base/message_loop.h" 10 #include "base/message_loop.h"
12 #include "base/stl_util-inl.h" 11 #include "base/stl_util-inl.h"
13 #include "base/task.h" 12 #include "base/task.h"
14 #include "gfx/canvas_skia.h" 13 #include "gfx/canvas_skia.h"
15 #include "gfx/font.h" 14 #include "gfx/font.h"
16 #include "third_party/skia/include/core/SkBitmap.h" 15 #include "third_party/skia/include/core/SkBitmap.h"
17 #include "ui/base/keycodes/keyboard_codes.h" 16 #include "ui/base/keycodes/keyboard_codes.h"
17 #include "ui/base/win/hwnd_util.h"
18 #include "views/accelerator.h" 18 #include "views/accelerator.h"
19 #include "views/controls/menu/menu_2.h" 19 #include "views/controls/menu/menu_2.h"
20 20
21 namespace views { 21 namespace views {
22 22
23 // The width of an icon, including the pixels between the icon and 23 // The width of an icon, including the pixels between the icon and
24 // the item label. 24 // the item label.
25 static const int kIconWidth = 23; 25 static const int kIconWidth = 23;
26 // Margins between the top of the item and the label. 26 // Margins between the top of the item and the label.
27 static const int kItemTopMargin = 3; 27 static const int kItemTopMargin = 3;
(...skipping 25 matching lines...) Expand all
53 // A window that receives messages from Windows relevant to the native menu 53 // A window that receives messages from Windows relevant to the native menu
54 // structure we have constructed in NativeMenuWin. 54 // structure we have constructed in NativeMenuWin.
55 class NativeMenuWin::MenuHostWindow { 55 class NativeMenuWin::MenuHostWindow {
56 public: 56 public:
57 MenuHostWindow(NativeMenuWin* parent) 57 MenuHostWindow(NativeMenuWin* parent)
58 : parent_(parent), 58 : parent_(parent),
59 ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)) { 59 ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)) {
60 RegisterClass(); 60 RegisterClass();
61 hwnd_ = CreateWindowEx(l10n_util::GetExtendedStyles(), kWindowClassName, 61 hwnd_ = CreateWindowEx(l10n_util::GetExtendedStyles(), kWindowClassName,
62 L"", 0, 0, 0, 0, 0, HWND_MESSAGE, NULL, NULL, NULL); 62 L"", 0, 0, 0, 0, 0, HWND_MESSAGE, NULL, NULL, NULL);
63 app::win::SetWindowUserData(hwnd_, this); 63 ui::SetWindowUserData(hwnd_, this);
64 } 64 }
65 65
66 ~MenuHostWindow() { 66 ~MenuHostWindow() {
67 DestroyWindow(hwnd_); 67 DestroyWindow(hwnd_);
68 } 68 }
69 69
70 HWND hwnd() const { return hwnd_; } 70 HWND hwnd() const { return hwnd_; }
71 71
72 private: 72 private:
73 static const wchar_t* kWindowClassName; 73 static const wchar_t* kWindowClassName;
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 // TODO(beng): bring over owner draw from old menu system. 271 // TODO(beng): bring over owner draw from old menu system.
272 } 272 }
273 return false; 273 return false;
274 } 274 }
275 275
276 static LRESULT CALLBACK MenuHostWindowProc(HWND window, 276 static LRESULT CALLBACK MenuHostWindowProc(HWND window,
277 UINT message, 277 UINT message,
278 WPARAM w_param, 278 WPARAM w_param,
279 LPARAM l_param) { 279 LPARAM l_param) {
280 MenuHostWindow* host = 280 MenuHostWindow* host =
281 reinterpret_cast<MenuHostWindow*>(app::win::GetWindowUserData(window)); 281 reinterpret_cast<MenuHostWindow*>(ui::GetWindowUserData(window));
282 // host is null during initial construction. 282 // host is null during initial construction.
283 LRESULT l_result = 0; 283 LRESULT l_result = 0;
284 if (!host || !host->ProcessWindowMessage(window, message, w_param, l_param, 284 if (!host || !host->ProcessWindowMessage(window, message, w_param, l_param,
285 &l_result)) { 285 &l_result)) {
286 return DefWindowProc(window, message, w_param, l_param); 286 return DefWindowProc(window, message, w_param, l_param);
287 } 287 }
288 return l_result; 288 return l_result;
289 } 289 }
290 290
291 HWND hwnd_; 291 HWND hwnd_;
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
631 631
632 //////////////////////////////////////////////////////////////////////////////// 632 ////////////////////////////////////////////////////////////////////////////////
633 // MenuWrapper, public: 633 // MenuWrapper, public:
634 634
635 // static 635 // static
636 MenuWrapper* MenuWrapper::CreateWrapper(Menu2* menu) { 636 MenuWrapper* MenuWrapper::CreateWrapper(Menu2* menu) {
637 return new NativeMenuWin(menu->model(), NULL); 637 return new NativeMenuWin(menu->model(), NULL);
638 } 638 }
639 639
640 } // namespace views 640 } // namespace views
OLDNEW
« no previous file with comments | « views/controls/menu/menu_win.cc ('k') | views/controls/native_control.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698