CRenderWnd Class Reference

This OIL class is rendered into. It passes all input to its parent CCamView window. More...

#include <rendwnd.h>

List of all members.

Public Member Functions

 CRenderWnd (CCamView *pView=NULL)
virtual ~CRenderWnd ()
virtual BOOL Create (const wxRect &rect, wxWindow *parent, UINT32 id)
void SetView (CCamView *pView)
CCamViewGetView (void)
virtual wxClientDC * GetClientDC ()
 Returns a pointer to the appropriate client DC, allocating it if necessary.
virtual void AllocateDC (BOOL KeepIt=TRUE)
 Returns a pointer to the appropriate client DC, allocating it if necessary.
virtual void DoneWithDC ()
 Hints that we've done with our DC.

Static Public Member Functions

static void SetDoubleBuffer (BOOL DoubleBuffer)
static BOOL GetDoubleBuffer ()

Protected Member Functions

void OnPaint (wxPaintEvent &evnt)
 Creates a CPaintDC and sends a private WM_RENDERVIEW message, together with a pointer to the CPaintDC in the LPARAM, to the parent CCamView. Uses a CCPaintDC so we can get to the rectangle list subsequently.
void OnLButtonDown (wxMouseEvent &evnt)
 Passes the mouse message on to the parent CCamView via a call to CRenderWnd::PassMsgToParent().
void OnLButtonDblClk (wxMouseEvent &evnt)
 Passes the mouse message on to the parent CCamView via a call to CRenderWnd::PassMsgToParent().
void OnLButtonUp (wxMouseEvent &evnt)
 Passes the mouse message on to the parent CCamView via a call to CRenderWnd::PassMsgToParent().
void OnMouseMove (wxMouseEvent &evnt)
 Passes the mouse message on to the parent CCamView via a call to CRenderWnd::PassMsgToParent().
void OnRButtonDown (wxMouseEvent &evnt)
 Passes the mouse message on to the parent CCamView via a call to CRenderWnd::PassMsgToParent().
void OnRButtonDblClk (wxMouseEvent &evnt)
 Passes the mouse message on to the parent CCamView via a call to CRenderWnd::PassMsgToParent().
void OnRButtonUp (wxMouseEvent &evnt)
 Passes the mouse message on to the parent CCamView via a call to CRenderWnd::PassMsgToParent().
void OnMButtonDown (wxMouseEvent &evnt)
 Passes the mouse message on to the parent CCamView via a call to CRenderWnd::PassMsgToParent().
void OnMButtonDblClk (wxMouseEvent &evnt)
 Passes the mouse message on to the parent CCamView via a call to CRenderWnd::PassMsgToParent().
void OnMButtonUp (wxMouseEvent &evnt)
 Passes the mouse message on to the parent CCamView via a call to CRenderWnd::PassMsgToParent().
void OnMouseWheel (wxMouseEvent &evnt)
 Passes the mouse message on to the parent CCamView.
void OnSize (wxSizeEvent &event)
 Does nothing, skipping the event.
void OnErase (wxEraseEvent &event)
 Does nothing.
void OnSetCursor (wxSetCursorEvent &event)
 Eat the cursor update requests to stop anyone else playing with them, this is needed on MSW or the cursor reverts to the normal arrow.
void OnEnter (wxMouseEvent &event)
void OnLeave (wxMouseEvent &event)
void OnKey (wxKeyEvent &event)
 This DOES NOT ACTUALLY HANDLE EVENTS, it only notes a key has been pressed and stops the mouse motion mangler eating the next mouse move.
void OnChar (wxKeyEvent &event)
void OnIdle (wxIdleEvent &event)
 Laze deletion of our client DC on idle.

Static Protected Member Functions

static void ReflectDoubleBufferingInChildren (wxWindow *pWindow)

Protected Attributes

CCamViewm_pView
INT32 m_DCUsers
CCClientDCm_pCCClientDC

Static Protected Attributes

static BOOL m_DoubleBuffer = FALSE


Detailed Description

This OIL class is rendered into. It passes all input to its parent CCamView window.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
ages ago

Definition at line 128 of file rendwnd.h.


Constructor & Destructor Documentation

CRenderWnd::CRenderWnd CCamView pView = NULL  ) 
 

Definition at line 160 of file rendwnd.cpp.

00160                                       :
00161     m_pView(pView), m_pCCClientDC(NULL)
00162 {
00163     m_DCUsers=0;
00164     // Nothing else to do for now...
00165 }

CRenderWnd::~CRenderWnd  )  [virtual]
 

Definition at line 167 of file rendwnd.cpp.

00168 {
00169     TRACEUSER("Gerry", _T("Deleting CRenderWnd at 0x%08x\n"), this);
00170     if (m_DCUsers)
00171     {
00172         ERROR3("CRenderWnd::~CRenderWnd non-zero DC user count - leaking a DC");
00173     }
00174     else
00175     {
00176         if (m_pCCClientDC)
00177         {
00178             delete(m_pCCClientDC);
00179             m_pCCClientDC = NULL;
00180         }
00181     }
00182 }


Member Function Documentation

void CRenderWnd::AllocateDC BOOL  KeepIt = TRUE  )  [virtual]
 

Returns a pointer to the appropriate client DC, allocating it if necessary.

Author:
Alex Bligh <alex@alex.org.uk>
Date:
12/06/2006
Parameters:
None [INPUTS]
None [OUTPUTS]
Returns:
Pointer to the CCClientDC

Errors: - Scope: Public

See also:
CCamView::OnCreate()

Definition at line 199 of file rendwnd.cpp.

00200 {
00201     ERROR3IF((m_DCUsers && !m_pCCClientDC), "We have users, but no client DC");
00202     if (!m_pCCClientDC)
00203         m_pCCClientDC = new CCClientDC(this); // OK if it fails
00204     
00205     if (KeepIt)
00206         m_DCUsers++;
00207     return;
00208 }

BOOL CRenderWnd::Create const wxRect &  rect,
wxWindow *  parent,
UINT32  id
[virtual]
 

Definition at line 297 of file rendwnd.cpp.

00299 {
00300     BOOL ok=wxWindow::Create(pParent, id, rect.GetTopLeft(), rect.GetSize(), wxNO_FULL_REPAINT_ON_RESIZE);
00301     SetExtraStyle(wxWS_EX_PROCESS_IDLE);
00302 #if defined(__WXGTK__)
00303 	::SetDoubleBuffer(this, m_DoubleBuffer);
00304 #endif
00305     return ok;
00306 }

void CRenderWnd::DoneWithDC  )  [virtual]
 

Hints that we've done with our DC.

Author:
Alex Bligh <alex@alex.org.uk>
Date:
12/06/2006
See also:
View; PaperRenderRegion.
Note this is merely a hint. This routine is not guaranteed to eb called

Definition at line 244 of file rendwnd.cpp.

00245 {
00246     ERROR3IF((m_DCUsers<=0), "We have no users, but I'm being told I'm done with");
00247 
00248     if (m_DCUsers>0)
00249         m_DCUsers--;
00250 
00251     // Note we use a lazy-destroy from our idle handler
00252 }

wxClientDC * CRenderWnd::GetClientDC  )  [virtual]
 

Returns a pointer to the appropriate client DC, allocating it if necessary.

Author:
Alex Bligh <alex@alex.org.uk>
Date:
12/06/2006
Parameters:
None [INPUTS]
None [OUTPUTS]
Returns:
Pointer to the CCClientDC

Errors: - Scope: Public

See also:
CCamView::OnCreate()

Definition at line 225 of file rendwnd.cpp.

00226 {
00227     if (!m_pCCClientDC)
00228         AllocateDC(FALSE);
00229     return (wxClientDC*)(m_pCCClientDC?m_pCCClientDC->GetDC():NULL);
00230 }

static BOOL CRenderWnd::GetDoubleBuffer  )  [inline, static]
 

Definition at line 145 of file rendwnd.h.

00145 {return m_DoubleBuffer;}

CCamView* CRenderWnd::GetView void   )  [inline]
 

Definition at line 142 of file rendwnd.h.

00142 { return(m_pView); }

void CRenderWnd::OnChar wxKeyEvent &  event  )  [protected]
 

Definition at line 500 of file rendwnd.cpp.

00501 {
00502     TRACEUSER( "jlh92", _T("CRenderWnd::OnChar \"%c\" \n"), event.GetUnicodeKey() );
00503 
00504     if( !AfxGetApp().HandleKeyPress( event ) )
00505         event.Skip(); // Pass the key event on to someone who really wants it.
00506 }

void CRenderWnd::OnEnter wxMouseEvent &  event  )  [protected]
 

Definition at line 731 of file rendwnd.cpp.

00732 {
00733     TRACEUSER( "Luke", _T("OnEnter %p\n"), event.GetEventObject() );
00734     
00735 //  if( event.GetEventObject() != m_pFrame )
00736 //      return;
00737     
00738     wxPoint             pt( event.GetPosition() );
00739     wxSetCursorEvent    CursorEvent( pt.x, pt.y );
00740     m_pView->OnSetCursor( CursorEvent );
00741     if( CursorEvent.HasCursor() )
00742     {
00743         wxSetCursor( CursorEvent.GetCursor() );
00744     }
00745 }

void CRenderWnd::OnErase wxEraseEvent &  evnt  )  [protected]
 

Does nothing.

Author:
Gerry_Iles (Xara Group Ltd) <camelotdev@xara.com>
Date:
03/02/2006
Parameters:
Not used. [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: - Scope: Protected

See also:
-

Definition at line 703 of file rendwnd.cpp.

00704 {
00705     // Do nothing
00706 }

void CRenderWnd::OnIdle wxIdleEvent &  event  )  [protected]
 

Laze deletion of our client DC on idle.

Author:
Alex Bligh <alex@alex.org.uk>
Date:
12/06/2006
See also:
View; PaperRenderRegion.
We appear to need to create and delete DCs or rendering into the first RenderWindow doesn't work. Who knows why.

Definition at line 267 of file rendwnd.cpp.

00268 {
00269     if (PrintMonitor::IsPrintingNow())
00270         return;
00271 
00272     if ((m_DCUsers<=0) && m_pCCClientDC)
00273     {
00274         delete m_pCCClientDC;
00275         m_pCCClientDC=NULL;
00276     }
00277 }

void CRenderWnd::OnKey wxKeyEvent &  event  )  [protected]
 

This DOES NOT ACTUALLY HANDLE EVENTS, it only notes a key has been pressed and stops the mouse motion mangler eating the next mouse move.

Author:
Alex Bligh (alex@alex.org.uk)
Date:
2 May 2006
Parameters:
reference to the event [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: - Scope: Protected

See also:
-

Definition at line 492 of file rendwnd.cpp.

00493 {
00494     if (m_pView)
00495         m_pView->DontSkipNextMouse();
00496     
00497     event.Skip(); // Pass the key event on to someone who really wants it.
00498 }

void CRenderWnd::OnLButtonDblClk wxMouseEvent &  evnt  )  [protected]
 

Passes the mouse message on to the parent CCamView via a call to CRenderWnd::PassMsgToParent().

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
ages ago
Parameters:
Not used. [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: - Scope: Protected

See also:
CRenderWnd::PassMsgToParent(); CCamView::OnLButtonDblClk()

Definition at line 412 of file rendwnd.cpp.

00413 {
00414     if (m_pView)
00415         m_pView->OnLButtonDblClk(evnt);
00416 }

void CRenderWnd::OnLButtonDown wxMouseEvent &  evnt  )  [protected]
 

Passes the mouse message on to the parent CCamView via a call to CRenderWnd::PassMsgToParent().

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
ages ago
Parameters:
Not used. [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: - Scope: Protected

See also:
CRenderWnd::PassMsgToParent(); CCamView::OnLButtonDown()

Definition at line 389 of file rendwnd.cpp.

00390 {
00391     if (m_pView)
00392         m_pView->OnLButtonDown(evnt);
00393 }

void CRenderWnd::OnLButtonUp wxMouseEvent &  evnt  )  [protected]
 

Passes the mouse message on to the parent CCamView via a call to CRenderWnd::PassMsgToParent().

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
ages ago
Parameters:
Not used. [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: - Scope: Protected

See also:
CRenderWnd::PassMsgToParent(); CCamView::OnLButtonUp()

Definition at line 435 of file rendwnd.cpp.

00436 {
00437     if (m_pView)
00438         m_pView->OnLButtonUp(evnt);
00439 }

void CRenderWnd::OnLeave wxMouseEvent &  event  )  [protected]
 

Definition at line 747 of file rendwnd.cpp.

00748 {
00749     TRACEUSER( "Luke", _T("OnLeave %p\n"), event.GetEventObject() );
00750 
00751 //  if( event.GetEventObject() != m_pFrame )
00752 //      return;
00753     
00754     ::wxSetCursor( *wxSTANDARD_CURSOR );
00755 }

void CRenderWnd::OnMButtonDblClk wxMouseEvent &  evnt  )  [protected]
 

Passes the mouse message on to the parent CCamView via a call to CRenderWnd::PassMsgToParent().

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
ages ago
Parameters:
Not used. [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: - Scope: Protected

See also:
CRenderWnd::PassMsgToParent(); CCamView::OnLButtonDblClk()

Definition at line 614 of file rendwnd.cpp.

00615 {
00616     if (m_pView)
00617         m_pView->OnMButtonDblClk(evnt);
00618 }

void CRenderWnd::OnMButtonDown wxMouseEvent &  evnt  )  [protected]
 

Passes the mouse message on to the parent CCamView via a call to CRenderWnd::PassMsgToParent().

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
ages ago
Parameters:
Not used. [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: - Scope: Protected

See also:
CRenderWnd::PassMsgToParent(); CCamView::OnLButtonDown()

Definition at line 591 of file rendwnd.cpp.

00592 {
00593     if (m_pView)
00594         m_pView->OnMButtonDown(evnt);
00595 }

void CRenderWnd::OnMButtonUp wxMouseEvent &  evnt  )  [protected]
 

Passes the mouse message on to the parent CCamView via a call to CRenderWnd::PassMsgToParent().

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
ages ago
Parameters:
Not used. [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: - Scope: Protected

See also:
CRenderWnd::PassMsgToParent(); CCamView::OnLButtonUp()

Definition at line 637 of file rendwnd.cpp.

00638 {
00639     if (m_pView)
00640         m_pView->OnMButtonUp(evnt);
00641 }

void CRenderWnd::OnMouseMove wxMouseEvent &  event  )  [protected]
 

Passes the mouse message on to the parent CCamView via a call to CRenderWnd::PassMsgToParent().

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
ages ago
Parameters:
Not used. [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: - Scope: Protected

See also:
CRenderWnd::PassMsgToParent(); CCamView::OnMouseMove()

Definition at line 458 of file rendwnd.cpp.

00459 {
00460     if (m_pView)
00461         m_pView->OnMouseMove( event );
00462     
00463 #if defined(__WXGTK__)
00464     wxSetCursorEvent    CursorEvent( event.m_x, event.m_y );
00465     OnSetCursor( CursorEvent );
00466     if( CursorEvent.HasCursor() )
00467     {
00468         // The window cursor seems to be ignored, but is needed for
00469         // CaptureMouse to work
00470         wxSetCursor( CursorEvent.GetCursor() );
00471         SetCursor( CursorEvent.GetCursor() );
00472     }
00473 #endif
00474 }

void CRenderWnd::OnMouseWheel wxMouseEvent &  evnt  )  [protected]
 

Passes the mouse message on to the parent CCamView.

Author:
Gerry_Iles (Xara Group Ltd) <camelotdev@xara.com>
Date:
03/02/2006
Parameters:
Not used. [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: - Scope: Protected

See also:
-

Definition at line 659 of file rendwnd.cpp.

00660 {
00661     if (m_pView)
00662         m_pView->OnMouseWheel(evnt);
00663 }

void CRenderWnd::OnPaint wxPaintEvent &  evnt  )  [protected]
 

Creates a CPaintDC and sends a private WM_RENDERVIEW message, together with a pointer to the CPaintDC in the LPARAM, to the parent CCamView. Uses a CCPaintDC so we can get to the rectangle list subsequently.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
ages ago
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: - Scope: Protected

See also:
CCamView::OnRenderView()

Definition at line 329 of file rendwnd.cpp.

00330 {
00331     if ((!CCamApp::IsDisabled()) && (!PrintMonitor::IsPrintingNow()))
00332     {
00333         CCPaintDC dc(this);
00334 //      wxPalette* OldPal = PaletteManager::StartPaintPalette(&dc);
00335 
00336         if (m_pView)
00337             m_pView->OnDraw(dc.GetDC());
00338 
00339 //      PaletteManager::StopPaintPalette(&dc, OldPal);
00340     }
00341     else
00342     {
00343         // if we were printing, we have to draw something - white will do
00344         if (PrintMonitor::IsPrintingNow())
00345         {
00346             // Draw a white rectangle here
00347             wxPaintDC MyPaint(this);
00348 
00349             // Lets have a white brush...
00350             MyPaint.SetBrush(wxBrush(wxColour(*wxWHITE)));
00351             MyPaint.SetPen(*wxTRANSPARENT_PEN);
00352 
00353             wxRegionIterator upd(GetUpdateRegion()); // get the update rect list
00354 
00355             while (upd)
00356             {
00357                 wxRect rect(upd.GetRect());
00358                 MyPaint.DrawRectangle(rect);
00359                 upd++;
00360             }
00361 
00362             // ask for a full redraw at the end
00363             PrintMonitor::WantFullRedraw(TRUE);
00364         }
00365         else
00366         {
00367             wxPaintDC dc( this );                               // Clear paint condition 
00368         }
00369     }
00370 }

void CRenderWnd::OnRButtonDblClk wxMouseEvent &  evnt  )  [protected]
 

Passes the mouse message on to the parent CCamView via a call to CRenderWnd::PassMsgToParent().

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
ages ago
Parameters:
Not used. [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: - Scope: Protected

See also:
CRenderWnd::PassMsgToParent(); CCamView::OnRButtonDblClk()

Definition at line 546 of file rendwnd.cpp.

00547 {
00548     if (m_pView)
00549         m_pView->OnRButtonDblClk(evnt);
00550 }

void CRenderWnd::OnRButtonDown wxMouseEvent &  evnt  )  [protected]
 

Passes the mouse message on to the parent CCamView via a call to CRenderWnd::PassMsgToParent().

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
ages ago
Parameters:
Not used. [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: - Scope: Protected

See also:
CRenderWnd::PassMsgToParent(); CCamView::OnRButtonDown()

Definition at line 523 of file rendwnd.cpp.

00524 {
00525     if (m_pView)
00526         m_pView->OnRButtonDown(evnt);
00527 }

void CRenderWnd::OnRButtonUp wxMouseEvent &  evnt  )  [protected]
 

Passes the mouse message on to the parent CCamView via a call to CRenderWnd::PassMsgToParent().

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
ages ago
Parameters:
Not used. [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: - Scope: Protected

See also:
CRenderWnd::PassMsgToParent(); CCamView::OnRButtonUp()

Definition at line 569 of file rendwnd.cpp.

00570 {
00571     if (m_pView)
00572         m_pView->OnRButtonUp(evnt);
00573 }

void CRenderWnd::OnSetCursor wxSetCursorEvent &  event  )  [protected]
 

Eat the cursor update requests to stop anyone else playing with them, this is needed on MSW or the cursor reverts to the normal arrow.

Author:
Luke_Hart (Xara Group Ltd) <camelotdev@xara.com>
Date:
08/02/06
Parameters:
The event. [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: - Scope: Protected

See also:

Definition at line 724 of file rendwnd.cpp.

00725 {
00726     if( NULL != m_pView )
00727         m_pView->OnSetCursor( event );
00728 }

void CRenderWnd::OnSize wxSizeEvent &  evnt  )  [protected]
 

Does nothing, skipping the event.

Author:
Gerry_Iles (Xara Group Ltd) <camelotdev@xara.com>
Date:
03/02/2006
Parameters:
Not used. [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: - Scope: Protected

See also:
-

Definition at line 681 of file rendwnd.cpp.

00682 {
00683     TRACEUSER("Gerry", _T("CRenderWnd::OnSize(%d, %d)\n"), evnt.m_size.x, evnt.m_size.y);
00684     evnt.Skip();
00685 }

void CRenderWnd::ReflectDoubleBufferingInChildren wxWindow *  pWindow  )  [static, protected]
 

Definition at line 766 of file rendwnd.cpp.

00767 {
00768 #if defined(__WXGTK__)
00769     // Process this one
00770     if (pWindow->IsKindOf(CLASSINFO(CRenderWnd)))
00771 		::SetDoubleBuffer(pWindow, m_DoubleBuffer);
00772 #endif
00773 
00774     // Now process children if any
00775     wxWindowList::Node * pNode = pWindow->GetChildren().GetFirst();
00776     while (pNode)
00777     {
00778         ReflectDoubleBufferingInChildren(pNode->GetData());
00779         pNode = pNode->GetNext();
00780     }
00781     return;
00782 }

void CRenderWnd::SetDoubleBuffer BOOL  DoubleBuffer  )  [static]
 

Definition at line 758 of file rendwnd.cpp.

00759 {
00760     m_DoubleBuffer = DoubleBuffer;
00761     // Now go through and set or clear double buffering on each window
00762     wxWindow * pWindow = CCamFrame::GetMainFrame();
00763     if (pWindow) ReflectDoubleBufferingInChildren(pWindow);
00764 }

void CRenderWnd::SetView CCamView pView  )  [inline]
 

Definition at line 141 of file rendwnd.h.

00141 { m_pView = pView; }


Member Data Documentation

INT32 CRenderWnd::m_DCUsers [protected]
 

Definition at line 188 of file rendwnd.h.

BOOL CRenderWnd::m_DoubleBuffer = FALSE [static, protected]
 

Definition at line 185 of file rendwnd.h.

CCClientDC* CRenderWnd::m_pCCClientDC [protected]
 

Definition at line 192 of file rendwnd.h.

CCamView* CRenderWnd::m_pView [protected]
 

Definition at line 183 of file rendwnd.h.


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 03:53:15 2007 for Camelot by  doxygen 1.4.4