2007e18248b6eb0a7d584889346e1b7485e12bcf
[platform/framework/web/crosswalk.git] / src / ozone / ui / events / event_converter_in_process.h
1 // Copyright 2013 Intel Corporation. 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 OZONE_UI_EVENTS_EVENT_CONVERTER_IN_PROCESS_H_
6 #define OZONE_UI_EVENTS_EVENT_CONVERTER_IN_PROCESS_H_
7
8 #include <string>
9
10 #include "base/memory/scoped_ptr.h"
11 #include "ozone/ui/events/event_converter_ozone_wayland.h"
12 #include "ozone/ui/events/keyboard_code_conversion_ozone.h"
13 #include "ui/events/event.h"
14 #include "ui/events/platform/platform_event_source.h"
15
16 namespace ui {
17
18 class EventConverterInProcess : public ui::EventConverterOzoneWayland,
19                                 public ui::PlatformEventSource {
20  public:
21   EventConverterInProcess();
22   virtual ~EventConverterInProcess();
23
24   virtual void MotionNotify(float x, float y) OVERRIDE;
25   virtual void ButtonNotify(unsigned handle,
26                             ui::EventType type,
27                             ui::EventFlags flags,
28                             float x,
29                             float y) OVERRIDE;
30   virtual void AxisNotify(float x,
31                           float y,
32                           int xoffset,
33                           int yoffset) OVERRIDE;
34   virtual void PointerEnter(unsigned handle, float x, float y) OVERRIDE;
35   virtual void PointerLeave(unsigned handle, float x, float y) OVERRIDE;
36   virtual void KeyNotify(ui::EventType type,
37                          unsigned code,
38                          unsigned modifiers) OVERRIDE;
39   virtual void TouchNotify(ui::EventType type,
40                            float x,
41                            float y,
42                            int32_t touch_id,
43                            uint32_t time_stamp) OVERRIDE;
44   virtual void CloseWidget(unsigned handle) OVERRIDE;
45
46   virtual void OutputSizeChanged(unsigned width, unsigned height) OVERRIDE;
47   virtual void WindowResized(unsigned windowhandle,
48                              unsigned width,
49                              unsigned height) OVERRIDE;
50   virtual void WindowUnminimized(unsigned windowhandle) OVERRIDE;
51
52   virtual void Commit(unsigned handle, const std::string& text) OVERRIDE;
53   virtual void PreeditChanged(unsigned handle, const std::string& text,
54                               const std::string& commit) OVERRIDE;
55   virtual void PreeditEnd() OVERRIDE;
56   virtual void PreeditStart() OVERRIDE;
57
58   virtual void SetWindowChangeObserver(
59       ui::WindowChangeObserver* observer) OVERRIDE;
60   virtual void SetOutputChangeObserver(
61       ui::OutputChangeObserver* observer) OVERRIDE;
62
63  private:
64   // PlatformEventSource:
65   virtual void OnDispatcherListChanged() OVERRIDE;
66   static void NotifyMotion(EventConverterInProcess* data,
67                            float x,
68                            float y);
69   static void NotifyButtonPress(EventConverterInProcess* data,
70                                 unsigned handle,
71                                 ui::EventType type,
72                                 ui::EventFlags flags,
73                                 float x,
74                                 float y);
75   static void NotifyAxis(EventConverterInProcess* data,
76                          float x,
77                          float y,
78                          int xoffset,
79                          int yoffset);
80   static void NotifyPointerEnter(EventConverterInProcess* data,
81                                  unsigned handle,
82                                  float x,
83                                  float y);
84   static void NotifyPointerLeave(EventConverterInProcess* data,
85                                  unsigned handle,
86                                  float x,
87                                  float y);
88   static void NotifyKeyEvent(EventConverterInProcess* data,
89                              ui::EventType type,
90                              ui::KeyboardCode code,
91                              uint16 CharacterCodeFromNativeKey,
92                              unsigned modifiers);
93   static void NotifyTouchEvent(EventConverterInProcess* data,
94                                ui::EventType type,
95                                float x,
96                                float y,
97                                int32_t touch_id,
98                                uint32_t time_stamp);
99   static void NotifyCloseWidget(EventConverterInProcess* data,
100                                 unsigned handle);
101   static void NotifyOutputSizeChanged(EventConverterInProcess* data,
102                                       unsigned width,
103                                       unsigned height);
104   static void NotifyWindowResized(EventConverterInProcess* data,
105                                   unsigned handle,
106                                   unsigned width,
107                                   unsigned height);
108   static void NotifyWindowUnminimized(EventConverterInProcess* data,
109                                       unsigned handle);
110   static void NotifyCommit(EventConverterInProcess* data, unsigned handle,
111                            const std::string& text);
112   static void NotifyPreeditChanged(EventConverterInProcess* data,
113                                    unsigned handle,
114                                    const std::string& text,
115                                    const std::string& commit);
116   static void NotifyPreeditEnd(EventConverterInProcess* data);
117   static void NotifyPreeditStart(EventConverterInProcess* data);
118
119   ui::WindowChangeObserver* observer_;
120   ui::OutputChangeObserver* output_observer_;
121   base::Callback<void(void*)> dispatch_callback_;  // NOLINT(readability/
122                                                    // function)
123   DISALLOW_COPY_AND_ASSIGN(EventConverterInProcess);
124 };
125
126 }  // namespace ui
127
128 #endif  // OZONE_UI_EVENTS_EVENT_CONVERTER_IN_PROCESS_H_