![]() |
VR-Forces 4.0.4 Class Documentation
|
00001 /********************************************************************* 00002 ** Copyright (c) 2002 MAK Technologies, Inc. 00003 ** All rights reserved. 00004 *********************************************************************/ 00005 /********************************************************************* 00006 ** $RCSfile: echelonView.h,v $ $Revision: 1.10 $ $State: Exp $ 00007 *********************************************************************/ 00008 00011 00012 00013 #ifndef DtEchelonView_H_ 00014 #define DtEchelonView_H_ 00015 00016 #include <QtGui/QWidget> 00017 #include <QtCore/QHash> 00018 00019 #include "tmqt/tmEchelonTree.h" 00020 00021 class DtEchelonHierarchy; 00022 class DtEchelonViewOptions; 00023 #include "symbolMapper/modelKey.h" 00024 class DtTMEchelonTree; 00025 class QVBoxLayout; 00026 class DtModelData; 00027 class DtBaseWindow; 00028 class QLabel; 00029 00037 #include "tmqt/tmqtDefines.h" 00038 class DT_DLL_tmqt DtEchelonView : public QWidget 00039 { 00040 Q_OBJECT 00041 public: 00042 00044 DtEchelonView(const DtEchelonHierarchy *hier, 00045 const DtEchelonViewOptions *opt = NULL); 00046 00048 virtual ~DtEchelonView(); 00049 00051 virtual bool init(); 00052 00055 virtual void syncWithHierarchy(); 00056 00058 virtual bool expanded(const DtModelKey &key) const; 00059 00062 virtual bool parentsExpanded(const DtModelKey &key) const; 00063 00065 virtual void setHierarchy(const DtEchelonHierarchy* hier); 00066 virtual const DtEchelonHierarchy* hierarchy() const; 00067 00068 virtual void setOptions(DtEchelonViewOptions* options); 00069 virtual const DtEchelonViewOptions* options() const; 00070 00071 void setEmbarkationHierarchy(DtEchelonHierarchy*); 00072 const DtEchelonHierarchy* embarkationHierarchy() const; 00073 00074 virtual void setSelection(const QVector<DtModelKey>& selectionList); 00075 00076 DtTMEchelonTree* echelonTree() const; 00077 00079 virtual void tick(); 00080 virtual void selectionModeChanged(DtBaseWindow* w); 00081 00084 virtual void disableView(const QString&); 00085 virtual void enableView(); 00086 00087 virtual void initConnections(); 00088 public: 00089 00091 static DtEchelonView* create(const DtEchelonHierarchy* hier, 00092 const DtEchelonViewOptions* options); 00093 00094 public slots: 00098 virtual void addNode(const DtModelKey &key); 00100 virtual void removeNode(const DtModelKey &key); 00103 virtual void setExpanded(const DtModelKey &key, bool expand, QVector<DtModelKey>* remove = NULL, QVector<DtModelKey>* add = NULL); 00106 virtual void expandAllToLevel(int level, QVector<DtModelKey>* remove = NULL, QVector<DtModelKey>* add = NULL); 00108 virtual void expandNode(const DtModelKey &key, QVector<DtModelKey>* remove = NULL, QVector<DtModelKey>* add = NULL); 00110 virtual void collapseNode(const DtModelKey &key, QVector<DtModelKey>* remove = NULL, QVector<DtModelKey>* add = NULL); 00112 virtual void collapseParentNode(const DtModelKey &key, QVector<DtModelKey>* remove = NULL, QVector<DtModelKey>* add = NULL); 00113 00114 signals: 00116 void nodeExpanded(const DtModelKey&, QVector<DtModelKey>* remove, QVector<DtModelKey>* add); 00118 void nodeCollapsed(const DtModelKey&, QVector<DtModelKey>* remove, QVector<DtModelKey>* add); 00119 00120 void selectionChanged(const QVector<DtModelKey>&); 00121 void selectionAdded(const QVector<DtModelKey>&); 00122 void clearSelection(bool); 00123 void showInformationClicked(const DtModelData&); 00124 void deleteRequested(); 00125 00126 protected: 00127 00130 QHash<DtModelKey, bool> myExpansionDict; 00131 00132 const DtEchelonHierarchy *myHierarchy; 00133 const DtEchelonHierarchy *myEmbarkationHierarchy; 00134 00135 const DtEchelonViewOptions *myOptions; 00136 00138 bool myAmOptionsOwner; 00139 00140 QVBoxLayout* myLayout; 00141 DtTMEchelonTree* myEchelonTree; 00142 00143 QLabel* myDisabledReason; 00144 00145 protected: 00147 virtual DtTMEchelonTree* createEchelonTree(QWidget* parent); 00148 00149 private: 00151 DtEchelonView(); 00153 DtEchelonView(const DtEchelonView& orig); 00155 DtEchelonView& operator=(const DtEchelonView& rhs); 00156 }; 00157 00158 inline void DtEchelonView::setEmbarkationHierarchy(DtEchelonHierarchy* h) 00159 { 00160 myEmbarkationHierarchy = h; 00161 00162 if (myEchelonTree) 00163 { 00164 myEchelonTree->setEmbarkationHierarchy(h); 00165 } 00166 } 00167 00168 inline const DtEchelonHierarchy* DtEchelonView::embarkationHierarchy() const 00169 { 00170 return myEmbarkationHierarchy; 00171 } 00172 00173 inline DtTMEchelonTree* DtEchelonView::echelonTree() const 00174 { 00175 return myEchelonTree; 00176 } 00177 00178 #endif