![]() |
VR-Forces 4.0.4 Class Documentation
|
00001 /****************************************************************************** 00002 ** Copyright (c) 2008 MAK Technologies, Inc. 00003 ** All rights reserved. 00004 ******************************************************************************/ 00005 /****************************************************************************** 00006 ** $RCSfile: DtAttachWidgetLogic.h,v $ $Revision: 1.29 $ $State: Exp $ 00007 ******************************************************************************/ 00008 00012 00013 #pragma once 00014 00015 #include <vrvCoreQt/vrvCoreQt.h> 00016 #include <vrvCore/DtObserver.h> 00017 #include <vrvCore/DtSelectionManager.h> 00018 #include <vrvCore/DtSubjectObserver.h> 00019 #include <vrvCore/DtAttachManager.h> 00020 00021 namespace makVrv 00022 { 00023 class DtDe; 00024 class DtAttachWidgetInterface; 00025 class DtAttachManager; 00026 class DtDriverManager; 00027 class DtInputDriver; 00028 class DtObserver; 00029 00032 class DT_DLL_VRVCOREQT DtAttachWidgetLogic : public DtDeObserver, public DtVirtualBaseClass 00033 { 00034 00035 public: 00036 00037 enum AttachState 00038 { 00039 Unattached, 00040 SingleAttached, 00041 MultipleAttached 00042 }; 00043 00044 enum SelectionState 00045 { 00046 NoSelection, 00047 SingleSelection, 00048 MultipleSelection 00049 }; 00050 00051 friend class DtAttachWidgetLogicCreator; 00052 00054 virtual ~DtAttachWidgetLogic(); 00055 00056 protected: 00057 00059 virtual void detach(); 00060 00062 virtual void attachNext(); 00063 00065 virtual void attachPrevious(); 00066 00068 virtual void attachToPart(const std::string& partName); 00069 00071 virtual void setHideAttachedModel( bool hide ); 00072 00074 virtual void setAttachFilterType( int filterType ); 00075 00077 virtual void setCurrentObserver( const std::string& observerName ); 00078 00080 virtual void attachToSelected(); 00081 00083 virtual void attachSelectedByMode( int mode ); 00084 00086 virtual void setAttachMode( int mode ); 00087 00088 virtual void observerChanged( const std::string& observerName, 00089 const DtUniqueID& id ); 00090 00091 virtual void slot_activate(DtDe* subject); 00092 00093 virtual void slot_deactivate(DtDe* subject); 00094 00095 protected: 00096 00098 DtAttachWidgetLogic(DtDe& de, DtAttachWidgetInterface& iFace ); 00099 00101 void setCurrentObserver( DtObserver* observer ); 00102 00104 void onAttachedToChanged( DtObserver* observer ); 00105 00107 void onHideModelChanged( DtObserver* observer ); 00108 00110 void updateAttachedNames(); 00111 00113 virtual void onObserverAboutToBeDestroyed( DtInputDriver* driver, 00114 DtObserver* observer ); 00115 00116 virtual void onCurrentObserverChanged( DtInputDriver* driver, 00117 DtObserver* observer ); 00118 00120 void onAttachTypeChanged( DtObserver* observer ); 00121 00122 void onCurrentAttachFilterTypeChanged( 00123 const DtAttachManager::ElementTypeList& filterType ); 00124 00126 virtual void onSelectionChanged( const DtSelectionManager::IdSet& selected, 00127 const DtSelectionManager::IdSet& deselected ); 00128 00129 virtual void onIs2DChanged( int mode ); 00130 00131 virtual void onObserverModeChanged( DtObserver*, int mode ); 00132 00134 virtual void enableSingleAttachModes(); 00135 00137 virtual void enableMultipleAttachModes(); 00138 00140 void determineAttachState(); 00141 00143 void updateAttachStateToWidget(); 00144 00146 void determineSelectionState(); 00147 00149 void updateSelectionStateToWidget(); 00150 00151 const DtAttachManager::ElementTypeList& indexToAttachFilterType( int index ); 00152 int attachFilterTypeToIndex( const DtAttachManager::ElementTypeList& filterType ); 00153 00154 void updateAttachableParts(); 00155 00156 protected: 00157 00158 DtDe& myDe; 00159 DtAttachWidgetInterface& myInterface; 00160 DtObserver* myCurrentObserver; 00161 AttachState myAttachState; 00162 SelectionState mySelectionState; 00163 DtAttachManager::ElementTypeList myCurrentAttachFilterType; 00164 }; 00165 00168 class DT_DLL_VRVCOREQT DtAttachWidgetLogicCreator : public DtVirtualBaseClass 00169 { 00170 public: 00171 00173 static DtAttachWidgetLogicCreator& instance(DtDe&); 00174 00176 static void registerInstance(DtDe& de, DtAttachWidgetLogicCreator* instance); 00177 00179 DtAttachWidgetLogicCreator(); 00180 00182 virtual ~DtAttachWidgetLogicCreator(); 00183 00185 virtual DtVirtualBaseClass* create(DtDe& de, DtAttachWidgetInterface& iFace ); 00186 }; 00187 }