File indexing completed on 2024-05-12 16:33:25

0001 /* This file is part of the KDE project
0002 
0003    Copyright 2008 Johannes Simon <johannes.simon@gmail.com>
0004    Copyright 2008 Inge Wallin    <inge@lysator.liu.se>
0005 
0006    This library is free software; you can redistribute it and/or
0007    modify it under the terms of the GNU Library General Public
0008    License as published by the Free Software Foundation; either
0009    version 2 of the License, or (at your option) any later version.
0010 
0011    This library is distributed in the hope that it will be useful,
0012    but WITHOUT ANY WARRANTY; without even the implied warranty of
0013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0014    Library General Public License for more details.
0015 
0016    You should have received a copy of the GNU Library General Public License
0017    along with this library; see the file COPYING.LIB.  If not, write to
0018    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0019  * Boston, MA 02110-1301, USA.
0020 */
0021 
0022 
0023 #ifndef KOCHART_AXESCONFIGWIDGET
0024 #define KOCHART_AXESCONFIGWIDGET
0025 
0026 
0027 #include "ConfigSubWidgetBase.h"
0028 #include "ChartShape.h"
0029 
0030 #include <QObject>
0031 
0032 class KoShape;
0033 class QAction;
0034 
0035 namespace KChart
0036 {
0037     class Position;
0038     class CartesianAxis;
0039 }
0040 
0041 namespace KoChart
0042 {
0043 class ChartShape;
0044 
0045 /**
0046  * Chart type configuration widget.
0047  */
0048 class AxesConfigWidget : public ConfigSubWidgetBase
0049 {
0050     Q_OBJECT
0051 
0052 public:
0053     AxesConfigWidget(QWidget *parent = 0);
0054     AxesConfigWidget(QList<ChartType> types, QWidget *parent = 0);
0055     ~AxesConfigWidget();
0056 
0057     void open(ChartShape* shape) override;
0058 
0059     /// Delete all open dialogs.
0060     /// This is called when e.g. the tool is deactivated.
0061     void deleteSubDialogs(ChartType type = LastChartType);
0062 
0063 public Q_SLOTS:
0064     void updateData(ChartType type, ChartSubtype subtype) override;
0065 
0066     void ui_axisSelectionChanged(int index);
0067     void ui_axisShowTitleChanged(bool b);
0068     void ui_axisShowChanged(bool b);
0069     void ui_axisPositionChanged(int index);
0070     void ui_axisLabelsPositionChanged(int index);
0071     void ui_axisShowLabelsChanged(bool value);
0072     void ui_axisShowMajorGridLinesChanged(bool b);
0073     void ui_axisShowMinorGridLinesChanged(bool b);
0074     void ui_axisUseLogarithmicScalingChanged(bool b);
0075     void ui_axisStepWidthChanged(double width);
0076     void ui_axisUseAutomaticStepWidthChanged(bool b);
0077     void ui_axisSubStepWidthChanged(double width);
0078     void ui_axisUseAutomaticSubStepWidthChanged(bool b);
0079     void ui_axisScalingButtonClicked();
0080     void ui_axisEditFontButtonClicked();
0081     void ui_axisLabelsFontChanged();
0082 
0083 Q_SIGNALS:
0084     void axisAdded(AxisDimension, const QString& title);
0085     void axisRemoved(Axis *axis);
0086     void axisShowTitleChanged(Axis *axis, bool b);
0087     void axisShowChanged(Axis *axis, bool b);
0088     void axisPositionChanged(Axis *axis, const QString &pos);
0089     void axisLabelsPositionChanged(Axis *axis, const QString &pos);
0090     void axisShowLabelsChanged(Axis *axis, bool value);
0091     void axisShowMajorGridLinesChanged(Axis *axis, bool b);
0092     void axisShowMinorGridLinesChanged(Axis *axis, bool b);
0093     void axisUseLogarithmicScalingChanged(Axis *axis, bool b);
0094     void axisStepWidthChanged(Axis *axis, qreal width);
0095     void axisSubStepWidthChanged(Axis *axis, qreal width);
0096     void axisUseAutomaticStepWidthChanged(Axis *axis, bool automatic);
0097     void axisUseAutomaticSubStepWidthChanged(Axis *axis, bool automatic);
0098     void axisLabelsFontChanged(Axis *axis, const QFont& font);
0099 
0100     void gapBetweenBarsChanged(Axis *axis, int percent);
0101     void gapBetweenSetsChanged(Axis *axis, int percent);
0102 
0103 private Q_SLOTS:
0104     void slotGapBetweenBars();
0105     void slotGapBetweenSets();
0106 
0107 private:
0108     Axis *axis(int index) const;
0109     void setupDialogs();
0110     void createActions();
0111 
0112     class Private;
0113     Private * const d;
0114 };
0115 
0116 }  // namespace KoChart
0117 
0118 
0119 #endif // KOCHART_AXESCONFIGWIDGET