Files
Work/statbar/HOLD/STATLOGO.HPP
2024-08-07 09:16:27 -04:00

79 lines
2.0 KiB
C++

#ifndef _STATBAR_STATUSBARLOGO_HPP_
#define _STATBAR_STATUSBARLOGO_HPP_
#ifndef _STATBAR_STATBAR_HPP_
#include <statbar/statbar.hpp>
#endif
#ifndef _COMMON_PUREBITMAP_HPP_
#include <common/purebmp.hpp>
#endif
class StatusBarLogo : public StatusBar
{
public:
StatusBarLogo(GUIWindow &guiWindow,const String &nameBitmap,BOOL stretchBlt=TRUE);
virtual ~StatusBarLogo();
void setBitmap(GUIWindow &guiWindow,const String &nameBitmap);
void centerxy(BOOL centerx,BOOL centery);
void stretchBlt(BOOL stretchBlt);
protected:
virtual void postPaint(PureDevice &screenDevice,const Rect &paintRect);
private:
PureBitmap mPureBitmap;
BOOL mStretchBlt;
BOOL mCentery;
BOOL mCenterx;
};
inline
StatusBarLogo::StatusBarLogo(GUIWindow &guiWindow,const String &nameBitmap,BOOL stretchBlt)
: StatusBar(guiWindow), mPureBitmap(nameBitmap,guiWindow.processInstance()), mStretchBlt(stretchBlt),
mCenterx(FALSE), mCentery(FALSE)
{
}
inline
StatusBarLogo::~StatusBarLogo()
{
}
inline
void StatusBarLogo::centerxy(BOOL centerx,BOOL centery)
{
mCenterx=centerx;
mCentery=centery;
}
inline
void StatusBarLogo::stretchBlt(BOOL stretchBlt)
{
mStretchBlt=stretchBlt;
}
inline
void StatusBarLogo::setBitmap(GUIWindow &guiWindow,const String &nameBitmap)
{
mPureBitmap=PureBitmap(nameBitmap,guiWindow.processInstance());
PureDevice screenDevice(guiWindow);
postPaint(screenDevice,postPaintRect());
}
inline
void StatusBarLogo::postPaint(PureDevice &screenDevice,const Rect &paintRect)
{
PureDevice memDevice(screenDevice);
memDevice.select((GDIObj)mPureBitmap);
if(mStretchBlt)screenDevice.stretchBlt(paintRect,memDevice,Rect(0,0,mPureBitmap.width(),mPureBitmap.height()));
else
{
if(!mCenterx&&!mCentery)screenDevice.bitBlt(paintRect,memDevice,Point(0,0));
else
{
Rect bltRect(paintRect);
if(mCentery)bltRect.top(bltRect.top()+((paintRect.bottom()-mPureBitmap.height())/2));
if(mCenterx)bltRect.left(bltRect.left()+((paintRect.right()-mPureBitmap.width())/2));
screenDevice.bitBlt(bltRect,memDevice,Point(0,0));
}
}
}
#endif