All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
HistogramStyleWidget.cpp
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/charts/histogramStyleWidget.cpp
22 
23  \brief A widget used to adjust a histogram's style.
24 */
25 
26 
27 //Terralib
28 #include "../../../se/Fill.h"
29 #include "../../../se/Stroke.h"
30 #include "../se/BasicFillDialog.h"
31 #include "../se/BasicStrokeDialog.h"
32 #include "HistogramStyleWidget.h"
33 #include "HistogramStyle.h"
34 #include "ui_HistogramStyleWidgetForm.h"
35 
36 //QT
37 #include <QWidget>
38 
39 #include <memory>
40 
42  : QWidget(parent, f),
43  m_ui(new Ui::HistogramStyleWidgetForm),
44  m_histogramStyle(initial)
45 {
46  m_ui->setupUi(this);
47 
48  if(!m_histogramStyle)
50 
51 // connect signal and slots
52  connect(m_ui->m_fillPushButton, SIGNAL(clicked()), this, SLOT(onFillPushButtonClicked()));
53  connect(m_ui->m_strokePushButton, SIGNAL(clicked()), this, SLOT(onStrokePushButtonClicked()));
54 }
55 
57 {
58  delete m_histogramStyle;
59 }
60 
62 {
63  return m_histogramStyle->clone();
64 }
65 
67 {
68  std::auto_ptr<te::se::Fill> fill (te::qt::widgets::BasicFillDialog::getFill(m_histogramStyle->getFill(), 0, "Bar Fill"));
69  if (fill.get())
70  m_histogramStyle->setFill(fill->clone());
71 }
72 
74 {
75  std::auto_ptr<te::se::Stroke> stroke (te::qt::widgets::BasicStrokeDialog::getStroke(m_histogramStyle->getStroke(), 0, "Bar Stroke"));
76  if(stroke.get())
77  m_histogramStyle->setStroke(stroke->clone());
78 }
HistogramStyle * m_histogramStyle
The histogram's chart style that will be configured by this widget.
A widget used to adjust a histogram's style.
A class used to define the style of a histogram's chart.
te::qt::widgets::HistogramStyle * getHistogramStyle()
Returns a pointer to the HistogramStyle being configured.
HistogramStyle * clone()
Returns a pointer to a clone of this HistogramStyle.
te::se::Stroke * getStroke() const
Gets the configured stroke element.
HistogramStyleWidget(te::qt::widgets::HistogramStyle *initial=0, QWidget *parent=0, Qt::WindowFlags f=0)
Constructor.
te::se::Fill * getFill() const
Gets the configured fill element.
std::auto_ptr< Ui::HistogramStyleWidgetForm > m_ui
The widget form.