Vaca::GdiObject< T, Destroyer > Class Template Reference

#include <GdiObject.h>

Inheritance diagram for Vaca::GdiObject< T, Destroyer >:

Vaca::Referenceable Vaca::NonCopyable

List of all members.


Detailed Description

template<typename T, class Destroyer = Win32DestroyGdiObject>
class Vaca::GdiObject< T, Destroyer >

This class is a wrapper for Win32's GDI objects.

For internal use only.

Template Parameters:
T Type of handle (e.g. HCURSOR, HBRUSH, etc.).
Destroyer A class with a static method destroy to be used in the destructor of GdiObject (to free the T handle).


Public Member Functions

 GdiObject ()
 Creates a new GdiObject with the handle pointing to NULL.
 GdiObject (T handle)
 Creates a wrapper for the specified handle.
virtual ~GdiObject ()
 Destroys the handle using the Destroyer template-parameter.
bool isValid () const
 Returns true if the handle is valid (not NULL).
getHandle () const
 Returns the handle.
void setHandle (T handle)
 Sets the handle.

Private Attributes

m_handle

Constructor & Destructor Documentation

template<typename T, class Destroyer = Win32DestroyGdiObject>
Vaca::GdiObject< T, Destroyer >::GdiObject (  )  [inline]

Creates a new GdiObject with the handle pointing to NULL.

template<typename T, class Destroyer = Win32DestroyGdiObject>
Vaca::GdiObject< T, Destroyer >::GdiObject ( handle  )  [inline]

Creates a wrapper for the specified handle.

Parameters:
handle Handle to be wrapped. It will be delete in the GdiObject destructor.

template<typename T, class Destroyer = Win32DestroyGdiObject>
virtual Vaca::GdiObject< T, Destroyer >::~GdiObject (  )  [inline, virtual]

Destroys the handle using the Destroyer template-parameter.


Member Function Documentation

template<typename T, class Destroyer = Win32DestroyGdiObject>
bool Vaca::GdiObject< T, Destroyer >::isValid (  )  const [inline]

Returns true if the handle is valid (not NULL).

template<typename T, class Destroyer = Win32DestroyGdiObject>
T Vaca::GdiObject< T, Destroyer >::getHandle (  )  const [inline]

Returns the handle.

template<typename T, class Destroyer = Win32DestroyGdiObject>
void Vaca::GdiObject< T, Destroyer >::setHandle ( handle  )  [inline]

Sets the handle.

Warning:
The current handle (getHandle) must be NULL. This means that you can use this method just one time.
Parameters:
handle The handle to be wrapped. It will be delete in the GdiObject destructor.


Member Data Documentation

template<typename T, class Destroyer = Win32DestroyGdiObject>
T Vaca::GdiObject< T, Destroyer >::m_handle [private]