Changeset View
Changeset View
Standalone View
Standalone View
src/part/KgvPageLayoutSize.h
Show All 22 Lines | 19 | /* This file was part of the KDE project | |||
---|---|---|---|---|---|
23 | modify it under the terms of the GNU Library General Public | 23 | modify it under the terms of the GNU Library General Public | ||
24 | License as published by the Free Software Foundation; either | 24 | License as published by the Free Software Foundation; either | ||
25 | version 2 of the License, or (at your option) any later version. | 25 | version 2 of the License, or (at your option) any later version. | ||
26 | */ | 26 | */ | ||
27 | 27 | | |||
28 | #ifndef kgvpagelayoutsize_h | 28 | #ifndef kgvpagelayoutsize_h | ||
29 | #define kgvpagelayoutsize_h | 29 | #define kgvpagelayoutsize_h | ||
30 | 30 | | |||
31 | #include <QGroupBox> | | |||
32 | #include <QButtonGroup> | 31 | #include <QButtonGroup> | ||
32 | #include <QGroupBox> | ||||
33 | // #include <KgvGlobal.h> | 33 | // #include <KgvGlobal.h> | ||
34 | #include <KgvUnit.h> | | |||
35 | #include <QDialog> | | |||
36 | #include <KgvPageLayout.h> | 34 | #include <KgvPageLayout.h> | ||
37 | #include <KgvPageLayoutDia.h> | 35 | #include <KgvPageLayoutDia.h> | ||
36 | #include <KgvUnit.h> | ||||
38 | #include <QComboBox> | 37 | #include <QComboBox> | ||
38 | #include <QDialog> | ||||
39 | 39 | | |||
40 | class KComboBox; | 40 | class KComboBox; | ||
41 | class KgvUnitDoubleSpinBox; | 41 | class KgvUnitDoubleSpinBox; | ||
42 | 42 | | |||
43 | /** | 43 | /** | ||
44 | * This class is a widget that shows the KgvPageLayout data structure and allows the user to change it. | 44 | * This class is a widget that shows the KgvPageLayout data structure and allows | ||
45 | * the user to change it. | ||||
45 | */ | 46 | */ | ||
46 | class KgvPageLayoutSize : public QWidget { | 47 | class KgvPageLayoutSize : public QWidget { | ||
47 | Q_OBJECT | 48 | Q_OBJECT | ||
48 | 49 | | |||
49 | public: | 50 | public: | ||
50 | /** | 51 | /** | ||
51 | * Constructor | 52 | * Constructor | ||
52 | * @param parent the parent widget | 53 | * @param parent the parent widget | ||
53 | * @param layout the page layout that this widget should be initialized with. | 54 | * @param layout the page layout that this widget should be initialized | ||
55 | * with. | ||||
54 | * @param unit the unit-type (mm/cm/inch) that the dialog should show | 56 | * @param unit the unit-type (mm/cm/inch) that the dialog should show | ||
55 | * @param columns the KgvColumns (amout of columns) that the preview should be initialized with | 57 | * @param columns the KgvColumns (amout of columns) that the preview should | ||
56 | * @param unitChooser if true a combobox with the unit-type is shown for the user to change | 58 | * be initialized with | ||
57 | * @param enableBorders if true enable the user to change the margins (aka borders) of the page | 59 | * @param unitChooser if true a combobox with the unit-type is shown for the | ||
58 | */ | 60 | * user to change | ||
59 | KgvPageLayoutSize(QWidget *parent, const KgvPageLayout& layout, KgvUnit::Unit unit, | 61 | * @param enableBorders if true enable the user to change the margins (aka | ||
60 | const KgvColumns& columns, bool unitChooser, bool enableBorders); | 62 | * borders) of the page | ||
63 | */ | ||||
64 | KgvPageLayoutSize(QWidget *parent, const KgvPageLayout &layout, | ||||
65 | KgvUnit::Unit unit, const KgvColumns &columns, | ||||
66 | bool unitChooser, bool enableBorders); | ||||
61 | 67 | | |||
62 | /** | 68 | /** | ||
63 | * @return if the dialog is in a sane state and the values can be used. | 69 | * @return if the dialog is in a sane state and the values can be used. | ||
64 | */ | 70 | */ | ||
65 | bool queryClose(); | 71 | bool queryClose(); | ||
66 | /** | 72 | /** | ||
67 | * Update the page preview widget with the param columns. | 73 | * Update the page preview widget with the param columns. | ||
68 | * @param columns the new columns | 74 | * @param columns the new columns | ||
69 | */ | 75 | */ | ||
70 | void setColumns(KgvColumns &columns); | 76 | void setColumns(KgvColumns &columns); | ||
71 | 77 | | |||
72 | public Q_SLOTS: | 78 | public Q_SLOTS: | ||
73 | /** | 79 | /** | ||
74 | * Set a new unit for the widget updating the widgets. | 80 | * Set a new unit for the widget updating the widgets. | ||
75 | * @param unit the new unit | 81 | * @param unit the new unit | ||
76 | */ | 82 | */ | ||
77 | void setUnit( KgvUnit::Unit unit ); | 83 | void setUnit(KgvUnit::Unit unit); | ||
78 | /** | 84 | /** | ||
79 | * Enable the user to edit the page border size | 85 | * Enable the user to edit the page border size | ||
80 | * @param on if true enable the user to change the margins (aka borders) of the page | 86 | * @param on if true enable the user to change the margins (aka borders) of | ||
87 | * the page | ||||
81 | */ | 88 | */ | ||
82 | void setEnableBorders(bool on); | 89 | void setEnableBorders(bool on); | ||
83 | 90 | | |||
84 | Q_SIGNALS: | 91 | Q_SIGNALS: | ||
85 | /** | 92 | /** | ||
86 | * Emitted whenever the user changed something in the dialog. | 93 | * Emitted whenever the user changed something in the dialog. | ||
87 | * @param layout the update layout structure with currently displayed info. | 94 | * @param layout the update layout structure with currently displayed info. | ||
88 | * Note that the info may not be fully correct and physically possible (in which | 95 | * Note that the info may not be fully correct and physically possible (in | ||
89 | * case queryClose will return false) | 96 | * which case queryClose will return false) | ||
90 | */ | 97 | */ | ||
91 | void propertyChange(KgvPageLayout &layout); | 98 | void propertyChange(KgvPageLayout &layout); | ||
92 | 99 | | |||
93 | protected: | 100 | protected: | ||
94 | QComboBox *cpgFormat; | 101 | QComboBox *cpgFormat; | ||
95 | KgvUnitDoubleSpinBox *epgWidth; | 102 | KgvUnitDoubleSpinBox *epgWidth; | ||
96 | KgvUnitDoubleSpinBox *epgHeight; | 103 | KgvUnitDoubleSpinBox *epgHeight; | ||
97 | KgvUnitDoubleSpinBox *ebrLeft; | 104 | KgvUnitDoubleSpinBox *ebrLeft; | ||
98 | KgvUnitDoubleSpinBox *ebrRight; | 105 | KgvUnitDoubleSpinBox *ebrRight; | ||
99 | KgvUnitDoubleSpinBox *ebrTop; | 106 | KgvUnitDoubleSpinBox *ebrTop; | ||
100 | KgvUnitDoubleSpinBox *ebrBottom; | 107 | KgvUnitDoubleSpinBox *ebrBottom; | ||
101 | KgvPagePreview *pgPreview; | 108 | KgvPagePreview *pgPreview; | ||
102 | QGroupBox *m_orientGroup; | 109 | QGroupBox *m_orientGroup; | ||
103 | QButtonGroup m_orientButtons; | 110 | QButtonGroup m_orientButtons; | ||
104 | 111 | | |||
105 | protected Q_SLOTS: | 112 | protected Q_SLOTS: | ||
106 | void formatChanged( int ); | 113 | void formatChanged(int); | ||
107 | void widthChanged( double ); | 114 | void widthChanged(double); | ||
108 | void heightChanged( double ); | 115 | void heightChanged(double); | ||
109 | void leftChanged( double ); | 116 | void leftChanged(double); | ||
110 | void rightChanged( double ); | 117 | void rightChanged(double); | ||
111 | void topChanged( double ); | 118 | void topChanged(double); | ||
112 | void bottomChanged( double ); | 119 | void bottomChanged(double); | ||
113 | void orientationChanged( int ); | 120 | void orientationChanged(int); | ||
114 | void setUnitInt( int unit ); | 121 | void setUnitInt(int unit); | ||
115 | 122 | | |||
116 | private: | 123 | private: | ||
117 | void updatePreview(); | 124 | void updatePreview(); | ||
118 | void setValues(); | 125 | void setValues(); | ||
119 | 126 | | |||
120 | KgvUnit::Unit m_unit; | 127 | KgvUnit::Unit m_unit; | ||
121 | KgvPageLayout m_layout; | 128 | KgvPageLayout m_layout; | ||
122 | 129 | | |||
123 | bool m_blockSignals, m_haveBorders; | 130 | bool m_blockSignals, m_haveBorders; | ||
124 | }; | 131 | }; | ||
125 | 132 | | |||
126 | #endif | 133 | #endif |