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

The GDI Brush class is derived from TGdiObject. More...

#include <owl/gdiobjec.h>

Inheritance diagram for owl::TBrush:
owl::TGdiObject owl::TGdiBase owl::THatch8x8Brush

Public Types

typedef HBRUSH THandle
 
- 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.
 

Public Member Functions

 TBrush (HBRUSH handle, TAutoDelete autoDelete=NoAutoDelete)
 TBrush encapsulates an HBRUSH.
 
 TBrush (const TColor &color, bool useCache=true)
 Creates a solid TBrush object with the given color.
 
 TBrush (const TColor &color, int style)
 Creates a hatched TBrush object with the given style and color.
 
 TBrush (const LOGBRUSH &logBrush)
 Creates a TBrush object with values from the given LOGBRUSH.
 
 TBrush (const TBitmap &pattern)
 Creates a patterned TBrush object with the given pattern.
 
 TBrush (const TDib &pattern)
 Creates a patterned TBrush object with the given DIB pattern.
 
 TBrush (const TBrush &src)
 Constructs a copy of an existing brush.
 
 ~TBrush ()
 
HBRUSH GetHandle () const
 Returns the handle of the brush with type HBRUSH.
 
 operator HBRUSH () const
 Typecasting operator.
 
LOGBRUSH GetObject () const
 Retrieves information about this brush object and places it in the given LOGBRUSH structure.
 
- 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.
 

Additional Inherited Members

- 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 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)
 
- Protected Attributes inherited from owl::TGdiObject
HANDLE Handle
 GDI handle of this object.
 
bool ShouldDelete
 Should object delete GDI handle in dtor?
 

Detailed Description

The GDI Brush class is derived from TGdiObject.

TBrush provides constructors for creating solid, styled, or patterned brushes from explicit information. It can also create a brush indirectly from a borrowed handle.

Definition at line 180 of file gdiobjec.h.

Member Typedef Documentation

◆ THandle

Definition at line 184 of file gdiobjec.h.

Constructor & Destructor Documentation

◆ TBrush() [1/7]

owl::TBrush::TBrush ( HBRUSH handle,
TAutoDelete autoDelete = NoAutoDelete )

TBrush encapsulates an HBRUSH.

Alias an existing brush handle. Assume ownership if autoDelete says so.

Creates a TBrush object and sets the Handle data member to the given borrowed handle. The ShouldDelete data member defaults to false, ensuring that the borrowed handle will not be deleted when the C++ object is destroyed.

Definition at line 253 of file brush.cpp.

References _T, owl::TGdiObject::Brush, owl::TGdiObject::Handle, OWL_CDLEVEL, owl::TGdiObject::RefAdd(), owl::TGdiObject::ShouldDelete, and TRACEX.

◆ TBrush() [2/7]

owl::TBrush::TBrush ( const TColor & color,
bool useCache = true )

Creates a solid TBrush object with the given color.

To save a brush creation this constructor uses a cache that can detect any color that matches a stock color when useCache is true.

Definition at line 272 of file brush.cpp.

References _T, owl::TGdiObject::Brush, owl::TGdiObject::CheckValid(), owl::TGdiObject::Handle, OWL_CDLEVEL, owl::TGdiObject::RefAdd(), owl::TGdiObject::ShouldDelete, TRACEX, and WARNX.

◆ TBrush() [3/7]

owl::TBrush::TBrush ( const TColor & color,
int style )

Creates a hatched TBrush object with the given style and color.

Definition at line 321 of file brush.cpp.

References _T, owl::TGdiObject::Brush, owl::TGdiObject::CheckValid(), owl::TGdiObject::Handle, OWL_CDLEVEL, owl::TGdiObject::RefAdd(), TRACEX, and WARNX.

◆ TBrush() [4/7]

owl::TBrush::TBrush ( const LOGBRUSH & logBrush)

Creates a TBrush object with values from the given LOGBRUSH.

Definition at line 352 of file brush.cpp.

References _T, owl::TGdiObject::Brush, owl::TGdiObject::CheckValid(), owl::TGdiObject::Handle, OWL_CDLEVEL, owl::TGdiObject::RefAdd(), TRACEX, and WARNX.

◆ TBrush() [5/7]

owl::TBrush::TBrush ( const TBitmap & pattern)

Creates a patterned TBrush object with the given pattern.

Definition at line 337 of file brush.cpp.

References _T, owl::TGdiObject::Brush, owl::TGdiObject::CheckValid(), owl::TGdiObject::Handle, OWL_CDLEVEL, owl::TGdiObject::RefAdd(), TRACEX, and WARNX.

◆ TBrush() [6/7]

owl::TBrush::TBrush ( const TDib & pattern)

Creates a patterned TBrush object with the given DIB pattern.

Definition at line 418 of file brush.cpp.

References _T, owl::TGdiObject::Brush, owl::TGdiObject::CheckValid(), owl::TGdiObject::Handle, OWL_CDLEVEL, owl::TGdiObject::RefAdd(), TRACEX, and WARNX.

◆ TBrush() [7/7]

owl::TBrush::TBrush ( const TBrush & src)

Constructs a copy of an existing brush.

Contructed brush will share the handle unless NO_GDI_SHARE_HANDLES is defined, in which case a new handle is created.

Definition at line 386 of file brush.cpp.

References _T, owl::TGdiObject::Brush, owl::TGdiObject::CheckValid(), owl::TGdiObject::Handle, OWL_CDLEVEL, owl::TGdiObject::RefAdd(), TRACEX, and WARNX.

◆ ~TBrush()

owl::TBrush::~TBrush ( )

Definition at line 408 of file brush.cpp.

References _T, owl::TGdiObject::Handle, OWL_CDLEVEL, owl::TGdiObject::ShouldDelete, and TRACEX.

Member Function Documentation

◆ GetHandle()

HBRUSH owl::TBrush::GetHandle ( ) const
inline

Returns the handle of the brush with type HBRUSH.

Definition at line 1110 of file gdiobjec.h.

References owl::TGdiObject::GetGdiHandle().

◆ GetObject()

LOGBRUSH owl::TBrush::GetObject ( ) const

Retrieves information about this brush object and places it in the given LOGBRUSH structure.

Returns true if the call is successful; otherwise returns false.

Definition at line 433 of file brush.cpp.

References GetHandle(), and owl::TGdiObject::GetObject().

◆ operator HBRUSH()

owl::TBrush::operator HBRUSH ( ) const
inline

Typecasting operator.

Converts this brush's Handle to type HBRUSH (the data type representing the handle to a physical brush).

Definition at line 1119 of file gdiobjec.h.


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