Fixed: #1018 Implement setWindowIcon for Win32

This commit is contained in:
kervala 2010-07-14 11:48:24 +02:00
parent c20188e90a
commit 1cc6877502

View file

@ -302,7 +302,39 @@ void CDriverGL::setWindowIcon(const std::vector<NLMISC::CBitmap> &bitmaps)
{ {
#if defined(NL_OS_WINDOWS) #if defined(NL_OS_WINDOWS)
// TODO static HICON winIconBig = NULL;
static HICON winIconSmall = NULL;
if (winIconBig)
{
DestroyIcon(winIconBig);
winIconBig = NULL;
}
if (winIconSmall)
{
DestroyIcon(winIconSmall);
winIconSmall = NULL;
}
// first bitmap is the small icon
if (bitmaps.size() > 0)
winIconSmall = bitmaps[0].getHICON(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 32);
// second bitmap is the big icon
if (bitmaps.size() > 1)
winIconBig = bitmaps[1].getHICON(GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON), 32);
if (winIconBig)
{
SendMessage(_win, WM_SETICON, 0 /* ICON_SMALL */, (LPARAM)winIconSmall);
SendMessage(_win, WM_SETICON, 1 /* ICON_BIG */, (LPARAM)winIconBig);
}
else
{
SendMessage(_win, WM_SETICON, 0 /* ICON_SMALL */, (LPARAM)winIconSmall);
SendMessage(_win, WM_SETICON, 1 /* ICON_BIG */, (LPARAM)winIconSmall);
}
#elif defined(NL_OS_MAC) #elif defined(NL_OS_MAC)
@ -1193,6 +1225,10 @@ bool CDriverGL::destroyWindow()
{ {
H_AUTO_OGL(CDriverGL_destroyWindow) H_AUTO_OGL(CDriverGL_destroyWindow)
// make sure window icons are deleted
std::vector<NLMISC::CBitmap> bitmaps;
setWindowIcon(bitmaps);
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
// Then delete. // Then delete.