From 9a621a0dc47b15abb33bd3cb5c6b0ad987e0f583 Mon Sep 17 00:00:00 2001 From: Bowon Ryu Date: Wed, 29 Jun 2016 17:17:34 +0900 Subject: [PATCH] ecore_win32: add ecore_win32_window_icon_set() api. to switch application window icon on runtime, we added this api. this is necessary for tizen sdk ui tools. Change-Id: I942dbb1786f0da2274299fa6ec939c807129820b --- src/lib/ecore_win32/Ecore_Win32.h | 4 ++++ src/lib/ecore_win32/ecore_win32.c | 31 +++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/src/lib/ecore_win32/Ecore_Win32.h b/src/lib/ecore_win32/Ecore_Win32.h index 154ede8..b829a7b 100644 --- a/src/lib/ecore_win32/Ecore_Win32.h +++ b/src/lib/ecore_win32/Ecore_Win32.h @@ -490,6 +490,10 @@ EAPI void ecore_win32_window_state_request_send(Ecore_Win32_Window *window, EAPI void ecore_win32_window_type_set(Ecore_Win32_Window *window, Ecore_Win32_Window_Type type); +//TIZEN_ONLY(160628): This function can set icon using file path on Windows. +EAPI void ecore_win32_window_icon_set(Ecore_Win32_Window *window, + char *path); + /* Cursor */ EAPI Ecore_Win32_Cursor *ecore_win32_cursor_new(const void *pixels_and, diff --git a/src/lib/ecore_win32/ecore_win32.c b/src/lib/ecore_win32/ecore_win32.c index 37b7956..cb54190 100644 --- a/src/lib/ecore_win32/ecore_win32.c +++ b/src/lib/ecore_win32/ecore_win32.c @@ -633,6 +633,37 @@ ecore_win32_current_time_get(void) return _ecore_win32_event_last_time; } + +//TIZEN_ONLY(160628): This function can set icon using file path on Windows. +EAPI void +ecore_win32_window_icon_set(Ecore_Win32_Window *window, char *path) +{ + HICON icon; + HICON icon_sm; + + icon = (HICON)LoadImage(NULL, + path, + IMAGE_ICON, + GetSystemMetrics(SM_CXICON), + GetSystemMetrics(SM_CYICON), + LR_LOADFROMFILE); + + icon_sm = (HICON)LoadImage(NULL, + path, + IMAGE_ICON, + GetSystemMetrics(SM_CXSMICON), + GetSystemMetrics(SM_CYSMICON), + LR_LOADFROMFILE); + + if (!icon) + icon = LoadIcon(NULL, IDI_APPLICATION); + if (!icon_sm) + icon_sm = LoadIcon(NULL, IDI_APPLICATION); + + SetClassLongPtr(window->window, GCLP_HICON, (LONG_PTR)icon); + SetClassLongPtr(window->window, GCLP_HICONSM, (LONG_PTR)icon_sm); +} + /** * @} */ -- 2.7.4