Files
Work/common/BMPLNK.CPP
2024-08-07 09:09:36 -04:00

47 lines
1.1 KiB
C++

#include <common/bmplnk.hpp>
LinkedBitmap::LinkedBitmap(void)
: mCtlID(0), mhBitmap(0), mReferenceCount(0), mhLibrary(0)
{
::memset(&mBitmapInfo,0,sizeof(BITMAP));
}
LinkedBitmap::LinkedBitmap(int ctlID,String &bitmapName,HINSTANCE hLibrary)
: mCtlID(ctlID), mReferenceCount(1), mhLibrary(hLibrary), mBitmapName(bitmapName)
{
::memset(&mBitmapInfo,0,sizeof(BITMAP));
loadBitmap(bitmapName,hLibrary);
}
LinkedBitmap::LinkedBitmap(const LinkedBitmap &someLinkedBitmap)
: mCtlID(someLinkedBitmap.mCtlID), mReferenceCount(someLinkedBitmap.mReferenceCount),
mhLibrary(someLinkedBitmap.mhLibrary), mBitmapName(someLinkedBitmap.mBitmapName)
{
::memset(&mBitmapInfo,0,sizeof(BITMAP));
loadBitmap(someLinkedBitmap.mBitmapName,someLinkedBitmap.mhLibrary);
}
LinkedBitmap::~LinkedBitmap()
{
destroy();
}
void LinkedBitmap::destroy(void)
{
if(!isOkay())return;
::DeleteObject(mhBitmap);
mhBitmap=0;
}
WORD LinkedBitmap::drawBitmap(HDC hDC,RECT locationRect)
{
DrawBitmap::drawBitmap(hDC,mhBitmap,locationRect);
return TRUE;
}
WORD LinkedBitmap::drawBitmap(void)
{
DrawBitmap::drawBitmap(mhBitmap);
return TRUE;
}