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

TCursor, derived from TGdiBase, represents the GDI cursor object class. More...

#include <owl/gdiobjec.h>

Inheritance diagram for owl::TCursor:
owl::TGdiBase

Classes

struct  TInfo
 

Public Types

typedef HCURSOR THandle
 TCursor encapsulates an HCURSOR.
 

Public Member Functions

 TCursor (HCURSOR handle, TAutoDelete autoDelete=NoAutoDelete)
 Creates a TCursor object and sets the Handle data member to the given borrowed handle.
 
 TCursor (HINSTANCE, const TCursor &cursor)
 Creates a copy of the given cursor object.
 
 TCursor (HINSTANCE, TResId)
 Constructs a cursor object from the specified resource ID.
 
 TCursor (HINSTANCE, const TPoint &hotSpot, const TSize &size, void *andBits, void *xorBits)
 Constructs a TCursor object of the specified size at the specified point.
 
 TCursor (const void *resBits, uint32 resSize)
 Constructs a TCursor object from the specified resource.
 
 TCursor (const ICONINFO &iconInfo)
 Creates a TCursor object from the specified ICONINFO structure information.
 
 ~TCursor ()
 Destroys a TCursor object.
 
HCURSOR GetHandle () const
 Returns the handle of the cursor with type HCURSOR.
 
 operator HCURSOR () const
 An inline typecasting operator.
 
bool operator== (const TCursor &other) const
 Returns true if this cursor equals other; otherwise returns false.
 
auto GetInfo () const -> TInfo
 Retrieves information about this cursor.
 
auto GetIconInfo () const -> ICONINFO
 Retrieves information about this cursor.
 
auto GetIconInfoEx () const -> ICONINFOEX
 Retrieves information about this cursor.
 

Additional Inherited Members

- Protected Member Functions inherited from owl::TGdiBase
void CheckValid (uint resId=IDS_GDIFAILURE)
 
 TGdiBase ()
 This default constructor sets Handle to 0 and ShouldDelete to true.
 
 TGdiBase (HANDLE handle, TAutoDelete autoDelete=NoAutoDelete)
 Initializes members to given values, and validates the handle.
 
- Static Protected Member Functions inherited from owl::TGdiBase
static void _CheckValid (HANDLE handle, uint resId=IDS_GDIFAILURE)
 
- Protected Attributes inherited from owl::TGdiBase
HANDLE Handle
 GDI handle of this object.
 
bool ShouldDelete
 Should object delete GDI handle in dtor?
 

Detailed Description

TCursor, derived from TGdiBase, represents the GDI cursor object class.

TCursor constructors can create cursors from a resource or from explicit information. Because cursors are not real GDI objects, the TCursor destructor overrides the base destructor, ~TGdiBase.

Definition at line 730 of file gdiobjec.h.

Member Typedef Documentation

◆ THandle

TCursor encapsulates an HCURSOR.

Definition at line 734 of file gdiobjec.h.

Constructor & Destructor Documentation

◆ TCursor() [1/6]

owl::TCursor::TCursor ( HCURSOR handle,
TAutoDelete autoDelete = NoAutoDelete )

Creates a TCursor 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 24 of file cursor.cpp.

References OWL_CDLEVEL, and TRACEX.

◆ TCursor() [2/6]

owl::TCursor::TCursor ( HINSTANCE ,
const TCursor & cursor )

Creates a copy of the given cursor object.

The 32bit version (for compiling a Win32 application) uses CopyIcon() and does a cast to get to HICON.

Definition at line 36 of file cursor.cpp.

References owl::TGdiBase::CheckValid(), owl::TGdiBase::Handle, OWL_CDLEVEL, and TRACEX.

◆ TCursor() [3/6]

owl::TCursor::TCursor ( HINSTANCE instance,
TResId resId )

◆ TCursor() [4/6]

owl::TCursor::TCursor ( HINSTANCE instance,
const TPoint & hotSpot,
const TSize & size,
void * andBits,
void * xorBits )

Constructs a TCursor object of the specified size at the specified point.

Definition at line 64 of file cursor.cpp.

References owl::TGdiBase::CheckValid(), owl::TGdiBase::Handle, OWL_CDLEVEL, PRECONDITION, and TRACEX.

◆ TCursor() [5/6]

owl::TCursor::TCursor ( const void * resBits,
uint32 resSize )

Constructs a TCursor object from the specified resource.

Definition at line 77 of file cursor.cpp.

References owl::TGdiBase::CheckValid(), owl::TGdiBase::Handle, OWL_CDLEVEL, PRECONDITION, and TRACEX.

◆ TCursor() [6/6]

owl::TCursor::TCursor ( const ICONINFO & iconInfo)

Creates a TCursor object from the specified ICONINFO structure information.

Definition at line 89 of file cursor.cpp.

References owl::TGdiBase::CheckValid(), owl::TGdiBase::Handle, OWL_CDLEVEL, TRACEX, and WARN.

◆ ~TCursor()

owl::TCursor::~TCursor ( )

Destroys a TCursor object.

Definition at line 118 of file cursor.cpp.

References owl::TGdiBase::Handle, OWL_CDLEVEL, owl::TGdiBase::ShouldDelete, and TRACEX.

Member Function Documentation

◆ GetHandle()

HCURSOR owl::TCursor::GetHandle ( ) const
inline

Returns the handle of the cursor with type HCURSOR.

Definition at line 1623 of file gdiobjec.h.

References owl::TGdiBase::Handle.

◆ GetIconInfo()

auto owl::TCursor::GetIconInfo ( ) const -> ICONINFO

Retrieves information about this cursor.

Wrapper for the Windows API function of the same name. Throws TXGdi on failure.

Note
GetIconInfo creates bitmaps for the hbmMask and hbmColor members of ICONINFO. The calling application must manage these bitmaps and delete them when they are no longer necessary (using the Windows API function ::DeleteObject explicitly, or by passing ownership of the handles to TBitmap with the parameter autoDelete set to TAutoDelete::AutoDelete).
See also
http://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-geticoninfo

Definition at line 157 of file cursor.cpp.

References GetHandle(), and GetIconInfo().

◆ GetIconInfoEx()

auto owl::TCursor::GetIconInfoEx ( ) const -> ICONINFOEX

Retrieves information about this cursor.

Wrapper for the Windows API function of the same name. Throws TXGdi on failure.

Note
GetIconInfoEx creates bitmaps for the hbmMask and hbmColor members of ICONINFOEX. The calling application must manage these bitmaps and delete them when they are no longer necessary (using the Windows API function ::DeleteObject explicitly, or by passing ownership of the handles to TBitmap with the parameter autoDelete set to TAutoDelete::AutoDelete).
See also
http://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-geticoninfoexa

Definition at line 176 of file cursor.cpp.

References GetHandle(), and GetIconInfoEx().

◆ GetInfo()

auto owl::TCursor::GetInfo ( ) const -> TInfo

Retrieves information about this cursor.

Throws TXGdi on failure.

Definition at line 129 of file cursor.cpp.

References _T, owl::AutoDelete, CHECK, GetIconInfoEx(), and MAX_PATH.

◆ operator HCURSOR()

owl::TCursor::operator HCURSOR ( ) const
inline

An inline typecasting operator.

Converts this cursor's Handle to type HCURSOR (the data type representing the handle to a cursor resource).

Definition at line 1632 of file gdiobjec.h.

◆ operator==()

bool owl::TCursor::operator== ( const TCursor & other) const
inline

Returns true if this cursor equals other; otherwise returns false.

Definition at line 1640 of file gdiobjec.h.

References owl::TGdiBase::Handle.


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