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

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

Issue 8687031: views: Move the remaining files to ui/views/controls/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years 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/native_control_gtk.cc ('k') | views/controls/native_control_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef VIEWS_CONTROLS_NATIVE_CONTROL_WIN_H_
6 #define VIEWS_CONTROLS_NATIVE_CONTROL_WIN_H_
7 #pragma once
8
9 #include "base/basictypes.h"
10 #include "base/compiler_specific.h"
11 #include "base/memory/scoped_vector.h"
12 #include "ui/views/controls/native/native_view_host.h"
13 #include "ui/views/widget/child_window_message_processor.h"
14
15 namespace ui {
16 class ViewProp;
17 }
18
19 namespace views {
20
21 // A View that hosts a native Windows control.
22 class NativeControlWin : public ChildWindowMessageProcessor,
23 public NativeViewHost {
24 public:
25 NativeControlWin();
26 virtual ~NativeControlWin();
27
28 // Called by our subclassed window procedure when a WM_KEYDOWN message is
29 // received by the HWND created by an object derived from NativeControlWin.
30 // Returns true if the key was processed, false otherwise.
31 virtual bool OnKeyDown(int vkey) { return false; }
32
33 // Overridden from ChildWindowMessageProcessor:
34 virtual bool ProcessMessage(UINT message,
35 WPARAM w_param,
36 LPARAM l_param,
37 LRESULT* result) OVERRIDE;
38
39 // Overridden from View:
40 virtual void OnEnabledChanged() OVERRIDE;
41
42 protected:
43 virtual void ViewHierarchyChanged(bool is_add,
44 View* parent,
45 View* child) OVERRIDE;
46 virtual void VisibilityChanged(View* starting_from, bool is_visible) OVERRIDE;
47 virtual void OnFocus() OVERRIDE;
48
49 // Called by the containing NativeWidgetWin when a WM_CONTEXTMENU message is
50 // received from the HWND created by an object derived from NativeControlWin.
51 virtual void ShowContextMenu(const gfx::Point& location);
52
53 // Called when the NativeControlWin is attached to a View hierarchy with a
54 // valid Widget. The NativeControlWin should use this opportunity to create
55 // its associated HWND.
56 virtual void CreateNativeControl() = 0;
57
58 // MUST be called by the subclass implementation of |CreateNativeControl|
59 // immediately after creating the control HWND, otherwise it won't be attached
60 // to the NativeViewHost and will be effectively orphaned.
61 virtual void NativeControlCreated(HWND native_control);
62
63 // Returns additional extended style flags. When subclasses call
64 // CreateWindowEx in order to create the underlying control, they must OR the
65 // ExStyle parameter with the value returned by this function.
66 //
67 // We currently use this method in order to add flags such as WS_EX_LAYOUTRTL
68 // to the HWND for views with right-to-left UI layout.
69 DWORD GetAdditionalExStyle() const;
70
71 // TODO(xji): we use the following temporary function as we transition the
72 // various native controls to use the right set of RTL flags. This function
73 // will go away (and be replaced by GetAdditionalExStyle()) once all the
74 // controls are properly transitioned.
75 DWORD GetAdditionalRTLStyle() const;
76
77 private:
78 typedef ScopedVector<ui::ViewProp> ViewProps;
79
80 // Called by the containing NativeWidgetWin when a message of type
81 // WM_CTLCOLORBTN or WM_CTLCOLORSTATIC is sent from the HWND created by an
82 // object derived from NativeControlWin.
83 LRESULT GetControlColor(UINT message, HDC dc, HWND sender);
84
85 // Our subclass window procedure for the attached control.
86 static LRESULT CALLBACK NativeControlWndProc(HWND window,
87 UINT message,
88 WPARAM w_param,
89 LPARAM l_param);
90
91 // The window procedure before we subclassed.
92 WNDPROC original_wndproc_;
93
94 ViewProps props_;
95
96 DISALLOW_COPY_AND_ASSIGN(NativeControlWin);
97 };
98
99 } // namespace views
100
101 #endif // VIEWS_CONTROLS_NATIVE_CONTROL_WIN_H_
OLDNEW
« no previous file with comments | « views/controls/native_control_gtk.cc ('k') | views/controls/native_control_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698