2 * Copyright (c) 2021 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.
17 #ifndef __SCL_CSHARP_NUI_H__
18 #define __SCL_CSHARP_NUI_H__
21 #include <cscl-ui-controller.h>
23 #define MAX_FONT_NAME_LEN 32
24 #define DEGREE_TO_SCLROTATION(degree) \
25 (degree == 90 ? ROTATION_90_CW : \
26 (degree == 180 ? ROTATION_180 : \
27 (degree == 270 ? ROTATION_90_CCW : \
34 typedef enum _LabelAlignment {
35 LABEL_ALIGN_LEFT_TOP = 0,
36 LABEL_ALIGN_CENTER_TOP,
37 LABEL_ALIGN_RIGHT_TOP,
38 LABEL_ALIGN_LEFT_MIDDLE,
39 LABEL_ALIGN_CENTER_MIDDLE,
40 LABEL_ALIGN_RIGHT_MIDDLE,
41 LABEL_ALIGN_LEFT_BOTTOM,
42 LABEL_ALIGN_CENTER_BOTTOM,
43 LABEL_ALIGN_RIGHT_BOTTOM,
47 typedef enum _WindowType {
55 /* graphics backend */
56 typedef void (*scl_nui_draw_text_cb)(const char *font_name, short font_size, bool is_italic, bool is_bold, int r, int g, int b, int a,
57 const char *str, int pos_x, int pos_y, int w, int h,
58 LabelAlignment align, int padding_x, int padding_y, int inner_width, int inner_height, WindowType type, void* user_data);
60 typedef void (*scl_nui_draw_image_cb)(const char *image_path, int dest_x, int dest_y, int dest_weight, int dest_height, int src_x, int src_y, int src_width, int src_height, WindowType type, void* user_data);
61 typedef void (*scl_nui_draw_rectangle_cb)(int pos_x, int pos_y, int width, int height, bool fill, int fill_color_r, int fill_color_g, int fill_color_b, int fill_color_a, SCLWindowType type, void* user_data);
64 typedef void (*scl_nui_update_window_cb)(SCLWindowType type, int x, int y, int width, int height, void* user_data);
65 typedef int (*scl_nui_key_click_event_cb)(const char *key_value, unsigned long key_event, int key_type, int key_modifier);
66 typedef int (*scl_nui_drag_state_changed_cb)(const char *key_value, unsigned long key_event, int key_type, int event_type, int current_x, int current_y);
67 typedef int (*scl_nui_event_notification_cb)(SCLUINotiType noti_type, SclNotiDesc *etc_info);
68 typedef void (*scl_nui_update_window_position_cb)(SCLWindowType type, int pos_x, int pos_y, int rot_x, int rot_y, void* user_data);
70 int scl_nui_init(const char *entry_filepath);
75 int scl_nui_get_input_mode(const char **input_mode);
76 int scl_nui_set_input_mode(const char *input_mode);
77 int scl_nui_set_update_pending(bool pend);
78 int scl_nui_set_rotation(int degree);
80 int scl_nui_set_draw_text_cb(scl_nui_draw_text_cb callback, void *user_data);
81 int scl_nui_set_draw_image_cb(scl_nui_draw_image_cb callback, void *user_data);
82 int scl_nui_set_draw_rectangle_cb(scl_nui_draw_rectangle_cb callback, void *user_data);
84 int scl_nui_set_cur_sublayout(const char *sub_layout_name);
85 int scl_nui_set_string_substitution(const char *original, const char *substitute);
86 int scl_nui_unset_string_substitution(const char *original);
88 int scl_nui_set_update_window_cb(scl_nui_update_window_cb callback, void *user_data);
90 int scl_nui_set_key_click_event_cb(scl_nui_key_click_event_cb callback);
91 int scl_nui_set_drag_state_changed_cb(scl_nui_drag_state_changed_cb callback);
92 int scl_nui_set_event_notification_cb(scl_nui_event_notification_cb callback);
93 int scl_nui_set_update_window_position_cb(scl_nui_update_window_position_cb callback, void *user_data);
95 int scl_nui_enable_magnifier(bool enabled);
96 int scl_nui_enable_sound(bool enabled);
97 int scl_nui_enable_vibration(bool enabled);
98 int scl_nui_set_private_key(const char* custom_id, char* label, char* imagelabel[SCL_BUTTON_STATE_MAX], char* imagebg[SCL_BUTTON_STATE_MAX], unsigned long key_event, char *key_value, bool redraw);
99 int scl_nui_unset_private_key(const char* custom_id);
100 int scl_nui_enable_button(const char* custom_id, bool enabled);
101 int scl_nui_get_shift_state(unsigned int *state);
102 int scl_nui_set_shift_state(unsigned int state);
103 int scl_nui_set_autocapital_shift_state(bool state);
104 int scl_nui_disable_input_event(bool disable);
110 #endif /* __SCL_CSHARP_NUI_H__ */