Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

OSGQNodeTreeView_qt.h

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002  *                                OpenSG                                     *
00003  *                                                                           *
00004  *                                                                           *
00005  *             Copyright (C) 2000-2002 by the OpenSG Forum                   *
00006  *                                                                           *
00007  *                            www.opensg.org                                 *
00008  *                                                                           *
00009  *   contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de          *
00010  *                                                                           *
00011 \*---------------------------------------------------------------------------*/
00012 /*---------------------------------------------------------------------------*\
00013  *                                License                                    *
00014  *                                                                           *
00015  * This library is free software; you can redistribute it and/or modify it   *
00016  * under the terms of the GNU Library General Public License as published    *
00017  * by the Free Software Foundation, version 2.                               *
00018  *                                                                           *
00019  * This library is distributed in the hope that it will be useful, but       *
00020  * WITHOUT ANY WARRANTY; without even the implied warranty of                *
00021  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU         *
00022  * Library General Public License for more details.                          *
00023  *                                                                           *
00024  * You should have received a copy of the GNU Library General Public         *
00025  * License along with this library; if not, write to the Free Software       *
00026  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.                 *
00027  *                                                                           *
00028 \*---------------------------------------------------------------------------*/
00029 /*---------------------------------------------------------------------------*\
00030  *                                Changes                                    *
00031  *                                                                           *
00032  *                                                                           *
00033  *                                                                           *
00034  *                                                                           *
00035  *                                                                           *
00036  *                                                                           *
00037 \*---------------------------------------------------------------------------*/
00038 
00039 #ifndef _OSGQNODETREEVIEW_H_
00040 #define _OSGQNODETREEVIEW_H_
00041 #ifdef __sgi
00042 #pragma once
00043 #endif
00044 
00045 #include "OSGWindowQTDef.h"
00046 
00047 #include <OSGNode.h>
00048 #include <OSGFieldContainerFields.h>
00049 
00050 #include <list>
00051 
00052 #include <qlistview.h>
00053 
00054 OSG_BEGIN_NAMESPACE
00055 
00056 class QFCItem;
00057 
00058 class OSG_WINDOWQTLIB_DLLMAPPING QHeaderItem : public QListViewItem
00059 {
00060 public:
00061              QHeaderItem(QFCItem *parent, const QString &strText);
00062 
00063     virtual ~QHeaderItem(void                                   );
00064 
00065     static   QHeaderItem *dcast(QListViewItem *pItem);
00066 
00067 private:
00068     typedef QListViewItem Inherited;
00069 };
00070 
00071 class OSG_WINDOWQTLIB_DLLMAPPING QSceneGraphItem : public QListViewItem
00072 {
00073 public:
00074              QSceneGraphItem(QListView     *parent);
00075              QSceneGraphItem(QListViewItem *parent);
00076     virtual ~QSceneGraphItem(void                 );
00077 
00078     static   QSceneGraphItem   *dcast    (QListViewItem *pItem);
00079 
00080     virtual  FieldContainerPtr  getFC    (void                ) const = 0;
00081     
00082     virtual  void               setOpen  (bool bOpen          );
00083 
00084     virtual  void               expand   (void                )       = 0;
00085     virtual  void               collapse (void                )       = 0;
00086 
00087 protected:
00088              UInt32             getAspect(void                );
00089 
00090 private:
00091     typedef QListViewItem Inherited;
00092 };
00093 
00094 
00095 class OSG_WINDOWQTLIB_DLLMAPPING QFCItem : public QSceneGraphItem
00096 {
00097 public:
00098     QFCItem(QListView     *parent, const FieldContainerPtr &pFC);
00099     QFCItem(QListViewItem *parent, const FieldContainerPtr &pFC);
00100 
00101     virtual ~QFCItem(void);
00102 
00103     static QFCItem *dcast(QListViewItem *pItem);
00104 
00105     virtual FieldContainerPtr  getFC   (void) const;
00106 
00107     virtual void               setup   (void);
00108 
00109     virtual void               expand  (void);
00110     virtual void               collapse(void);
00111 
00112 private:
00113     typedef QSceneGraphItem Inherited;
00114 
00115     void addRefedContainer(SFFieldContainerPtr *pSFFCPtr  );
00116     void addRefedContainer(MFFieldContainerPtr *pMFFCPtr, 
00117                            FieldDescription    *pFieldDesc);
00118     void addAttachments   (SFAttachmentMap     *pSFAttMap );
00119     void addParents       (MFFieldContainerPtr *pMFFCPtr  );
00120 
00121     FieldContainerPtr _pFC;
00122 };
00123 
00124 class OSG_WINDOWQTLIB_DLLMAPPING QNodeItem : public QFCItem
00125 {
00126 public:
00127     QNodeItem(QListView     *parent, const NodePtr &pNode);
00128     QNodeItem(QListViewItem *parent, const NodePtr &pNode);
00129 
00130     virtual ~QNodeItem(void);
00131 
00132     static QNodeItem *dcast(QListViewItem *pItem);
00133 
00134 private:
00135     typedef QFCItem Inherited;
00136 };
00137 
00138 class OSG_WINDOWQTLIB_DLLMAPPING QNodeCoreItem : public QFCItem
00139 {
00140 public:
00141             QNodeCoreItem(QListView     *parent, const NodeCorePtr &pNodeCore);
00142             QNodeCoreItem(QListViewItem *parent, const NodeCorePtr &pNodeCore);
00143     virtual ~QNodeCoreItem(void);
00144 
00145     static  QNodeCoreItem *dcast(QListViewItem *pItem);
00146 
00147 private:
00148     typedef QFCItem Inherited;
00149 };
00150 
00151 class OSG_WINDOWQTLIB_DLLMAPPING QNodeTreeView : public QListView
00152 {
00153     Q_OBJECT
00154 
00155 public:
00156     QNodeTreeView(QWidget *parent, const char *name=NULL);
00157     
00158     virtual  ~QNodeTreeView(void);
00159 
00160     static QNodeTreeView   *dcast        (      QListView       *pView);
00161 
00162           FieldContainerPtr getRoot      (void                         );
00163     const FieldContainerPtr getRoot      (void                         ) const;
00164 
00165           UInt32            getAspect    (void                         ) const;
00166 
00167           FieldContainerPtr getSelectedFC(void                         ) const;
00168 
00169           QFCItem          *rereadTree   (void                         );
00170 
00171 public slots:
00172           void              setRoot      (const FieldContainerPtr &pRoot   );
00173           void              setAspect    (      UInt32             uiAspect);
00174           void              setSelectedFC(const FieldContainerPtr &pFC     );
00175 
00176 private:
00177     typedef QListView                    Inherited;
00178 
00179     typedef std::list<FieldContainerPtr> BranchType;
00180     typedef BranchType::iterator         BranchTypeIt;
00181     typedef BranchType::const_iterator   BranchTypeConstIt;
00182 
00183     void removeChildren    (      QListViewItem     *pItem   );
00184 
00185     void doSelectFC        (const FieldContainerPtr &pFC     );
00186 
00187     bool getBranch         (const FieldContainerPtr &pFromFC, 
00188                                   BranchType        &branch  );
00189     bool getBranchRecursion(const FieldContainerPtr &pFC, 
00190                                   BranchType        &branch  );
00191     void expandBranch      (const BranchType        &branch  );
00192 
00193     QListViewItem *findItemInChildren(const FieldContainerPtr &pFC,
00194                                             QListViewItem     *pParentItem);
00195 
00196     FieldContainerPtr _pRoot;
00197     UInt32            _uiAspect;
00198 };
00199 
00200 OSG_END_NAMESPACE
00201 
00202 #define OSGQNODETREEVIEW_HEADER_CVSID "@(#)$Id: OSGQNodeTreeView_qt.h,v 1.2 2003/05/16 13:54:29 neumannc Exp $"
00203 
00204 // #include "OSGQNodeTreeView_qt.inl"
00205 
00206 #endif /* _OSGQNODETREEVIEW_H_ */

Generated on Thu Aug 25 04:08:59 2005 for OpenSG by  doxygen 1.4.3