132#ifndef WXCHARTDIR_WXCHARTVIEWER_H
133#define WXCHARTDIR_WXCHARTVIEWER_H
138#include "wxchartviewer_defs.h"
139#include "wxchartviewer_version.h"
141#include <wx/bitmap.h>
145#include <wx/graphics.h>
146#include <wx/overlay.h>
147#include <wx/popupwin.h>
152namespace CD_NAMESPACE
161 MouseUsageDefault = 0,
162 MouseUsageScroll = 1,
163 MouseUsageZoomIn = 3,
164 MouseUsageZoomOut = 4
173class WXDLLIMPEXP_FWD_WXCHARTVIEWER wxEnhancedTooltip;
181class WXDLLIMPEXP_WXCHARTVIEWER
wxChartViewer :
public wxPanel,
public ViewPortManager
193 wxChartViewer(wxWindow* parent = 0, wxWindowID
id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxTAB_TRAVERSAL,
const wxString& name = wxPanelNameStr);
221 virtual void setDPI(
int dpi);
237 virtual void setChart(BaseChart* chart);
769 static double ConvertDateTimeToChartTime(wxDateTime dt);
781 static wxDateTime ConvertChartTimeToDateTime(
double ct);
783 DECLARE_EVENT_TABLE()
792 void OnMouseMove(wxMouseEvent &evt);
798 void OnPaint(wxPaintEvent & evt);
804 void PaintNow(BaseChart* chart);
811 void Render(wxDC& dc, BaseChart* chart);
816 virtual
void OnDelayedMouseMove();
822 virtual
void OnMouseCaptureLost(wxMouseCaptureLostEvent& evt);
828 virtual
void OnMousePressEvent(wxMouseEvent& evt);
834 virtual
void OnMouseReleaseEvent(wxMouseEvent& evt);
840 virtual
void OnLeaveEvent(wxMouseEvent& evt);
846 virtual
void OnWheelEvent(wxMouseEvent& evt);
852 virtual
void OnHoldTimerEvent (wxTimerEvent& evt);
858 virtual
void OnDelayTimerEvent(wxTimerEvent& evt);
863 virtual
void OnSetCursor();
867 BaseChart* m_currentChart;
868 ImageMapHandler* m_hotSpotTester;
869 BaseChart* m_imageMapChart;
870 wxString m_defaultToolTip;
871 wxColour m_selectBoxLineColor;
872 int m_selectBoxLineWidth;
873 wxPenStyle m_selectBoxLineStyle;
877 int m_scrollDirection;
878 double m_zoomInRatio;
879 double m_zoomOutRatio;
880 double m_mouseWheelZoomRatio;
882 int m_updateInterval;
883 bool m_needUpdateChart;
884 bool m_needUpdateImageMap;
888 int m_currentHotSpot;
891 bool m_isPlotAreaMouseDown;
892 bool m_isDragScrolling;
893 bool m_isMouseTracking;
894 bool m_isInMouseMove;
898 int m_plotAreaMouseDownXPos;
899 int m_plotAreaMouseDownYPos;
902 bool IsDrag(
int direction, wxMouseEvent& event);
905 void GetDragZoomRect(
int px,
int py,
int& x,
int& y,
int& w,
int& h);
908 void OnPlotAreaMouseDrag(wxMouseEvent& point);
913 wxRect m_currentRect;
914 wxRect m_previousRect;
917 void SetSelectionRect(
int x,
int y,
int width,
int height);
920 void SetRectVisible(
bool b);
923 void DrawSelectionRect(wxDC& dc);
927 bool m_holdTimerActive;
929 bool m_isInViewPortChanged;
931 int m_delayUpdateChart;
932 BaseChart* m_delayedChart;
935 void CommitUpdateChart();
937 unsigned int m_lastMouseMove;
938 wxMouseEvent* m_delayedMouseEvent;
939 wxTimer m_delayedMouseEventTimer;
940 void CommitMouseMove(wxMouseEvent& event);
942 bool m_delayImageMapUpdate;
947 int m_isInMouseMovePlotArea;
950 wxString m_autoHideMsg;
953 void ApplyAutoHide(const wxString& msg);
956 wxEnhancedTooltip* m_enhancedToolTip;
957 wxString m_cdmlToolTipPrefix;
958 void ShowToolTip(const wxString& text, const wxPoint& cursorPosition);
959 void ShowEnhancedToolTip(const wxString& text, const wxPoint& cursorPosition = wxPoint(0,0));
960 void MoveEnhancedToolTip(const wxPoint& cursorPosition, const wxRect& rFrom);
964 bool m_reentrantGuard;
966 wxBitmap m_chartBitmap;
969 double ToImageX(
int x);
970 double ToImageY(
int y);
971 int ToDisplayX(
double x);
972 int ToDisplayY(
double y);
974 double m_toImageScaleX;
975 double m_toImageScaleY;
996 wxViewPortControl(wxWindow* parent = 0, wxWindowID
id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxTAB_TRAVERSAL,
const wxString& name = wxPanelNameStr);
1007 virtual void setChart(BaseChart* chart);
1037 DECLARE_EVENT_TABLE()
1044 void OnPaint(wxPaintEvent & evt);
1057 void Render(wxDC& dc, BaseChart* chart);
1092 virtual void OnViewPortChanged();
1095 bool IsDrag(wxMouseEvent& event);
1098 void PaintDisplay();
1104 void UpdateCursor(
int position);
1107 void UpdateChartViewerIfNecessary();
1110 double ToImageX(
int x);
1113 double ToImageY(
int y);
1117 bool m_reentrantGuard;
1121 bool m_isPlotAreaMouseDown;
1125wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_WXCHARTVIEWER, wxEVT_CHARTVIEWER_CLICKED, wxCommandEvent);
1127wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_WXCHARTVIEWER, wxEVT_CHARTVIEWER_VIEWPORT_CHANGED, wxCommandEvent);
1129wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_WXCHARTVIEWER, wxEVT_CHARTVIEWER_MOUSEMOVE_CHART, wxCommandEvent);
1131wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_WXCHARTVIEWER, wxEVT_CHARTVIEWER_MOUSELEAVE_CHART, wxCommandEvent);
1133wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_WXCHARTVIEWER, wxEVT_CHARTVIEWER_MOUSEMOVE_PLOTAREA, wxCommandEvent);
1135wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_WXCHARTVIEWER, wxEVT_CHARTVIEWER_MOUSELEAVE_PLOTAREA, wxCommandEvent);
1137wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_WXCHARTVIEWER, wxEVT_CHARTVIEWER_MOUSEWHEEL, wxCommandEvent);
1140#define EVT_CHARTVIEWER_CLICKED(winid, fn) \
1141 wx__DECLARE_EVT1(wxEVT_CHARTVIEWER_CLICKED, winid, wxCommandEventHandler(fn))
1143#define EVT_CHARTVIEWER_VIEWPORT_CHANGED(winid, fn) \
1144 wx__DECLARE_EVT1(wxEVT_CHARTVIEWER_VIEWPORT_CHANGED, winid, wxCommandEventHandler(fn))
1146#define EVT_CHARTVIEWER_MOUSEMOVE_CHART(winid, fn) \
1147 wx__DECLARE_EVT1(wxEVT_CHARTVIEWER_MOUSEMOVE_CHART, winid, wxCommandEventHandler(fn))
1149#define EVT_CHARTVIEWER_MOUSELEAVE_CHART(winid, fn) \
1150 wx__DECLARE_EVT1(wxEVT_CHARTVIEWER_MOUSELEAVE_CHART, winid, wxCommandEventHandler(fn))
1152#define EVT_CHARTVIEWER_MOUSEMOVE_PLOTAREA(winid, fn) \
1153 wx__DECLARE_EVT1(wxEVT_CHARTVIEWER_MOUSEMOVE_PLOTAREA, winid, wxCommandEventHandler(fn))
1155#define EVT_CHARTVIEWER_MOUSELEAVE_PLOTAREA(winid, fn) \
1156 wx__DECLARE_EVT1(wxEVT_CHARTVIEWER_MOUSELEAVE_PLOTAREA, winid, wxCommandEventHandler(fn))
1158#define EVT_CHARTVIEWER_MOUSEWHEEL(winid, fn) \
1159 wx__DECLARE_EVT1(wxEVT_CHARTVIEWER_MOUSEWHEEL, winid, wxCommandEventHandler(fn))
Class representing a ChartDirector chart viewer control.
Definition wxchartviewer.h:182
virtual void setMouseWheelZoomRatio(double ratio)
Sets the magnification ratio for each mouse wheel event.
Definition wxchartviewer.cpp:1186
virtual bool needUpdateChart()
Determines if the current wxEVT_CHARTVIEWER_VIEWPORT_CHANGED event requires chart update.
Definition wxchartviewer.cpp:1232
virtual int getChartMouseY()
Gets the mouse y-coordinate in the chart pixel coordinate system.
Definition wxchartviewer.cpp:1254
virtual void setZoomInRatio(double ratio)
Sets the magnification ratio for each zoom in click of the mouse.
Definition wxchartviewer.cpp:1158
virtual int getMinimumDrag()
Gets the minimum mouse drag distance before it is considered as an intentional drag.
Definition wxchartviewer.cpp:1208
virtual int getPlotAreaMouseX()
Gets the mouse x-coordinate on the plot area in the chart pixel coordinate system.
Definition wxchartviewer.cpp:1262
virtual void setViewPortControl(wxViewPortControl *vpc)
Sets the viewport control to be associated with this chart viewer control.
Definition wxchartviewer.cpp:1044
virtual BaseChart * getChart()
Gets the BaseChart pointer provided by the previous wxChartViewer::setChart method call.
Definition wxchartviewer.cpp:993
virtual void setSelectionBorderColor(const wxColour &color)
Sets the border color of the zoom selection box as a wxColour value.
Definition wxchartviewer.cpp:1088
virtual bool isInMouseMoveEvent()
Checks if the current code is executing in a wxEVT_CHARTVIEWER_MOUSEMOVE_CHART or wxEVT_CHARTVIEWER_M...
Definition wxchartviewer.cpp:1308
virtual bool isInViewPortChangedEvent()
Checks if the current code is executing in a ViewPortChanged event.
Definition wxchartviewer.cpp:1315
virtual void setZoomOutRatio(double ratio)
Sets the magnification ratio for each zoom out click of the mouse.
Definition wxchartviewer.cpp:1172
virtual int getScrollDirection()
Gets the scroll direction for mouse scroll actions.
Definition wxchartviewer.cpp:1151
virtual void setMinimumDrag(int offset)
Sets the minimum mouse drag distance before it is considered as an intentional drag.
Definition wxchartviewer.cpp:1201
virtual double getZoomInRatio()
Gets the magnification ratio for each zoom in click of the mouse.
Definition wxchartviewer.cpp:1165
virtual void setScrollDirection(int direction)
Sets the scroll direction for mouse scroll actions.
Definition wxchartviewer.cpp:1144
virtual bool needUpdateImageMap()
Determines if the current viewPortChanged signal requires image map update.
Definition wxchartviewer.cpp:1239
virtual int getPlotAreaMouseY()
Gets the mouse y-coordinate on the plot area in the chart pixel coordinate system.
Definition wxchartviewer.cpp:1278
virtual void updateDisplay()
Updates the display.
Definition wxchartviewer.cpp:1325
virtual int getSelectionBorderWidth()
Gets the border width of the zoom selection box.
Definition wxchartviewer.cpp:1081
virtual double getViewPortBottom()
Gets the position of the bottom side of the viewport.
Definition wxchartviewer.h:757
virtual double getMouseWheelZoomRatio()
Gets the magnification ratio for each mouse wheel event.
Definition wxchartviewer.cpp:1193
virtual bool isMouseOnPlotArea()
Checks if the mouse cursor is on the extended plot area.
Definition wxchartviewer.cpp:1294
virtual wxViewPortControl * getViewPortControl()
Get the viewport control associated with this chart viewer control.
Definition wxchartviewer.cpp:1067
virtual void setUpdateInterval(int interval)
Sets the minimum gap interval between two viewPortChanged signals in milliseconds.
Definition wxchartviewer.cpp:1218
virtual void setMouseUsage(int mouseUsage)
Sets the mouse usage mode.
Definition wxchartviewer.cpp:1116
virtual void removeDynamicLayer(const wxString &msg)
Set the message used to remove the dynamic layer.
Definition wxchartviewer.cpp:1374
virtual int getDPI()
Gets the DPI (scale factor) of the chart on the screen.
Definition wxchartviewer.cpp:149
virtual void setDPI(int dpi)
Sets the DPI (scale factor) of the chart on the screen.
Definition wxchartviewer.cpp:143
virtual bool isMouseDragging()
Checks if the mouse is dragging on the plot area.
Definition wxchartviewer.cpp:1301
virtual wxPenStyle getSelectionBorderStyle()
Gets the border style of the zoom selection box.
Definition wxchartviewer.cpp:1109
virtual void setDefaultToolTip(const wxString &text)
Sets the default tool tip to use when the mouse is over the wxChartViewer but not over any hot spot.
Definition wxchartviewer.cpp:1030
virtual int getChartMouseX()
Gets the mouse x-coordinate in the chart pixel coordinate system.
Definition wxchartviewer.cpp:1246
virtual void setSelectionBorderStyle(wxPenStyle style)
Sets the border style of the zoom selection box.
Definition wxchartviewer.cpp:1102
virtual void setImageMap(const char *imageMap)
Sets the image map that defines the hot spots on the chart image.
Definition wxchartviewer.cpp:1000
wxChartViewer(wxWindow *parent=0, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL, const wxString &name=wxPanelNameStr)
Constructor for a chart viewer control.
Definition wxchartviewer.cpp:319
virtual void setCDMLToolTipPrefix(const wxString &prefix)
Sets the CDML tooltip prefix.
Definition wxchartviewer.cpp:1037
virtual double getZoomOutRatio()
Gets the magnification ratio for each zoom out click of the mouse.
Definition wxchartviewer.cpp:1179
virtual int getUpdateInterval()
Gets the minimum gap interval between two wxEVT_CHARTVIEWER_VIEWPORT_CHANGED events in milliseconds.
Definition wxchartviewer.cpp:1225
virtual wxColour getSelectionBorderColor()
Gets the border color of the zoom selection box.
Definition wxchartviewer.cpp:1095
virtual bool onMouseWheelZoom(int x, int y, int zDelta)
Handles mouse wheel zooming.
Definition wxchartviewer.cpp:735
virtual void setChart(BaseChart *chart)
Sets a BaseChart object for display.
Definition wxchartviewer.cpp:968
virtual void setSelectionBorderWidth(int width)
Sets the border width of the zoom selection box.
Definition wxchartviewer.cpp:1074
virtual void updateViewPort(bool needUpdateChart, bool needUpdateImageMap)
Triggers the wxEVT_CHARTVIEWER_VIEWPORT_CHANGED event.
Definition wxchartviewer.cpp:1552
virtual double getViewPortRight()
Gets the position of the right side of the viewport.
Definition wxchartviewer.h:748
virtual void setZoomDirection(int direction)
Sets the zoom direction for mouse zoom in/out actions.
Definition wxchartviewer.cpp:1130
virtual int getZoomDirection()
Gets the zoom direction for mouse zoom in/out actions.
Definition wxchartviewer.cpp:1137
virtual int getMouseUsage()
Gets the mouse usage mode.
Definition wxchartviewer.cpp:1123
virtual ImageMapHandler * getImageMapHandler()
Gets the ImageMapHandler object for the current image map.
Definition wxchartviewer.cpp:1023
Class representing a ChartDirector viewport control.
Definition wxchartviewer.h:985
virtual void OnMousePressEvent(wxMouseEvent &evt)
Handles left mouse button down events.
Definition wxchartviewer.cpp:1776
virtual void OnMouseWheelEvent(wxMouseEvent &evt)
Handles mouse wheel events.
Definition wxchartviewer.cpp:1861
void OnPaint(wxPaintEvent &evt)
Handles the OnPaint event.
Definition wxchartviewer.cpp:1714
virtual BaseChart * getChart()
Gets the BaseChart object associated with the wxViewPortControl.
Definition wxchartviewer.cpp:1690
virtual void setChart(BaseChart *chart)
Sets a BaseChart object for displaying in the control.
Definition wxchartviewer.cpp:1681
virtual void setViewer(wxChartViewer *viewer)
Associates a wxChartViewer object with this wxViewPortControl object.
Definition wxchartviewer.cpp:1649
virtual void OnMouseCaptureLost(wxMouseCaptureLostEvent &evt)
Handles mouse capture lost events.
Definition wxchartviewer.cpp:1769
void PaintNow(BaseChart *chart)
Paints a chart immediately on screen.
Definition wxchartviewer.cpp:1725
virtual void OnMouseMoveEvent(wxMouseEvent &evt)
Handles mouse move events.
Definition wxchartviewer.cpp:1808
void Render(wxDC &dc, BaseChart *chart)
Renders the chart on the device context.
Definition wxchartviewer.cpp:1735
wxViewPortControl(wxWindow *parent=0, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL, const wxString &name=wxPanelNameStr)
Constructor for a ChartDirector viewport.
Definition wxchartviewer.cpp:1630
virtual void updateDisplay()
Requests the viewport control to update its contents.
Definition wxchartviewer.cpp:1910
virtual void OnMouseReleaseEvent(wxMouseEvent &evt)
Handles left mouse button up events.
Definition wxchartviewer.cpp:1835
virtual wxChartViewer * getViewer()
Gets the wxChartViewer object associated with this viewport control.
Definition wxchartviewer.cpp:1674