1 #ifndef _PlotCtrl_PlotCtrl_h 2 #define _PlotCtrl_PlotCtrl_h 3 4 #include <CtrlLib/CtrlLib.h> 5 #include <PlotLib/PlotLib.h> 6 7 #define LAYOUTFILE <PlotCtrl/PlotCtrl.lay> 8 #include <CtrlCore/lay.h> 9 10 using namespace Upp; 11 12 class PlotCtrl : public Ctrl, public Plot{ 13 public: 14 typedef PlotCtrl CLASSNAME; 15 PlotCtrl(); 16 PlotCtrl& Zoom(double rx,double ry,Pointf C=Null); 17 PlotCtrl& ZoomIn(double ratio=2,const Pointf& C=Null); 18 PlotCtrl& ZoomOut(double ratio=2,const Pointf& C=Null); 19 PlotCtrl& ZoomAll(bool visibleonly=false); 20 virtual void Layout(); 21 virtual void Paint(Draw& w); 22 virtual void LeftDown(Point pt,dword keyflags); 23 virtual void LeftUp(Point pt,dword keyflags); 24 virtual void RightDown(Point pt,dword keyflags); 25 virtual void MouseMove(Point pt, dword keyflags); 26 virtual void MiddleDown(Point pt,dword keyflags); 27 virtual void MiddleUp(Point pt,dword keyflags); 28 virtual void MouseLeave(); 29 virtual void MouseWheel(Point pt, int zdelta, dword keyflags); 30 virtual Image CursorImage(Point p, dword keyflags); 31 Callback WhenSync; 32 protected: 33 RectTracker tr; 34 Image img; 35 Pointf mpos; 36 Rectf lim; 37 private: 38 enum{PC_CROSS,PC_ARROW,PC_PAN,PC_WAIT,PC_LOCAL}; 39 int cursor; 40 Image cimg; 41 void TrackerSync(Rect r); 42 }; 43 44 class LegendCtrl : public Ctrl, public Legend{ 45 public: 46 typedef LegendCtrl CLASSNAME; 47 LegendCtrl(Plot& p); 48 Callback WhenSync; 49 virtual void Paint(Draw& w); 50 void SetSize(const Size& sz); 51 Size GetSize()const; 52 protected: 53 unsigned hash; 54 Image img; 55 }; 56 57 class PlotStyleDlg : public WithStyleDlg<TopWindow>{ 58 public: 59 typedef PlotStyleDlg CLASSNAME; 60 PlotStyleDlg(PlotCtrl& parent,int index=0); 61 private: 62 PlotCtrl& p; 63 void Change(); 64 void UpdateFields(); 65 void Rename(); 66 class RenameDlg:public WithRenameDlg<TopWindow>{ 67 PlotCtrl& p; 68 int idx; 69 public: 70 typedef RenameDlg CLASSNAME; 71 RenameDlg(PlotCtrl& plot,int index); 72 void Update(); 73 }; 74 }; 75 76 #endif 77