]> Shamusworld >> Repos - architektonas/blob - src/forms/widgetpen.cpp
Fixed problem with MDI activation.
[architektonas] / src / forms / widgetpen.cpp
1 // widgetpen.cpp
2 //
3 // Part of the Architektonas Project
4 // Originally part of QCad Community Edition by Andrew Mustun
5 // Extensively rewritten and refactored by James L. Hammons
6 // Portions copyright (C) 2001-2003 RibbonSoft
7 // Copyright (C) 2010 Underground Software
8 // See the README and GPLv2 files for licensing and warranty information
9 //
10 // JLH = James L. Hammons <jlhamm@acm.org>
11 //
12 // Who  When        What
13 // ---  ----------  -----------------------------------------------------------
14 // JLH  05/10/2010  Created this file. :-)
15 //
16
17 #include "widgetpen.h"
18
19 WidgetPen::WidgetPen(QWidget * parent/*= 0*/, Qt::WindowFlags flags/*= 0*/):
20         QWidget(parent, flags)
21 {
22         ui.setupUi(this);
23 }
24
25 WidgetPen::~WidgetPen()
26 {
27 }
28
29 void WidgetPen::setPen(Pen pen, bool showByLayer, bool showUnchanged, const QString & title)
30 {
31         ui.cbColor->init(showByLayer, showUnchanged);
32         ui.cbWidth->init(showByLayer, showUnchanged);
33         ui.cbLineType->init(showByLayer, showUnchanged);
34
35         if (!showUnchanged)
36         {
37                 ui.cbColor->setColor(pen.getColor());
38                 ui.cbWidth->setWidth(pen.getWidth());
39                 ui.cbLineType->setLineType(pen.getLineType());
40         }
41
42         if (!title.isEmpty())
43                 ui.bgPen->setTitle(title);
44 }
45
46 Pen WidgetPen::getPen()
47 {
48         Pen pen;
49
50         pen.setColor(ui.cbColor->getColor());
51         pen.setWidth(ui.cbWidth->getWidth());
52         pen.setLineType(ui.cbLineType->getLineType());
53
54         return pen;
55 }
56
57 bool WidgetPen::isColorUnchanged()
58 {
59         return ui.cbColor->isUnchanged();
60 }
61
62 bool WidgetPen::isLineTypeUnchanged()
63 {
64         return ui.cbLineType->isUnchanged();
65 }
66
67 bool WidgetPen::isWidthUnchanged()
68 {
69         return ui.cbWidth->isUnchanged();
70 }