Base class to create small rectangular info boxes mpInfoLayer is the base class to create a small rectangular info box in transparent overlay over plot layers. It is used to implement objects like legends. More...
#include <mathplot.h>
Public Member Functions | |
mpInfoLayer () | |
mpInfoLayer (wxRect rect, const wxBrush *brush=wxTRANSPARENT_BRUSH) | |
virtual | ~mpInfoLayer () |
virtual void | UpdateInfo (mpWindow &w, wxEvent &event) |
virtual bool | HasBBox () |
virtual void | Plot (wxDC &dc, mpWindow &w) |
virtual bool | IsInfo () |
virtual bool | Inside (wxPoint &point) |
virtual void | Move (wxPoint delta) |
virtual void | UpdateReference () |
wxPoint | GetPosition () |
wxSize | GetSize () |
const wxRect & | GetRectangle () |
Protected Attributes | |
wxRect | m_dim |
The bounding rectangle of the box. It may be resized dynamically by the Plot method. | |
wxPoint | m_reference |
Holds the reference point for movements. | |
wxBrush | m_brush |
The brush to be used for the background. | |
int | m_winX |
int | m_winY |
Holds the mpWindow size. Used to rescale position when window is resized. |
Base class to create small rectangular info boxes mpInfoLayer is the base class to create a small rectangular info box in transparent overlay over plot layers. It is used to implement objects like legends.
mpInfoLayer::mpInfoLayer | ( | ) |
Default constructor.
References mpLAYER_INFO.
mpInfoLayer::mpInfoLayer | ( | wxRect | rect, | |
const wxBrush * | brush = wxTRANSPARENT_BRUSH | |||
) |
Complete constructor.
rect | Sets the initial size rectangle of the layer. | |
brush | pointer to a fill brush. Default is transparent |
References m_brush, m_reference, mpLayer::m_type, m_winX, m_winY, and mpLAYER_INFO.
mpInfoLayer::~mpInfoLayer | ( | ) | [virtual] |
Destructor
wxPoint mpInfoLayer::GetPosition | ( | ) |
Returns the position of the upper left corner of the box (in pixels)
References m_dim.
const wxRect& mpInfoLayer::GetRectangle | ( | ) | [inline] |
Returns the current rectangle coordinates.
Referenced by mpWindow::OnMouseMove().
wxSize mpInfoLayer::GetSize | ( | ) |
virtual bool mpInfoLayer::HasBBox | ( | ) | [inline, virtual] |
mpInfoLayer has not bounding box.
Reimplemented from mpLayer.
bool mpInfoLayer::Inside | ( | wxPoint & | point | ) | [virtual] |
Checks whether a point is inside the info box rectangle.
point | The point to be checked |
References m_dim.
Referenced by mpWindow::IsInsideInfoLayer().
virtual bool mpInfoLayer::IsInfo | ( | ) | [inline, virtual] |
Specifies that this is an Info box layer.
Reimplemented from mpLayer.
void mpInfoLayer::Move | ( | wxPoint | delta | ) | [virtual] |
Moves the layer rectangle of given pixel deltas.
delta | The wxPoint container for delta coordinates along x and y. Units are in pixels. |
References m_dim, and m_reference.
Referenced by mpWindow::OnMouseMove().
void mpInfoLayer::Plot | ( | wxDC & | dc, | |
mpWindow & | w | |||
) | [virtual] |
Plot method. Can be overidden by derived classes.
dc | the device content where to plot | |
w | the window to plot |
Implements mpLayer.
Reimplemented in mpInfoCoords, and mpInfoLegend.
References mpWindow::GetScrX(), mpWindow::GetScrY(), m_brush, m_dim, mpLayer::m_pen, mpLayer::m_visible, m_winX, m_winY, and UpdateReference().
void mpInfoLayer::UpdateInfo | ( | mpWindow & | w, | |
wxEvent & | event | |||
) | [virtual] |
Updates the content of the info box. Should be overidden by derived classes. Update may behave in different ways according to the type of event which called it.
w | parent mpWindow from which to obtain informations | |
event | The event which called the update. |
Reimplemented in mpInfoCoords, and mpInfoLegend.
Referenced by mpWindow::OnMouseMove().
void mpInfoLayer::UpdateReference | ( | ) | [virtual] |
Updates the rectangle reference point. Used by internal methods of mpWindow to correctly move mpInfoLayers.
References m_dim, and m_reference.
Referenced by mpWindow::OnMouseLeftRelease(), mpInfoLegend::Plot(), mpInfoCoords::Plot(), and Plot().
wxBrush mpInfoLayer::m_brush [protected] |
The brush to be used for the background.
Reimplemented from mpLayer.
Referenced by mpInfoLayer(), mpInfoLegend::Plot(), mpInfoCoords::Plot(), and Plot().
wxRect mpInfoLayer::m_dim [protected] |
The bounding rectangle of the box. It may be resized dynamically by the Plot method.
Referenced by GetPosition(), GetSize(), Inside(), Move(), mpInfoLegend::Plot(), mpInfoCoords::Plot(), Plot(), and UpdateReference().
wxPoint mpInfoLayer::m_reference [protected] |
Holds the reference point for movements.
Referenced by Move(), mpInfoLayer(), and UpdateReference().
int mpInfoLayer::m_winX [protected] |
Referenced by mpInfoLayer(), mpInfoLegend::Plot(), mpInfoCoords::Plot(), and Plot().
int mpInfoLayer::m_winY [protected] |
Holds the mpWindow size. Used to rescale position when window is resized.
Referenced by mpInfoLayer(), mpInfoLegend::Plot(), mpInfoCoords::Plot(), and Plot().