]> Shamusworld >> Repos - architektonas/blob - src/forms/cadtoolbarpolylines.cpp
Initial import
[architektonas] / src / forms / cadtoolbarpolylines.cpp
1 // cadtoolbarpolylines.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 "cadtoolbarpolylines.h"
15
16 #include "cadtoolbar.h"
17 #include "qg_actionhandler.h"
18
19 CadToolBarPolylines::CadToolBarPolylines(QWidget * parent/*= 0*/, Qt::WindowFlags flags/*= 0*/):
20         QWidget(parent, flags), actionHandler(NULL), cadToolBar(NULL)
21 {
22         ui.setupUi(this);
23 }
24
25 CadToolBarPolylines::~CadToolBarPolylines()
26 {
27 }
28
29 void CadToolBarPolylines::mousePressEvent(QMouseEvent * e)
30 {
31         if (e->button() == Qt::RightButton && cadToolBar != NULL)
32         {
33                 cadToolBar->back();
34                 e->accept();
35         }
36 }
37
38 void CadToolBarPolylines::contextMenuEvent(QContextMenuEvent * e)
39 {
40         e->accept();
41 }
42
43 void CadToolBarPolylines::setCadToolBar(CadToolBar * tb)
44 {
45         cadToolBar = tb;
46
47         if (tb != NULL)
48                 actionHandler = tb->getActionHandler();
49         else
50                 RS_DEBUG->print(RS_Debug::D_ERROR, "CadToolBarPolylines::setCadToolBar(): No valid toolbar set.");
51 }
52
53 void CadToolBarPolylines::drawPolyline()
54 {
55         if (cadToolBar != NULL && actionHandler != NULL)
56                 actionHandler->slotDrawPolyline();
57 }
58
59 void CadToolBarPolylines::polylineAdd()
60 {
61         if (cadToolBar != NULL && actionHandler != NULL)
62                 actionHandler->slotPolylineAdd();
63 }
64
65 void CadToolBarPolylines::polylineAppend()
66 {
67         if (cadToolBar != NULL && actionHandler != NULL)
68                 actionHandler->slotPolylineAppend();
69 }
70
71 void CadToolBarPolylines::polylineDel()
72 {
73         if (cadToolBar != NULL && actionHandler != NULL)
74                 actionHandler->slotPolylineDel();
75 }
76
77 void CadToolBarPolylines::polylineDelBetween()
78 {
79         if (cadToolBar != NULL && actionHandler != NULL)
80                 actionHandler->slotPolylineDelBetween();
81 }
82
83 void CadToolBarPolylines::polylineTrim()
84 {
85         if (cadToolBar != NULL && actionHandler != NULL)
86                 actionHandler->slotPolylineTrim();
87 }
88
89 void CadToolBarPolylines::back()
90 {
91         if (cadToolBar != NULL)
92                 cadToolBar->back();
93 }