|
|
|
@ -1712,6 +1712,10 @@ bool CDriverD3D::release()
|
|
|
|
|
|
|
|
|
|
if (_HWnd)
|
|
|
|
|
{
|
|
|
|
|
// make sure window icons are deleted
|
|
|
|
|
std::vector<NLMISC::CBitmap> bitmaps;
|
|
|
|
|
setWindowIcon(bitmaps);
|
|
|
|
|
|
|
|
|
|
if (_DestroyWindow)
|
|
|
|
|
DestroyWindow (_HWnd);
|
|
|
|
|
_HWnd = NULL;
|
|
|
|
@ -2177,6 +2181,73 @@ void CDriverD3D::setWindowTitle(const ucstring &title)
|
|
|
|
|
SetWindowTextW(_HWnd,(WCHAR*)title.c_str());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ***************************************************************************
|
|
|
|
|
void CDriverD3D::setWindowIcon(const std::vector<NLMISC::CBitmap> &bitmaps)
|
|
|
|
|
{
|
|
|
|
|
if (!_HWnd)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
static HICON winIconBig = NULL;
|
|
|
|
|
static HICON winIconSmall = NULL;
|
|
|
|
|
|
|
|
|
|
if (winIconBig)
|
|
|
|
|
{
|
|
|
|
|
DestroyIcon(winIconBig);
|
|
|
|
|
winIconBig = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (winIconSmall)
|
|
|
|
|
{
|
|
|
|
|
DestroyIcon(winIconSmall);
|
|
|
|
|
winIconSmall = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sint smallIndex = -1;
|
|
|
|
|
uint smallWidth = GetSystemMetrics(SM_CXSMICON);
|
|
|
|
|
uint smallHeight = GetSystemMetrics(SM_CYSMICON);
|
|
|
|
|
|
|
|
|
|
sint bigIndex = -1;
|
|
|
|
|
uint bigWidth = GetSystemMetrics(SM_CXICON);
|
|
|
|
|
uint bigHeight = GetSystemMetrics(SM_CYICON);
|
|
|
|
|
|
|
|
|
|
// find icons with the exact size
|
|
|
|
|
for(uint i = 0; i < bitmaps.size(); ++i)
|
|
|
|
|
{
|
|
|
|
|
if (smallIndex == -1 && bitmaps[i].getWidth() == smallWidth && bitmaps[i].getHeight() == smallHeight)
|
|
|
|
|
smallIndex = i;
|
|
|
|
|
|
|
|
|
|
if (bigIndex == -1 && bitmaps[i].getWidth() == bigWidth && bitmaps[i].getHeight() == bigHeight)
|
|
|
|
|
bigIndex = i;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// find icons with taller size (we will resize them)
|
|
|
|
|
for(uint i = 0; i < bitmaps.size(); ++i)
|
|
|
|
|
{
|
|
|
|
|
if (smallIndex == -1 && bitmaps[i].getWidth() >= smallWidth && bitmaps[i].getHeight() >= smallHeight)
|
|
|
|
|
smallIndex = i;
|
|
|
|
|
|
|
|
|
|
if (bigIndex == -1 && bitmaps[i].getWidth() >= bigWidth && bitmaps[i].getHeight() >= bigHeight)
|
|
|
|
|
bigIndex = i;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (smallIndex > -1)
|
|
|
|
|
winIconSmall = bitmaps[smallIndex].getHICON(smallWidth, smallHeight, 32);
|
|
|
|
|
|
|
|
|
|
if (bigIndex > -1)
|
|
|
|
|
winIconBig = bitmaps[bigIndex].getHICON(bigWidth, bigHeight, 32);
|
|
|
|
|
|
|
|
|
|
if (winIconBig)
|
|
|
|
|
{
|
|
|
|
|
SendMessage(_HWnd, WM_SETICON, 0 /* ICON_SMALL */, (LPARAM)winIconSmall);
|
|
|
|
|
SendMessage(_HWnd, WM_SETICON, 1 /* ICON_BIG */, (LPARAM)winIconBig);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
SendMessage(_HWnd, WM_SETICON, 0 /* ICON_SMALL */, (LPARAM)winIconSmall);
|
|
|
|
|
SendMessage(_HWnd, WM_SETICON, 1 /* ICON_BIG */, (LPARAM)winIconSmall);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ***************************************************************************
|
|
|
|
|
void CDriverD3D::setWindowPos(sint32 x, sint32 y)
|
|
|
|
|
{
|
|
|
|
|