DumontEXE 0.0.1
cmcTreeModel.h
00001 /* ***************************************************************************
00002 **
00003 ** Copyright (C) 2007 Lorimark Solutions, LLC. All rights reserved.
00004 **
00005 ** This file is part of the DumontEXE Scripting Extension Kit
00006 **
00007 ** This file may be used under the terms of the GNU General Public
00008 ** License version 2.0 as published by the Free Software Foundation
00009 ** and appearing in the file LICENSE.GPL included in the packaging of
00010 ** this file.  Please review the following information to ensure GNU
00011 ** General Public Licensing requirements will be met:
00012 ** http://dumont.showoff-db.org/opensource.html
00013 **
00014 ** If you are unsure which license is appropriate for your use, please
00015 ** review the following information:
00016 ** http://dumont.showoff-db.org/licensing.html 
00017 ** or contact the sales department at sales@lorimarksolutions.com.
00018 **
00019 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00020 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00021 **
00022 ** author: Mark Petryk ~ Lorimark Solutions, LLC
00023 ** **************************************************************************/
00024 
00025 #ifndef CDA_TREE_MODEL_H_422FD07F_0597_4cbb_A034_9AE85166472E
00026 #define CDA_TREE_MODEL_H_422FD07F_0597_4cbb_A034_9AE85166472E
00027 
00028 #include <QAbstractItemModel>
00029 #include <QModelIndex>
00030 #include <QUuid>
00031 #include <QString>
00032 
00033 namespace cmcDatabaseApi {
00034 
00035 class cmcApplication;
00036 class cmcCursor;
00037 class cmcTreeModelNode;
00038 
00039 /*!
00040 ** \brief Tree Model
00041 **
00042 **
00043 */
00044 class cmcTreeModel:
00045   public QAbstractItemModel
00046 {
00047   Q_OBJECT
00048   public:
00049 
00050     /*!
00051     ** \brief Copy Constructor
00052     **
00053     */
00054     cmcTreeModel( const cmcTreeModel & copy );
00055 
00056     cmcTreeModel( QObject * parent = 0 );
00057 
00058     cmcTreeModel
00059     (
00060       cmcApplication * app,
00061       const QString & categoryName,
00062       const QString & idFieldName,
00063       const QString & idParentFieldName,
00064       const QString & itemNameFieldName,
00065       const QString & itemAttrFieldName,
00066       const QString & itemDataFieldName
00067     );
00068 
00069     /*!
00070     ** \brief Primary Destructor
00071     **
00072     ** This destructor handles cleanup of the object.
00073     **
00074     */
00075     virtual ~cmcTreeModel();
00076 
00077     virtual void setRootNode( cmcTreeModelNode *node );
00078 
00079     virtual cmcTreeModelNode * getRootNode();
00080 
00081     virtual QModelIndex index( int row, int column, const QModelIndex &parent ) const;
00082 
00083     virtual QModelIndex parent( const QModelIndex &child ) const;
00084 
00085     int rowCount(const QModelIndex &parent) const;
00086 
00087     int columnCount(const QModelIndex &parent) const;
00088 
00089     QVariant data(const QModelIndex &index, int role) const;
00090 
00091     QVariant headerData(int section, Qt::Orientation orientation, int role) const;
00092 
00093     //--------------------------------------------------------------------------------
00094 
00095     bool canFetchMore ( const QModelIndex & parent ) const;
00096 
00097     void fetchMore ( const QModelIndex & parent );
00098 
00099     //--------------------------------------------------------------------------------
00100 
00101     cmcCursor * getCursor( const cmcTreeModelNode * node );
00102 
00103     cmcCursor * getCursor( const QModelIndex & index );
00104 
00105     cmcCursor * getChildrenCursor( const cmcTreeModelNode * parentNode );
00106 
00107     cmcCursor * getChildrenCursor( const cmcTreeModelNode * parentNode ) const;
00108 
00109     cmcCursor * getChildrenCursor( const QModelIndex & parent );
00110 
00111     cmcCursor * getChildrenCursor( const QModelIndex & parent ) const;
00112 
00113 
00114   public slots:
00115 
00116   signals:
00117 
00118   protected:
00119 
00120   private:
00121 
00122     void loadChildNodes( cmcTreeModelNode * parentNode );
00123 
00124     cmcTreeModelNode *nodeFromIndex(const QModelIndex &index) const;
00125 
00126     cmcTreeModelNode *rootNode;
00127 
00128     cmcApplication * app;
00129 
00130 //    cmcCursor * cursor;
00131 
00132     QString categoryName;
00133 
00134     QString idFieldName;
00135     QString idParentFieldName;
00136     QString itemNameFieldName;
00137     QString itemAttrFieldName;
00138     QString itemDataFieldName;
00139 
00140 }; // endclass cmcTreeModel
00141 
00142 } // namespace cmcDatabaseApi
00143 
00144 #endif // #ifndef CDA_TREE_MODEL_H
00145 
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties




~ ~ ~ ~ ~ ~
Source Code without Comments is like a Cranberry Garland
without the berries. Comment your Code!
 
Commence Database User Support Group Forum
http://newsgroup.showoff-db.org/
~ ~ ~ ~ ~ ~
Author: Mark Petryk
Lorimark Solutions, LLC
mark@lorimarksolutions.com