blob: b42ff8dacf0735c0aeb1536d1965a55881b1e526 [file] [log] [blame]
Avi Drissman3e1a26c2022-09-15 20:26:031// Copyright 2014 The Chromium Authors
[email protected]6bc684df2014-02-20 20:29:352// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef UI_BASE_WIN_WINDOW_EVENT_TARGET_H_
6#define UI_BASE_WIN_WINDOW_EVENT_TARGET_H_
7
8#include <windows.h>
9
Henrique Ferreiro376c7652020-05-22 09:00:0410#include "base/component_export.h"
[email protected]6bc684df2014-02-20 20:29:3511
12namespace ui {
13
14// This interface is implemented by classes who get input events forwarded to
15// them from others. E.g. would be a win32 parent child relationship where the
16// child forwards input events to the parent after doing minimal processing.
Henrique Ferreiro376c7652020-05-22 09:00:0417class COMPONENT_EXPORT(UI_BASE) WindowEventTarget {
[email protected]6bc684df2014-02-20 20:29:3518 public:
19 static const char kWin32InputEventTarget[];
20
21 // Handles mouse events like WM_MOUSEMOVE, WM_LBUTTONDOWN, etc.
22 // The |message| parameter identifies the message.
23 // The |w_param| and |l_param| values are dependent on the type of the
24 // message.
[email protected]76c1a2b2014-06-24 01:58:1925 // The |handled| parameter is an output parameter which when set to false
26 // indicates that the message should be DefProc'ed.
[email protected]6bc684df2014-02-20 20:29:3527 // Returns the result of processing the message.
28 virtual LRESULT HandleMouseMessage(unsigned int message,
29 WPARAM w_param,
[email protected]76c1a2b2014-06-24 01:58:1930 LPARAM l_param,
31 bool* handled) = 0;
[email protected]6bc684df2014-02-20 20:29:3532
lanwei499bc4f2017-03-29 20:30:2933 // Handles pointer events like WM_POINTERUP, WM_POINTERDOWN, WM_POINTERUPDATE
34 // events.
35 // The |message| parameter identifies the message.
36 // The |w_param| and |l_param| values are as per MSDN docs.
37 // The |handled| parameter is an output parameter which when set to false
38 // indicates that the message should be DefProc'ed.
39 // Returns the result of processing the message.
40 virtual LRESULT HandlePointerMessage(unsigned int message,
41 WPARAM w_param,
42 LPARAM l_param,
43 bool* handled) = 0;
44
[email protected]6bc684df2014-02-20 20:29:3545 // Handles keyboard events like WM_KEYDOWN/WM_KEYUP, etc.
46 // The |message| parameter identifies the message.
47 // The |w_param| and |l_param| values are dependent on the type of the
48 // message.
[email protected]76c1a2b2014-06-24 01:58:1949 // The |handled| parameter is an output parameter which when set to false
50 // indicates that the message should be DefProc'ed.
[email protected]6bc684df2014-02-20 20:29:3551 // Returns the result of processing the message.
52 virtual LRESULT HandleKeyboardMessage(unsigned int message,
53 WPARAM w_param,
[email protected]76c1a2b2014-06-24 01:58:1954 LPARAM l_param,
55 bool* handled) = 0;
[email protected]6bc684df2014-02-20 20:29:3556
57 // Handles WM_TOUCH events.
58 // The |message| parameter identifies the message.
59 // The |w_param| and |l_param| values are as per MSDN docs.
[email protected]76c1a2b2014-06-24 01:58:1960 // The |handled| parameter is an output parameter which when set to false
61 // indicates that the message should be DefProc'ed.
[email protected]6bc684df2014-02-20 20:29:3562 // Returns the result of processing the message.
63 virtual LRESULT HandleTouchMessage(unsigned int message,
64 WPARAM w_param,
[email protected]76c1a2b2014-06-24 01:58:1965 LPARAM l_param,
66 bool* handled) = 0;
[email protected]6bc684df2014-02-20 20:29:3567
Ella Gedd3c80b42019-09-25 01:17:5768 // Handles WM_INPUT events.
69 // The |message| parameter identifies the message.
70 // The |w_param| and |l_param| values are as per MSDN docs.
71 // The |handled| parameter is an output parameter which when set to false
72 // indicates that the message should be DefProc'ed.
73 // Returns the result of processing the message.
74 virtual LRESULT HandleInputMessage(unsigned int message,
75 WPARAM w_param,
76 LPARAM l_param,
77 bool* handled) = 0;
78
[email protected]6bc684df2014-02-20 20:29:3579 // Handles scroll messages like WM_VSCROLL and WM_HSCROLL.
80 // The |message| parameter identifies the scroll message.
81 // The |w_param| and |l_param| values are dependent on the type of scroll.
[email protected]76c1a2b2014-06-24 01:58:1982 // The |handled| parameter is an output parameter which when set to false
83 // indicates that the message should be DefProc'ed.
[email protected]6bc684df2014-02-20 20:29:3584 virtual LRESULT HandleScrollMessage(unsigned int message,
85 WPARAM w_param,
[email protected]76c1a2b2014-06-24 01:58:1986 LPARAM l_param,
87 bool* handled) = 0;
[email protected]6bc684df2014-02-20 20:29:3588
89 // Handles the WM_NCHITTEST message
90 // The |message| parameter identifies the message.
91 // The |w_param| and |l_param| values are as per MSDN docs.
[email protected]76c1a2b2014-06-24 01:58:1992 // The |handled| parameter is an output parameter which when set to false
93 // indicates that the message should be DefProc'ed.
[email protected]6bc684df2014-02-20 20:29:3594 // Returns the result of processing the message.
95 virtual LRESULT HandleNcHitTestMessage(unsigned int message,
96 WPARAM w_param,
[email protected]76c1a2b2014-06-24 01:58:1997 LPARAM l_param,
98 bool* handled) = 0;
ananta6bdd5d52015-06-03 19:08:2499
chaopeng04fd9302018-03-02 21:43:06100 // Apply the transform from Direct Manipulation API.
chaopeng77ff930c2018-03-13 03:35:03101
102 // Calls ApplyPinchZoomScale() for pinch-zoom gesture. scale is the scale
103 // factor.
chaopeng04fd9302018-03-02 21:43:06104 virtual void ApplyPinchZoomScale(float scale) = 0;
chaopeng77ff930c2018-03-13 03:35:03105
106 // Pinch gesture phase. The sequencing expected of these events.
107 // The sequence of calls is ApplyPinchZoomBegin(), any number of calls to
108 // ApplyPinchZoomScale() and finally ApplyPinchZoomEnd().
109 virtual void ApplyPinchZoomBegin() = 0;
110 virtual void ApplyPinchZoomEnd() = 0;
111
112 // Calls ApplyPanGestureScroll() for pan gesture, scroll_x and scroll_y are
113 // pixel precison scroll offset.
chaopeng04fd9302018-03-02 21:43:06114 virtual void ApplyPanGestureScroll(int scroll_x, int scroll_y) = 0;
115
chaopenge8f2c032018-04-05 03:11:59116 // Calls ApplyPanGestureFling() for pan inertia gesture, scroll_x and scroll_y
117 // are pixel precison scroll offset.
118 virtual void ApplyPanGestureFling(int scroll_x, int scroll_y) = 0;
119
120 // Pan gesture phase. The sequencing expected of these events.
121 // The sequence of calls is ApplyPanGestureScrollBegin(), any number of calls
122 // to ApplyPanGestureScroll(), ApplyPanGestureScrollEnd(),
123 // ApplyPanGestureFlingBegin(), any number of calls to ApplyPanGestureFling(),
124 // and finally ApplyPanGestureFlingEnd().
Mario Bianucci4da9f93b2019-08-26 19:54:38125 // |transition_to_pinch| is a hint to know if the scroll end will be followed
126 // by a pinch begin or not, so that momentum_phase can be set to Blocked if
127 // a momentum scroll/fling will not be happening next.
chaopenge8f2c032018-04-05 03:11:59128 virtual void ApplyPanGestureScrollBegin(int scroll_x, int scroll_y) = 0;
Mario Bianucci4da9f93b2019-08-26 19:54:38129 virtual void ApplyPanGestureScrollEnd(bool transition_to_pinch) = 0;
chaopenge8f2c032018-04-05 03:11:59130 virtual void ApplyPanGestureFlingBegin() = 0;
131 virtual void ApplyPanGestureFlingEnd() = 0;
132
[email protected]6bc684df2014-02-20 20:29:35133 protected:
134 WindowEventTarget();
135 virtual ~WindowEventTarget();
136};
137
138} // namespace ui
139
140#endif // UI_BASE_WIN_WINDOW_EVENT_TARGET_H_
141
142