aswang  1.0
Public Member Functions
aswang::DC Class Reference

Wrap an Device Context to make generic graphic operations easier. More...

#include <dc.h>

List of all members.

Public Member Functions

 DC ()
 DC (HWND fw)
 Gets the DC of the given window.
 DC (HWND fw, HDC ndc)
 Wraps the given DC and internally associates it with the given window.
 DC (HDC ndc)
 Wraps the given DC.
 DC (const DC &ndc)
 Creates a compatible DC and wraps it.
virtual ~DC ()
virtual void SetWindow (HWND fw)
 Set the window for which the DC should be internally associated.
virtual HWND GetWindow () const
 Get the window for which the DC is internally associated.
virtual bool Get ()
 Get the DC for the window the object is associated with.
virtual void Free ()
 Free the DC. The method depends on whether the DC is internally associated with a window.
virtual void _Release ()
 Free a DC that is associated with a window.
virtual void _Delete ()
 Free a DC that is not associated with any window.
virtual HDC GetHDC () const
 Get the windows DC handle.
virtual void SetHDC (HDC ndc)
 Set the windows DC handle.
virtual void SetPos (int x, int y) const
 Graphics operation. Sets the current coordinate from the top-left corner.
virtual POINT GetPos () const
 Graphics operation. Returns the current coordinate from the top-left corner.
virtual void DrawLine (int width, int height)
 Treats its parameters as offsets from the current position.
virtual void DrawRect (int x, int y, int width, int height)
 Draws a rectangle.
virtual void DrawRect (const RECT *r)
 Draws a rectangle.
virtual HDC CreateCompatibleHDC () const
 Creates a compatible DC and returns the windows handle.
virtual void Copy (const DC &dvc)
 Performs a BitBlt operation and copies given DC entirely.
virtual HBITMAP CreateCompatibleBitmap () const
 Creates a compatible bitmap and returns the windows handle.
virtual void Select (HGDIOBJ obj)
 Selects the given object. The previously selected object is pushed onto a deque.
virtual void Unselect (HGDIOBJ obj)
 Pops the previously selected object of the same type off a deque and selects it.
virtual void UnselectAll ()
 Restores the original object for all object types for which objects have been selected.
virtual void SolidFill (HBRUSH brush)
 Fills the device context completely with the given brush.
virtual void FillRect (int x, int y, int width, int height, HBRUSH hbr)
 Fills a rectangle with the given brush.
virtual void FillRect (const RECT *r, HBRUSH hbr)
 Fills a rectangle with the given brush.
virtual void DrawAbsLine (int x, int y)
 Draws a line to the given coordinate.
virtual void Draw (HICON hIcon, int destX=0, int destY=0)
 Draws an icon at the given coordinate.
virtual DCoperator= (HWND fw)
 Internally associates the object with the given window.
virtual DCoperator= (HDC ndc)
 Wraps the given DC.
virtual DCoperator= (const DC &ndc)
 Creates a compatible DC and wraps it.
virtual operator HDC () const
 Returns the windows handle of the DC which the object is wrapping.

Detailed Description

Wrap an Device Context to make generic graphic operations easier.

Definition at line 28 of file dc.h.


Constructor & Destructor Documentation

aswang::DC::DC ( ) [inline]

Definition at line 34 of file dc.h.

aswang::DC::DC ( HWND  fw) [inline]

Gets the DC of the given window.

Definition at line 36 of file dc.h.

aswang::DC::DC ( HWND  fw,
HDC  ndc 
) [inline]

Wraps the given DC and internally associates it with the given window.

Definition at line 38 of file dc.h.

aswang::DC::DC ( HDC  ndc) [inline]

Wraps the given DC.

Definition at line 40 of file dc.h.

aswang::DC::DC ( const DC ndc) [inline]

Creates a compatible DC and wraps it.

Definition at line 42 of file dc.h.

virtual aswang::DC::~DC ( ) [inline, virtual]

Definition at line 45 of file dc.h.


Member Function Documentation

void DC::_Delete ( ) [virtual]

Free a DC that is not associated with any window.

Definition at line 48 of file dc.cpp.

void DC::_Release ( ) [virtual]

Free a DC that is associated with a window.

Definition at line 42 of file dc.cpp.

void DC::Copy ( const DC dvc) [virtual]

Performs a BitBlt operation and copies given DC entirely.

Definition at line 118 of file dc.cpp.

HBITMAP DC::CreateCompatibleBitmap ( ) const [virtual]

Creates a compatible bitmap and returns the windows handle.

Definition at line 111 of file dc.cpp.

HDC DC::CreateCompatibleHDC ( ) const [virtual]

Creates a compatible DC and returns the windows handle.

Definition at line 104 of file dc.cpp.

void DC::Draw ( HICON  hIcon,
int  destX = 0,
int  destY = 0 
) [virtual]

Draws an icon at the given coordinate.

Definition at line 182 of file dc.cpp.

void DC::DrawAbsLine ( int  x,
int  y 
) [virtual]

Draws a line to the given coordinate.

Definition at line 176 of file dc.cpp.

void DC::DrawLine ( int  width,
int  height 
) [virtual]

Treats its parameters as offsets from the current position.

Definition at line 85 of file dc.cpp.

void DC::DrawRect ( int  x,
int  y,
int  width,
int  height 
) [virtual]

Draws a rectangle.

Definition at line 92 of file dc.cpp.

void DC::DrawRect ( const RECT *  r) [virtual]

Draws a rectangle.

Definition at line 98 of file dc.cpp.

void DC::FillRect ( int  x,
int  y,
int  width,
int  height,
HBRUSH  hbr 
) [virtual]

Fills a rectangle with the given brush.

Definition at line 163 of file dc.cpp.

void DC::FillRect ( const RECT *  r,
HBRUSH  hbr 
) [virtual]

Fills a rectangle with the given brush.

Definition at line 170 of file dc.cpp.

void DC::Free ( ) [virtual]

Free the DC. The method depends on whether the DC is internally associated with a window.

Definition at line 31 of file dc.cpp.

bool DC::Get ( ) [virtual]

Get the DC for the window the object is associated with.

Definition at line 24 of file dc.cpp.

virtual HDC aswang::DC::GetHDC ( ) const [inline, virtual]

Get the windows DC handle.

Definition at line 60 of file dc.h.

POINT DC::GetPos ( ) const [virtual]

Graphics operation. Returns the current coordinate from the top-left corner.

Definition at line 76 of file dc.cpp.

virtual HWND aswang::DC::GetWindow ( ) const [inline, virtual]

Get the window for which the DC is internally associated.

Definition at line 50 of file dc.h.

virtual aswang::DC::operator HDC ( ) const [inline, virtual]

Returns the windows handle of the DC which the object is wrapping.

Definition at line 103 of file dc.h.

DC & DC::operator= ( HWND  fw) [virtual]

Internally associates the object with the given window.

Definition at line 54 of file dc.cpp.

DC & DC::operator= ( HDC  ndc) [virtual]

Wraps the given DC.

Definition at line 60 of file dc.cpp.

DC & DC::operator= ( const DC ndc) [virtual]

Creates a compatible DC and wraps it.

Definition at line 65 of file dc.cpp.

void DC::Select ( HGDIOBJ  obj) [virtual]

Selects the given object. The previously selected object is pushed onto a deque.

Definition at line 124 of file dc.cpp.

virtual void aswang::DC::SetHDC ( HDC  ndc) [inline, virtual]

Set the windows DC handle.

Definition at line 62 of file dc.h.

void DC::SetPos ( int  x,
int  y 
) const [virtual]

Graphics operation. Sets the current coordinate from the top-left corner.

Definition at line 70 of file dc.cpp.

virtual void aswang::DC::SetWindow ( HWND  fw) [inline, virtual]

Set the window for which the DC should be internally associated.

Definition at line 48 of file dc.h.

void DC::SolidFill ( HBRUSH  brush) [virtual]

Fills the device context completely with the given brush.

Definition at line 156 of file dc.cpp.

void DC::Unselect ( HGDIOBJ  obj) [virtual]

Pops the previously selected object of the same type off a deque and selects it.

Definition at line 132 of file dc.cpp.

void DC::UnselectAll ( ) [virtual]

Restores the original object for all object types for which objects have been selected.

Definition at line 143 of file dc.cpp.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines