• 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   // The |handled| parameter is an output parameter which when set to false
27   // indicates that the message should be DefProc'ed.
28   // Returns the result of processing the message.
29   virtual LRESULT HandleMouseMessage(unsigned int message,
30                                      WPARAM w_param,
31                                      LPARAM l_param,
32                                      bool* handled) = 0;
33 
34   // Handles keyboard events like WM_KEYDOWN/WM_KEYUP, etc.
35   // The |message| parameter identifies the message.
36   // The |w_param| and |l_param| values are dependent on the type of the
37   // message.
38   // The |handled| parameter is an output parameter which when set to false
39   // indicates that the message should be DefProc'ed.
40   // Returns the result of processing the message.
41   virtual LRESULT HandleKeyboardMessage(unsigned int message,
42                                         WPARAM w_param,
43                                         LPARAM l_param,
44                                         bool* handled) = 0;
45 
46   // Handles WM_TOUCH events.
47   // The |message| parameter identifies the message.
48   // The |w_param| and |l_param| values are as per MSDN docs.
49   // The |handled| parameter is an output parameter which when set to false
50   // indicates that the message should be DefProc'ed.
51   // Returns the result of processing the message.
52   virtual LRESULT HandleTouchMessage(unsigned int message,
53                                      WPARAM w_param,
54                                      LPARAM l_param,
55                                      bool* handled) = 0;
56 
57   // Handles scroll messages like WM_VSCROLL and WM_HSCROLL.
58   // The |message| parameter identifies the scroll message.
59   // The |w_param| and |l_param| values are dependent on the type of scroll.
60   // The |handled| parameter is an output parameter which when set to false
61   // indicates that the message should be DefProc'ed.
62   virtual LRESULT HandleScrollMessage(unsigned int message,
63                                       WPARAM w_param,
64                                       LPARAM l_param,
65                                       bool* handled) = 0;
66 
67   // Handles the WM_NCHITTEST message
68   // The |message| parameter identifies the message.
69   // The |w_param| and |l_param| values are as per MSDN docs.
70   // The |handled| parameter is an output parameter which when set to false
71   // indicates that the message should be DefProc'ed.
72   // Returns the result of processing the message.
73   virtual LRESULT HandleNcHitTestMessage(unsigned int message,
74                                          WPARAM w_param,
75                                          LPARAM l_param,
76                                          bool* handled) = 0;
77  protected:
78   WindowEventTarget();
79   virtual ~WindowEventTarget();
80 };
81 
82 }  // namespace ui
83 
84 #endif  // UI_BASE_WIN_WINDOW_EVENT_TARGET_H_
85 
86 
87