Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 UI_VIEWS_WIN_HWND_MESSAGE_HANDLER_DELEGATE_H_ | 5 #ifndef UI_VIEWS_WIN_HWND_MESSAGE_HANDLER_DELEGATE_H_ |
| 6 #define UI_VIEWS_WIN_HWND_MESSAGE_HANDLER_DELEGATE_H_ | 6 #define UI_VIEWS_WIN_HWND_MESSAGE_HANDLER_DELEGATE_H_ |
| 7 | 7 |
| 8 #include "ui/views/views_export.h" | 8 #include "ui/views/views_export.h" |
| 9 | 9 |
| 10 namespace gfx { | 10 namespace gfx { |
| 11 class Insets; | 11 class Insets; |
| 12 class Path; | 12 class Path; |
| 13 class Point; | 13 class Point; |
| 14 class Size; | 14 class Size; |
| 15 } | 15 } |
| 16 | 16 |
| 17 namespace views { | 17 namespace views { |
| 18 | 18 |
| 19 class InputMethod; | 19 class InputMethod; |
| 20 class NativeWidgetWin; | |
| 21 | 20 |
| 22 // Implemented by the object that uses the HWNDMessageHandler to handle | 21 // Implemented by the object that uses the HWNDMessageHandler to handle |
| 23 // notifications from the underlying HWND and service requests for data. | 22 // notifications from the underlying HWND and service requests for data. |
| 24 class VIEWS_EXPORT HWNDMessageHandlerDelegate { | 23 class VIEWS_EXPORT HWNDMessageHandlerDelegate { |
| 25 public: | 24 public: |
| 26 virtual bool IsWidgetWindow() const = 0; | 25 virtual bool IsWidgetWindow() const = 0; |
| 27 | 26 |
| 28 // TODO(beng): resolve this more satisfactorily vis-a-vis ShouldUseNativeFrame | 27 // TODO(beng): resolve this more satisfactorily vis-a-vis ShouldUseNativeFrame |
| 29 // to avoid confusion. | 28 // to avoid confusion. |
| 30 virtual bool IsUsingCustomFrame() const = 0; | 29 virtual bool IsUsingCustomFrame() const = 0; |
| 31 | 30 |
| 32 virtual void SchedulePaint() = 0; | 31 virtual void SchedulePaint() = 0; |
| 33 virtual void EnableInactiveRendering() = 0; | 32 virtual void EnableInactiveRendering() = 0; |
| 34 virtual bool IsInactiveRenderingDisabled() = 0; | 33 virtual bool IsInactiveRenderingDisabled() = 0; |
| 35 | 34 |
| 36 virtual bool CanResize() const = 0; | 35 virtual bool CanResize() const = 0; |
| 37 virtual bool CanMaximize() const = 0; | 36 virtual bool CanMaximize() const = 0; |
| 38 virtual bool CanActivate() const = 0; | 37 virtual bool CanActivate() const = 0; |
| 39 | 38 |
| 39 virtual bool WidgetSizeIsClientSize() const = 0; | |
| 40 | |
| 40 // Returns true if the delegate has a focus saving mechanism that should be | 41 // Returns true if the delegate has a focus saving mechanism that should be |
| 41 // used when the window is activated and deactivated. | 42 // used when the window is activated and deactivated. |
| 42 virtual bool CanSaveFocus() const = 0; | 43 virtual bool CanSaveFocus() const = 0; |
| 43 virtual void SaveFocusOnDeactivate() = 0; | 44 virtual void SaveFocusOnDeactivate() = 0; |
| 44 virtual void RestoreFocusOnActivate() = 0; | 45 virtual void RestoreFocusOnActivate() = 0; |
| 45 virtual void RestoreFocusOnEnable() = 0; | 46 virtual void RestoreFocusOnEnable() = 0; |
| 46 | 47 |
| 47 // Returns true if the delegate represents a modal window. | 48 // Returns true if the delegate represents a modal window. |
| 48 virtual bool IsModal() const = 0; | 49 virtual bool IsModal() const = 0; |
| 49 | 50 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 81 // TODO(beng): Investigate migrating these methods to On* prefixes once | 82 // TODO(beng): Investigate migrating these methods to On* prefixes once |
| 82 // HWNDMessageHandler is the WindowImpl. | 83 // HWNDMessageHandler is the WindowImpl. |
| 83 | 84 |
| 84 // Called when another app was activated. | 85 // Called when another app was activated. |
| 85 virtual void HandleAppDeactivated() = 0; | 86 virtual void HandleAppDeactivated() = 0; |
| 86 | 87 |
| 87 // Called when the window was activated or deactivated. |active| reflects the | 88 // Called when the window was activated or deactivated. |active| reflects the |
| 88 // new state. | 89 // new state. |
| 89 virtual void HandleActivationChanged(bool active) = 0; | 90 virtual void HandleActivationChanged(bool active) = 0; |
| 90 | 91 |
| 92 // Called when the user clicks on the window with the mouse to activate it. | |
| 93 virtual void HandleMouseActivate(int hittest_code) = 0; | |
| 94 | |
| 91 // Called when a well known "app command" from the system was performed. | 95 // Called when a well known "app command" from the system was performed. |
| 92 // Returns true if the command was handled. | 96 // Returns true if the command was handled. |
| 93 virtual bool HandleAppCommand(short command) = 0; | 97 virtual bool HandleAppCommand(short command) = 0; |
| 94 | 98 |
| 95 // Called when the window has lost mouse capture. | 99 // Called when the window has lost mouse capture. |
| 96 virtual void HandleCaptureLost() = 0; | 100 virtual void HandleCaptureLost() = 0; |
| 97 | 101 |
| 98 // Called when the user tried to close the window. | 102 // Called when the user tried to close the window. |
| 99 virtual void HandleClose() = 0; | 103 virtual void HandleClose() = 0; |
| 100 | 104 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 172 // Called to forward a WM_NOTIFY message to the tooltip manager. | 176 // Called to forward a WM_NOTIFY message to the tooltip manager. |
| 173 virtual bool HandleTooltipNotify(int w_param, | 177 virtual bool HandleTooltipNotify(int w_param, |
| 174 NMHDR* l_param, | 178 NMHDR* l_param, |
| 175 LRESULT* l_result) = 0; | 179 LRESULT* l_result) = 0; |
| 176 | 180 |
| 177 // Called to forward mouse events to the tooltip manager. | 181 // Called to forward mouse events to the tooltip manager. |
| 178 virtual void HandleTooltipMouseMove(UINT message, | 182 virtual void HandleTooltipMouseMove(UINT message, |
| 179 WPARAM w_param, | 183 WPARAM w_param, |
| 180 LPARAM l_param) = 0; | 184 LPARAM l_param) = 0; |
| 181 | 185 |
| 182 // This is provided for methods that need to call private methods on NWW. | 186 // Called when the windows session is ending. |
| 183 // TODO(beng): should be removed once HWNDMessageHandler is the WindowImpl. | 187 virtual void HandleEndSession() = 0; |
| 184 virtual NativeWidgetWin* AsNativeWidgetWin() = 0; | 188 |
| 189 // Called when a native menu is opened to perform initialization. | |
| 190 virtual void HandleInitMenuPopup() = 0; | |
| 191 | |
| 192 // Called when the window's frame has changed. | |
| 193 virtual void HandleFrameChanged() = 0; | |
| 194 | |
| 195 // Catch-all. Called before handling any messages. Returns true if the | |
| 196 // message should not be processed further, returning the value in |result|. | |
|
sky
2012/08/27 23:36:04
nit: clarify 'returning the value' applies to OnWn
| |
| 197 virtual bool HandleMSG(UINT message, | |
| 198 WPARAM w_param, | |
| 199 LPARAM l_param, | |
| 200 LRESULT* result) = 0; | |
| 185 | 201 |
| 186 protected: | 202 protected: |
| 187 virtual ~HWNDMessageHandlerDelegate() {} | 203 virtual ~HWNDMessageHandlerDelegate() {} |
| 188 }; | 204 }; |
| 189 | 205 |
| 190 } // namespace views | 206 } // namespace views |
| 191 | 207 |
| 192 #endif // UI_VIEWS_WIN_HWND_MESSAGE_HANDLER_DELEGATE_H_ | 208 #endif // UI_VIEWS_WIN_HWND_MESSAGE_HANDLER_DELEGATE_H_ |
| OLD | NEW |