| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this |
| 2 // source code is governed by a BSD-style license that can be found in the | 2 // source code is governed by a BSD-style license that can be found in the |
| 3 // LICENSE file. | 3 // 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 | 7 |
| 8 #include "views/controls/native/native_view_host.h" | 8 #include "views/controls/native/native_view_host.h" |
| 9 | 9 |
| 10 namespace views { | 10 namespace views { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 | 38 |
| 39 protected: | 39 protected: |
| 40 virtual void ViewHierarchyChanged(bool is_add, View *parent, View *child); | 40 virtual void ViewHierarchyChanged(bool is_add, View *parent, View *child); |
| 41 virtual void VisibilityChanged(View* starting_from, bool is_visible); | 41 virtual void VisibilityChanged(View* starting_from, bool is_visible); |
| 42 virtual void Focus(); | 42 virtual void Focus(); |
| 43 | 43 |
| 44 // Called by the containing WidgetWin when a WM_CONTEXTMENU message is | 44 // Called by the containing WidgetWin when a WM_CONTEXTMENU message is |
| 45 // received from the HWND created by an object derived from NativeControlWin. | 45 // received from the HWND created by an object derived from NativeControlWin. |
| 46 virtual void ShowContextMenu(const gfx::Point& location); | 46 virtual void ShowContextMenu(const gfx::Point& location); |
| 47 | 47 |
| 48 // Derived classes interested in receiving key down notification should | |
| 49 // override this method and return true. In which case OnKeyDown is called | |
| 50 // when a key down message is sent to the control. | |
| 51 // Note that this method is called at the time of the control creation: the | |
| 52 // behavior will not change if the returned value changes after the control | |
| 53 // has been created. | |
| 54 virtual bool NotifyOnKeyDown() const { return false; } | |
| 55 | |
| 56 // Called when the NativeControlWin is attached to a View hierarchy with a | 48 // Called when the NativeControlWin is attached to a View hierarchy with a |
| 57 // valid Widget. The NativeControlWin should use this opportunity to create | 49 // valid Widget. The NativeControlWin should use this opportunity to create |
| 58 // its associated HWND. | 50 // its associated HWND. |
| 59 virtual void CreateNativeControl() = 0; | 51 virtual void CreateNativeControl() = 0; |
| 60 | 52 |
| 61 // MUST be called by the subclass implementation of |CreateNativeControl| | 53 // MUST be called by the subclass implementation of |CreateNativeControl| |
| 62 // immediately after creating the control HWND, otherwise it won't be attached | 54 // immediately after creating the control HWND, otherwise it won't be attached |
| 63 // to the NativeViewHost and will be effectively orphaned. | 55 // to the NativeViewHost and will be effectively orphaned. |
| 64 virtual void NativeControlCreated(HWND native_control); | 56 virtual void NativeControlCreated(HWND native_control); |
| 65 | 57 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 83 // NativeControlWin. | 75 // NativeControlWin. |
| 84 LRESULT GetControlColor(UINT message, HDC dc, HWND sender); | 76 LRESULT GetControlColor(UINT message, HDC dc, HWND sender); |
| 85 | 77 |
| 86 // Our subclass window procedure for the attached control. | 78 // Our subclass window procedure for the attached control. |
| 87 static LRESULT CALLBACK NativeControlWndProc(HWND window, | 79 static LRESULT CALLBACK NativeControlWndProc(HWND window, |
| 88 UINT message, | 80 UINT message, |
| 89 WPARAM w_param, | 81 WPARAM w_param, |
| 90 LPARAM l_param); | 82 LPARAM l_param); |
| 91 | 83 |
| 92 // The window procedure before we subclassed. | 84 // The window procedure before we subclassed. |
| 93 static WNDPROC original_wndproc_; | 85 WNDPROC original_wndproc_; |
| 94 | 86 |
| 95 DISALLOW_COPY_AND_ASSIGN(NativeControlWin); | 87 DISALLOW_COPY_AND_ASSIGN(NativeControlWin); |
| 96 }; | 88 }; |
| 97 | 89 |
| 98 } // namespace views | 90 } // namespace views |
| 99 | 91 |
| 100 #endif // #ifndef VIEWS_CONTROLS_NATIVE_CONTROL_WIN_H_ | 92 #endif // #ifndef VIEWS_CONTROLS_NATIVE_CONTROL_WIN_H_ |
| OLD | NEW |