typedef int (*scl_nui_event_notification_cb)(SCLUINotiType noti_type, SclNotiDesc *etc_info);
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);
-int scl_nui_init(const char *entry_filepath);
+int scl_nui_init(Ecore_Wl2_Window *window, const char *entry_filepath);
int scl_nui_fini();
int scl_nui_show();
int scl_nui_hide();
#endif
#define LOG_TAG "CSCLUINUI"
-#define USE_ELM_WIN 0
-
-#ifdef USE_ELM_WIN
-static Evas_Object *g_win = NULL;
-#endif
-
+static Ecore_Wl2_Window *g_win = NULL;
static CSCLUI *g_ui = NULL;
static scl_nui_draw_text_cb g_draw_text_cb;
static CUIEventCallback event_callback;
-Evas_Object *get_main_window()
+Ecore_Wl2_Window *get_main_window()
{
return g_win;
}
-EXPORT_API int scl_nui_init(const char *entry_filepath)
+EXPORT_API int scl_nui_init(Ecore_Wl2_Window *window, const char *entry_filepath)
{
-#ifdef USE_ELM_WIN
- elm_init(0, NULL);
-#endif
-
- //LOGI("################## Hello ################");
-
- //sleep(10);
-
if (!g_ui) {
g_ui = new CSCLUI;
}
if (!g_ui)
return 1;
-#ifdef USE_ELM_WIN
- g_win = elm_win_add(NULL, "test", ELM_WIN_UTILITY);
-#endif
-
+ g_win = window;
g_ui->init(g_win, SCL_PARSER_TYPE_XML, entry_filepath);
g_ui->set_graphics_backend_callback(&callback, NULL);
{
int ret = 0;
-#ifdef USE_ELM_WIN
- if (g_win)
- evas_object_del(g_win);
-
- g_win = NULL;
-#endif
-
if (g_ui)
g_ui->fini();
else
ret = 1;
-#ifdef USE_ELM_WIN
- elm_shutdown();
-#endif
-
return ret;
}
extern void mouse_move(void *data, Evas *e, Evas_Object *object, void *event_info);
static std::map<std::string, SclNinePatchInfo> _nine_patch_map;
-
+static Ecore_Evas *g_ee = NULL;
/**
* Constructor
*/
m_highlight_ui_object = NULL;
m_backend_callback = NULL;
m_backend_callback_data = NULL;
+
+ ecore_evas_init();
+ g_ee = ecore_evas_new(NULL, 0, 0, 0, 0, NULL);
+ if (!g_ee)
+ LOGE("Could not create ecore_evas");
}
void CSCLGraphicsImplNui::fini()
m_backend_callback = NULL;
m_backend_callback_data = NULL;
+
+ if (g_ee)
+ ecore_evas_free(g_ee);
+
+ ecore_evas_shutdown();
}
Evas_Object* extract_partimage_from_fullimage(
SCL_DEBUG();
SclSize ret = { 0, 0 };
- CSCLWindows *windows = CSCLWindows::get_instance();
- if (!windows) return ret;
+ Evas *evas = ecore_evas_get(g_ee);
+ if (!evas) {
+ LOGE("Could not get ecore_evas");
+ return ret;
+ }
- Evas_Object *window_object = (Evas_Object*)(windows->get_base_window());
- Evas_Object *image_object = NULL;
+ Evas_Object *image = evas_object_image_add(evas);
+ evas_object_image_file_set(image, image_path, NULL);
- if (window_object) {
- Evas *evas = evas_object_evas_get(window_object);
- image_object = evas_object_image_add(evas);
+ if (evas_object_image_load_error_get(image) != EVAS_LOAD_ERROR_NONE) {
+ LOGE("Could not load image");
+ return ret;
}
- if (image_object) {
- int w, h;
- evas_object_image_file_set(image_object, image_path, NULL);
- evas_object_image_size_get(image_object, &w, &h);
- evas_object_del(image_object);
- ret.width = w;
- ret.height = h;
- }
+ int w, h;
+ evas_object_image_size_get(image, &w, &h);
+ evas_object_del(image);
+ ret.width = w;
+ ret.height = h;
return ret;
}
if (utils && context && rect && window) {
int x = 0, y = 0, width = 0, height = 0;
sclint scr_w = 0, scr_h = 0;
- elm_win_screen_position_get(static_cast<Evas_Object*>(window), &x, &y);
- evas_object_geometry_get(static_cast<Evas_Object*>(window), NULL, NULL, &width, &height);
+
+ ecore_wl2_window_geometry_get(static_cast<Ecore_Wl2_Window*>(window), &x, &y, &width, &height);
utils->log("WinNui_getwinrect %p %d %d %d %d\n",
window, x, y, width, height);
m_base_window_context.opener.window = parent;
m_base_window_context.geometry.x = m_base_window_context.geometry.y = 0;
m_base_window_context.etc_info = NULL;
- m_base_window_context.window = SCLWINDOW_INVALID;
+ m_base_window_context.window = parent;
- if (impl) {
- m_base_window_context.window = impl->create_base_window(parent, &m_base_window_context, width, height);
+ if (impl)
push_window_in_Z_order_list(m_base_window_context.window);
- }
}
// Update the position information