Bug 1232181 - Add a few win resource helpers. r=aklotz

This commit is contained in:
Jim Mathies 2016-03-01 12:48:26 -06:00
Родитель 744331de7b
Коммит 002407fe45
1 изменённых файлов: 76 добавлений и 0 удалений

Просмотреть файл

@ -49,6 +49,78 @@ public:
}
};
template<>
class nsAutoRefTraits<HDC>
{
public:
typedef HDC RawRef;
static HDC Void()
{
return nullptr;
}
static void Release(RawRef aFD)
{
if (aFD != Void()) {
::DeleteDC(aFD);
}
}
};
template<>
class nsAutoRefTraits<HBRUSH>
{
public:
typedef HBRUSH RawRef;
static HBRUSH Void()
{
return nullptr;
}
static void Release(RawRef aFD)
{
if (aFD != Void()) {
::DeleteObject(aFD);
}
}
};
template<>
class nsAutoRefTraits<HRGN>
{
public:
typedef HRGN RawRef;
static HRGN Void()
{
return nullptr;
}
static void Release(RawRef aFD)
{
if (aFD != Void()) {
::DeleteObject(aFD);
}
}
};
template<>
class nsAutoRefTraits<HBITMAP>
{
public:
typedef HBITMAP RawRef;
static HBITMAP Void()
{
return nullptr;
}
static void Release(RawRef aFD)
{
if (aFD != Void()) {
::DeleteObject(aFD);
}
}
};
template<>
class nsAutoRefTraits<SC_HANDLE>
{
@ -140,6 +212,10 @@ public:
};
typedef nsAutoRef<HKEY> nsAutoRegKey;
typedef nsAutoRef<HDC> nsAutoHDC;
typedef nsAutoRef<HBRUSH> nsAutoBrush;
typedef nsAutoRef<HRGN> nsAutoRegion;
typedef nsAutoRef<HBITMAP> nsAutoBitmap;
typedef nsAutoRef<SC_HANDLE> nsAutoServiceHandle;
typedef nsAutoRef<HANDLE> nsAutoHandle;
typedef nsAutoRef<HMODULE> nsModuleHandle;