BALL  1.4.1
geometricControl.h
Go to the documentation of this file.
00001 // -*- Mode: C++; tab-width: 2; -*-
00002 // vi: set ts=2:
00003 //
00004 
00005 #ifndef BALL_VIEW_WIDGETS_GEOMETRICCONTROL_H
00006 #define BALL_VIEW_WIDGETS_GEOMETRICCONTROL_H
00007 
00008 #ifndef BALL_COMMON_H
00009 # include <BALL/common.h>
00010 #endif
00011 
00012 #ifndef BALL_VIEW_WIDGETS_GENERICCONTROL_H
00013 # include <BALL/VIEW/WIDGETS/genericControl.h>
00014 #endif
00015 
00016 #ifndef BALL_VIEW_KERNEL_COMMON_H
00017 # include <BALL/VIEW/KERNEL/common.h>
00018 #endif 
00019 
00020 
00021 #include <QtCore/QPoint>
00022 #include <QtGui/QMenu>
00023 
00024 namespace BALL
00025 {
00026   namespace VIEW
00027   {
00028     class Representation;
00029     class ModifyRepresentationDialog;
00030     class ClippingPlane;
00031     class TransformationMessage;
00032 
00042     class BALL_VIEW_EXPORT GeometricControl
00043       : public GenericControl
00044     {
00045       Q_OBJECT
00046 
00047       public:
00048       
00049       BALL_EMBEDDABLE(GeometricControl, GenericControl)
00050 
00051       
00054 
00070       GeometricControl(QWidget* parent = 0, const char* name = 0);
00071       
00073       virtual ~GeometricControl();
00074 
00078       virtual void clear(){};
00079 
00081       virtual void initializeWidget(MainControl& main_control);
00082       
00084 
00085 
00088       virtual void addRepresentation(Representation& rep);
00089 
00092       virtual void removeRepresentation(Representation& rep);
00093 
00096       virtual void updateRepresentation(Representation& rep);
00097       
00103       std::list<Representation*> getHighlightedRepresentations() const;
00104       
00108       virtual void onNotify(Message *message);
00109 
00116       virtual void buildContextMenu();
00117 
00119       virtual void checkMenu(MainControl& main_control);
00120 
00122       void moveItems(const TransformationMessage& msg);
00123 
00124       void updateClippingPlanes();
00125 
00126       public slots:
00127         
00129 
00132       
00134       virtual void renameRepresentation();
00135 
00137       virtual void selectAtoms();
00138 
00140       virtual void selectedRepresentation(Representation& representation, bool state);
00141 
00143       virtual void updateSelection();
00144 
00146       virtual void focus();
00147 
00149       virtual void enterMoveMode();
00150       
00152       virtual void flipClippingCapping();
00153 
00155       virtual void flipClippingPlane();
00156       
00158       virtual void setClippingPosition();
00159 
00161       virtual void setClippingPlaneX();
00162       
00164       virtual void setClippingPlaneY();
00165 
00167       virtual void setClippingPlaneZ();
00168 
00170       void hideShowClippingPlane();
00171 
00173       virtual void selectClipRepresentations();
00174 
00176       void createNewClippingPlane();
00177 
00179       void duplicate();
00180 
00182       void saveSurface();
00183 
00185       void loadSurface();
00186 
00188       ModifyRepresentationDialog* getModifySurfaceDialog();
00189 
00190       protected slots:
00191       
00193 
00194 
00195 
00197       virtual void modifyRepresentation_();
00198 
00201       virtual void generateListViewItem_(Representation& rep);
00202       
00204       virtual void deleteCurrentItems();
00205 
00207       
00208       protected slots:
00209 
00210       virtual void onItemClicked(QTreeWidgetItem* item, int col);
00211       void showGuestContextMenu(const QPoint& pos);
00212 
00213       protected:
00214 
00215       void addItem_(const String& text, const char* member, QWidget* widget = 0);
00216       
00217       // only for Python Interface
00218       GeometricControl(const GeometricControl& control);
00219 
00220       enum ColumnID
00221       {
00222         COLUMN_ID__TYPE       = 0,
00223         COLUMN_ID__Properties
00224       };
00225 
00226       void setClippingPlane_(const Vector3& n);
00227 
00228       // the context menu
00229       QMenu             context_menu_;
00230       QMenu             clipping_plane_context_menu_;
00231 
00232       Representation*   context_representation_;
00233       ClippingPlane*    context_plane_;
00234 
00235       HashMap<Representation*, QTreeWidgetItem*> representation_to_item_;
00236       HashMap<ClippingPlane*, QTreeWidgetItem*> plane_to_item_;
00237       HashMap<QTreeWidgetItem*, Representation*> item_to_representation_;
00238       HashMap<QTreeWidgetItem*, ClippingPlane*> item_to_plane_;
00239 
00240       ModifyRepresentationDialog*   modify_rep_dialog_;
00241 
00242       bool creating_representations_;
00243       bool ignore_change_;
00244 
00245       QAction* menu_clipping_plane_, *menu_load_surface_, *modify_surface_;
00246       vector<QAction*> context_menu_actions_;
00247     };
00248     
00249 } } // namespaces
00250 
00251 #endif // BALL_VIEW_WIDGETS_GEOMETRICCONTROL_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines