Exiting from Screen zoom by pressing "Escape" or "Backspace" key.
[profile/tv/apps/web/browser.git] / services / PlatformInputManager / PlatformInputManager.h
1 /*
2  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the License);
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an AS IS BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #ifndef PLATFORMINPUTMANAGER_H
18 #define PLATFORMINPUTMANAGER_H
19
20 #include <boost/signals2/signal.hpp>
21 #include <boost/thread/thread.hpp>
22 #include <Ecore.h>
23 #include <Eina.h>
24 #include <Elementary.h>
25
26 #include "AbstractService.h"
27 #include "ServiceFactory.h"
28 #include "service_macros.h"
29
30 namespace tizen_browser
31 {
32 namespace services
33 {
34
35 class BROWSER_EXPORT PlatformInputManager : public tizen_browser::core::AbstractService
36 {
37 public:
38     /**
39      * @brief Default constructor with variable initialization.
40      */
41     PlatformInputManager();
42
43     /**
44      * @brief Initialization of the object, adding event filter, setting cursor to be always visible.
45      */
46     void init(Evas_Object *mainWindow);
47
48     /**
49      * Signals emitted after certain button on keyboard/remote controller press.
50      */
51     boost::signals2::signal<void ()> menuPressed;
52     boost::signals2::signal<void ()> returnPressed;
53     boost::signals2::signal<void ()> enterPressed;
54     boost::signals2::signal<void ()> leftPressed;
55     boost::signals2::signal<void ()> rightPressed;
56     boost::signals2::signal<void ()> backPressed;
57     boost::signals2::signal<void ()> escapePressed;
58     boost::signals2::signal<void ()> mouseClicked;
59
60     /**
61      * @brief Returns current service's name.
62      */
63     virtual std::string getName();
64
65 private:
66     /**
67      * @brief Struct holding parameters of mouse movement.
68      * It is used in pointer mode to simulate mouse move after pressing arrows.
69      */
70     struct MouseMovementParams {
71         bool moveMousePointer;
72         int xMod, yMod;
73         int counter, speed;
74     };
75
76     /**
77      * @brief It process every input event and handles it if necessary.
78      */
79     static Eina_Bool __filter(void */*data*/, void */*loop_data*/, int /*type*/, void */*event*/);
80 };
81
82 }
83 }
84
85 #endif // PLATFORMINPUTMANAGER_H