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