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

Side by Side Diff: views/controls/native_control_win.h

Issue 4637002: Adds the ability for classes other than native control to process (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/chrome
Patch Set: Tweaks Created 10 years, 1 month 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
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 #ifndef VIEWS_CONTROLS_NATIVE_CONTROL_WIN_H_ 5 #ifndef VIEWS_CONTROLS_NATIVE_CONTROL_WIN_H_
6 #define VIEWS_CONTROLS_NATIVE_CONTROL_WIN_H_ 6 #define VIEWS_CONTROLS_NATIVE_CONTROL_WIN_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/scoped_ptr.h" 9 #include "base/scoped_ptr.h"
10 #include "base/scoped_vector.h"
10 #include "views/controls/combobox/combobox.h" 11 #include "views/controls/combobox/combobox.h"
11 #include "views/controls/native/native_view_host.h" 12 #include "views/controls/native/native_view_host.h"
13 #include "views/widget/child_window_message_processor.h"
12 14
13 namespace app { 15 namespace app {
14 namespace win { 16 namespace win {
15 class ScopedProp; 17 class ScopedProp;
16 } 18 }
17 } 19 }
18 20
19 namespace views { 21 namespace views {
20 22
21 // A View that hosts a native Windows control. 23 // A View that hosts a native Windows control.
22 class NativeControlWin : public NativeViewHost { 24 class NativeControlWin : public ChildWindowMessageProcessor,
25 public NativeViewHost {
23 public: 26 public:
24 static const wchar_t* kNativeControlWinKey;
25
26 NativeControlWin(); 27 NativeControlWin();
27 virtual ~NativeControlWin(); 28 virtual ~NativeControlWin();
28 29
29 // Called by the containing WidgetWin when a message is received from the HWND 30 // Overridden from ChildWindowMessageProcessor:
30 // created by an object derived from NativeControlWin. Derived classes MUST
31 // call _this_ version of the function if they override it and do not handle
32 // all of the messages listed in widget_win.cc ProcessNativeControlWinMessage.
33 // Returns true if the message was handled, with a valid result in |result|.
34 // Returns false if the message was not handled.
35 virtual bool ProcessMessage(UINT message, 31 virtual bool ProcessMessage(UINT message,
36 WPARAM w_param, 32 WPARAM w_param,
37 LPARAM l_param, 33 LPARAM l_param,
38 LRESULT* result); 34 LRESULT* result);
39 35
40 // Called by our subclassed window procedure when a WM_KEYDOWN message is 36 // Called by our subclassed window procedure when a WM_KEYDOWN message is
41 // received by the HWND created by an object derived from NativeControlWin. 37 // received by the HWND created by an object derived from NativeControlWin.
42 // Returns true if the key was processed, false otherwise. 38 // Returns true if the key was processed, false otherwise.
43 virtual bool OnKeyDown(int vkey) { return false; } 39 virtual bool OnKeyDown(int vkey) { return false; }
44 40
(...skipping 27 matching lines...) Expand all
72 // to the HWND for views with right-to-left UI layout. 68 // to the HWND for views with right-to-left UI layout.
73 DWORD GetAdditionalExStyle() const; 69 DWORD GetAdditionalExStyle() const;
74 70
75 // TODO(xji): we use the following temporary function as we transition the 71 // TODO(xji): we use the following temporary function as we transition the
76 // various native controls to use the right set of RTL flags. This function 72 // various native controls to use the right set of RTL flags. This function
77 // will go away (and be replaced by GetAdditionalExStyle()) once all the 73 // will go away (and be replaced by GetAdditionalExStyle()) once all the
78 // controls are properly transitioned. 74 // controls are properly transitioned.
79 DWORD GetAdditionalRTLStyle() const; 75 DWORD GetAdditionalRTLStyle() const;
80 76
81 private: 77 private:
78 typedef ScopedVector<app::win::ScopedProp> ScopedProps;
79
82 // Called by the containing WidgetWin when a message of type WM_CTLCOLORBTN or 80 // Called by the containing WidgetWin when a message of type WM_CTLCOLORBTN or
83 // WM_CTLCOLORSTATIC is sent from the HWND created by an object dreived from 81 // WM_CTLCOLORSTATIC is sent from the HWND created by an object dreived from
84 // NativeControlWin. 82 // NativeControlWin.
85 LRESULT GetControlColor(UINT message, HDC dc, HWND sender); 83 LRESULT GetControlColor(UINT message, HDC dc, HWND sender);
86 84
87 // Our subclass window procedure for the attached control. 85 // Our subclass window procedure for the attached control.
88 static LRESULT CALLBACK NativeControlWndProc(HWND window, 86 static LRESULT CALLBACK NativeControlWndProc(HWND window,
89 UINT message, 87 UINT message,
90 WPARAM w_param, 88 WPARAM w_param,
91 LPARAM l_param); 89 LPARAM l_param);
92 90
93 // The window procedure before we subclassed. 91 // The window procedure before we subclassed.
94 WNDPROC original_wndproc_; 92 WNDPROC original_wndproc_;
95 93
96 scoped_ptr<app::win::ScopedProp> prop_; 94 ScopedProps props_;
97 95
98 DISALLOW_COPY_AND_ASSIGN(NativeControlWin); 96 DISALLOW_COPY_AND_ASSIGN(NativeControlWin);
99 }; 97 };
100 98
101 } // namespace views 99 } // namespace views
102 100
103 #endif // #ifndef VIEWS_CONTROLS_NATIVE_CONTROL_WIN_H_ 101 #endif // #ifndef VIEWS_CONTROLS_NATIVE_CONTROL_WIN_H_
OLDNEW
« no previous file with comments | « chrome/browser/autocomplete/autocomplete_edit_view_win.cc ('k') | views/controls/native_control_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698