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

TIcon, derived from TGdiObject, represents the GDI object icon class. More...

#include <owl/gdiobjec.h>

Inheritance diagram for owl::TIcon:
owl::TGdiBase

Classes

struct  TInfo
 

Public Types

typedef HICON THandle
 TIcon encapsulates an HICON.
 

Public Member Functions

 TIcon (HICON handle, TAutoDelete autoDelete=NoAutoDelete)
 Creates a TIcon object and sets the Handle data member to the given borrowed handle.
 
 TIcon (HINSTANCE, const TIcon &icon)
 Creates a copy of the given icon object.
 
 TIcon (HINSTANCE, TResId)
 Creates an icon object from the given resource.
 
 TIcon (HINSTANCE, const tstring &filename, int index)
 Creates an icon object from the given resource file.
 
 TIcon (HINSTANCE, const TSize &size, int planes, int bitsPixel, const void *andBits, const void *xorBits)
 Creates an icon object with the given values.
 
 TIcon (const void *resBits, uint32 resSize)
 Creates an icon object of the given size from the bits found in the resBits buffer.
 
 TIcon (const ICONINFO &iconInfo)
 Creates an icon object with the given ICONINFO information.
 
 ~TIcon ()
 Destroys the icon and frees any memory that the icon occupied.
 
HICON GetHandle () const
 Returns the handle of the icon with type HICON.
 
 operator HICON () const
 Typecasting operator that converts this icon's Handle to type HICON (the data type representing the handle to an icon resource).
 
bool operator== (const TIcon &other) const
 Returns true if the handles of two icons are identical.
 
auto GetInfo () const -> TInfo
 Retrieves information about this icon.
 
auto GetIconInfo () const -> ICONINFO
 Retrieves information about this icon.
 
auto GetIconInfoEx () const -> ICONINFOEX
 Retrieves information about this icon.
 

Detailed Description

TIcon, derived from TGdiObject, represents the GDI object icon class.

TIcon constructors can create icons from a resource or from explicit information. Because icons are not real GDI objects, the TIcon destructor overloads the base destructor, ~TGdiObject.

Definition at line 670 of file gdiobjec.h.

Member Typedef Documentation

◆ THandle

TIcon encapsulates an HICON.

Definition at line 674 of file gdiobjec.h.

Constructor & Destructor Documentation

◆ TIcon() [1/7]

owl::TIcon::TIcon ( HICON handle,
TAutoDelete autoDelete = NoAutoDelete )

Creates a TIcon 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 22 of file icon.cpp.

◆ TIcon() [2/7]

owl::TIcon::TIcon ( HINSTANCE ,
const TIcon & icon )

Creates a copy of the given icon object.

Definition at line 31 of file icon.cpp.

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

◆ TIcon() [3/7]

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

Creates an icon object from the given resource.

Definition at line 40 of file icon.cpp.

References owl::TGdiBase::CheckValid(), owl::TGdiBase::Handle, and owl::TGdiBase::ShouldDelete.

◆ TIcon() [4/7]

owl::TIcon::TIcon ( HINSTANCE instance,
const tstring & filename,
int index )

Creates an icon object from the given resource file.

Definition at line 50 of file icon.cpp.

References owl::TGdiBase::CheckValid(), owl::TShell::ExtractIcon(), and owl::TGdiBase::Handle.

◆ TIcon() [5/7]

owl::TIcon::TIcon ( HINSTANCE instance,
const TSize & size,
int planes,
int bitsPixel,
const void * andBits,
const void * xorBits )

Creates an icon object with the given values.

Definition at line 62 of file icon.cpp.

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

◆ TIcon() [6/7]

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

Creates an icon object of the given size from the bits found in the resBits buffer.

Definition at line 75 of file icon.cpp.

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

◆ TIcon() [7/7]

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

Creates an icon object with the given ICONINFO information.

Definition at line 84 of file icon.cpp.

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

◆ ~TIcon()

owl::TIcon::~TIcon ( )

Destroys the icon and frees any memory that the icon occupied.

Definition at line 110 of file icon.cpp.

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

Member Function Documentation

◆ GetHandle()

HICON owl::TIcon::GetHandle ( ) const
inline

Returns the handle of the icon with type HICON.

Definition at line 1574 of file gdiobjec.h.

References owl::TGdiBase::Handle.

◆ GetIconInfo()

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

Retrieves information about this icon.

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 148 of file icon.cpp.

References GetHandle(), and GetIconInfo().

◆ GetIconInfoEx()

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

Retrieves information about this icon.

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 167 of file icon.cpp.

References GetHandle(), and GetIconInfoEx().

◆ GetInfo()

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

Retrieves information about this icon.

Throws TXGdi on failure.

Definition at line 120 of file icon.cpp.

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

◆ operator HICON()

owl::TIcon::operator HICON ( ) const
inline

Typecasting operator that converts this icon's Handle to type HICON (the data type representing the handle to an icon resource).

Definition at line 1583 of file gdiobjec.h.

◆ operator==()

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

Returns true if the handles of two icons are identical.

Definition at line 1591 of file gdiobjec.h.

References owl::TGdiBase::Handle.


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