2 * Copyright (c) 2012 - 2014 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 #include "sclres_type.h"
19 #ifndef __SCL_KEY_FOCUS_HANDLER_H__
20 #define __SCL_KEY_FOCUS_HANDLER_H__
22 //#define TARGET_EMULATOR
28 #define NAVI_INFO_MAX_ROWS 20
29 #define NAVI_INFO_MAX_COLS 20
33 scl8 candidate_otherside;
34 } NEXT_CANDIDATE_INFO;
37 typedef struct _SclKeyboardRowInfo {
41 sclshort col_coord[NAVI_INFO_MAX_COLS];
44 typedef struct _SclKeyFocusNavigationInfo {
47 SclKeyboardRowInfo* rows[NAVI_INFO_MAX_ROWS];
48 }SclKeyFocusNavigationInfo;
50 typedef struct _SclPopupRelativeKeyInfo {
53 }SclPopupRelativeKeyInfo;
55 typedef struct _SclPopupRowInfo {
58 sclshort col_coord[NAVI_INFO_MAX_COLS];
59 SclPopupRelativeKeyInfo nexts[NAVI_INFO_MAX_COLS][NAVIGATE_MAX];
62 typedef struct _SclPopupNavigationInfo {
65 SclPopupRowInfo* rows[NAVI_INFO_MAX_ROWS];
66 }SclPopupNavigationInfo;
70 * @brief The class to store key focus navigation information
72 * This class implements functions to support key focus navigation on the software keyboard
73 * using remote controller input. It generates navigation information for the currently loaded
74 * keyboard layout and provides the index of next key depending upon the navigation direction.
75 * The key information can be retrieved from the array of key coordinates from Resource Cache.
77 * Apart from key navigation information, this class also provides functions to grab and ungrab
78 * the remote controller keys.
80 * The public interface can be divided in three categories :
81 * 1. Focus grab/ungrab API : Invoked while showing and hiding the software keyboard
82 * - Client class: CSCLWindowsImplEfl
83 * 2. Focus navigation info building API : Invoked while computing layout of the current keyboard
84 * - Client class/function: CSCLResourceCache::recompute_layout
85 * 3. Focus navigation API: Invoked while handling remote controller key press events
86 * - Client class: CSCLEventsImplEfl
88 class CSCLKeyFocusHandler
91 virtual ~CSCLKeyFocusHandler();
93 static CSCLKeyFocusHandler* get_instance();
96 /*Focus grab/ungrab API*/
97 bool grab_keyboard(const sclwindow parent);
98 void ungrab_keyboard(const sclwindow parent);
101 /*Focus navigation info building API*/
102 void reset_key_navigation_info(sclwindow window);
103 void update_key_navigation_info(sclwindow window, scl8 index, SclLayoutKeyCoordinatePointer p_next_key);
104 void finalize_key_navigation_info(sclwindow window);
106 void popup_opened(sclwindow window);
107 void popup_closed(sclwindow window);
109 /*Focus navigation API*/
110 void init_key_index();
111 scl8 get_current_focus_key(void);
112 sclwindow get_current_focus_window(void);
113 void process_navigation(SCLHighlightNavigationDirection direction);
115 void set_current_focus(sclwindow window, scl8 index);
118 NEXT_CANDIDATE_INFO get_next_candidate_key(SCLHighlightNavigationDirection direction, SclRectangle cur, sclwindow window);
120 sclwindow m_focus_window;
123 #ifdef USING_KEY_GRAB
124 bool m_keyboard_grabbed;
126 bool sub_layout_match(sclchar *layout1, sclchar *layout2);
128 CSCLKeyFocusHandler();
129 #ifdef TARGET_EMULATOR
131 void create_sniffer_window(void);
132 void set_window_accepts_focus(const sclwindow window, sclboolean acceptable);