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  {
50  class LayerItemView;
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::unique_ptr<QueueAction> m_VL_actions; //!< Vector layers action list.
124  std::unique_ptr<QueueAction> m_RL_actions; //!< Raster layers action list.
125  std::unique_ptr<QueueAction> m_TL_actions; //!< Tabular layers action list.
126  std::unique_ptr<QueueAction> m_FL_actions; //!< Folder layers action list.
127  std::unique_ptr<QueueAction> m_ML_actions; //!< Multiple selected items action list.
128  std::unique_ptr<QueueAction> m_NL_actions; //!< No selected items action list.
129  std::unique_ptr<QueueAction> m_AL_actions; //!< All kinds of items action list.
130  std::unique_ptr<QueueAction> m_IL_actions; //!< Invalid layers action list.
131  };
132 
133  }
134  }
135 }
136 
137 #endif // __TERRALIB_QT_WIDGETS_LAYER_INTERNAL_LAYERVIEWMENUMANAGER_H
te::qt::widgets::LayerViewMenuManager::eventFilter
bool eventFilter(QObject *watched, QEvent *event)
te::qt::widgets::LayerViewMenuManager::VECTOR_LAYER
@ VECTOR_LAYER
Vector layers menu.
Definition: LayerViewMenuManager.h:73
te
TerraLib.
Definition: AddressGeocodingOp.h:52
te::qt::widgets::LayerViewMenuManager::m_view
LayerItemView * m_view
View being inspected.
Definition: LayerViewMenuManager.h:121
te::qt::widgets::LayerViewMenuManager::TABULAR_LAYER
@ TABULAR_LAYER
Tabular layers menu.
Definition: LayerViewMenuManager.h:75
te::qt::widgets::QueueAction
te::common::QueueT< QAction * > QueueAction
Definition: LayerViewMenuManager.h:50
te::qt::widgets::LayerViewMenuManager::FOLDER_LAYER
@ FOLDER_LAYER
Folder layers menu.
Definition: LayerViewMenuManager.h:76
TEQTWIDGETSEXPORT
#define TEQTWIDGETSEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:63
te::qt::widgets::LayerViewMenuManager::NO_LAYERS
@ NO_LAYERS
No selected layers menu.
Definition: LayerViewMenuManager.h:78
te::qt::widgets::LayerViewMenuManager::addAction
void addAction(LMENUACTIONS mnu, QAction *act, int pos=-1)
Adds an action to some menu.
te::qt::widgets::LayerViewMenuManager::m_TL_actions
std::unique_ptr< QueueAction > m_TL_actions
Tabular layers action list.
Definition: LayerViewMenuManager.h:125
te::qt::widgets::LayerViewMenuManager::RASTER_LAYER
@ RASTER_LAYER
Raster layers menu.
Definition: LayerViewMenuManager.h:74
te::qt::widgets::LayerViewMenuManager::m_ML_actions
std::unique_ptr< QueueAction > m_ML_actions
Multiple selected items action list.
Definition: LayerViewMenuManager.h:127
te::qt::widgets::LayerItemView
A specialization of QTreeView for manipulate layers.
Definition: LayerItemView.h:79
te::qt::widgets::LayerViewMenuManager::MULTI_LAYERS
@ MULTI_LAYERS
Multiple layers selected menu.
Definition: LayerViewMenuManager.h:77
te::qt::widgets::LayerViewMenuManager::m_AL_actions
std::unique_ptr< QueueAction > m_AL_actions
All kinds of items action list.
Definition: LayerViewMenuManager.h:129
te::qt::widgets::LayerViewMenuManager::m_RL_actions
std::unique_ptr< QueueAction > m_RL_actions
Raster layers action list.
Definition: LayerViewMenuManager.h:124
te::qt::widgets::LayerViewMenuManager::m_VL_actions
std::unique_ptr< QueueAction > m_VL_actions
Vector layers action list.
Definition: LayerViewMenuManager.h:123
te::qt::widgets::LayerViewMenuManager::LayerViewMenuManager
LayerViewMenuManager(LayerItemView *view)
Contructor.
te::qt::widgets::LayerViewMenuManager::m_IL_actions
std::unique_ptr< QueueAction > m_IL_actions
Invalid layers action list.
Definition: LayerViewMenuManager.h:130
te::qt::widgets::LayerViewMenuManager::~LayerViewMenuManager
~LayerViewMenuManager()
Destructor.
te::qt::widgets::LayerViewMenuManager
Class for manage the menus of the LayerViewItem.
Definition: LayerViewMenuManager.h:61
te::qt::widgets::LayerViewMenuManager::m_NL_actions
std::unique_ptr< QueueAction > m_NL_actions
No selected items action list.
Definition: LayerViewMenuManager.h:128
te::qt::widgets::LayerViewMenuManager::ALL_LAYERS
@ ALL_LAYERS
All kinds of items menu.
Definition: LayerViewMenuManager.h:79
te::qt::widgets::LayerViewMenuManager::m_FL_actions
std::unique_ptr< QueueAction > m_FL_actions
Folder layers action list.
Definition: LayerViewMenuManager.h:126
te::common::QueueT
Struct that implements the generic queue.
Definition: GenericQueue.h:86
te::qt::widgets::LayerViewMenuManager::LMENUACTIONS
LMENUACTIONS
Defines the type of actions we can use.
Definition: LayerViewMenuManager.h:72