Loading...
Searching...
No Matches
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/rp/AbstractAction.h
22
23 \brief This file defines the abstract class AbstractAction
24*/
25
26#ifndef __TE_QT_PLUGINS_RP_INTERNAL_ABSTRACTACTION_H
27#define __TE_QT_PLUGINS_RP_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 <QObject>
37#include <QMenu>
38#include <QAction>
39
40namespace 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 rp
54 {
55 /*!
56 \class AbstractAction
57
58 \brief This is an abstract class used to register actions into rp 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, QMenu* popupMenu);
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 /*!
89 \brief Slot function used when a action was selected from layer pop up.
90
91 \param checked Flag used in case a toggle action.
92 */
93 virtual void onPopUpActionActivated(bool checked);
94
95 protected:
96
97 /*!
98 \brief Create and set the actions parameters.
99
100 \param name The action name.
101
102 \param pixmap The action pixmap name.
103 */
104 void createAction(std::string name, std::string pixmap = "");
105
106 /*!
107 \brief Create and set the actions parameters.
108
109 \param name The action name.
110
111 \param pixmap The action pixmap name.
112 */
113 void createPopUpAction(std::string name, std::string pixmap = "");
114
115 /*!
116 \brief Add a new layer into layer explorer widget
117
118 \param layer The layer auto pointer
119
120 */
122
123 /*!
124 \brief Get the selected layer from layer explorer in app
125
126 \return The layer auto pointer
127
128 */
130
131 /*!
132 \brief Get the list of layers from app
133
134 \return The list pf layer auto pointers
135
136 */
137 std::list<te::map::AbstractLayerPtr> getLayers();
138
139
140 Q_SIGNALS:
141
143
144 public:
145 QAction* getAction()
146 {
147 return m_action;
148 }
149
150 protected:
151
152 QMenu* m_menu; //!< Parent Menu.
153 QMenu* m_popupMenu; //!< Parent popMenu.
154 QAction* m_action; //!< Action used to call the process.
155 QAction* m_popupAction; //!< Action used to call the process from pop up layer.
156 };
157
158 } // end namespace rp
159 } // end namespace plugins
160 } // end namespace qt
161} // end namespace te
162
163#endif //__TE_QT_PLUGINS_RP_INTERNAL_ABSTRACTACTION_H
This is an abstract class used to register actions into rp pluging.
virtual void onActionActivated(bool checked)=0
Slot function used when a action was selected.
QAction * m_popupAction
Action used to call the process from pop up layer.
void createAction(std::string name, std::string pixmap="")
Create and set the actions parameters.
void createPopUpAction(std::string name, std::string pixmap="")
Create and set the actions parameters.
void triggered(te::qt::af::evt::Event *e)
QAction * m_action
Action used to call the process.
virtual ~AbstractAction()
Destructor.
std::list< te::map::AbstractLayerPtr > getLayers()
Get the list of layers from app.
AbstractAction(QMenu *menu, QMenu *popupMenu)
Constructor.
virtual void onPopUpActionActivated(bool checked)
Slot function used when a action was selected from layer pop up.
QMenu * m_popupMenu
Parent popMenu.
void addNewLayer(te::map::AbstractLayerPtr layer)
Add a new layer into layer explorer widget.
te::map::AbstractLayerPtr getCurrentLayer()
Get the selected layer from layer explorer in app.
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
TerraLib.
#define slots
A base class for application events.
Definition: Event.h:60
Proxy configuration file for TerraView (see terraview_config.h).