63d5dab2cd30d57dec48ac163c4e8e9891180aef
[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
51   virtual void Commit(unsigned handle, const std::string& text) OVERRIDE;
52   virtual void PreeditChanged(unsigned handle, const std::string& text,
53                               const std::string& commit) OVERRIDE;
54   virtual void PreeditEnd() OVERRIDE;
55   virtual void PreeditStart() OVERRIDE;
56
57   virtual void SetWindowChangeObserver(
58       ui::WindowChangeObserver* observer) OVERRIDE;
59   virtual void SetOutputChangeObserver(
60       ui::OutputChangeObserver* observer) OVERRIDE;
61
62  private:
63   // PlatformEventSource:
64   virtual void OnDispatcherListChanged() OVERRIDE;
65   static void NotifyMotion(EventConverterInProcess* data,
66                            float x,
67                            float y);
68   static void NotifyButtonPress(EventConverterInProcess* data,
69                                 unsigned handle,
70                                 ui::EventType type,
71                                 ui::EventFlags flags,
72                                 float x,
73                                 float y);
74   static void NotifyAxis(EventConverterInProcess* data,
75                          float x,
76                          float y,
77                          int xoffset,
78                          int yoffset);
79   static void NotifyPointerEnter(EventConverterInProcess* data,
80                                  unsigned handle,
81                                  float x,
82                                  float y);
83   static void NotifyPointerLeave(EventConverterInProcess* data,
84                                  unsigned handle,
85                                  float x,
86                                  float y);
87   static void NotifyKeyEvent(EventConverterInProcess* data,
88                              ui::EventType type,
89                              ui::KeyboardCode code,
90                              uint16 CharacterCodeFromNativeKey,
91                              unsigned modifiers);
92   static void NotifyTouchEvent(EventConverterInProcess* data,
93                                ui::EventType type,
94                                float x,
95                                float y,
96                                int32_t touch_id,
97                                uint32_t time_stamp);
98   static void NotifyCloseWidget(EventConverterInProcess* data,
99                                 unsigned handle);
100   static void NotifyOutputSizeChanged(EventConverterInProcess* data,
101                                       unsigned width,
102                                       unsigned height);
103   static void NotifyWindowResized(EventConverterInProcess* data,
104                                   unsigned handle,
105                                   unsigned width,
106                                   unsigned height);
107   static void NotifyCommit(EventConverterInProcess* data, unsigned handle,
108                            const std::string& text);
109   static void NotifyPreeditChanged(EventConverterInProcess* data,
110                                    unsigned handle,
111                                    const std::string& text,
112                                    const std::string& commit);
113   static void NotifyPreeditEnd(EventConverterInProcess* data);
114   static void NotifyPreeditStart(EventConverterInProcess* data);
115
116   ui::WindowChangeObserver* observer_;
117   ui::OutputChangeObserver* output_observer_;
118   base::Callback<void(void*)> dispatch_callback_;  // NOLINT(readability/
119                                                    // function)
120   DISALLOW_COPY_AND_ASSIGN(EventConverterInProcess);
121 };
122
123 }  // namespace ui
124
125 #endif  // OZONE_UI_EVENTS_EVENT_CONVERTER_IN_PROCESS_H_