From: Bowon Ryu Date: Wed, 29 Jun 2016 08:17:34 +0000 (+0900) Subject: ecore_win32: add ecore_win32_window_icon_set() api. X-Git-Tag: accepted/tizen/common/20160703.130317~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9a621a0dc47b15abb33bd3cb5c6b0ad987e0f583;p=platform%2Fupstream%2Fefl.git 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 --- 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); +} + /** * @} */