ecore_win32: add ecore_win32_window_icon_set() api. 69/77269/2
authorBowon Ryu <bowon.ryu@samsung.com>
Wed, 29 Jun 2016 08:17:34 +0000 (17:17 +0900)
committerBowon Ryu <bowon.ryu@samsung.com>
Wed, 29 Jun 2016 08:19:26 +0000 (17:19 +0900)
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
src/lib/ecore_win32/ecore_win32.c

index 154ede8..b829a7b 100644 (file)
@@ -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,
index 37b7956..cb54190 100644 (file)
@@ -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);
+}
+
 /**
  * @}
  */