OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
owl::TBtnBitmap Class Reference

TBtnBitmap is an enhanced version of TBitmap with the ability to update the face color of a bitmap to match the system setting (COLOR_BTNFACE). More...

#include <owl/glyphbtn.h>

Inheritance diagram for owl::TBtnBitmap:
owl::TBitmap owl::TGdiObject owl::TGdiBase

Public Member Functions

 TBtnBitmap (HINSTANCE hInstance, TResId resId, const TColor &faceColor=TColor::LtGray)
 Loads the specified bitmap and updates the face color, if necessary.
 
 TBtnBitmap (HBITMAP hBitmap, const TColor &faceColor=TColor::LtGray, TAutoDelete autoDelete=NoAutoDelete)
 Aliases the specified bitmap handle and updates the face color, if necessary.
 
void UpdateFaceColor ()
 Updates the face color of the associated bitmap to the current system setting.
 
- Public Member Functions inherited from owl::TBitmap
 TBitmap (HBITMAP handle, TAutoDelete autoDelete=NoAutoDelete)
 Construct an alias TBitmap for an existing bitmap handle.
 
 TBitmap (const TClipboard &clipboard)
 Creates a TBitmap object with values from the given Clipboard.
 
 TBitmap (const TBitmap &bitmap)
 Creates a copy of the given bitmap object.
 
 TBitmap (int width, int height, uint8 planes=1, uint8 bitCount=1, const void *bits=0)
 Creates a bitmap object from bitCount bits in the bits buffer with the given width, height, and planes argument values.
 
 TBitmap (const BITMAP &bitmap)
 Creates a bitmap object with the values found in the given bitmap structure.
 
 TBitmap (const TDC &, int width, int height, bool discardable=false)
 Creates a bitmap object for the given device context with the given argument values.
 
 TBitmap (const TDC &, const TDib &dib, uint32 usage=CBM_INIT)
 Creates a bitmap object for the given device context with the given dib and usage argument values.
 
 TBitmap (const TMetaFilePict &metaFile, TPalette &palette, const TSize &size)
 Creates a bitmap object from the given metaFile using the given palette and size arguments.
 
 TBitmap (const TDib &dib, const TPalette *palette=0)
 Creates a bitmap object from the given dib and palette arguments.
 
 TBitmap (HINSTANCE, TResId)
 Creates a bitmap object for the given application instance from the given resource.
 
 ~TBitmap ()
 
HBITMAP GetHandle () const
 Returns the handle of the bitmap of type BITMAP.
 
 operator HBITMAP () const
 Typecasting operator.
 
bool GetObject (BITMAP &bitmap) const
 Retrieves data (width, height, and color format) for this bitmap and sets it in the given BITMAP structure.
 
BITMAP GetObject () const
 
int Width () const
 Returns the width of this bitmap using GDI's GetObject.
 
int Height () const
 Returns the height of this bitmap using GDI's GetObject.
 
TSize Size () const
 The width and height of the bitmap in pixels.
 
int Planes () const
 Returns the number of planes in this bitmap.
 
int BitsPixel () const
 Returns the number of bits per pixel in this bitmap.
 
uint32 GetBitmapBits (uint32 count, void *bits) const
 Copies up to count bits of this bitmap to the buffer bits.
 
uint32 SetBitmapBits (uint32 count, const void *bits)
 Copies up to count bits from the bits buffer to this bitmap.
 
bool GetBitmapDimension (TSize &size) const
 Retrieves the size of this bitmap (width and height, measured in tenths of millimeters) and sets it in the size argument.
 
TSize GetBitmapDimension () const
 Functional-style overload.
 
bool SetBitmapDimension (const TSize &size, TSize *oldSize=0)
 Sets the size of this bitmap from the given size argument (width and height, measured in tenths of millimeters).
 
void ToClipboard (TClipboard &clipboard)
 Put a device-dependent bitmap on the clipboard as a (DD)BITMAP.
 
- Public Member Functions inherited from owl::TGdiObject
 ~TGdiObject ()
 Decrement the reference count on this object.
 
HGDIOBJ GetGdiHandle () const
 Returns the handle of the GDI object.
 
 operator HGDIOBJ () const
 Typecasting operator that converts this GDI object handle to type HGDIOBJ.
 
int GetObject (int count, void *object) const
 Retrieve the object's attributes into a buffer.
 
bool operator== (const TGdiObject &other) const
 Returns true if the handles are equal. This is a binary compare.
 
bool operator< (const TGdiObject &other) const
 not implemented just to make happy STL
 
bool IsGDIObject () const
 Returns true if this represents a real GDI object.
 
uint32 GetObjectType () const
 Returns the type of the GDI object.
 
auto IsHandleOwner () const -> bool
 Returns true if handle lifetime is managed.
 

Static Public Member Functions

static void MapColor (TDC &dc, TDC &srcDC, const TColor &toColor, const TColor &fromColor, int width, int height)
 Helper routine used to map the face color of the underlying bitmap.
 
- Static Public Member Functions inherited from owl::TGdiObject
static TObjInfo * RefFind (HANDLE object)
 Searches for the given object handle.
 
static void RefAdd (HANDLE handle, TType type)
 RefAdd adds a reference entry for the object with the given handle and type.
 
static void RefRemove (HANDLE handle)
 Removes the reference entry to the object with the given handle.
 
static void RefInc (HANDLE handle)
 Increments by 1 the reference count of the object associated with the given handle.
 
static void RefDec (HANDLE handle, bool wantDelete)
 Decrements this object's reference count by 1 and deletes the object when the reference count reaches zero.
 
static int RefCount (HANDLE handle)
 Returns this object's current reference count or -1 if the object is not found.
 

Protected Attributes

TColor FaceColor
 Current face color of bitmap.
 
- Protected Attributes inherited from owl::TGdiObject
HANDLE Handle
 GDI handle of this object.
 
bool ShouldDelete
 Should object delete GDI handle in dtor?
 

Additional Inherited Members

- Public Types inherited from owl::TBitmap
typedef HBITMAP THandle
 TBitmap encapsulates an HBITMAP.
 
- Public Types inherited from owl::TGdiObject
enum  TType { None , Pen , Brush , Font , Palette , Bitmap , TextBrush }
 This enumeration is used to store the object type in the struct TObjInfo. More...
 
typedef HGDIOBJ THandle
 TGdiObject encapsulates an HGDIOBJ.
 
- Protected Member Functions inherited from owl::TBitmap
 TBitmap ()
 
void Create (const TDib &dib, const TPalette &palette)
 Create a bitmap & get its handle, given a dib and a palette Used by ctors here and in derived classes.
 
void Create (const TBitmap &src)
 Create a bitmap & get its handle, given an other bitmap Used by ctors here and in derived classes.
 
- Protected Member Functions inherited from owl::TGdiObject
 TGdiObject ()
 This default constructor sets Handle to 0 and ShouldDelete to true.
 
 TGdiObject (HANDLE handle, TAutoDelete autoDelete=NoAutoDelete)
 Create a wrapper for a given GDI object.
 
void CheckValid (uint resId=IDS_GDIFAILURE)
 
- Static Protected Member Functions inherited from owl::TGdiObject
static void _CheckValid (HANDLE handle, uint resId=IDS_GDIFAILURE)
 

Detailed Description

TBtnBitmap is an enhanced version of TBitmap with the ability to update the face color of a bitmap to match the system setting (COLOR_BTNFACE).

Definition at line 49 of file glyphbtn.h.

Constructor & Destructor Documentation

◆ TBtnBitmap() [1/2]

owl::TBtnBitmap::TBtnBitmap ( HINSTANCE hInstance,
TResId resId,
const TColor & faceColor = TColor::LtGray )

Loads the specified bitmap and updates the face color, if necessary.

If not specified, the default face color is assumed to be TColor::LtGray.

Definition at line 53 of file glyphbtn.cpp.

References UpdateFaceColor().

◆ TBtnBitmap() [2/2]

owl::TBtnBitmap::TBtnBitmap ( HBITMAP hBitmap,
const TColor & faceColor = TColor::LtGray,
TAutoDelete autoDelete = NoAutoDelete )

Aliases the specified bitmap handle and updates the face color, if necessary.

If not specified, the default face color is assumed to be TColor::LtGray.

Definition at line 67 of file glyphbtn.cpp.

References UpdateFaceColor().

Member Function Documentation

◆ MapColor()

void owl::TBtnBitmap::MapColor ( TDC & dc,
TDC & srcDC,
const TColor & toColor,
const TColor & fromColor,
int width,
int height )
static

Helper routine used to map the face color of the underlying bitmap.

Definition at line 101 of file glyphbtn.cpp.

References owl::TDC::BitBlt(), owl::TDC::RestoreBrush(), owl::RopDSPDxax, and owl::TDC::SelectObject().

◆ UpdateFaceColor()

void owl::TBtnBitmap::UpdateFaceColor ( )

Updates the face color of the associated bitmap to the current system setting.

Does nothing if the current face color already matches the system color.

Definition at line 82 of file glyphbtn.cpp.

References FaceColor, owl::TBitmap::Height(), MapColor(), owl::TColor::Sys3dFace, and owl::TBitmap::Width().

Member Data Documentation

◆ FaceColor

TColor owl::TBtnBitmap::FaceColor
protected

Current face color of bitmap.

Definition at line 62 of file glyphbtn.h.


The documentation for this class was generated from the following files: