summaryrefslogtreecommitdiff
path: root/noncore/graphics/drawpad/newpagedialog.cpp
Unidiff
Diffstat (limited to 'noncore/graphics/drawpad/newpagedialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/graphics/drawpad/newpagedialog.cpp83
1 files changed, 62 insertions, 21 deletions
diff --git a/noncore/graphics/drawpad/newpagedialog.cpp b/noncore/graphics/drawpad/newpagedialog.cpp
index c11d977..b1b26ef 100644
--- a/noncore/graphics/drawpad/newpagedialog.cpp
+++ b/noncore/graphics/drawpad/newpagedialog.cpp
@@ -13,49 +13,90 @@
13 13
14#include "newpagedialog.h" 14#include "newpagedialog.h"
15 15
16#include <qbuttongroup.h>
17#include <qgroupbox.h>
16#include <qlabel.h> 18#include <qlabel.h>
17#include <qlayout.h> 19#include <qlayout.h>
20#include <qradiobutton.h>
18#include <qspinbox.h> 21#include <qspinbox.h>
19 22
20NewPageDialog::NewPageDialog(QWidget* parent, const char* name) 23NewPageDialog::NewPageDialog(uint width, uint height, const QColor& foregroundColor,
24 const QColor& backgroundColor, QWidget* parent, const char* name)
21 : QDialog(parent, name, true) 25 : QDialog(parent, name, true)
22{ 26{
23 setCaption(tr("New Page")); 27 setCaption(tr("New Page"));
24 28
25 QLabel* widthLabel = new QLabel(tr("Width :"), this); 29 m_foregroundColor = foregroundColor;
26 QLabel* heightLabel = new QLabel(tr("Height :"), this); 30 m_backgroundColor = backgroundColor;
27 31
28 m_pWidthSpinBox = new QSpinBox(1, 1024, 1, this); 32 QGroupBox* sizeGroupBox = new QGroupBox(0, Qt::Vertical, tr("Page Size"), this);
29 m_pHeightSpinBox = new QSpinBox(1, 1024, 1, this);
30 33
31 QGridLayout* gridLayout = new QGridLayout(this, 2, 2, 2, 2); 34 QLabel* widthLabel = new QLabel(tr("Width :"), sizeGroupBox);
35 QLabel* heightLabel = new QLabel(tr("Height :"), sizeGroupBox);
32 36
33 gridLayout->addWidget(widthLabel, 0, 0); 37 m_pWidthSpinBox = new QSpinBox(1, 1024, 1, sizeGroupBox);
34 gridLayout->addWidget(heightLabel, 1, 0); 38 m_pHeightSpinBox = new QSpinBox(1, 1024, 1, sizeGroupBox);
35 gridLayout->addWidget(m_pWidthSpinBox, 0, 1);
36 gridLayout->addWidget(m_pHeightSpinBox, 1, 1);
37}
38 39
39NewPageDialog::~NewPageDialog() 40 m_pWidthSpinBox->setValue(width);
40{ 41 m_pHeightSpinBox->setValue(height);
42
43 m_pContentButtonGroup = new QButtonGroup(0, Qt::Vertical, tr("Contents"), this);
44
45 QRadioButton* whiteColorRadioButton = new QRadioButton(tr("White"), m_pContentButtonGroup);
46 QRadioButton* foregroundColorRadioButton = new QRadioButton(tr("Foreground Color"), m_pContentButtonGroup);
47 QRadioButton* backgroundColorRadioButton = new QRadioButton(tr("Background Color"), m_pContentButtonGroup);
48
49 m_pContentButtonGroup->setButton(0);
50
51 QVBoxLayout* mainLayout = new QVBoxLayout(this, 4, 4);
52 sizeGroupBox->layout()->setSpacing(4);
53 m_pContentButtonGroup->layout()->setSpacing(4);
54 QGridLayout* sizeLayout = new QGridLayout(sizeGroupBox->layout(), 2, 2);
55 QVBoxLayout* contentLayout = new QVBoxLayout(m_pContentButtonGroup->layout());
56
57 sizeLayout->addWidget(widthLabel, 0, 0);
58 sizeLayout->addWidget(heightLabel, 1, 0);
59 sizeLayout->addWidget(m_pWidthSpinBox, 0, 1);
60 sizeLayout->addWidget(m_pHeightSpinBox, 1, 1);
61
62 sizeLayout->setColStretch(1, 1);
63
64 contentLayout->addWidget(whiteColorRadioButton);
65 contentLayout->addWidget(foregroundColorRadioButton);
66 contentLayout->addWidget(backgroundColorRadioButton);
67
68 mainLayout->addWidget(sizeGroupBox);
69 mainLayout->addWidget(m_pContentButtonGroup);
41} 70}
42 71
43void NewPageDialog::setWidth(int width) 72NewPageDialog::~NewPageDialog()
44{ 73{
45 m_pWidthSpinBox->setValue(width);
46} 74}
47 75
48void NewPageDialog::setHeight(int height) 76uint NewPageDialog::selectedWidth()
49{ 77{
50 m_pHeightSpinBox->setValue(height); 78 return (m_pWidthSpinBox->value());
51} 79}
52 80
53int NewPageDialog::width() 81uint NewPageDialog::selectedHeight()
54{ 82{
55 return m_pWidthSpinBox->value(); 83 return (m_pHeightSpinBox->value());
56} 84}
57 85
58int NewPageDialog::height() 86const QColor& NewPageDialog::selectedColor()
59{ 87{
60 return m_pHeightSpinBox->value(); 88 switch (m_pContentButtonGroup->id(m_pContentButtonGroup->selected())) {
89 case 0:
90 return (Qt::white);
91 break;
92 case 1:
93 return (m_foregroundColor);
94 break;
95 case 2:
96 return (m_backgroundColor);
97 break;
98 default:
99 return (Qt::white);
100 break;
101 }
61} 102}