mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-11 17:59:03 +00:00
Fixed: #1018 Implement setWindowIcon for Win32
This commit is contained in:
parent
263cd23f8c
commit
5b2600003b
1 changed files with 37 additions and 1 deletions
|
@ -302,7 +302,39 @@ void CDriverGL::setWindowIcon(const std::vector<NLMISC::CBitmap> &bitmaps)
|
|||
{
|
||||
#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)
|
||||
|
||||
|
@ -1193,6 +1225,10 @@ bool CDriverGL::destroyWindow()
|
|||
{
|
||||
H_AUTO_OGL(CDriverGL_destroyWindow)
|
||||
|
||||
// make sure window icons are deleted
|
||||
std::vector<NLMISC::CBitmap> bitmaps;
|
||||
setWindowIcon(bitmaps);
|
||||
|
||||
#ifdef NL_OS_WINDOWS
|
||||
|
||||
// Then delete.
|
||||
|
|
Loading…
Reference in a new issue