message.h

Go to the documentation of this file.
00001 // -*- Mode: C++; tab-width: 2; -*-
00002 // vi: set ts=2:
00003 //
00004 // $Id: message.h,v 1.69.16.1 2007/03/25 21:26:00 oliver Exp $
00005 //
00006 
00007 #ifndef BALL_VIEW_KERNEL_MESSAGE_H
00008 #define BALL_VIEW_KERNEL_MESSAGE_H
00009 
00010 #ifndef BALL_VIEW_KERNEL_STAGE_H
00011 # include <BALL/VIEW/KERNEL/stage.h>
00012 #endif
00013 
00014 #ifndef BALL_VIEW_KERNEL_COMMON_H
00015 # include <BALL/VIEW/KERNEL/common.h>
00016 #endif
00017 
00018 class QWidget;
00019 
00020 namespace BALL
00021 {
00022   class Composite;
00023   class ConformationSet;
00024 
00025   namespace VIEW
00026   {
00027     class Dataset;
00028     class ConnectionObject;
00029     class GeometricObject;
00030 
00033 
00052 class BALL_VIEW_EXPORT Message
00053 {
00054   public:
00055 
00059 
00065   Message();
00066 
00069   Message(const Message& message);
00070 
00073   virtual ~Message();
00074 
00076 
00079 
00085   void setSender(const ConnectionObject* sender);
00086 
00092   const ConnectionObject* getSender() const;
00093 
00105   void setDeletable(bool flag = true);
00106 
00109   bool isDeletable() const;
00111 
00112   private:
00113 
00114   const ConnectionObject* connection_object_;
00115 
00116   bool deletable_;
00117 };
00118 
00119 
00129 class DatasetMessage
00130   : public Message
00131 {
00132   public:
00133 
00135     enum Type
00136     {
00138       UNDEFINED = -1,
00139 
00141       ADD = 0,
00142 
00144       REMOVE,
00145 
00147       UPDATE,
00148 
00150       SELECTED,
00151 
00153       VISUALIZE,
00154 
00156       VISUALIZE_END = 100
00157     };
00158 
00160     DatasetMessage(Dataset* set = 0, Type type = UNDEFINED);
00161 
00163     DatasetMessage(const DatasetMessage& msg);
00164 
00166     Type getType() const { return type_;}
00167 
00169     void setType(Type type) { type_ = type;}
00170 
00172     Dataset* getDataset() const { return dataset_;}
00173 
00175     void setDataset(Dataset* set) { dataset_ = set;}
00176 
00178     bool isValid() const;
00179 
00180     protected:
00181 
00182     Dataset* dataset_;
00183     Type     type_;
00184     String   dataset_type_;
00185 };
00186 
00187         
00188 
00192 class BALL_VIEW_EXPORT CompositeMessage
00193   : public Message
00194 {
00195   public:
00196 
00198   enum CompositeMessageType
00199   {
00201     UNDEFINED = -1,
00202 
00206     NEW_COMPOSITE,
00207     
00209     REMOVED_COMPOSITE,
00210     
00212     CHANGED_COMPOSITE,
00213     
00215     CHANGED_COMPOSITE_HIERARCHY,
00216     
00218     SELECTED_COMPOSITE,
00219     
00221     DESELECTED_COMPOSITE,
00222     
00224     CENTER_CAMERA,
00225 
00229     NEW_MOLECULE
00230   };
00231 
00235 
00241   CompositeMessage();
00242 
00244   CompositeMessage(const Composite& composite, CompositeMessageType type, bool update_representations = true);
00245 
00247   CompositeMessage(const CompositeMessage& message);
00248 
00250   virtual ~CompositeMessage();
00251 
00253 
00256   
00259   void setComposite(const Composite& composite);
00260 
00263   Composite* getComposite() const;
00264 
00268   void setCompositeName(const String& name);
00269 
00272   const String& getCompositeName() const;
00273 
00275   void setType(CompositeMessageType type)
00276      { type_ = type;}
00277 
00279   CompositeMessageType getType() const
00280      { return type_;}
00281 
00283   void setUpdateRepresentations(bool state)
00284      { update_representations_ = state;}
00285 
00287   bool updateRepresentations() const
00288      { return update_representations_;}
00289 
00291   void setShowSelectionInfos(bool state)
00292      { show_selection_infos_ = state;}
00293 
00295   bool showSelectionInfos()
00296      { return show_selection_infos_;}
00297 
00299 
00300   protected:
00301 
00302   CompositeMessageType  type_;
00303   Composite*            composite_;
00304   String                composite_name_;
00305   bool                  update_representations_;
00306   bool                  show_selection_infos_;
00307 };
00308 
00309 
00320 class BALL_VIEW_EXPORT SceneMessage: public Message
00321 {
00322   public:
00323 
00327   
00329   enum SceneMessageType
00330   {
00332     UNDEFINED = 0,
00333 
00335     REBUILD_DISPLAY_LISTS,
00336     
00338     REDRAW,
00339 
00341     UPDATE_CAMERA,
00342     
00344     REMOVE_COORDINATE_SYSTEM,
00345 
00347     EXPORT_PNG,
00348 
00350     EXPORT_POVRAY,
00351 
00353     ENTER_ROTATE_MODE,
00354 
00356     ENTER_PICKING_MODE,
00357 
00359     ENTER_MOVE_MODE
00360   };
00361 
00363 
00366 
00373   SceneMessage(SceneMessageType type = UNDEFINED);
00374 
00377   SceneMessage(const SceneMessage& message);
00378 
00381   virtual ~SceneMessage();
00382 
00384 
00387   
00389   void setType(SceneMessageType type);
00390 
00392   SceneMessageType getType() const
00393      { return type_;}
00394 
00397   void setStage(Stage stage) 
00398      { stage_ = stage;}
00399   
00401   Stage& getStage() 
00402      { return stage_;}
00403 
00405   const Stage& getStage() const
00406      { return stage_;}
00407 
00409 
00410   private:
00411 
00412   SceneMessageType  type_;
00413   Stage             stage_;
00414 };
00415 
00416 
00422 class BALL_VIEW_EXPORT GenericSelectionMessage: public Message
00423 {
00424   public:
00425 
00429 
00434   GenericSelectionMessage();
00435 
00438   GenericSelectionMessage(const GenericSelectionMessage& message);
00439 
00442   virtual ~GenericSelectionMessage();
00443           
00445 
00448 
00452   void setSelection(const List<Composite*>& selection);
00453 
00456   const List<Composite*>& getSelection() const;
00457 
00460   List<Composite*>& getSelection();
00461 
00463 
00464   private:
00465 
00466   List<Composite*> selection_;
00467 };
00468 
00469 
00475 class BALL_VIEW_EXPORT ControlSelectionMessage: public GenericSelectionMessage
00476 {
00477   public:
00478   ControlSelectionMessage();
00479 };
00480 
00481 
00484 class BALL_VIEW_EXPORT NewSelectionMessage: public Message
00485 {
00486   public:
00487   NewSelectionMessage();
00488 
00490   bool openItems()
00491      { return open_;}
00492 
00494   void setOpenItems(bool state)
00495      { open_ = state;}
00496 
00497   protected:
00498    bool open_;
00499 };
00500 
00505 class BALL_VIEW_EXPORT GeometricObjectSelectionMessage: public Message
00506 {
00507   public:
00508 
00512 
00515   GeometricObjectSelectionMessage();
00516 
00519   virtual ~GeometricObjectSelectionMessage();
00520 
00522 
00525   
00529   void setSelection(const List<GeometricObject*>& selection)
00530      { selection_ = selection;}
00531 
00534   const List<GeometricObject*>& getSelection() const
00535      { return selection_;}
00536 
00538   void setSelected(bool state)
00539      { state_ = state;}
00540 
00542   bool isSelected() const
00543      { return state_;}
00544 
00546 
00547   private:
00548 
00549   List<GeometricObject*> selection_;
00550 
00551   bool state_;
00552 };
00553 
00554 
00555 class Representation;
00556 
00558 class BALL_VIEW_EXPORT RepresentationMessage: public Message
00559 {
00560   public:
00561 
00563   enum RepresentationMessageType
00564   {
00566     UNDEFINED = -1,
00567 
00569     ADD = 0,
00570 
00572     REMOVE,
00573 
00575     UPDATE,
00576 
00578     SELECTED,
00579 
00581     STARTED_UPDATE,
00582 
00584     FINISHED_UPDATE,
00585 
00587     ADD_TO_GEOMETRIC_CONTROL
00588   };
00589 
00591   RepresentationMessage();
00592   
00594   virtual ~RepresentationMessage();
00595 
00597   RepresentationMessage(Representation& rep, RepresentationMessageType type);
00598 
00600   void setRepresentation(Representation& rep)
00601      {representation_ = &rep;}
00602 
00604   Representation* getRepresentation() 
00605      {return representation_;}
00606 
00608   void setType(RepresentationMessageType type);
00609 
00611   RepresentationMessageType getType() const
00612      { return type_;}
00613   
00614   private:
00615 
00616   Representation*           representation_;
00617   RepresentationMessageType type_;
00618 };
00619   
00620 
00624 class BALL_VIEW_EXPORT MolecularTaskMessage
00625   : public Message
00626 {
00627   public:
00628 
00630   enum MolecularTaskMessageType
00631   {
00633     UNDEFINED = -1,
00635     BUILD_BONDS,
00637     CHECK_RESIDUE,
00639     ADD_HYDROGENS,
00641     CREATE_DISTANCE_GRID
00642   };
00643 
00645   MolecularTaskMessage(MolecularTaskMessageType type = UNDEFINED);
00646 
00648   void setType(MolecularTaskMessageType type);
00649 
00651   MolecularTaskMessageType getType() const
00652      {return type_;}
00653 
00654   protected:
00655   
00656   MolecularTaskMessageType type_;
00657 };
00658 
00659 
00663 class BALL_VIEW_EXPORT ShowDisplayPropertiesMessage
00664   :public Message
00665 {
00666   public:
00668     ShowDisplayPropertiesMessage()
00669       : Message(){};
00670 };
00671 
00675 class BALL_VIEW_EXPORT CreateRepresentationMessage
00676   :public Message
00677 {
00678   public:
00680     CreateRepresentationMessage();
00681 
00683     CreateRepresentationMessage(const List<Composite*>& composites, 
00684                                 ModelType model_type, 
00685                                 ColoringMethod coloring_method)
00686       ;   
00687 
00689     const List<Composite*>& getComposites() const
00690        { return composites_;}
00691 
00693     ModelType getModelType() const
00694        { return model_type_;}
00695     
00697     ColoringMethod getColoringMethod() const
00698        { return coloring_method_;} 
00699   
00700     private: 
00701     List<Composite*>  composites_;
00702     ModelType         model_type_;
00703     ColoringMethod    coloring_method_;
00704 };
00705   
00706 
00710 class BALL_VIEW_EXPORT DeselectControlsMessage
00711   : public Message
00712 {
00713   public:
00714     DeselectControlsMessage()
00715       : Message() {};
00716 };
00717 
00718 
00720 class BALL_VIEW_EXPORT TransformationMessage
00721   : public Message
00722 {
00723   public:
00724 
00726   TransformationMessage();
00727 
00729   TransformationMessage(const Matrix4x4& m);
00730 
00732   void setMatrix(const Matrix4x4& m)
00733      { matrix_ = m;}
00734 
00736   const Matrix4x4& getMatrix() const
00737      { return matrix_;}
00738 
00739   private:
00740 
00741   Matrix4x4 matrix_;
00742 };
00743 
00744 
00746 class BALL_VIEW_EXPORT FinishedSimulationMessage
00747   : public Message
00748 {
00749   public:
00750 
00752   FinishedSimulationMessage();
00753 };
00754   
00755 
00757 class BALL_VIEW_EXPORT SyncClippingPlanesMessage
00758   : public Message
00759 {
00760   public:
00761 
00763   SyncClippingPlanesMessage(){};
00764 };
00765 
00766 
00768 class BALL_VIEW_EXPORT ShowHelpMessage
00769   : public Message
00770 {
00771   public:
00772 
00774   ShowHelpMessage(String url = "", String project = "BALLView", String entry = "");
00775 
00776   String getURL() const { return url_;}
00777 
00778   String getProject() const { return project_;}
00779 
00780   String getEntry() const { return entry_;}
00781 
00782   protected:
00783 
00784   String url_;
00785   String project_;
00786   String entry_;
00787 };
00788 
00789 
00794 class BALL_VIEW_EXPORT RegisterHelpSystemMessage
00795   : public Message
00796 {
00797   public:
00798 
00800   RegisterHelpSystemMessage();
00801 
00803   void setObject(const QObject* object) { object_ = object;}
00804 
00806   void setURL(const String& url) { url_ = url;}
00807 
00809   void setRegisterMode(bool state) { register_ = state;}
00810 
00812   const QObject* getObject() const { return object_;}
00813 
00815   const String& getURL() const { return url_;}
00816 
00818   bool isRegister() const { return register_;}
00819 
00820   protected:
00821 
00822   const QObject* object_;
00823   Index    menu_entry_;
00824   String   url_;
00825   bool     register_;
00826 };
00827 
00828 
00829 
00831 class BALL_VIEW_EXPORT DockingFinishedMessage
00832   :public Message
00833 {
00834   public:
00836     DockingFinishedMessage();
00837 
00839     DockingFinishedMessage(bool abort);
00840        
00842     virtual ~DockingFinishedMessage();
00843       
00845     void setConformationSet(const ConformationSet* conformation_set)
00846     {
00847       conformation_set_ = conformation_set;
00848     }
00849     
00850     //
00851     const ConformationSet* getConformationSet() const { return conformation_set_; }
00852     
00854     bool wasAborted() { return abort_; }
00855 
00856   protected:
00857 
00859     const ConformationSet* conformation_set_;
00860     bool abort_;
00861 };
00862 
00864 
00865 # ifndef BALL_NO_INLINE_FUNCTIONS
00866 #   include <BALL/VIEW/KERNEL/message.iC>
00867 # endif
00868         
00869 } } // namespaces
00870 
00871 #endif // BALL_VIEW_KERNEL_MESSAGE_H