wxArt2D
Public Member Functions | Protected Attributes | List of all members
a2dViewWindow< Twindow > Class Template Reference

specialized wxWindow derived template class to handle a2dView events More...

#include <docviewref.h>

Inheritance diagram for a2dViewWindow< Twindow >:
Inheritance graph
[legend]
Collaboration diagram for a2dViewWindow< Twindow >:
Collaboration graph
[legend]

Public Member Functions

 a2dViewWindow (a2dView *view, wxWindow *parent, wxWindowID id=-1, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxHSCROLL|wxVSCROLL, const wxString &name=wxT("a2dViewWindow"))
 Constructor for creation with view. More...
 
 a2dViewWindow (wxWindow *parent, wxWindowID id=-1, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxHSCROLL|wxVSCROLL, const wxString &name=wxT("a2dViewWindow"))
 Constructor for creation without view. More...
 
 ~a2dViewWindow ()
 Destructor.
 
virtual void SetView (a2dView *view)
 to switch the view in this window to another view More...
 
a2dViewGetView ()
 get the current view
 
virtual bool ProcessEvent (wxEvent &event)
 Extend event processing to search the view's event table. More...
 
virtual void OnDraw (wxDC &dc)
 Override this function to draw the graphic (or just process EVT_PAINT)
 
void OnCloseView (a2dCloseViewEvent &event)
 resets view to NULL when view was closed and skips the event for the parent window/frame.
 
void OnPaint (wxPaintEvent &event)
 calls OnDraw(dc);
 

Protected Attributes

a2dSmrtPtr< a2dViewm_view
 the view that uses this window to display itself
 

Detailed Description

template<class Twindow>
class a2dViewWindow< Twindow >

specialized wxWindow derived template class to handle a2dView events

The following events are sent up from the a2dView to this window.

::wxEVT_CLOSE_VIEW

Next one can be recieved from the a2dDocument after Registering this class.

::wxEVT_CHANGEDFILENAME_DOCUMENT

When the a2dView sent this events it disables itself until return, to prevent looping.

::wxEVT_CLOSE_VIEW should be handled in a derived class, or in some/the parent window of this window. The handler must call a2dDocumentViewScrolledWindow::SetView( NULL ) or set m_view to NULL and release it, this Detaches the view from the window, In case the window gets deleted via a Destroy() this will be done automatically.

These event are of type commandevents, and travel up to the parent of this window if not handled here.

All other events to the window are sent first to the a2dView and if not handled there, can be handled here.

Definition at line 3630 of file docviewref.h.

Constructor & Destructor Documentation

template<class Twindow >
a2dViewWindow< Twindow >::a2dViewWindow ( a2dView view,
wxWindow *  parent,
wxWindowID  id = -1,
const wxPoint &  pos = wxDefaultPosition,
const wxSize &  size = wxDefaultSize,
long  style = wxHSCROLL | wxVSCROLL,
const wxString &  name = wxT( "a2dViewWindow< Twindow >" ) 
)

Constructor for creation with view.

Parameters
viewThe view for the document ( can be NULL )
parentthe parent window for this window
idThe window identifier. It may take a value of -1 to indicate a default value.
posThe window position.
sizeThe window size.
styleWindow style, please look into wxWindows docs for an overview.
nameThe name of the window.

Definition at line 3720 of file docviewref.h.

template<class Twindow >
a2dViewWindow< Twindow >::a2dViewWindow ( wxWindow *  parent,
wxWindowID  id = -1,
const wxPoint &  pos = wxDefaultPosition,
const wxSize &  size = wxDefaultSize,
long  style = wxHSCROLL | wxVSCROLL,
const wxString &  name = wxT( "a2dViewWindow< Twindow >" ) 
)

Constructor for creation without view.

Parameters
parentthe parent window for this window
idThe window identifier. It may take a value of -1 to indicate a default value.
posThe window position.
sizeThe window size.
styleWindow style, please look into wxWindows docs for an overview.
nameThe name of the window.

Definition at line 3738 of file docviewref.h.

Member Function Documentation

template<class Twindow >
bool a2dViewWindow< Twindow >::ProcessEvent ( wxEvent &  event)
virtual

Extend event processing to search the view's event table.

Some events are handled within the view as if the view is a window within a window. Therefore the wxWindow containing the view should redirect all its events to its views, when the view does not handle the event it will go to the window itself.

View events ::wxEVT_CLOSE_VIEW from the view are sent up to this window.

Next one can be recieved from the a2dDocument after Registering this class.

::wxEVT_CHANGEDFILENAME_DOCUMENT

Definition at line 3811 of file docviewref.h.

template<class Twindow >
void a2dViewWindow< Twindow >::SetView ( a2dView view)
virtual

to switch the view in this window to another view

Default releases the old view and sets it display to NULL. Next it sets and owns the new view and sets the view its display to this window. Override this if more needs to be done to switch the view.

Definition at line 3759 of file docviewref.h.


The documentation for this class was generated from the following file:
a2dViewWindow< Twindow > Class Template Reference -- Sun Oct 12 2014 17:04:52 -- Sun Oct 12 2014 -- 1.8.5 -- wxArt2D -- . -- Main Page Reference Documentation