mbo::MboDrawWin Class Reference

A draw window independant from main application. More...

#include <MboDrawWin.h>

Inheritance diagram for mbo::MboDrawWin:

Inheritance graph
{mbo::MboWinMsgHandler\n|# m_hwnd\l# m_strWndClassName\l# g_vWndClassList\l- g_mhwndList\l|+ MboWinMsgHandler()\l+ ~MboWinMsgHandler()\l+ GetHWND()\l+ Stop()\l+ ProcessMessage()\l+ ProcessDefault()\l+ PostMessage()\l+ PostMessage()\l+ GetModuleHandle()\l# WndClassName()\l# WndTitleText()\l# Action()\l# OnWindowCreated()\l# MessageHandler()\l# WndCreate()\l# WndCalcMetrics()\l# WndDestroy()\l# WndRegister()\l# AddHWND()\l}{mbo::MboThread\n|# m_hThread\l# m_hIsStopping\l# m_dwThreadId\l# m_mxStartStop\l- m_szThreadName\l|+ MboThread()\l+ MboThread()\l+ ~MboThread()\l+ IsRunning()\l+ IsStopping()\l+ WaitFor()\l+ KillThread()\l+ GetThreadId()\l+ SetThreadPriority()\l+ GetThreadName()\l+ Action()\l+ OnActionException()\l+ Start()\l+ Stop()\l+ OnThreadStart()\l+ OnThreadStop()\l+ SetThreadName()\l# ThreadProc()\l- ThreadProcCaller()\l- ThreadNamer()\l- ThreadProcRunner()\l- ForceThreadName()\l- operator=()\l}
[legend]
Collaboration diagram for mbo::MboDrawWin:

Collaboration graph
{mbo::MboWinMsgHandler\n|# m_hwnd\l# m_strWndClassName\l# g_vWndClassList\l- g_mhwndList\l|+ MboWinMsgHandler()\l+ ~MboWinMsgHandler()\l+ GetHWND()\l+ Stop()\l+ ProcessMessage()\l+ ProcessDefault()\l+ PostMessage()\l+ PostMessage()\l+ GetModuleHandle()\l# WndClassName()\l# WndTitleText()\l# Action()\l# OnWindowCreated()\l# MessageHandler()\l# WndCreate()\l# WndCalcMetrics()\l# WndDestroy()\l# WndRegister()\l# AddHWND()\l}{mbo::MboThread\n|# m_hThread\l# m_hIsStopping\l# m_dwThreadId\l# m_mxStartStop\l- m_szThreadName\l|+ MboThread()\l+ MboThread()\l+ ~MboThread()\l+ IsRunning()\l+ IsStopping()\l+ WaitFor()\l+ KillThread()\l+ GetThreadId()\l+ SetThreadPriority()\l+ GetThreadName()\l+ Action()\l+ OnActionException()\l+ Start()\l+ Stop()\l+ OnThreadStart()\l+ OnThreadStop()\l+ SetThreadName()\l# ThreadProc()\l- ThreadProcCaller()\l- ThreadNamer()\l- ThreadProcRunner()\l- ForceThreadName()\l- operator=()\l}{mbo::CCriticalSectionImpl\n|- m_cs\l|+ CCriticalSectionImpl()\l+ ~CCriticalSectionImpl()\l+ Enter()\l+ Leave()\l+ GetLock()\l+ GetLevel()\l}{mbo::ICriticalSection\n||+ ~ICriticalSection()\l+ Enter()\l+ Leave()\l+ GetLock()\l+ GetLevel()\l}
[legend]

List of all members.

Public Member Functions

 MboDrawWin (int nSizeX=400, int nSizeY=300, const MboString &strWndClassName="MboDrawWin", bool bStart=true)
 MboDrawWin (int nSizeX, int nSizeY, int nMinSizeX, int nMinSizeY, int nMaxSizeX, int nMaxSizeY, const MboString &strWndClassName="MboDrawWin", bool bStart=true)
virtual ~MboDrawWin ()
bool IsWindowVisible () const
bool IsWindow () const
bool IsWndSizeable () const
bool IsWndSizingOrMoving () const
virtual void WndShow (bool bActive=true)
virtual void WndHide ()
virtual void WndRestore ()
virtual void WndSetSize (int nSizeX, int nSizeY)
virtual void WndSetPosition (int nPosX, int nPosY)
virtual void WndDraw ()
virtual void OnWndSized ()
virtual void DrawRect (const RECT &rect, COLORREF colInner, COLORREF colOuter=RGB(0, 0, 0), DRAW_MODE enMode=DRAW_MODE_FILL)
virtual void DrawRect (LONG nLeft, LONG nTop, LONG nRight, LONG nBottom, COLORREF colInner, COLORREF colOuter=RGB(0, 0, 0), DRAW_MODE enMode=DRAW_MODE_FILL)
virtual void DrawLine (LONG nX1, LONG nY1, LONG nX2, LONG nY2, int nPenWidth, COLORREF colInner, DRAW_MODE enMode=DRAW_MODE_FILL, int fnPenStyle=PS_INSIDEFRAME)
virtual void DrawLine (POINT pt1, POINT pt2, int nPenWidth, COLORREF colInner, DRAW_MODE enMode=DRAW_MODE_FILL, int fnPenStyle=PS_INSIDEFRAME)
virtual void DrawEllipse (const RECT &rect, COLORREF colInner, COLORREF colOuter=RGB(0, 0, 0), DRAW_MODE enMode=DRAW_MODE_FILL)
virtual void DrawCircle (const POINT &ptCenter, const LONG nRadius, COLORREF colInner, COLORREF colOuter=RGB(0, 0, 0), DRAW_MODE enMode=DRAW_MODE_FILL)
virtual void DrawCircle (const LONG nCenterX, const LONG nCenterY, const LONG nRadius, COLORREF colInner, COLORREF colOuter=RGB(0, 0, 0), DRAW_MODE enMode=DRAW_MODE_FILL)
virtual void DrawPolygon (const POINT *aptPoints, int nNumPoints, COLORREF colInner, COLORREF colOuter=RGB(0, 0, 0), DRAW_MODE enMode=DRAW_MODE_FILL)
virtual void CalcTextRect (RECT &rect, const MboString &strText, UINT uFormat=0)
virtual void DrawText (const RECT &rect, const MboString &strText, UINT uFormat=0, COLORREF colInner=RGB(0, 0, 0), COLORREF colOuter=RGB(255, 255, 255), DRAW_MODE enMode=DRAW_MODE_TRANSPARENT)
virtual void DrawText (LONG nLeft, LONG nTop, LONG nRight, LONG nBottom, const MboString &strText, UINT uFormat=0, COLORREF colInner=RGB(0, 0, 0), COLORREF colOuter=RGB(255, 255, 255), DRAW_MODE enMode=DRAW_MODE_TRANSPARENT)
virtual bool DrawBitmap (int nLeft, int nTop, HBITMAP hBitmap)
virtual bool DrawBitmap (int nLeft, int nTop, const MboString &strResId)
virtual bool DrawBitmap (int nLeft, int nTop, UINT nResId)
virtual bool DrawIcon (int nLeft, int nTop, HICON hIcon)
virtual bool DrawIcon (int nLeft, int nTop, const MboString &strResId)
virtual bool DrawIcon (int nLeft, int nTop, UINT nResId)
virtual bool WndSetIconBig (UINT nResId)
virtual bool WndSetIconSmall (UINT nResId)
virtual bool WndSetIconBoth (UINT nResId)
virtual void DrawSetMode (HBRUSH &hBrush, HPEN &hPen, COLORREF colInner, COLORREF colOuter=RGB(0, 0, 0), DRAW_MODE enMode=DRAW_MODE_FILL, int nPenWidth=0, int fnPenStyle=PS_SOLID)
virtual bool WndCreate ()
virtual void WndClear ()
virtual void OnWindowCreated ()
virtual void OnButtonDown (UINT nFlags, int x, int y)
virtual void OnButtonDblClk (UINT nFlags, int x, int y)
virtual void OnButtonUp (UINT nFlags, int x, int y)
virtual void WndDestroy ()
virtual void WndUpdate ()
virtual LRESULT ProcessMessage (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
virtual void WndSetTitle (const MboString &strTitle)
int GetPositionX () const
int GetPositionY () const
int GetSizeX () const
int GetSizeY () const
int GetMinSizeX () const
int GetMinSizeY () const
int GetMaxSizeX () const
int GetMaxSizeY () const
int GetWidth () const
int GetHeight () const
int GetScreenSizeX () const
int GetScreenSizeY () const
virtual void WndLoadExtent (const CIniData &cIniData, const MboString &strSection, bool bWriteDefault=false)
virtual void WndSaveExtent (CIniData &cIniData, const MboString &strSection) const

Protected Member Functions

virtual bool WndCalcMetrics ()
virtual void WndRegisterHandle ()

Protected Attributes

HDC m_hScrDC
HDC m_hMemDC


Detailed Description

A draw window independant from main application.

The class creates a window and the message handler and connects them on intstance level. That is you don't have to worry about how to propagate 'slef' to the message handler ProcessMessage().

Actual drawing happens in a background buffer which should be copied to the screen by calling WndUpdate(). The standard message handler implementation does so for several system messages like window movement.

When drawing takes to much time it is a good idea to do that in a separate thread.

Definition at line 132 of file MboDrawWin.h.


Constructor & Destructor Documentation

mbo::MboDrawWin::MboDrawWin ( int  nSizeX = 400,
int  nSizeY = 300,
const MboString strWndClassName = "MboDrawWin",
bool  bStart = true 
) [explicit]

Creates a window and all necessary resources (classes, handlers).

Parameters:
nSizeX outer width of window
nSizeY outer height of window
strWndClassName the name of the window class that will be returned by WndClassName() if not overwritten.
bStart whether to create window and start handler directly. If you plan to override window creation functions in a derived class this parameter must be set false.
Note:
When using this constructor the created window is not resizeable.
Warning:
There is a known problem with small windows. When the window widsth is smaller than the width needed to display any configured frame or system menu elements the client area gets the size as configured and a transparent area is used to fillup the real window area. The problem however is inherent to the WINAPI.

mbo::MboDrawWin::MboDrawWin ( int  nSizeX,
int  nSizeY,
int  nMinSizeX,
int  nMinSizeY,
int  nMaxSizeX,
int  nMaxSizeY,
const MboString strWndClassName = "MboDrawWin",
bool  bStart = true 
)

Creates a window and all necessary resources (classes, handlers).

Parameters:
nSizeX outer width of window
nSizeY outer height of window
nMinSizeX minimum allowed outer width of window
nMinSizeY minimum allowed outer height of window
nMaxSizeX maximum allowed outer width of window
nMaxSizeY maximum allowed outer height of window
strWndClassName the name of the window class that will be returned by WndClassName() if not overwritten.
bStart whether to create window and start handler directly. If you plan to override window creation functions in a derived class this parameter must be set false.
Note:
When using this constructor the created window is resizeable as long as MinSizeX / MaxSizeX or MinSizeY / MaxSizeY differ.

All Size values area automatically corrected. That is you have exchanged minimum and maximum values the constructor will change them back and if the Size value is smaller than the MinSize value the MinSizeValue will be used and finally if the Size value is greater than the MxSize value then the MaxSize value will be used.

Warning:
There is a known problem with small windows. When the window widsth is smaller than the width needed to display any configured frame or system menu elements the client area gets the size as configured and a transparent area is used to fillup the real window area. The problem however is inherent to the WINAPI.

virtual mbo::MboDrawWin::~MboDrawWin (  )  [virtual]

Destruct instance and all allocated resources.


Member Function Documentation

bool mbo::MboDrawWin::IsWindowVisible (  )  const

Returns:
whether window is visible.

bool mbo::MboDrawWin::IsWindow (  )  const

Returns:
whether window is existing.

bool mbo::MboDrawWin::IsWndSizeable (  )  const

Returns:
whether window is sizeable.

bool mbo::MboDrawWin::IsWndSizingOrMoving (  )  const

Returns:
whether window is currently in move or size mode.

virtual void mbo::MboDrawWin::WndShow ( bool  bActive = true  )  [virtual]

Show the window and optionally activate it.

Parameters:
bActive whether to activate the window.
Note:
This does not restore the window. That is a minimized window remains minimized after this call.
See also:
WndRestore

virtual void mbo::MboDrawWin::WndHide (  )  [virtual]

Hide the window .

virtual void mbo::MboDrawWin::WndRestore (  )  [virtual]

Restore the window, does neither show nor activate it.

See also:
WndShow

virtual void mbo::MboDrawWin::WndSetSize ( int  nSizeX,
int  nSizeY 
) [virtual]

Resize the window by specifying its outer size.

You can only change the size of the window within minimum and maximum values specified. To Check these you can use the following methods:

Parameters:
nSizeX new width of window
nSizeY new height of window

virtual void mbo::MboDrawWin::WndSetPosition ( int  nPosX,
int  nPosY 
) [virtual]

Move the window to the specifying coordinates.

Note:
This is ignored if not running (in _DEBUG mode it uses an assertion).
Parameters:
nPosX new X coordinate of window (top/right edge)
nPosY new Y coordinate of window (top/right edge)

virtual void mbo::MboDrawWin::WndDraw (  )  [virtual]

The actual drawing routine which is only called upon window creation once. It calles WndUpdate() to show the new contents.

Derived classes should therfore override this method and do its actual drawing there and call WndUpdate() when finished. The other way to draw the window is to inherit this function as is and perform drawing in specialized methods that are controlled from outside this class. In that case those methods need to ensure WndUpdate() gets called to make the new contents visible.

virtual void mbo::MboDrawWin::OnWndSized (  )  [virtual]

Called when the window has been resized. The default implementation simply calls WndDraw(). A derived class however might want to change internal information to be able to modify what can be shown with new window size.

virtual void mbo::MboDrawWin::DrawRect ( const RECT &  rect,
COLORREF  colInner,
COLORREF  colOuter = RGB(0, 0, 0),
DRAW_MODE  enMode = DRAW_MODE_FILL 
) [virtual]

Draws a filled rectangle with whole rect included.

Parameters:
rect display bounds of rectangle to draw
colInner inner color (area)
colOuter outer color (border)
enMode draw mode to be used
Note:
GDI correction for bottom/right is done automatically.

virtual void mbo::MboDrawWin::DrawRect ( LONG  nLeft,
LONG  nTop,
LONG  nRight,
LONG  nBottom,
COLORREF  colInner,
COLORREF  colOuter = RGB(0, 0, 0),
DRAW_MODE  enMode = DRAW_MODE_FILL 
) [virtual]

Draws a filled rectangle with whole rect included.

Parameters:
nLeft rect coordinate
nTop rect coordinate
nRight rect coordinate
nBottom rect coordinate
colInner inner color (area)
colOuter outer color (border)
enMode draw mode to be used
Note:
GDI correction for bottom/right is done automatically.

virtual void mbo::MboDrawWin::DrawLine ( LONG  nX1,
LONG  nY1,
LONG  nX2,
LONG  nY2,
int  nPenWidth,
COLORREF  colInner,
DRAW_MODE  enMode = DRAW_MODE_FILL,
int  fnPenStyle = PS_INSIDEFRAME 
) [virtual]

Draws a line.

Parameters:
nX1 start coordinate X
nY1 start coordinate Y
nX2 end coordinate X
nY2 end coordinate Y
nPenWidth width of pen in pixels
colInner inner color (area)
enMode draw mode to be used
fnPenStyle style of pen (PS_xxx)

virtual void mbo::MboDrawWin::DrawLine ( POINT  pt1,
POINT  pt2,
int  nPenWidth,
COLORREF  colInner,
DRAW_MODE  enMode = DRAW_MODE_FILL,
int  fnPenStyle = PS_INSIDEFRAME 
) [virtual]

Draws a line.

Parameters:
pt1 start coordinates
pt2 end coordinates
nPenWidth width of pen in pixels
colInner inner color (area)
enMode draw mode to be used
fnPenStyle style of pen (PS_xxx)

virtual void mbo::MboDrawWin::DrawEllipse ( const RECT &  rect,
COLORREF  colInner,
COLORREF  colOuter = RGB(0, 0, 0),
DRAW_MODE  enMode = DRAW_MODE_FILL 
) [virtual]

Draws a filled ellipse within the given rectangular boundaries.

Parameters:
rect display bounds of ellipse to draw
colInner inner color (area)
colOuter outer color (border)
enMode draw mode to be used
Note:
GDI correction for bottom/right is done automatically.

virtual void mbo::MboDrawWin::DrawCircle ( const POINT &  ptCenter,
const LONG  nRadius,
COLORREF  colInner,
COLORREF  colOuter = RGB(0, 0, 0),
DRAW_MODE  enMode = DRAW_MODE_FILL 
) [virtual]

Draws a filled circle at given center with given radius.

Parameters:
ptCenter pixel coordinates for circle center
nRadius radius of circle in pixel
colInner inner color (area)
colOuter outer color (border)
enMode draw mode to be used

virtual void mbo::MboDrawWin::DrawCircle ( const LONG  nCenterX,
const LONG  nCenterY,
const LONG  nRadius,
COLORREF  colInner,
COLORREF  colOuter = RGB(0, 0, 0),
DRAW_MODE  enMode = DRAW_MODE_FILL 
) [virtual]

Draws a filled circle at given center with given radius.

Parameters:
nCenterX X coordinates for circle center
nCenterY Y coordinates for circle center
nRadius radius of circle in pixel
colInner inner color (area)
colOuter outer color (border)
enMode draw mode to be used

virtual void mbo::MboDrawWin::DrawPolygon ( const POINT *  aptPoints,
int  nNumPoints,
COLORREF  colInner,
COLORREF  colOuter = RGB(0, 0, 0),
DRAW_MODE  enMode = DRAW_MODE_FILL 
) [virtual]

Draws a filled polygon just like DrawRect draws a rectangle.

Parameters:
aptPoints array of points to connect by a line. If areas are spawned then those will be filled.
nNumPoints number of points in array
colInner inner color (area)
colOuter outer color (border)
enMode draw mode to be used

virtual void mbo::MboDrawWin::CalcTextRect ( RECT &  rect,
const MboString strText,
UINT  uFormat = 0 
) [virtual]

Calculates rectangle to display a text.

Return values:
rect display bounds for text box which are updated to be able to hold the complete text.
Parameters:
strText text to display.
uFormat text formatting options (like DT_LEFT, DT_CENTER, DT_RIGHT). This one will be extended by DT_CALCRECT.

virtual void mbo::MboDrawWin::DrawText ( const RECT &  rect,
const MboString strText,
UINT  uFormat = 0,
COLORREF  colInner = RGB(0, 0, 0),
COLORREF  colOuter = RGB(255, 255, 255),
DRAW_MODE  enMode = DRAW_MODE_TRANSPARENT 
) [virtual]

Draws text filled with color cInner at position specified by rect.

Parameters:
rect display bounds for text box
strText text to display
uFormat text formatting options (like DT_LEFT, DT_CENTER, DT_RIGHT)
colInner inner color (area)
colOuter outer color (border)
enMode draw mode to be used

virtual void mbo::MboDrawWin::DrawText ( LONG  nLeft,
LONG  nTop,
LONG  nRight,
LONG  nBottom,
const MboString strText,
UINT  uFormat = 0,
COLORREF  colInner = RGB(0, 0, 0),
COLORREF  colOuter = RGB(255, 255, 255),
DRAW_MODE  enMode = DRAW_MODE_TRANSPARENT 
) [virtual]

Draws text filled with color cInner at position specified by area.

Parameters:
nLeft rect coordinate
nTop rect coordinate
nRight rect coordinate
nBottom rect coordinate
strText text to display
uFormat text formatting options (like DT_LEFT, DT_CENTER, DT_RIGHT)
colInner inner color (area)
colOuter outer color (border)
enMode draw mode to be used

virtual bool mbo::MboDrawWin::DrawBitmap ( int  nLeft,
int  nTop,
HBITMAP  hBitmap 
) [virtual]

Draws a bitmap

Parameters:
nLeft x-coordinate of upper-left corner
nTop y-coordinate of upper-left corner
hBitmap handle to bitmap to draw
Returns:
whether bitmap could be loaded

virtual bool mbo::MboDrawWin::DrawBitmap ( int  nLeft,
int  nTop,
const MboString strResId 
) [virtual]

Draws a bitmap

Parameters:
nLeft x-coordinate of upper-left corner
nTop y-coordinate of upper-left corner
strResId ressource id name of bitmap
Returns:
whether bitmap could be loaded

virtual bool mbo::MboDrawWin::DrawBitmap ( int  nLeft,
int  nTop,
UINT  nResId 
) [virtual]

Draws a bitmap

Parameters:
nLeft x-coordinate of upper-left corner
nTop y-coordinate of upper-left corner
nResId ressource id of bitmap
Returns:
whether bitmap could be loaded

virtual bool mbo::MboDrawWin::DrawIcon ( int  nLeft,
int  nTop,
HICON  hIcon 
) [virtual]

Draws an icon

Parameters:
nLeft x-coordinate of upper-left corner
nTop y-coordinate of upper-left corner
hIcon handle to icon to draw
Returns:
whether icon could be loaded

virtual bool mbo::MboDrawWin::DrawIcon ( int  nLeft,
int  nTop,
const MboString strResId 
) [virtual]

Loads an icon and draws it

Parameters:
nLeft x-coordinates of upper-left corner
nTop y-coordinates of upper-left corner
strResId ressource id name of icon
Returns:
whether icon could be loaded

virtual bool mbo::MboDrawWin::DrawIcon ( int  nLeft,
int  nTop,
UINT  nResId 
) [virtual]

Loads an icon and draws it

Parameters:
nLeft x-coordinates of upper-left corner
nTop y-coordinates of upper-left corner
nResId ressource id of icon
Returns:
whether icon could be loaded

virtual bool mbo::MboDrawWin::WndSetIconBig ( UINT  nResId  )  [virtual]

Set the big (32x32) application icon.

Parameters:
nResId ressource id of icon
Returns:
whether icon could be loaded and message was send.

virtual bool mbo::MboDrawWin::WndSetIconSmall ( UINT  nResId  )  [virtual]

Set the small (16x16) application icon.

Parameters:
nResId ressource id of icon
Returns:
whether icon could be loaded and message was send.

virtual bool mbo::MboDrawWin::WndSetIconBoth ( UINT  nResId  )  [virtual]

Set the both application icons.

This method calls WndSetIconBig() and WndSetIconSmall().

Parameters:
nResId ressource id of icon
Returns:
whether icon could be loaded and message was send.
Note:
The icon should have both a small (16x16) and a big (32x32) image.

virtual void mbo::MboDrawWin::DrawSetMode ( HBRUSH &  hBrush,
HPEN &  hPen,
COLORREF  colInner,
COLORREF  colOuter = RGB(0, 0, 0),
DRAW_MODE  enMode = DRAW_MODE_FILL,
int  nPenWidth = 0,
int  fnPenStyle = PS_SOLID 
) [virtual]

Select the actual draw mode. The method returns brush and pen which must be deleted by the callee. Normally this is done only internally from within any of the draw methods.

Return values:
hBrush brush to paint with
hPen pen to paint with
Parameters:
colInner inner color (area)
colOuter outer color (border)
enMode draw mode to be used
nPenWidth width of pen in pixels
fnPenStyle style of pen (PS_xxx)

virtual bool mbo::MboDrawWin::WndCreate (  )  [virtual]

Creates the GUI Window

This function will be called from the same thread that runs the message loop. The default implementation does neither show nor activate the empty window. However the callback OnWindowCreated() gets executed directly after this function returns and right before the message loop starts and shall be used to show and/or activate the window.

Returns:
whether or not window could be created.
Note:
This method does neither show nor activate the window. That is job is done in the default implementation of OnWindowCreated().

If this function returns false then the calling thread will terminate by a handled runtime_error.

Reimplemented from mbo::MboWinMsgHandler.

virtual void mbo::MboDrawWin::WndClear (  )  [virtual]

White fill the client area. This function is normally only called from the default OnWindoCreated() callback.

virtual void mbo::MboDrawWin::OnWindowCreated (  )  [virtual]

Used to initialized the window (first drawing).

This method may of course be overwritten to perform tasks like calling WndSetTitle() or WndSetIcon(). The default implementation simply calls WndClear() when this function gets invoked and then shows and activates it.

Note:
If you override this method you must ensure that you active and show the window because otherwise you wouldn't be able to use it.

You cannot use OnThreadStart() callback to draw because it is called before the window has been created.

Reimplemented from mbo::MboWinMsgHandler.

virtual void mbo::MboDrawWin::OnButtonDown ( UINT  nFlags,
int  x,
int  y 
) [virtual]

Callback called when a mouse button is pressed.

Parameters:
nFlags Any combination of:
  • MK_CONTROL Set if the ctrl key is down.
  • MK_LBUTTON Set if the left mouse button was active.
  • MK_MBUTTON Set if the middle mouse button was active.
  • MK_RBUTTON Set if the right mouse button was active.
  • MK_SHIFT Set if the shift key is down.
x x position of mouse
y y position of mouse
Note:
x and y are relative to the upper-left corner of the client area.

virtual void mbo::MboDrawWin::OnButtonDblClk ( UINT  nFlags,
int  x,
int  y 
) [virtual]

Callback called when a mouse button is double clicked.

Parameters:
nFlags Any combination of:
  • MK_CONTROL Set if the ctrl key is down.
  • MK_LBUTTON Set if the left mouse button was active.
  • MK_MBUTTON Set if the middle mouse button was active.
  • MK_RBUTTON Set if the right mouse button was active.
  • MK_SHIFT Set if the shift key is down.
x x position of mouse
y y position of mouse
Note:
x and y are relative to the upper-left corner of the client area.

virtual void mbo::MboDrawWin::OnButtonUp ( UINT  nFlags,
int  x,
int  y 
) [virtual]

Callback called when a mouse button is release (up after pressed).

Parameters:
nFlags Any combination of:
  • MK_CONTROL Set if the ctrl key is down.
  • MK_LBUTTON Set if the left mouse button was active.
  • MK_MBUTTON Set if the middle mouse button was active.
  • MK_RBUTTON Set if the right mouse button was active.
  • MK_SHIFT Set if the shift key is down.
x x position of mouse
y y position of mouse
Note:
x and y are relative to the upper-left corner of the client area.

virtual void mbo::MboDrawWin::WndDestroy (  )  [virtual]

Destroys the GUI Window

Reimplemented from mbo::MboWinMsgHandler.

virtual void mbo::MboDrawWin::WndUpdate (  )  [virtual]

Copy background drawing buffer to screen.

virtual LRESULT mbo::MboDrawWin::ProcessMessage ( HWND  hwnd,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
) [virtual]

Overwrite this handler if you want to handle any message.

Note:
You should call ProcessDefault() from ProcessMessage() for any message not handled yourself.
Parameters:
hwnd Handle to the window procedure that received the message. This normally matches m_hwnd.
uMsg Specifies the message received.
wParam Specifies additional message information. The content of this parameter depends on the value of the Msg parameter.
lParam Specifies additional message information. The content of this parameter depends on the value of the Msg parameter.
Returns:
The return value is the result of the message processing and depends on the message.

Reimplemented from mbo::MboWinMsgHandler.

virtual void mbo::MboDrawWin::WndSetTitle ( const MboString strTitle  )  [virtual]

Set title of window.

Parameters:
strTitle new window title

int mbo::MboDrawWin::GetPositionX (  )  const

Returns:
X position of window (if running else 0)

int mbo::MboDrawWin::GetPositionY (  )  const

Returns:
Y position of window (if running else 0)

int mbo::MboDrawWin::GetSizeX (  )  const

Returns:
current window width

int mbo::MboDrawWin::GetSizeY (  )  const

Returns:
current window height

int mbo::MboDrawWin::GetMinSizeX (  )  const

Returns:
minimum window width

int mbo::MboDrawWin::GetMinSizeY (  )  const

Returns:
minimum window height

int mbo::MboDrawWin::GetMaxSizeX (  )  const

Returns:
maximum window width

int mbo::MboDrawWin::GetMaxSizeY (  )  const

Returns:
maximum window height

int mbo::MboDrawWin::GetWidth (  )  const

Returns:
width of client area

int mbo::MboDrawWin::GetHeight (  )  const

Returns:
height of client area

int mbo::MboDrawWin::GetScreenSizeX (  )  const

Returns:
horizontal size of screen in pixels

int mbo::MboDrawWin::GetScreenSizeY (  )  const

Returns:
vertical size of screen in pixels

virtual void mbo::MboDrawWin::WndLoadExtent ( const CIniData cIniData,
const MboString strSection,
bool  bWriteDefault = false 
) [virtual]

Load window position and size from ini file.

Parameters:
cIniData Ini file to use
strSection Section to use
bWriteDefault Whether to write the keys if not present already
Note:
This function uses the following keys: WndPosX, WndPosY, WndSizeX, WndSizeY.

This works only when running.

virtual void mbo::MboDrawWin::WndSaveExtent ( CIniData cIniData,
const MboString strSection 
) const [virtual]

Save window position and size to ini file.

Parameters:
cIniData Ini file to use
strSection Section to use
Note:
This function uses the following keys: WndPosX, WndPosY, WndSizeX, WndSizeY.

This works only when running.

virtual bool mbo::MboDrawWin::WndCalcMetrics (  )  [protected, virtual]

Register the window and calculate its metrics.

Reimplemented from mbo::MboWinMsgHandler.

virtual void mbo::MboDrawWin::WndRegisterHandle (  )  [protected, virtual]

Called from WndCreate() or WndCalcMetrics() to actually register the window handle and create the Screen DC. This function does not do anything if either the handle is not set or the screen DC handle was created already.


Member Data Documentation

HDC mbo::MboDrawWin::m_hScrDC [protected]

Handle to Device Context of window

Definition at line 795 of file MboDrawWin.h.

HDC mbo::MboDrawWin::m_hMemDC [protected]

Handle to Device Context of background buffer

Definition at line 796 of file MboDrawWin.h.


The documentation for this class was generated from the following file:
  Hosted on code.google.com  
© Marcus Börger
Generated on Fri Jan 18 21:21:11 2008 for MBO-lib by doxygen 1.5.4