OWLNext 7.0
Borland's Object Windows Library for the modern age
|
TPen is derived from TGdiObject. More...
#include <owl/gdiobjec.h>
Public Types | |
typedef HPEN | 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 | |
TPen (HPEN handle, TAutoDelete autoDelete=NoAutoDelete) | |
Alias an existing pen handle. Assume ownership if autoDelete says so. | |
TPen (const TColor &color, int width=1, int style=PS_SOLID) | |
Basic pen constructor. Detect constructions of stock pens & get stock objects instead. | |
TPen (const LOGPEN &logPen) | |
Creates a TPen object from the given logPen values. | |
TPen (const TPen &src) | |
Construct a copy of an existing pen. | |
TPen (uint32 penStyle, uint32 width, const TBrush &brush, uint32 styleCount, const uint32 *style) | |
Creates a TPen object with the given values. | |
TPen (uint32 penStyle, uint32 width, const LOGBRUSH &logBrush, uint32 styleCount, const uint32 *style) | |
Creates a TPen object with the given values. | |
HPEN | GetHandle () const |
Returns the handle of the pen with type HPEN. | |
operator HPEN () const | |
Typecasting operator. | |
LOGPEN | GetObject () const |
Retrieves information about this pen object and places it in the given LOGPEN 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? | |
TPen is derived from TGdiObject.
It encapsulates the GDI pen tool. Pens can be constructed from explicit information or indirectly. TPen relies on the base class's destructor, ~TGdiObject.
Definition at line 138 of file gdiobjec.h.
Definition at line 142 of file gdiobjec.h.
owl::TPen::TPen | ( | HPEN | handle, |
TAutoDelete | autoDelete = NoAutoDelete ) |
Alias an existing pen handle. Assume ownership if autoDelete says so.
Creates a TPen 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 34 of file pen.cpp.
References owl::TGdiObject::Handle, owl::TGdiObject::Pen, owl::TGdiObject::RefAdd(), and owl::TGdiObject::ShouldDelete.
Basic pen constructor. Detect constructions of stock pens & get stock objects instead.
Creates a TPen object with the given values. The width argument is in device units, but if set to 0, a 1-pixel width is assumed. Sets Handle with the given default values. If color is black or white, width is one, style is solid, a stock pen handle is returned. The values for style are listed in the following table.
PS_SOLID Creates
a solid pen.PS_DASH Creates
a dashed pen. Valid only when the pen width is one or less in device units.PS_DOT Creates
a dotted pen. Valid only when the pen width is one or less in device units.PS_DASHDOT Creates
a pen with alternating dashes dots. Valid only when the pen width is one or less in device units.PS_DASHDOTDOT Creates
a pen with alternating dashes double-dots. Valid only when the pen width is one or less in device units.PS_NULL Creates
a null pen.PS_INSIDEFRAME Creates
a solid pen. When this pen is used in any GDI drawing function that takes a bounding rectangle, the dimensions of the figure will be shrunk so that it fits entirely in the bounding rectangle, taking into account the width of the pen. Definition at line 65 of file pen.cpp.
References owl::TColor::Black, owl::TGdiObject::CheckValid(), owl::TGdiObject::Handle, owl::TGdiObject::Pen, owl::TGdiObject::RefAdd(), owl::TGdiObject::ShouldDelete, WARNX, and owl::TColor::White.
owl::TPen::TPen | ( | const LOGPEN & | logPen | ) |
Creates a TPen object from the given logPen values.
Definition at line 86 of file pen.cpp.
References owl::TGdiObject::CheckValid(), owl::TGdiObject::Handle, owl::TGdiObject::Pen, owl::TGdiObject::RefAdd(), and WARNX.
owl::TPen::TPen | ( | const TPen & | src | ) |
Construct a copy of an existing pen.
Contructed pen will share the handle unless NO_GDI_SHARE_HANDLES is defined, in which case a new handle is created
Definition at line 116 of file pen.cpp.
References owl::TGdiObject::CheckValid(), owl::TGdiObject::Handle, owl::TGdiObject::Pen, owl::TGdiObject::RefAdd(), and WARNX.
owl::TPen::TPen | ( | uint32 | penStyle, |
uint32 | width, | ||
const TBrush & | brush, | ||
uint32 | styleCount, | ||
const uint32 * | style ) |
Creates a TPen object with the given values.
Definition at line 136 of file pen.cpp.
References owl::TGdiObject::CheckValid(), owl::TGdiObject::Handle, owl::TGdiObject::Pen, owl::TGdiObject::RefAdd(), and WARNX.
owl::TPen::TPen | ( | uint32 | penStyle, |
uint32 | width, | ||
const LOGBRUSH & | logBrush, | ||
uint32 | styleCount, | ||
const uint32 * | style ) |
Creates a TPen object with the given values.
Definition at line 149 of file pen.cpp.
References owl::TGdiObject::CheckValid(), owl::TGdiObject::Handle, owl::TGdiObject::Pen, owl::TGdiObject::RefAdd(), and WARNX.
|
inline |
Returns the handle of the pen with type HPEN.
Definition at line 1079 of file gdiobjec.h.
References owl::TGdiObject::GetGdiHandle().
LOGPEN owl::TPen::GetObject | ( | ) | const |
Retrieves information about this pen object and places it in the given LOGPEN structure.
Throws TXGdi on failure.
Definition at line 162 of file pen.cpp.
References owl::TGdiObject::GetObject(), and owl::TGdiObject::Handle.
|
inline |
Typecasting operator.
Converts this pen's Handle to type HPEN (the data type representing the handle to a logical pen).
Definition at line 1088 of file gdiobjec.h.