LayerViewMenuManager.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 LayerViewMenuManager.h
22  *
23  * \brief Class for manage the menus of the LayerItemView.
24  */
25 #ifndef __TERRALIB_QT_WIDGETS_LAYER_INTERNAL_LAYERVIEWMENUMANAGER_H
26 #define __TERRALIB_QT_WIDGETS_LAYER_INTERNAL_LAYERVIEWMENUMANAGER_H
27 
28 #include "../../Config.h"
29 
30 // Qt
31 #include <QObject>
32 
33 // STL
34 #include <memory>
35 
36 // Forward declarations
37 class QAction;
38 
39 namespace te
40 {
41  namespace common
42  {
43  template<typename T> struct QueueT;
44  }
45 
46  namespace qt
47  {
48  namespace widgets
49  {
52 
53  /*!
54  * \class LayerViewMenuManager
55  *
56  * \brief Class for manage the menus of the LayerViewItem.
57  *
58  * \ingroup widgets
59  */
61  {
62  Q_OBJECT
63 
64  public:
65 
66  /*!
67  * \enum LMENUACTIONS
68  *
69  * \brief Defines the type of actions we can use.
70  */
72  {
73  VECTOR_LAYER, //!< Vector layers menu.
74  RASTER_LAYER, //!< Raster layers menu.
75  TABULAR_LAYER, //!< Tabular layers menu.
76  FOLDER_LAYER, //!< Folder layers menu.
77  MULTI_LAYERS, //!< Multiple layers selected menu.
78  NO_LAYERS, //!< No selected layers menu.
79  ALL_LAYERS, //!< All kinds of items menu.
80  INVALID_LAYERS //!< Invalid layers menu.
81  };
82 
83  /*!
84  * \name Instantiation Methods
85  *
86  * Methods related to creation and destruction of the object.
87  */
88  //@{
89 
90  /*!
91  * \brief Contructor.
92  * \param view The view that is being used.
93  */
95 
96  /*!
97  * \brief Destructor
98  */
100  //@}
101 
102  /*!
103  * \brief Adds an action to some menu.
104  * \param mnu The menu we will update.
105  * \param act The new action to be added.
106  * \param pos The position of the menu. \a pos = -1 signs to append the action.
107  */
108  void addAction(LMENUACTIONS mnu, QAction* act, int pos = -1);
109 
110  /*!
111  * \name Reimplementation of QObject
112  *
113  * Methods reimplemented of the QObject class.
114  */
115  //@{
116  bool eventFilter(QObject* watched, QEvent* event);
117  //@}
118 
119  protected:
120 
121  LayerItemView* m_view; //!< View being inspected.
122 
123  std::auto_ptr<QueueAction> m_VL_actions; //!< Vector layers action list.
124  std::auto_ptr<QueueAction> m_RL_actions; //!< Raster layers action list.
125  std::auto_ptr<QueueAction> m_TL_actions; //!< Tabular layers action list.
126  std::auto_ptr<QueueAction> m_FL_actions; //!< Folder layers action list.
127  std::auto_ptr<QueueAction> m_ML_actions; //!< Multiple selected items action list.
128  std::auto_ptr<QueueAction> m_NL_actions; //!< No selected items action list.
129  std::auto_ptr<QueueAction> m_AL_actions; //!< All kinds of items action list.
130  std::auto_ptr<QueueAction> m_IL_actions; //!< Invalid layers action list.
131  };
132 
133  }
134  }
135 }
136 
137 #endif // __TERRALIB_QT_WIDGETS_LAYER_INTERNAL_LAYERVIEWMENUMANAGER_H
std::auto_ptr< QueueAction > m_TL_actions
Tabular layers action list.
std::auto_ptr< QueueAction > m_IL_actions
Invalid layers action list.
std::auto_ptr< QueueAction > m_FL_actions
Folder layers action list.
te::common::QueueT< QAction * > QueueAction
std::auto_ptr< QueueAction > m_VL_actions
Vector layers action list.
std::auto_ptr< QueueAction > m_RL_actions
Raster layers action list.
std::auto_ptr< QueueAction > m_ML_actions
Multiple selected items action list.
Struct that implements the generic queue.
Definition: GenericQueue.h:85
URI C++ Library.
A specialization of QTreeView for manipulate layers.
Definition: LayerItemView.h:73
std::auto_ptr< QueueAction > m_NL_actions
No selected items action list.
LayerItemView * m_view
View being inspected.
Class for manage the menus of the LayerViewItem.
std::auto_ptr< QueueAction > m_AL_actions
All kinds of items action list.
LMENUACTIONS
Defines the type of actions we can use.
#define TEQTWIDGETSEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:63