AbstractAction.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/plugins/vp/AbstractAction.h
22 
23  \brief This file defines the abstract class AbstractAction
24 */
25 
26 #ifndef __TE_QT_PLUGINS_CELLSPACE_INTERNAL_ABSTRACTACTION_H
27 #define __TE_QT_PLUGINS_CELLSPACE_INTERNAL_ABSTRACTACTION_H
28 
29 // TerraLib
30 #ifndef Q_MOC_RUN
31 #include "../../../maptools/AbstractLayer.h"
32 #endif
33 #include "Config.h"
34 
35 // Qt
36 #include <QAction>
37 #include <QMenu>
38 #include <QObject>
39 
40 namespace te
41 {
42  namespace qt
43  {
44  namespace af
45  {
46  namespace evt
47  {
48  struct Event;
49  }
50  }
51  namespace plugins
52  {
53  namespace cellspace
54  {
55  /*!
56  \class AbstractAction
57 
58  \brief This is an abstract class used to register actions into Cellular Spaces pluging.
59 
60  */
61  class AbstractAction : public QObject
62  {
63  Q_OBJECT
64 
65  public:
66 
67  /*!
68  \brief Constructor.
69 
70  \param menu The parent menu object.
71  */
72  AbstractAction(QMenu* menu);
73 
74  /*!
75  \brief Destructor.
76  */
77  virtual ~AbstractAction();
78 
79  protected slots:
80 
81  /*!
82  \brief Slot function used when a action was selected.
83 
84  \param checked Flag used in case a toggle action.
85  */
86  virtual void onActionActivated(bool checked) = 0;
87 
88  protected:
89 
90  /*!
91  \brief Create and set the actions parameters.
92 
93  \param name The action name.
94 
95  \param pixmap The action pixmap name.
96  */
97  void createAction(std::string name, std::string pixmap = "");
98 
99  /*!
100  \brief Add a new layer into layer explorer widget
101 
102  \param layer The layer auto pointer
103 
104  */
106 
107  /*!
108  \brief Get the list of layers from app
109 
110  \return The list pf layer auto pointers
111 
112  */
113  std::list<te::map::AbstractLayerPtr> getLayers();
114 
115  Q_SIGNALS:
116 
118 
119  protected:
120 
121  QMenu* m_menu; //!< Parent Menu.
122  QAction* m_action; //!< Action used to call the process.
123  };
124 
125  } // end namespace cellspace
126  } // end namespace plugins
127  } // end namespace qt
128 } // end namespace te
129 
130 #endif //__TE_QT_PLUGINS_CELLSPACE_INTERNAL_ABSTRACTACTION_H
This is an abstract class used to register actions into Cellular Spaces pluging.
void triggered(te::qt::af::evt::Event *e)
void createAction(std::string name, std::string pixmap="")
Create and set the actions parameters.
A base class for application events.
Definition: Event.h:59
void addNewLayer(te::map::AbstractLayerPtr layer)
Add a new layer into layer explorer widget.
virtual void onActionActivated(bool checked)=0
Slot function used when a action was selected.
URI C++ Library.
std::list< te::map::AbstractLayerPtr > getLayers()
Get the list of layers from app.
Configuration flags for the Cellular Spaces Qt Widget plugin.
AbstractAction(QMenu *menu)
Constructor.
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
QAction * m_action
Action used to call the process.