All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
AbstractTreeItem.h
Go to the documentation of this file.
1 /* Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
2 
3  This file is part of the TerraLib - a Framework for building GIS enabled applications.
4 
5  TerraLib is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published by
7  the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  TerraLib is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with TerraLib. See COPYING. If not, write to
17  TerraLib Team at <terralib-team@terralib.org>.
18  */
19 
20 /*!
21  \file terralib/qt/widgets/layer/explorer/AbstractTreeItem.h
22 
23  \brief The class that represents an item in a LayerTreeModel.
24 */
25 
26 #ifndef __TERRALIB_QT_WIDGETS_LAYER_EXPLORER_INTERNAL_ABSTRACTTREEITEM_H
27 #define __TERRALIB_QT_WIDGETS_LAYER_EXPLORER_INTERNAL_ABSTRACTTREEITEM_H
28 
29 // TerraLib
30 #include "../../../../maptools/AbstractLayer.h"
31 #include "../../Config.h"
32 
33 //Qt
34 #include <QModelIndex>
35 #include <QObject>
36 #include <QVariant>
37 
38 // Forward declaration
39 class QMenu;
40 class QWidget;
41 
42 // STL
43 #include <vector>
44 
45 namespace te
46 {
47  namespace qt
48  {
49  namespace widgets
50  {
51  /*!
52  \class AbstractTreeItem
53 
54  \brief The class that represents an item in a LayerTreeModel.
55 
56  \ingroup widgets
57  */
58  class TEQTWIDGETSEXPORT AbstractTreeItem : public QObject
59  {
60  Q_OBJECT
61 
62  public:
63 
64  AbstractTreeItem(QObject* parent = 0);
65 
66  virtual ~AbstractTreeItem();
67 
68  std::vector<te::qt::widgets::AbstractTreeItem*> getDescendants();
69 
70  std::vector<te::qt::widgets::AbstractTreeItem*> getAncestors();
71 
72  // Return the number of columns for the children of the item
73  virtual int columnCount() const = 0;
74 
75  // Return the data stored under the given role
76  virtual QVariant data(int column, int role) const = 0;
77 
78  virtual QMenu* getMenu(QWidget* parent = 0) const = 0;
79 
80  virtual bool canFetchMore() const = 0;
81 
82  virtual void fetchMore() = 0;
83 
84  virtual Qt::ItemFlags flags() const = 0;
85 
86  virtual bool hasChildren() const = 0;
87 
88  virtual bool setData(int column, const QVariant& value, int role = Qt::EditRole) = 0;
89 
90  virtual te::map::AbstractLayerPtr getLayer() const = 0;
91 
92  /*!
93  \brief It returns the item type.
94 
95  \return The item type.
96  */
97  virtual const std::string getItemType() const = 0;
98  };
99 
100  } // end namespace widgets
101  } // end namespace qt
102 } // end namespace te
103 
104 #endif // __TERRALIB_QT_WIDGETS_LAYER_EXPLORER_INTERNAL_ABSTRACTTREEITEM_H
The class that represents an item in a LayerTreeModel.
#define TEQTWIDGETSEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:66
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr