00001 // -*- Mode: C++; tab-width: 2; -*- 00002 // vi: set ts=2: 00003 // 00004 00005 #ifndef BALL_VIEW_DIALOGS_ATOMOVERVIEW_H 00006 #define BALL_VIEW_DIALOGS_ATOMOVERVIEW_H 00007 00008 #ifndef BALL_COMMON_GLOBAL_H 00009 # include <BALL/COMMON/global.h> 00010 #endif 00011 00012 #ifndef BALL_CONCEPT_COMPOSITE_H 00013 # include <BALL/CONCEPT/composite.h> 00014 #endif 00015 00016 #include <BALL/VIEW/UIC/ui_atomOverview.h> 00017 00018 namespace BALL 00019 { 00020 class AtomContainer; 00021 00022 namespace VIEW 00023 { 00024 class MainControl; 00025 00032 class BALL_VIEW_EXPORT AtomOverview 00033 : public QDialog, 00034 public Ui_AtomOverviewData 00035 { 00036 Q_OBJECT 00037 00038 public: 00039 00041 class BALL_VIEW_EXPORT OverviewProcessor 00042 : public UnaryProcessor<Composite> 00043 { 00044 public: 00045 00046 BALL_CREATE(OverviewProcessor) 00047 00048 00049 OverviewProcessor(); 00050 00052 OverviewProcessor(const OverviewProcessor& model_processor); 00053 00055 virtual ~OverviewProcessor(); 00056 00058 Processor::Result operator() (Composite& composite); 00059 00061 void setTable(QTableWidget* widget) { table_ = widget;} 00062 00064 void showOnlySelection(bool state) {only_selection_ = state;} 00065 00066 protected: 00067 00068 QTableWidget* table_; 00069 bool only_selection_; 00070 }; 00071 00073 class BALL_VIEW_EXPORT ApplyProcessor 00074 : public UnaryProcessor<Composite> 00075 { 00076 public: 00077 00078 BALL_CREATE(ApplyProcessor) 00079 00080 00081 ApplyProcessor(); 00082 00084 ApplyProcessor(const ApplyProcessor& model_processor); 00085 00087 virtual ~ApplyProcessor(); 00088 00090 Processor::Result operator() (Composite& composite); 00091 00093 void setTable(QTableWidget* widget) { table_ = widget; row_ = 0;} 00094 00096 void setMainControl(MainControl* main_control) {main_control_ = main_control;} 00097 00099 void showOnlySelection(bool state) {only_selection_ = state;} 00100 00101 protected: 00102 00103 QTableWidget* table_; 00104 Position row_; 00105 bool only_selection_; 00106 MainControl* main_control_; 00107 }; 00108 00109 00113 00118 AtomOverview(QWidget *parent = NULL, const char *name = "AtomOverview"); 00119 00121 00124 00127 virtual ~AtomOverview(); 00128 00130 00133 00135 void setParent(AtomContainer* ac); 00136 00138 void showOnlySelection(bool state) {only_selection_ = state;} 00139 00141 00144 00145 protected slots: 00146 00152 virtual void accept(); 00153 00154 void itemChanged(QTableWidgetItem* item); 00155 void itemActivated(QTableWidgetItem* item); 00156 00157 protected: 00158 00159 void restoreItem_(QTableWidgetItem* item); 00160 00161 AtomContainer* parent_; 00162 OverviewProcessor processor_; 00163 ApplyProcessor apply_processor_; 00164 String item_backup_; 00165 bool ignore_; 00166 bool only_selection_; 00167 }; 00168 00169 } } // namespaces 00170 00171 #endif // BALL_VIEW_DIALOGS_AtomOverview_H