[SyncFS] Build indexes from FileTracker entries on disk.
[chromium-blink-merge.git] / ui / views / win / hwnd_message_handler_delegate.h
blobe17bf78eaa690a6a742035e5225542bc51248a1a
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
3 // found in the LICENSE file.
5 #ifndef UI_VIEWS_WIN_HWND_MESSAGE_HANDLER_DELEGATE_H_
6 #define UI_VIEWS_WIN_HWND_MESSAGE_HANDLER_DELEGATE_H_
8 #include "ui/views/views_export.h"
10 namespace gfx {
11 class Canvas;
12 class Insets;
13 class Path;
14 class Point;
15 class Size;
18 namespace ui {
19 class Accelerator;
20 class KeyEvent;
21 class MouseEvent;
22 class TouchEvent;
25 namespace views {
27 class InputMethod;
29 // Implemented by the object that uses the HWNDMessageHandler to handle
30 // notifications from the underlying HWND and service requests for data.
31 class VIEWS_EXPORT HWNDMessageHandlerDelegate {
32 public:
33 virtual bool IsWidgetWindow() const = 0;
35 // TODO(beng): resolve this more satisfactorily vis-a-vis ShouldUseNativeFrame
36 // to avoid confusion.
37 virtual bool IsUsingCustomFrame() const = 0;
39 virtual void SchedulePaint() = 0;
40 virtual void EnableInactiveRendering() = 0;
41 virtual bool IsInactiveRenderingDisabled() = 0;
43 virtual bool CanResize() const = 0;
44 virtual bool CanMaximize() const = 0;
45 virtual bool CanActivate() const = 0;
47 virtual bool WidgetSizeIsClientSize() const = 0;
49 // Returns true if the delegate represents a modal window.
50 virtual bool IsModal() const = 0;
52 // Returns the show state that should be used for the application's first
53 // window.
54 virtual int GetInitialShowState() const = 0;
56 virtual bool WillProcessWorkAreaChange() const = 0;
58 virtual int GetNonClientComponent(const gfx::Point& point) const = 0;
59 virtual void GetWindowMask(const gfx::Size& size, gfx::Path* mask) = 0;
61 // Returns true if the delegate modifies |insets| to define a custom client
62 // area for the window, false if the default client area should be used. If
63 // false is returned, |insets| is not modified.
64 virtual bool GetClientAreaInsets(gfx::Insets* insets) const = 0;
66 // Returns the minimum and maximum size the window can be resized to by the
67 // user.
68 virtual void GetMinMaxSize(gfx::Size* min_size,
69 gfx::Size* max_size) const = 0;
71 // Returns the current size of the RootView.
72 virtual gfx::Size GetRootViewSize() const = 0;
74 virtual void ResetWindowControls() = 0;
76 virtual void PaintLayeredWindow(gfx::Canvas* canvas) = 0;
78 virtual InputMethod* GetInputMethod() = 0;
80 virtual gfx::NativeViewAccessible GetNativeViewAccessible() = 0;
82 // Returns true if the window should handle standard system commands, such as
83 // close, minimize, maximize.
84 // TODO(benwells): Remove this once bubbles don't have two widgets
85 // implementing them on non-aura windows. http://crbug.com/189112.
86 virtual bool ShouldHandleSystemCommands() const = 0;
88 // TODO(beng): Investigate migrating these methods to On* prefixes once
89 // HWNDMessageHandler is the WindowImpl.
91 // Called when another app was activated.
92 virtual void HandleAppDeactivated() = 0;
94 // Called when the window was activated or deactivated. |active| reflects the
95 // new state.
96 virtual void HandleActivationChanged(bool active) = 0;
98 // Called when a well known "app command" from the system was performed.
99 // Returns true if the command was handled.
100 virtual bool HandleAppCommand(short command) = 0;
102 // Called from WM_CANCELMODE.
103 virtual void HandleCancelMode() = 0;
105 // Called when the window has lost mouse capture.
106 virtual void HandleCaptureLost() = 0;
108 // Called when the user tried to close the window.
109 virtual void HandleClose() = 0;
111 // Called when a command defined by the application was performed. Returns
112 // true if the command was handled.
113 virtual bool HandleCommand(int command) = 0;
115 // Called when an accelerator is invoked.
116 virtual void HandleAccelerator(const ui::Accelerator& accelerator) = 0;
118 // Called when the HWND is created.
119 virtual void HandleCreate() = 0;
121 // Called when the HWND is being destroyed, before any child HWNDs are
122 // destroyed.
123 virtual void HandleDestroying() = 0;
125 // Called after the HWND is destroyed, after all child HWNDs have been
126 // destroyed.
127 virtual void HandleDestroyed() = 0;
129 // Called when the HWND is to be focused for the first time. This is called
130 // when the window is shown for the first time. Returns true if the delegate
131 // set focus and no default processing should be done by the message handler.
132 virtual bool HandleInitialFocus(ui::WindowShowState show_state) = 0;
134 // Called when display settings are adjusted on the system.
135 virtual void HandleDisplayChange() = 0;
137 // Called when the user begins or ends a size/move operation using the window
138 // manager.
139 virtual void HandleBeginWMSizeMove() = 0;
140 virtual void HandleEndWMSizeMove() = 0;
142 // Called when the window's position changed.
143 virtual void HandleMove() = 0;
145 // Called when the system's work area has changed.
146 virtual void HandleWorkAreaChanged() = 0;
148 // Called when the window's visibility is changing. |visible| holds the new
149 // state.
150 virtual void HandleVisibilityChanging(bool visible) = 0;
152 // Called when the window's visibility changed. |visible| holds the new state.
153 virtual void HandleVisibilityChanged(bool visible) = 0;
155 // Called when the window's client size changed. |new_size| holds the new
156 // size.
157 virtual void HandleClientSizeChanged(const gfx::Size& new_size) = 0;
159 // Called when the window's frame has changed.
160 virtual void HandleFrameChanged() = 0;
162 // Called when focus shifted to this HWND from |last_focused_window|.
163 virtual void HandleNativeFocus(HWND last_focused_window) = 0;
165 // Called when focus shifted from the HWND to a different window.
166 virtual void HandleNativeBlur(HWND focused_window) = 0;
168 // Called when a mouse event is received. Returns true if the event was
169 // handled by the delegate.
170 virtual bool HandleMouseEvent(const ui::MouseEvent& event) = 0;
172 // Called when a translated key event is received (i.e. post IME translation.)
173 // Returns true if the event was handled by the delegate.
174 virtual bool HandleKeyEvent(const ui::KeyEvent& event) = 0;
176 // Called when an untranslated key event is received (i.e. pre-IME
177 // translation). Returns true if the event was sent to the input method.
178 virtual bool HandleUntranslatedKeyEvent(const ui::KeyEvent& event) = 0;
180 // Called when a touch event is received.
181 virtual void HandleTouchEvent(const ui::TouchEvent& event) = 0;
183 // Called when an IME message needs to be processed by the delegate. Returns
184 // true if the event was handled and no default processing should be
185 // performed.
186 virtual bool HandleIMEMessage(UINT message,
187 WPARAM w_param,
188 LPARAM l_param,
189 LRESULT* result) = 0;
191 // Called when the system input language changes.
192 virtual void HandleInputLanguageChange(DWORD character_set,
193 HKL input_language_id) = 0;
195 // Called to compel the delegate to paint |invalid_rect| accelerated. Returns
196 // true if accelerated painting was performed.
197 virtual bool HandlePaintAccelerated(const gfx::Rect& invalid_rect) = 0;
199 // Called to compel the delegate to paint using the software path.
200 virtual void HandlePaint(gfx::Canvas* canvas) = 0;
202 // Called to forward a WM_NOTIFY message to the tooltip manager.
203 virtual bool HandleTooltipNotify(int w_param,
204 NMHDR* l_param,
205 LRESULT* l_result) = 0;
207 // Called to forward mouse events to the tooltip manager.
208 virtual void HandleTooltipMouseMove(UINT message,
209 WPARAM w_param,
210 LPARAM l_param) = 0;
212 // Invoked on entering/exiting a menu loop.
213 virtual void HandleMenuLoop(bool in_menu_loop) = 0;
215 // Catch-all message handling and filtering. Called before
216 // HWNDMessageHandler's built-in handling, which may pre-empt some
217 // expectations in Views/Aura if messages are consumed. Returns true if the
218 // message was consumed by the delegate and should not be processed further
219 // by the HWNDMessageHandler. In this case, |result| is returned. |result| is
220 // not modified otherwise.
221 virtual bool PreHandleMSG(UINT message,
222 WPARAM w_param,
223 LPARAM l_param,
224 LRESULT* result) = 0;
226 // Like PreHandleMSG, but called after HWNDMessageHandler's built-in handling
227 // has run and after DefWindowProc.
228 virtual void PostHandleMSG(UINT message,
229 WPARAM w_param,
230 LPARAM l_param) = 0;
232 // Called when a scroll event is received. Returns true if the event was
233 // handled by the delegate.
234 virtual bool HandleScrollEvent(const ui::ScrollEvent& event) = 0;
236 // Called when the window size is about to change.
237 virtual void HandleWindowSizeChanging() = 0;
239 protected:
240 virtual ~HWNDMessageHandlerDelegate() {}
243 } // namespace views
245 #endif // UI_VIEWS_WIN_HWND_MESSAGE_HANDLER_DELEGATE_H_