BaseFrame Class Reference

Frame base class containing the following features:. More...

#include <baseframe.h>

Inheritance diagram for BaseFrame:

Inheritance graph
[legend]
Collaboration diagram for BaseFrame:

Collaboration graph
[legend]
List of all members.

Public Types

enum  { ZOOM = 1 }
 Enum to be use as a Mode. More...
enum  { ZOOM = 1 }
 Enum to be use as a Mode. More...
typedef int Mode
 typedef indicating in wich mode the user is.
typedef int Mode
 typedef indicating in wich mode the user is.

Public Slots

virtual void updateDrawing ()
 Update the information presented in the view if need it.
virtual void dockBeingClosed ()
 If the frame is contained in a dockWidget, this slot can be used when the enclosing dockwidget is being closed.
virtual void changeBackgroundColor (QColor color)
 Changes the color of the background.
virtual void setMode (BaseFrame::Mode selectedMode)
 Change the current mode, call by a selection of a tool.
virtual void updateDrawing ()
 Update the information presented in the view if need it.
virtual void dockBeingClosed ()
 If the frame is contained in a dockWidget, this slot can be used when the enclosing dockwidget is being closed.
virtual void changeBackgroundColor (QColor color)
 Changes the color of the background.
virtual void setMode (BaseFrame::Mode selectedMode)
 Change the current mode, call by a selection of a tool.

Signals

void parentDockBeingClosed (QWidget *viewWidget)
void parentDockBeingClosed (QWidget *viewWidget)

Public Member Functions

 BaseFrame (int Xborder, int Yborder, QWidget *parent=0, const char *name=0, QColor backgroundColor=Qt::black, int minSize=500, int maxSize=4000, int windowTopLeft=-500, int windowBottomRight=1001, int border=0)
 Constructs the view.
virtual void willBeKilled ()
 Signals that the widget is about to be deleted.
void setBorders (int x, int y)
 Sets the borders of the frame.
 BaseFrame (int Xborder, int Yborder, QWidget *parent=0, const char *name=0, QColor backgroundColor=Qt::black, int minSize=500, int maxSize=4000, int windowTopLeft=-500, int windowBottomRight=1001, int border=0)
 Constructs the view.
virtual void willBeKilled ()
 Signals that the widget is about to be deleted.
void setBorders (int x, int y)
 Sets the borders of the frame.

Protected Types

enum  DrawContentsMode {
  REFRESH = 1, UPDATE = 2, REDRAW = 3, REFRESH = 1,
  UPDATE = 2, REDRAW = 3
}
 Enumeration indicating in wich drawing contents mode the widget is: reuse of the double buffer or redraw the contents into the double buffer.
enum  DrawContentsMode {
  REFRESH = 1, UPDATE = 2, REDRAW = 3, REFRESH = 1,
  UPDATE = 2, REDRAW = 3
}
 Enumeration indicating in wich drawing contents mode the widget is: reuse of the double buffer or redraw the contents into the double buffer.

Protected Member Functions

virtual void drawContents (QPainter *p)=0
 Draws the contents of the frame.
virtual void resizeEvent (QResizeEvent *event)
 The view responds to a resize event.
virtual void mousePressEvent (QMouseEvent *event)
 The view responds to a mouse click.
virtual void mouseReleaseEvent (QMouseEvent *event)
 The view responds to a mouse release.
virtual void mouseMoveEvent (QMouseEvent *event)
 The view responds to a mouse move.
virtual void mouseDoubleClickEvent (QMouseEvent *event)
 The view responds to a double click.
QPoint viewportToWorld (int vx, int vy)
 Translates a point (vx, vy) on the viewport to a QPoint in the world.
QPoint viewportToWorld (const QPoint &point)
 This is an overloaded member function, provided for convenience.
QPoint worldToViewport (int wx, int wy)
 Translates a point (wx, wy) in the world to a QPoint on the viewport (relative to the widget).
QPoint worldToViewport (const QPoint &point)
 This is an overloaded member function, provided for convenience.
long worldToViewportAbscissa (long wx)
 Translates the abscissa wx in the world to the abscissa on the viewport (relative to the widget).
long worldToViewportOrdinate (long wy)
 Translates the abscissa wy in the world to the abscissa on the viewport (relative to the widget).
void drawRubber ()
 Draws the rectangle specifying the select area.
long worldToViewportWidth (long width)
 Translates the width width in the world to a width on the viewport (relative to the widget).
long worldToViewportHeight (long height)
 Translates the height height in the world to a height on the viewport (relative to the widget).
long viewportToWorldWidth (long width)
 Translates the width width on the viewport (relative to the widget) to a width in the world.
long viewportToWorldHeight (long height)
 Translates the height height on the viewport (relative to the widget) to a height in the world.
void drawRubberBand (bool draw, bool vertical=false)
 Sets if a rubber band has to be drawn while the mode is not ZOOM, and how it sould be drawn.
virtual void drawContents (QPainter *p)=0
 Draws the contents of the frame.
virtual void resizeEvent (QResizeEvent *event)
 The view responds to a resize event.
virtual void mousePressEvent (QMouseEvent *event)
 The view responds to a mouse click.
virtual void mouseReleaseEvent (QMouseEvent *event)
 The view responds to a mouse release.
virtual void mouseMoveEvent (QMouseEvent *event)
 The view responds to a mouse move.
virtual void mouseDoubleClickEvent (QMouseEvent *event)
 The view responds to a double click.
QPoint viewportToWorld (int vx, int vy)
 Translates a point (vx, vy) on the viewport to a QPoint in the world.
QPoint viewportToWorld (const QPoint &point)
 This is an overloaded member function, provided for convenience.
QPoint worldToViewport (int wx, int wy)
 Translates a point (wx, wy) in the world to a QPoint on the viewport (relative to the widget).
QPoint worldToViewport (const QPoint &point)
 This is an overloaded member function, provided for convenience.
long worldToViewportAbscissa (long wx)
 Translates the abscissa wx in the world to the abscissa on the viewport (relative to the widget).
long worldToViewportOrdinate (long wy)
 Translates the abscissa wy in the world to the abscissa on the viewport (relative to the widget).
void drawRubber ()
 Draws the rectangle specifying the select area.
long worldToViewportWidth (long width)
 Translates the width width in the world to a width on the viewport (relative to the widget).
long worldToViewportHeight (long height)
 Translates the height height in the world to a height on the viewport (relative to the widget).
long viewportToWorldWidth (long width)
 Translates the width width on the viewport (relative to the widget) to a width in the world.
long viewportToWorldHeight (long height)
 Translates the height height on the viewport (relative to the widget) to a height in the world.
void drawRubberBand (bool draw, bool vertical=false)
 Sets if a rubber band has to be drawn while the mode is not ZOOM, and how it sould be drawn.

Protected Attributes

const int MIN_SIZE
const int MAX_SIZE
const int BORDER
const int WINDOW_TOP_LEFT
const int WINDOW_BOTTOM_RIGHT
QSize oldSize
QRect viewport
ZoomWindow window
 Object enabling to transform the window which represent the part of the world to be drawn.
QPoint firstClick
 Coordinates of the point where the user has first click.
bool isDoubleClick
 Boolean indicating that the user has double clicked.
QRect * rubber
 Rectangle identifying the selected area.
DrawContentsMode drawContentsMode
 Mode giving the way of drawing the contents of the view.
Mode mode
 Draw mode (selected by the user via a menu, a button or a shortcut).
QCursor zoomCursor
 A cursor to represent the zoom state.
int Xborder
 Border on the left and right sides inside the window (QRect corresponding to the part of the drawing which will actually be drawn onto the widget).
int Yborder
 Border on the top and bottom sides inside the window (QRect corresponding to the part of the drawing which will actually be drawn onto the widget).
bool isRubberBandToBeDrawn
 Boolean indicating if a rubber band has to be drawn while not in ZOOM mode, the default is false.
bool wholeHeightRectangle
 Boolean indicating if while not in ZOOM mode, the rubber band has to be drawn on whole the height of the window.
QColor colorLegend
 Color use to display the legends.
QRect * rubber
 Rectangle identifying the selected area.

Detailed Description

Frame base class containing the following features:.

Attention:
This class needs the ZoomWindow class (which provides the zooming calculations), and the zoom_cursor.png for the zoom cursor.
Author:
Lynn Hazan


Member Enumeration Documentation

anonymous enum

Enum to be use as a Mode.

The only value provided in this class is ZOOM, indicating that the user is in a mode enabling him to zoom.

anonymous enum

Enum to be use as a Mode.

The only value provided in this class is ZOOM, indicating that the user is in a mode enabling him to zoom.


Constructor & Destructor Documentation

BaseFrame::BaseFrame ( int  Xborder,
int  Yborder,
QWidget *  parent = 0,
const char *  name = 0,
QColor  backgroundColor = Qt::black,
int  minSize = 500,
int  maxSize = 4000,
int  windowTopLeft = -500,
int  windowBottomRight = 1001,
int  border = 0 
)

Constructs the view.

Parameters:
Xborder border on the left and right sides inside the window (QRect corresponding to the part of the drawing which will actually be drawn onto the widget).
Yborder border on the top and bottom sides inside the window (QRect corresponding to the part of the drawing which will actually be drawn onto the widget).
parent the parent QWidget.
name name of the widget (can be used for introspection).
backgroundColor color used as background. Balck is the default.
minSize minumum size of the view.
maxSize maximum size of the view.
windowTopLeft the top-left corner of the window (QRect corresponding to the part of the drawing which will actually be drawn onto the widget).
windowBottomRight bottom-right corner of the window (QRect corresponding to the part of the drawing which will actually be drawn onto the widget).
border size of the border between the frame and the contents.

BaseFrame::BaseFrame ( int  Xborder,
int  Yborder,
QWidget *  parent = 0,
const char *  name = 0,
QColor  backgroundColor = Qt::black,
int  minSize = 500,
int  maxSize = 4000,
int  windowTopLeft = -500,
int  windowBottomRight = 1001,
int  border = 0 
)

Constructs the view.

Parameters:
Xborder border on the left and right sides inside the window (QRect corresponding to the part of the drawing which will actually be drawn onto the widget).
Yborder border on the top and bottom sides inside the window (QRect corresponding to the part of the drawing which will actually be drawn onto the widget).
parent the parent QWidget.
name name of the widget (can be used for introspection).
backgroundColor color used as background. Balck is the default.
minSize minumum size of the view.
maxSize maximum size of the view.
windowTopLeft the top-left corner of the window (QRect corresponding to the part of the drawing which will actually be drawn onto the widget).
windowBottomRight bottom-right corner of the window (QRect corresponding to the part of the drawing which will actually be drawn onto the widget).
border size of the border between the frame and the contents.


Member Function Documentation

void BaseFrame::setBorders ( int  x,
int  y 
) [inline]

Sets the borders of the frame.

Parameters:
x border on the left and right sides inside the window (QRect corresponding to the part of the drawing which will actually be drawn onto the widget).
y border on the top and bottom sides inside the window (QRect corresponding to the part of the drawing which will actually be drawn onto the widget).

virtual void BaseFrame::dockBeingClosed (  )  [inline, virtual, slot]

If the frame is contained in a dockWidget, this slot can be used when the enclosing dockwidget is being closed.

Emits the parentDockBeingClosed signal.

virtual void BaseFrame::setMode ( BaseFrame::Mode  selectedMode  )  [inline, virtual, slot]

Change the current mode, call by a selection of a tool.

Parameters:
selectedMode new mode of drawing.

virtual void BaseFrame::drawContents ( QPainter *  p  )  [protected, pure virtual]

Draws the contents of the frame.

Parameters:
p painter used to draw the contents

Implemented in PositionView, TraceView, PositionView, and TraceView.

void BaseFrame::resizeEvent ( QResizeEvent *  event  )  [protected, virtual]

The view responds to a resize event.

Parameters:
event resize event.

Reimplemented in PositionView, TraceView, PositionView, and TraceView.

void BaseFrame::mousePressEvent ( QMouseEvent *  event  )  [protected, virtual]

The view responds to a mouse click.

Parameters:
event mouse release event.

Reimplemented in TraceView, and TraceView.

void BaseFrame::mouseReleaseEvent ( QMouseEvent *  event  )  [protected, virtual]

The view responds to a mouse release.

Parameters:
event mouse event.

Reimplemented in TraceView, and TraceView.

void BaseFrame::mouseMoveEvent ( QMouseEvent *  event  )  [protected, virtual]

The view responds to a mouse move.

Parameters:
event mouse event.

Reimplemented in TraceView, and TraceView.

void BaseFrame::mouseDoubleClickEvent ( QMouseEvent *  event  )  [protected, virtual]

The view responds to a double click.

Parameters:
event mouse event.

Reimplemented in TraceView, and TraceView.

QPoint BaseFrame::viewportToWorld ( int  vx,
int  vy 
) [protected]

Translates a point (vx, vy) on the viewport to a QPoint in the world.

Parameters:
vx x coordinate of the point in the viewport's coordinates system (relative to the widget).
vy y coordinate of the point in the viewport's coordinates system (relative to the widget).
Returns:
the point on the viewport translated to a point in the world.

QPoint BaseFrame::viewportToWorld ( const QPoint &  point  )  [inline, protected]

This is an overloaded member function, provided for convenience.

It behaves essentially like the above function.

Parameters:
point point with coordinates relative to the widget (viewport).
Returns:
the point on the viewport translated to a point in the world.

QPoint BaseFrame::worldToViewport ( int  wx,
int  wy 
) [protected]

Translates a point (wx, wy) in the world to a QPoint on the viewport (relative to the widget).

Parameters:
wx x coordinate of the point in the world's coordinates system.
wy y coordinate of the point in the world's coordinates system.
Returns:
the point on the world translated to a point in the viewport.

QPoint BaseFrame::worldToViewport ( const QPoint &  point  )  [inline, protected]

This is an overloaded member function, provided for convenience.

It behaves essentially like the above function.

Parameters:
point point with coordinates in the world.
Returns:
the point on the world translated to a point in the viewport.

long BaseFrame::worldToViewportAbscissa ( long  wx  )  [protected]

Translates the abscissa wx in the world to the abscissa on the viewport (relative to the widget).

Parameters:
wx abscissa in the world's coordinates system.
Returns:
abscissa in the viewport's coordinates system.

long BaseFrame::worldToViewportOrdinate ( long  wy  )  [protected]

Translates the abscissa wy in the world to the abscissa on the viewport (relative to the widget).

Parameters:
wy ordinate in the world's coordinates system.
Returns:
ordinate in the viewport's coordinates system.

long BaseFrame::worldToViewportWidth ( long  width  )  [inline, protected]

Translates the width width in the world to a width on the viewport (relative to the widget).

Parameters:
width width in the world's coordinates system.
Returns:
width in the viewport's coordinates system.

long BaseFrame::worldToViewportHeight ( long  height  )  [inline, protected]

Translates the height height in the world to a height on the viewport (relative to the widget).

Parameters:
height height in the world's coordinates system.
Returns:
height in the viewport's coordinates system.

long BaseFrame::viewportToWorldWidth ( long  width  )  [inline, protected]

Translates the width width on the viewport (relative to the widget) to a width in the world.

Parameters:
width width in the world's coordinates system.
Returns:
width in the viewport's coordinates system.

long BaseFrame::viewportToWorldHeight ( long  height  )  [inline, protected]

Translates the height height on the viewport (relative to the widget) to a height in the world.

Parameters:
height height in the world's coordinates system.
Returns:
height in the viewport's coordinates system.

void BaseFrame::drawRubberBand ( bool  draw,
bool  vertical = false 
) [inline, protected]

Sets if a rubber band has to be drawn while the mode is not ZOOM, and how it sould be drawn.

Parameters:
draw true if a rubber band has to be drawn, false otherwise.
vertical true if the rubber band has to be drawn on whole the height of the window, false otherwise.

void BaseFrame::setBorders ( int  x,
int  y 
) [inline]

Sets the borders of the frame.

Parameters:
x border on the left and right sides inside the window (QRect corresponding to the part of the drawing which will actually be drawn onto the widget).
y border on the top and bottom sides inside the window (QRect corresponding to the part of the drawing which will actually be drawn onto the widget).

virtual void BaseFrame::dockBeingClosed (  )  [inline, virtual, slot]

If the frame is contained in a dockWidget, this slot can be used when the enclosing dockwidget is being closed.

Emits the parentDockBeingClosed signal.

virtual void BaseFrame::setMode ( BaseFrame::Mode  selectedMode  )  [inline, virtual, slot]

Change the current mode, call by a selection of a tool.

Parameters:
selectedMode new mode of drawing.

virtual void BaseFrame::drawContents ( QPainter *  p  )  [protected, pure virtual]

Draws the contents of the frame.

Parameters:
p painter used to draw the contents

Implemented in PositionView, TraceView, PositionView, and TraceView.

virtual void BaseFrame::resizeEvent ( QResizeEvent *  event  )  [protected, virtual]

The view responds to a resize event.

Parameters:
event resize event.

Reimplemented in PositionView, TraceView, PositionView, and TraceView.

virtual void BaseFrame::mousePressEvent ( QMouseEvent *  event  )  [protected, virtual]

The view responds to a mouse click.

Parameters:
event mouse release event.

Reimplemented in TraceView, and TraceView.

virtual void BaseFrame::mouseReleaseEvent ( QMouseEvent *  event  )  [protected, virtual]

The view responds to a mouse release.

Parameters:
event mouse event.

Reimplemented in TraceView, and TraceView.

virtual void BaseFrame::mouseMoveEvent ( QMouseEvent *  event  )  [protected, virtual]

The view responds to a mouse move.

Parameters:
event mouse event.

Reimplemented in TraceView, and TraceView.

virtual void BaseFrame::mouseDoubleClickEvent ( QMouseEvent *  event  )  [protected, virtual]

The view responds to a double click.

Parameters:
event mouse event.

Reimplemented in TraceView, and TraceView.

QPoint BaseFrame::viewportToWorld ( int  vx,
int  vy 
) [protected]

Translates a point (vx, vy) on the viewport to a QPoint in the world.

Parameters:
vx x coordinate of the point in the viewport's coordinates system (relative to the widget).
vy y coordinate of the point in the viewport's coordinates system (relative to the widget).
Returns:
the point on the viewport translated to a point in the world.

QPoint BaseFrame::viewportToWorld ( const QPoint &  point  )  [inline, protected]

This is an overloaded member function, provided for convenience.

It behaves essentially like the above function.

Parameters:
point point with coordinates relative to the widget (viewport).
Returns:
the point on the viewport translated to a point in the world.

QPoint BaseFrame::worldToViewport ( int  wx,
int  wy 
) [protected]

Translates a point (wx, wy) in the world to a QPoint on the viewport (relative to the widget).

Parameters:
wx x coordinate of the point in the world's coordinates system.
wy y coordinate of the point in the world's coordinates system.
Returns:
the point on the world translated to a point in the viewport.

QPoint BaseFrame::worldToViewport ( const QPoint &  point  )  [inline, protected]

This is an overloaded member function, provided for convenience.

It behaves essentially like the above function.

Parameters:
point point with coordinates in the world.
Returns:
the point on the world translated to a point in the viewport.

long BaseFrame::worldToViewportAbscissa ( long  wx  )  [protected]

Translates the abscissa wx in the world to the abscissa on the viewport (relative to the widget).

Parameters:
wx abscissa in the world's coordinates system.
Returns:
abscissa in the viewport's coordinates system.

long BaseFrame::worldToViewportOrdinate ( long  wy  )  [protected]

Translates the abscissa wy in the world to the abscissa on the viewport (relative to the widget).

Parameters:
wy ordinate in the world's coordinates system.
Returns:
ordinate in the viewport's coordinates system.

long BaseFrame::worldToViewportWidth ( long  width  )  [inline, protected]

Translates the width width in the world to a width on the viewport (relative to the widget).

Parameters:
width width in the world's coordinates system.
Returns:
width in the viewport's coordinates system.

long BaseFrame::worldToViewportHeight ( long  height  )  [inline, protected]

Translates the height height in the world to a height on the viewport (relative to the widget).

Parameters:
height height in the world's coordinates system.
Returns:
height in the viewport's coordinates system.

long BaseFrame::viewportToWorldWidth ( long  width  )  [inline, protected]

Translates the width width on the viewport (relative to the widget) to a width in the world.

Parameters:
width width in the world's coordinates system.
Returns:
width in the viewport's coordinates system.

long BaseFrame::viewportToWorldHeight ( long  height  )  [inline, protected]

Translates the height height on the viewport (relative to the widget) to a height in the world.

Parameters:
height height in the world's coordinates system.
Returns:
height in the viewport's coordinates system.

void BaseFrame::drawRubberBand ( bool  draw,
bool  vertical = false 
) [inline, protected]

Sets if a rubber band has to be drawn while the mode is not ZOOM, and how it sould be drawn.

Parameters:
draw true if a rubber band has to be drawn, false otherwise.
vertical true if the rubber band has to be drawn on whole the height of the window, false otherwise.


Member Data Documentation

bool BaseFrame::wholeHeightRectangle [protected]

Boolean indicating if while not in ZOOM mode, the rubber band has to be drawn on whole the height of the window.

The default is no.


The documentation for this class was generated from the following files:
Generated on Mon Sep 17 20:47:31 2007 for NeuroScope by  doxygen 1.5.1