Keyboard settings Blank screen issue fixed
[framework/uifw/ise-default.git] / mcf / include / mcfcontroller.h
1 /*
2  * Copyright 2012  Samsung Electronics Co., Ltd
3  *
4  * Licensed under the Flora License, Version 1.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.tizenopensource.org/license
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
18 #include "mcfgwes.h"
19 #include "mcfutils.h"
20 #include "mcfcontext.h"
21 #include "mcfeventcallback.h"
22
23 #ifndef __MCF_CONTROLLER_H__
24 #define __MCF_CONTROLLER_H__
25
26 //MCF_BEGIN_DECLS
27
28 namespace mcf
29 {
30 enum McfInternalSignal {
31     MCF_SIG_START,
32     MCF_SIG_SHOW,
33     MCF_SIG_HIDE,
34     MCF_SIG_INPMODE_CHANGE,
35     MCF_SIG_DISP_CHANGE,
36     MCF_SIG_POPUP_SHOW,
37     MCF_SIG_POPUP_HIDE,
38     MCF_SIG_MOUSE_PRESS,
39     MCF_SIG_MOUSE_LONG_PRESS,
40     MCF_SIG_MOUSE_RELEASE,
41     MCF_SIG_KEYEVENT,
42     MCF_SIG_FOCUS_CHANGE,
43
44     MCF_SIG_MAXNUM
45 };
46
47 /**
48  * @brief The base class to work as a soft-based keyboard
49  *
50  * This class implements all functions for working as a soft-based keyboard
51  * In side of ISE developer, they can modify it by their requirements.
52  */
53 class CMCFController
54 {
55 private:
56     static CMCFController* sInstance; /* For singleton */
57     CMCFController();
58 public:
59     ~CMCFController();
60
61     static CMCFController* get_instance();
62     void init();
63
64     void set_event_callback(IMCFEventCallback *callback);
65
66 private:
67     mcfboolean process_button_pressed_event(mcfwindow window, mcfint x, mcfint y, mcfbyte keyindex, mcftouchdevice touchid);
68     mcfboolean process_button_long_pressed_event(mcfwindow window, mcfbyte keyindex, mcftouchdevice touchid);
69     mcfboolean process_button_repeat_pressed_event(mcfwindow window, mcfbyte keyindex, mcftouchdevice touchid);
70     mcfboolean process_button_move_event(mcfwindow window, mcfint x, mcfint y, mcfbyte keyindex, mcftouchdevice touchid);
71     mcfboolean process_button_release_event(mcfwindow window, mcfint x, mcfint y, mcfbyte keyindex, mcftouchdevice touchid);
72
73     mcfboolean configure_autopopup_window(mcfwindow window, mcfbyte keyindex, McfRectangle* rect);
74
75     mcfboolean check_event_transition_enabled(const McfLayoutKeyConfigure *btnFrom, const McfLayoutKeyConfigure *btnTo);
76     MCFKeyModifier get_drag_key_modifier(mcfint deltax, mcfint deltay, mcffloat dist,
77                                          mcfboolean check_farthest,mcftouchdevice touchid, mcfbyte extraOption);
78
79 public:
80     void handle_engine_signal(McfInternalSignal signal, mcfwindow skipwindow = MCFWINDOW_INVALID);
81     mcfboolean process_input_mode_change(const mcfbyte mode, mcfboolean saveMultikeys = TRUE);
82     mcfboolean process_display_change(const mcfint degree);
83
84     mcfboolean mouse_press(mcfwindow window, mcfint x, mcfint y, mcftouchdevice touchid = 0);
85     mcfboolean mouse_release(mcfwindow window, mcfint x, mcfint y, mcftouchdevice touchid = 0);
86     mcfboolean mouse_move(mcfwindow window, mcfint x, mcfint y, mcftouchdevice touchid = 0);
87     mcfboolean timer_event(const mcf32 id);
88
89     mcfboolean set_longkey_duration(mcflong msc);
90     mcfboolean set_longkey_cancel_dist(mcfshort dist);
91     mcfboolean set_repeatkey_duration(mcflong msc);
92     mcfboolean set_short_longkey_duration(mcflong msc);
93
94     mcfboolean set_button_delay_duration(mcflong msc);
95
96     void clear_multikey_buffer();
97
98     MCFDebugMode get_debug_mode();
99     void set_debug_mode(MCFDebugMode mode);
100
101     void disable_input_events(mcfboolean disabled);
102 protected:
103
104     /* Interval time(msc) for checking long key event */
105     mcflong mLongkeyDuration;
106     mcfshort mLongkeyCancelDist;
107     mcflong mRepeatKeyDuration;
108     mcflong mShortLongkeyDuration;
109
110     mcflong mButtonDelayDuration;
111
112     IMCFEventCallback *mEventCallback;
113
114     MCFDebugMode mDebugMode;
115     mcfint mDebugVariable;
116
117     mcfint mRepeatKeySeq;
118
119     mcfboolean mInputEventsDisabled;
120
121     /* FIXME : A workaround for restoring multikeyidx, should be implemented after designing whole usecases */
122     #define MAX_MULTIKEY_BUFFER 50
123     mcfshort mMultiKeyBuffer[MAX_MULTIKEY_BUFFER][3]; /* 0 for layout, 1 for keyindex, 2 for value */
124 };
125
126 }
127
128 //MCF_END_DECLS
129
130 #endif //__MCF_CONTROLLER_H__