00001 /* -*- mode: c++ -*- */ 00002 00014 #ifndef PyCanvas_H 00015 #define PyCanvas_H 00016 00017 #include <vector> 00018 #include <string> 00019 00020 class CanvasWindow; 00021 class QApplication; 00022 class QtDisplay; 00023 class QtCut; 00024 class QtView; 00025 00041 class PyCanvas 00042 { 00043 00044 private: 00045 00047 CanvasWindow * m_canvas; 00048 00050 QApplication * m_app; 00051 00053 mutable std::vector<QtDisplay *> m_displays; 00054 00056 QtView * findSelectedView ( QtDisplay * display ); 00057 00058 public: 00059 00062 PyCanvas ( CanvasWindow * ); 00063 00065 PyCanvas (); 00066 00069 void show (); 00070 00073 void close (); 00074 00077 void addDisplay ( QtDisplay * display_wrap ); 00078 00080 void saveAs ( const std::string & filename ); 00081 00085 QtDisplay * getDisplay (); 00086 00088 const std::vector<QtDisplay *> & getDisplays () const; 00089 00092 QtCut * getCut(); 00093 00095 void selectAllDisplays ( bool flag = true ); 00096 00098 void selectDisplay ( QtDisplay * display ); 00099 00102 void print ( const std::string & filename ); 00103 00105 void saveAsImage( QtDisplay * display, const std::string &filename ); 00106 00108 void saveSelectedImages(const std::string & filename); 00109 00111 void removeDisplay ( QtDisplay * display ); 00112 00115 const std::vector < std::string > & getTextRepTypes () const; 00116 00120 void addTextRep ( QtDisplay * display, const std::string & type ); 00121 00123 void addText( QtDisplay * display, const std::string &text ); 00124 00128 void addTextAt ( QtDisplay * display, const std::string &text, 00129 double xrel, double yrel ); 00130 00133 const std::vector<double> & mouseData(); 00134 00138 void setPlotMatrix ( unsigned int columns, unsigned int rows ); 00139 00142 void clear (); 00143 00144 }; 00145 00146 #endif // PyCanvas_H