Canvas Class Reference

Provides a generic Canvas interface, shared between OpenGL canvases and pixel-based canvases. More...

#include <Canvas.h>

Inheritance diagram for Canvas:

ImageCanvas OpenGLCanvas

List of all members.

Public Member Functions

virtual void redraw ()=0
Constructors
 Canvas (Gui *gui, unsigned width=(480), unsigned height=(480))
virtual ~Canvas ()
Saving
virtual bool save (const char *fileName)=0
Interaction/Visualization interface
virtual void init ()
virtual void registerInteractionListener (InteractionListener *listener)
virtual void unregisterInteractionListener (InteractionListener *listener)
Accessors
virtual bool supportsOpenGL () const =0
virtual QWidget * getQWidget ()=0
GuigetGui () const
RenderergetRenderer ()
CameragetCamera ()
ScenegetScene ()
Mutators
virtual void setRenderer (Renderer *renderer)
void setGui (Gui *gui)
Canvas dimensions
unsigned getWidth () const
unsigned getHeight () const

Protected Member Functions

Interaction/Visualization interface to children
virtual void mousePressed (QMouseEvent *event)
virtual void mouseReleased (QMouseEvent *event)
virtual void mouseMoved (QMouseEvent *event)
virtual void keyPressed (QKeyEvent *event)
virtual void keyReleased (QKeyEvent *event)

Protected Attributes

Guim_gui
Rendererm_renderer
unsigned m_width
unsigned m_height
bool m_initted
ListenerList m_interactionListeners

Friends

class InteractionListener


Detailed Description

Provides a generic Canvas interface, shared between OpenGL canvases and pixel-based canvases.

Author:
Travis Fischer (fisch0920@gmail.com)

Matthew Jacobs (jacobs.mh@gmail.com)

Date:
Fall 2008
Author:
Travis Fischer (fisch0920@gmail.com)

Matthew Jacobs (jacobs.mh@gmail.com)

Date:
Fall 2008

Definition at line 29 of file Canvas.h.


Constructor & Destructor Documentation

Canvas::Canvas ( Gui gui,
unsigned  width = (480),
unsigned  height = (480) 
)

Definition at line 18 of file Canvas.cpp.

Canvas::~Canvas (  )  [virtual]

Definition at line 25 of file Canvas.cpp.


Member Function Documentation

virtual bool Canvas::save ( const char *  fileName  )  [pure virtual]

Attempts to saver this canvas' image to the specified file

Returns:
whether or not the save was successful

Implemented in ImageCanvas, and OpenGLCanvas.

void Canvas::init (  )  [virtual]

Reimplemented in OpenGLCanvas.

Definition at line 33 of file Canvas.cpp.

void Canvas::registerInteractionListener ( InteractionListener listener  )  [virtual]

Definition at line 52 of file Canvas.cpp.

void Canvas::unregisterInteractionListener ( InteractionListener listener  )  [virtual]

Definition at line 65 of file Canvas.cpp.

virtual bool Canvas::supportsOpenGL (  )  const [pure virtual]

Returns:
true iff this Canvas supports OpenGL
Note:
Gui assumes that if a Canvas supports OpenGL, it also derives from QGLWidget
See also:
also OpenGLCanvas

Implemented in ImageCanvas, and OpenGLCanvas.

virtual QWidget* Canvas::getQWidget (  )  [pure virtual]

Returns:
the QWidget associated with this Canvas

Implemented in ImageCanvas, and OpenGLCanvas.

Gui* Canvas::getGui (  )  const [inline]

Definition at line 82 of file Canvas.h.

Renderer* Canvas::getRenderer (  )  [inline]

Definition at line 86 of file Canvas.h.

Camera* Canvas::getCamera (  )  [inline]

Definition at line 90 of file Canvas.h.

Scene* Canvas::getScene (  )  [inline]

Definition at line 95 of file Canvas.h.

void Canvas::setRenderer ( Renderer renderer  )  [virtual]

Definition at line 48 of file Canvas.cpp.

void Canvas::setGui ( Gui gui  )  [inline]

Definition at line 106 of file Canvas.h.

unsigned Canvas::getWidth (  )  const [inline]

Definition at line 115 of file Canvas.h.

unsigned Canvas::getHeight (  )  const [inline]

Definition at line 119 of file Canvas.h.

virtual void Canvas::redraw (  )  [pure virtual]

Implemented in ImageCanvas, and OpenGLCanvas.

void Canvas::mousePressed ( QMouseEvent *  event  )  [protected, virtual]

Definition at line 82 of file Canvas.cpp.

void Canvas::mouseReleased ( QMouseEvent *  event  )  [protected, virtual]

Definition at line 93 of file Canvas.cpp.

void Canvas::mouseMoved ( QMouseEvent *  event  )  [protected, virtual]

Definition at line 104 of file Canvas.cpp.

void Canvas::keyPressed ( QKeyEvent *  event  )  [protected, virtual]

Definition at line 115 of file Canvas.cpp.

void Canvas::keyReleased ( QKeyEvent *  event  )  [protected, virtual]

Definition at line 126 of file Canvas.cpp.


Friends And Related Function Documentation

friend class InteractionListener [friend]

Definition at line 30 of file Canvas.h.


Member Data Documentation

Gui* Canvas::m_gui [protected]

Definition at line 143 of file Canvas.h.

Definition at line 144 of file Canvas.h.

unsigned Canvas::m_width [protected]

Definition at line 146 of file Canvas.h.

unsigned Canvas::m_height [protected]

Definition at line 147 of file Canvas.h.

bool Canvas::m_initted [protected]

Definition at line 148 of file Canvas.h.

ListenerList Canvas::m_interactionListeners [protected]

Definition at line 150 of file Canvas.h.


The documentation for this class was generated from the following files:

Generated on 28 Feb 2009 for Milton by doxygen 1.5.6