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  FOLDER_LAYER, //!< Folder layers menu.
76  MULTI_LAYERS, //!< Multiple layers selected menu.
77  NO_LAYERS, //!< No selected layers menu.
78  ALL_LAYERS, //!< All kinds of items menu.
79  INVALID_LAYERS //!< Invalid layers menu.
80  };
81 
82  /*!
83  * \name Instantiation Methods
84  *
85  * Methods related to creation and destruction of the object.
86  */
87  //@{
88 
89  /*!
90  * \brief Contructor.
91  * \param view The view that is being used.
92  */
94 
95  /*!
96  * \brief Destructor
97  */
99  //@}
100 
101  /*!
102  * \brief Adds an action to some menu.
103  * \param mnu The menu we will update.
104  * \param act The new action to be added.
105  * \param pos The position of the menu. \a pos = -1 signs to append the action.
106  */
107  void addAction(LMENUACTIONS mnu, QAction* act, int pos = -1);
108 
109  /*!
110  * \name Reimplementation of QObject
111  *
112  * Methods reimplemented of the QObject class.
113  */
114  //@{
115  bool eventFilter(QObject* watched, QEvent* event);
116  //@}
117 
118  protected:
119 
120  LayerItemView* m_view; //!< View being inspected.
121 
122  std::auto_ptr<QueueAction> m_VL_actions; //!< Vector layers action list.
123  std::auto_ptr<QueueAction> m_RL_actions; //!< Raster layers action list.
124  std::auto_ptr<QueueAction> m_FL_actions; //!< Folder layers action list.
125  std::auto_ptr<QueueAction> m_ML_actions; //!< Multiple selected items action list.
126  std::auto_ptr<QueueAction> m_NL_actions; //!< No selected items action list.
127  std::auto_ptr<QueueAction> m_AL_actions; //!< All kinds of items action list.
128  std::auto_ptr<QueueAction> m_IL_actions; //!< Invalid layers action list.
129  };
130 
131  }
132  }
133 }
134 
135 #endif // __TERRALIB_QT_WIDGETS_LAYER_INTERNAL_LAYERVIEWMENUMANAGER_H
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:71
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