00001
00002
00003
00004
00005
00006 #ifndef BALL_VIEW_WIDGETS_GEOMETRICCONTROL_H
00007 #define BALL_VIEW_WIDGETS_GEOMETRICCONTROL_H
00008
00009 #ifndef BALL_COMMON_H
00010 # include <BALL/common.h>
00011 #endif
00012
00013 #ifndef BALL_VIEW_WIDGETS_GENERICCONTROL_H
00014 # include <BALL/VIEW/WIDGETS/genericControl.h>
00015 #endif
00016
00017 #ifndef BALL_VIEW_KERNEL_COMMON_H
00018 # include <BALL/VIEW/KERNEL/common.h>
00019 #endif
00020
00021
00022 #include <QtCore/qpoint.h>
00023 #include <QtGui/QMenu>
00024
00025 namespace BALL
00026 {
00027 namespace VIEW
00028 {
00029 class Representation;
00030 class ModifyRepresentationDialog;
00031 class ClippingPlane;
00032 class TransformationMessage;
00033
00043 class BALL_VIEW_EXPORT GeometricControl
00044 : public GenericControl
00045 {
00046 Q_OBJECT
00047
00048 public:
00049
00050 BALL_EMBEDDABLE(GeometricControl, GenericControl)
00051
00052
00055
00071 GeometricControl(QWidget* parent = 0, const char* name = 0);
00072
00074 virtual ~GeometricControl();
00075
00079 virtual void clear(){};
00080
00082 virtual void initializeWidget(MainControl& main_control);
00083
00085
00086
00089 virtual void addRepresentation(Representation& rep);
00090
00093 virtual void removeRepresentation(Representation& rep);
00094
00097 virtual void updateRepresentation(Representation& rep);
00098
00104 List<Representation*> getHighlightedRepresentations() const;
00105
00109 virtual void onNotify(Message *message);
00110
00117 virtual void buildContextMenu();
00118
00120 virtual void checkMenu(MainControl& main_control);
00121
00123 void moveItems(const TransformationMessage& msg);
00124
00125 void updateClippingPlanes();
00126
00127 public slots:
00128
00130
00133
00135 virtual void renameRepresentation();
00136
00138 virtual void selectAtoms();
00139
00141 virtual void selectedRepresentation(Representation& representation, bool state);
00142
00144 virtual void updateSelection();
00145
00147 virtual void focus();
00148
00150 virtual void enterMoveMode();
00151
00153 virtual void flipClippingCapping();
00154
00156 virtual void flipClippingPlane();
00157
00159 virtual void setClippingPosition();
00160
00162 virtual void setClippingPlaneX();
00163
00165 virtual void setClippingPlaneY();
00166
00168 virtual void setClippingPlaneZ();
00169
00171 void hideShowClippingPlane();
00172
00174 virtual void selectClipRepresentations();
00175
00177 void createNewClippingPlane();
00178
00180 void duplicate();
00181
00183 void saveSurface();
00184
00186 void loadSurface();
00187
00189 ModifyRepresentationDialog* getModifySurfaceDialog();
00190
00191 protected slots:
00192
00194
00195
00196
00198 virtual void modifyRepresentation_();
00199
00202 virtual void generateListViewItem_(Representation& rep);
00203
00205 virtual void deleteCurrentItems();
00206
00208
00209 protected slots:
00210
00211 virtual void onItemClicked(QTreeWidgetItem* item, int col);
00212 void showGuestContextMenu(const QPoint& pos);
00213
00214 protected:
00215
00216 void addItem_(const String& text, const char* member, QWidget* widget = 0);
00217
00218
00219 GeometricControl(const GeometricControl& control);
00220
00221 enum ColumnID
00222 {
00223 COLUMN_ID__TYPE = 0,
00224 COLUMN_ID__Properties
00225 };
00226
00227 void setClippingPlane_(const Vector3& n);
00228
00229
00230 QMenu context_menu_;
00231 QMenu clipping_plane_context_menu_;
00232
00233 Representation* context_representation_;
00234 ClippingPlane* context_plane_;
00235
00236 HashMap<Representation*, QTreeWidgetItem*> representation_to_item_;
00237 HashMap<ClippingPlane*, QTreeWidgetItem*> plane_to_item_;
00238 HashMap<QTreeWidgetItem*, Representation*> item_to_representation_;
00239 HashMap<QTreeWidgetItem*, ClippingPlane*> item_to_plane_;
00240
00241 ModifyRepresentationDialog* modify_rep_dialog_;
00242
00243 bool creating_representations_;
00244 bool ignore_change_;
00245
00246 QAction* menu_clipping_plane_, *menu_load_surface_, *modify_surface_;
00247 vector<QAction*> context_menu_actions_;
00248 };
00249
00250 } }
00251
00252 #endif // BALL_VIEW_WIDGETS_GEOMETRICCONTROL_H