00001 #ifndef BALL_VIEW_WIDGETS_SDWIDGET_H 00002 #define BALL_VIEW_WIDGETS_SDWIDGET_H 00003 00004 #ifndef BALL_COMMON_GLOBAL_H 00005 # include <BALL/COMMON/global.h> 00006 #endif 00007 00008 #ifndef BALL_DATATYPE_OPTIONS_H 00009 # include <BALL/DATATYPE/options.h> 00010 #endif 00011 00012 #include <BALL/KERNEL/system.h> 00013 #include <QtGui/qwidget.h> 00014 00015 namespace BALL 00016 { 00017 namespace VIEW 00018 { 00019 00021 class BALL_VIEW_EXPORT SDWidget 00022 : public QWidget 00023 { 00024 Q_OBJECT 00025 00026 public: 00027 00031 00032 struct BALL_VIEW_EXPORT Option 00033 { 00036 static const char* SHOW_HYDROGENS; 00037 }; 00038 00040 struct BALL_VIEW_EXPORT Default 00041 { 00042 static const bool SHOW_HYDROGENS; 00043 }; 00044 00046 00048 SDWidget(QWidget *parent = 0, bool show_hydrogens = false); 00049 00051 SDWidget(const System& system, QWidget *parent = 0, bool resize_to_parent = true); 00052 00054 virtual ~SDWidget(); 00055 00059 00060 Options options; 00061 00064 void setDefaultOptions(); 00066 00068 void plot(const System& system, bool clear = true, bool create_sd = true); 00069 00071 System& getSystem() {return system_;}; 00072 00074 const System& getSystem() const {return system_;}; 00075 00077 void setSystem(const System& system) {system_ = system;}; 00078 00080 void clear(); 00081 00082 protected: 00083 void paintEvent(QPaintEvent *event); 00084 00085 QPointF getEndpoint_(QRectF& character_boundary, QPointF from, QPointF to); 00086 System system_; 00087 00088 bool resize_to_parent_; 00089 bool clear_; 00090 }; 00091 00092 } 00093 } 00094 00095 #endif