• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2014 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 UI_BASE_WIN_WINDOW_EVENT_TARGET_H_
6 #define UI_BASE_WIN_WINDOW_EVENT_TARGET_H_
7 
8 #include <windows.h>
9 
10 #include "base/basictypes.h"
11 #include "ui/base/ui_base_export.h"
12 
13 namespace ui {
14 
15 // This interface is implemented by classes who get input events forwarded to
16 // them from others. E.g. would be a win32 parent child relationship where the
17 // child forwards input events to the parent after doing minimal processing.
18 class UI_BASE_EXPORT WindowEventTarget {
19  public:
20   static const char kWin32InputEventTarget[];
21 
22   // Handles mouse events like WM_MOUSEMOVE, WM_LBUTTONDOWN, etc.
23   // The |message| parameter identifies the message.
24   // The |w_param| and |l_param| values are dependent on the type of the
25   // message.
26   // Returns the result of processing the message.
27   virtual LRESULT HandleMouseMessage(unsigned int message,
28                                      WPARAM w_param,
29                                      LPARAM l_param) = 0;
30 
31   // Handles keyboard events like WM_KEYDOWN/WM_KEYUP, etc.
32   // The |message| parameter identifies the message.
33   // The |w_param| and |l_param| values are dependent on the type of the
34   // message.
35   // Returns the result of processing the message.
36   virtual LRESULT HandleKeyboardMessage(unsigned int message,
37                                         WPARAM w_param,
38                                         LPARAM l_param) = 0;
39 
40   // Handles WM_TOUCH events.
41   // The |message| parameter identifies the message.
42   // The |w_param| and |l_param| values are as per MSDN docs.
43   // Returns the result of processing the message.
44   virtual LRESULT HandleTouchMessage(unsigned int message,
45                                      WPARAM w_param,
46                                      LPARAM l_param) = 0;
47 
48   // Handles scroll messages like WM_VSCROLL and WM_HSCROLL.
49   // The |message| parameter identifies the scroll message.
50   // The |w_param| and |l_param| values are dependent on the type of scroll.
51   virtual LRESULT HandleScrollMessage(unsigned int message,
52                                       WPARAM w_param,
53                                       LPARAM l_param) = 0;
54 
55   // Handles the WM_NCHITTEST message
56   // The |message| parameter identifies the message.
57   // The |w_param| and |l_param| values are as per MSDN docs.
58   // Returns the result of processing the message.
59   virtual LRESULT HandleNcHitTestMessage(unsigned int message,
60                                          WPARAM w_param,
61                                          LPARAM l_param) = 0;
62  protected:
63   WindowEventTarget();
64   virtual ~WindowEventTarget();
65 };
66 
67 }  // namespace ui
68 
69 #endif  // UI_BASE_WIN_WINDOW_EVENT_TARGET_H_
70 
71 
72