1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
|
/* This file is part of the KDE project
* Copyright (C) 1998, 1999 Reginald Stadlbauer <reggie@kde.org>
* Copyright (C) 2005 Thomas Zander <zander@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; version 2.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef kopagelayoutsize_h
#define kopagelayoutsize_h
#include <tqgroupbox.h>
#include <KoGlobal.h>
#include <KoUnit.h>
#include <kdialogbase.h>
#include <KoPageLayout.h>
#include <KoPageLayoutDia.h>
class TQComboBox;
class KoUnitDoubleSpinBox;
class KoPageLayoutColumns;
/**
* This class is a widget that shows the KoPageLayout data structure and allows the user to change it.
*/
class KoPageLayoutSize : public TQWidget {
TQ_OBJECT
public:
/**
* Contructor
* @param parent the parent widget
* @param layout the page layout that this widget should be initialzed with.
* @param unit the unit-type (mm/cm/inch) that the dialog should show
* @param columns the KoColumns (amout of columns) that the preview should be initialized with
* @param unitChooser if true a combobox with the unit-type is shown for the user to change
* @param enableBorders if true enable the user to change the margins (aka borders) of the page
*/
KoPageLayoutSize(TQWidget *parent, const KoPageLayout& layout, KoUnit::Unit unit,
const KoColumns& columns, bool unitChooser, bool enableBorders);
/**
* @return if the dialog is in a sane state and the values can be used.
*/
bool queryClose();
/**
* Update the page preview widget with the param columns.
* @param columns the new columns
*/
void setColumns(KoColumns &columns);
public slots:
/**
* Set a new unit for the widget updating the widgets.
* @param unit the new unit
*/
void setUnit( KoUnit::Unit unit );
/**
* Enable the user to edit the page border size
* @param on if true enable the user to change the margins (aka borders) of the page
*/
void setEnableBorders(bool on);
signals:
/**
* Emitted whenever the user changed something in the dialog.
* @param layout the update layout structure with currently displayed info.
* Note that the info may not be fully correct and physically possible (in which
* case queryClose will return false)
*/
void propertyChange(KoPageLayout &layout);
protected:
TQComboBox *cpgUnit;
TQComboBox *cpgFormat;
KoUnitDoubleSpinBox *epgWidth;
KoUnitDoubleSpinBox *epgHeight;
KoUnitDoubleSpinBox *ebrLeft;
KoUnitDoubleSpinBox *ebrRight;
KoUnitDoubleSpinBox *ebrTop;
KoUnitDoubleSpinBox *ebrBottom;
KoPagePreview *pgPreview;
TQButtonGroup *m_orientGroup;
protected slots:
void formatChanged( int );
void widthChanged( double );
void heightChanged( double );
void leftChanged( double );
void rightChanged( double );
void topChanged( double );
void bottomChanged( double );
void orientationChanged( int );
void setUnitInt( int unit );
private:
void updatePreview();
void setValues();
KoUnit::Unit m_unit;
KoPageLayout m_layout;
};
#endif
|