]> Shamusworld >> Repos - architektonas/blob - src/forms/lineoptions.cpp
289d85a9870c40101f0c2090edbe3c969c552b63
[architektonas] / src / forms / lineoptions.cpp
1 // lineoptions.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 // (C) 2010 Underground Software
7 //
8 // JLH = James L. Hammons <jlhamm@acm.org>
9 //
10 // Who  When        What
11 // ---  ----------  -----------------------------------------------------------
12 // JLH  05/10/2010  Created this file. :-)
13 //
14
15 #include "lineoptions.h"
16
17 #include "rs.h"
18 #include "rs_actiondrawline.h"
19 #include "rs_actioninterface.h"
20
21 LineOptions::LineOptions(QToolBar * parent/*= 0*/, Qt::WindowFlags flags/*= 0*/):
22         QWidget(parent, flags), action(NULL)
23 {
24         ui.setupUi(this);
25
26         // We need to add the widget (this thing) to the toolbar passed in. Otherwise,
27         // nothing will show up on the screen. :-)
28         if (parent)
29                 parent->addWidget(this);
30 }
31
32 LineOptions::~LineOptions()
33 {
34 }
35
36 void LineOptions::setAction(RS_ActionInterface * a)
37 {
38         if (a != NULL && a->rtti() == RS2::ActionDrawLine)
39         {
40                 action = (RS_ActionDrawLine *)a;
41         }
42         else
43         {
44                 RS_DEBUG->print(RS_Debug::D_ERROR, "QG_LineOptions::setAction: wrong action type");
45                 action = NULL;
46         }
47 }
48
49 void LineOptions::close()
50 {
51         if (action)
52                 action->close();
53 }
54
55 void LineOptions::undo()
56 {
57         if (action)
58                 action->undo();
59 }