GraphicSelectorWidget.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/widgets/se/GraphicSelectorWidget.h
22 
23  \brief A widget used to select a graphic element.
24 */
25 
26 #ifndef __TERRALIB_QT_WIDGETS_SE_INTERNAL_GRAPHICSELECTORWIDGET_H
27 #define __TERRALIB_QT_WIDGETS_SE_INTERNAL_GRAPHICSELECTORWIDGET_H
28 
29 // TerraLib
30 #include "../Config.h"
31 
32 // Qt
33 #include <QWidget>
34 
35 // STL
36 #include <memory>
37 #include <string>
38 #include <vector>
39 
40 // Forward declaraion
41 class QStackedWidget;
42 namespace Ui { class GraphicSelectorWidgetForm; }
43 
44 namespace te
45 {
46 // Forward declarations
47  namespace se
48  {
49  class Graphic;
50  }
51 
52  namespace qt
53  {
54  namespace widgets
55  {
56  /*!
57  \class GraphicSelectorWidget
58 
59  \brief A widget used to select a graphic element.
60  */
62  {
63  Q_OBJECT
64 
65  public:
66 
67  /** @name Initializer Methods
68  * Methods related to instantiation and destruction.
69  */
70  //@{
71 
72  /*! \brief Constructs a graphic selector widget dialog which is a child of parent, with widget flags set to f. */
73  GraphicSelectorWidget(QWidget* parent = 0, Qt::WindowFlags f = 0);
74 
75  /*! \brief Destructor. */
77 
78  //@}
79 
80  public:
81 
82  /*!
83  \brief Sets the graphic element.
84 
85  \return The graphic element.
86 
87  \note The widget will NOT take the ownership of the given graphic.
88  */
89  void setGraphic(const te::se::Graphic* graphic);
90 
91  /*!
92  \brief Gets the configured graphic element.
93 
94  \return The configured graphic element.
95 
96  \note The caller will take the ownership of the returned graphic.
97  */
98  te::se::Graphic* getGraphic() const;
99 
100  /*!
101  \brief Gets the current graphic icon.
102 
103  \param size The icon size that will be generated.
104 
105  \return An icon that represents the graphic. i.e. a simple preview.
106  */
107  QIcon getGraphicIcon(const QSize& size);
108 
109  protected slots:
110 
111  void onGraphicTypeComboBoxCurrentIndexChanged(int index);
112 
113  void onGraphicChanged();
114 
115  signals:
116 
117  /*! This signal is emitted when the graphic element is changed. */
118  void graphicChanged();
119 
120  private:
121 
122  std::auto_ptr<Ui::GraphicSelectorWidgetForm> m_ui; //!< Widget form.
123  QStackedWidget* m_graphicWidgets; //!< Set of Graphic Widgets that can be used to configure the graphic element.
124  };
125 
126  } // end namespace widgets
127  } // end namespace qt
128 } // end namespace te
129 
130 #endif // __TERRALIB_QT_WIDGETS_SE_INTERNAL_GRAPHICSELECTORWIDGET_H
A widget used to select a graphic element.
A Graphic is a graphic symbol with an inherent shape, color(s), and possibly size.
Definition: Graphic.h:66
URI C++ Library.
std::auto_ptr< Ui::GraphicSelectorWidgetForm > m_ui
Widget form.
#define TEQTWIDGETSEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:63
QStackedWidget * m_graphicWidgets
Set of Graphic Widgets that can be used to configure the graphic element.