]> Shamusworld >> Repos - architektonas/blob - src/forms/cadtoolbarsplines.cpp
Refactoring: Moved RS_GraphicView to GraphicView.
[architektonas] / src / forms / cadtoolbarsplines.cpp
1 // cadtoolbarsplines.cpp
2 //
3 // Originally part of QCad Community Edition by Andrew Mustun
4 // Extensively rewritten and refactored by James L. Hammons
5 // (C) 2010 Underground Software
6 //
7 // JLH = James L. Hammons <jlhamm@acm.org>
8 //
9 // Who  When        What
10 // ---  ----------  -----------------------------------------------------------
11 // JLH  05/10/2010  Created this file. :-)
12 //
13
14 #include "cadtoolbarsplines.h"
15
16 #include "cadtoolbar.h"
17 #include "qg_actionhandler.h"
18 #include "rs_debug.h"
19
20 CadToolBarSplines::CadToolBarSplines(QWidget * parent/*= 0*/, Qt::WindowFlags flags/*= 0*/):
21         QWidget(parent, flags), actionHandler(NULL), cadToolBar(NULL)
22 {
23         ui.setupUi(this);
24 }
25
26 CadToolBarSplines::~CadToolBarSplines()
27 {
28 }
29
30 void CadToolBarSplines::mousePressEvent(QMouseEvent * e)
31 {
32         if (e->button() == Qt::RightButton && cadToolBar != NULL)
33         {
34                 cadToolBar->back();
35                 e->accept();
36         }
37 }
38
39 void CadToolBarSplines::contextMenuEvent(QContextMenuEvent * e)
40 {
41         e->accept();
42 }
43
44 void CadToolBarSplines::setCadToolBar(CadToolBar * tb)
45 {
46         cadToolBar = tb;
47
48         if (tb != NULL)
49                 actionHandler = tb->getActionHandler();
50         else
51                 RS_DEBUG->print(RS_Debug::D_ERROR, "CadToolBarSplines::setCadToolBar(): No valid toolbar set.");
52 }
53
54 void CadToolBarSplines::drawSpline()
55 {
56         if (cadToolBar != NULL && actionHandler != NULL)
57                 actionHandler->slotDrawSpline();
58 }
59
60 void CadToolBarSplines::back()
61 {
62         if (cadToolBar != NULL)
63                 cadToolBar->back();
64 }