]> Shamusworld >> Repos - architektonas/blob - src/forms/cadtoolbardim.cpp
03aaee7e3814e5875724ff8afd7e5a27022516d1
[architektonas] / src / forms / cadtoolbardim.cpp
1 // cadtoolbardim.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 "cadtoolbardim.h"
15
16 #include "cadtoolbar.h"
17 #include "qg_actionhandler.h"
18
19 CadToolBarDim::CadToolBarDim(QWidget * parent/*= 0*/, Qt::WindowFlags flags/*= 0*/):
20         QWidget(parent, flags), actionHandler(NULL), cadToolBar(NULL)
21 {
22         ui.setupUi(this);
23 }
24
25 CadToolBarDim::~CadToolBarDim()
26 {
27 }
28
29 void CadToolBarDim::mousePressEvent(QMouseEvent * e)
30 {
31         if (e->button() == Qt::RightButton && cadToolBar != NULL)
32         {
33                 cadToolBar->back();
34                 e->accept();
35         }
36 }
37
38 void CadToolBarDim::contextMenuEvent(QContextMenuEvent * e)
39 {
40         e->accept();
41 }
42
43 void CadToolBarDim::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, "CadToolBarDim::setCadToolBar(): No valid toolbar set.");
51 }
52
53 void CadToolBarDim::drawDimAligned()
54 {
55         if (cadToolBar != NULL && actionHandler != NULL)
56                 actionHandler->slotDimAligned();
57 }
58
59 void CadToolBarDim::drawDimLinear()
60 {
61         if (cadToolBar != NULL && actionHandler != NULL)
62                 actionHandler->slotDimLinear();
63 }
64
65 void CadToolBarDim::drawDimLinearHor()
66 {
67         if (cadToolBar != NULL && actionHandler != NULL)
68                 actionHandler->slotDimLinearHor();
69 }
70
71 void CadToolBarDim::drawDimLinearVer()
72 {
73         if (cadToolBar != NULL && actionHandler != NULL)
74                 actionHandler->slotDimLinearVer();
75 }
76
77 void CadToolBarDim::drawDimRadial()
78 {
79         if (cadToolBar != NULL && actionHandler != NULL)
80                 actionHandler->slotDimRadial();
81 }
82
83 void CadToolBarDim::drawDimDiametric()
84 {
85         if (cadToolBar != NULL && actionHandler != NULL)
86                 actionHandler->slotDimDiametric();
87 }
88
89 void CadToolBarDim::drawDimAngular()
90 {
91         if (cadToolBar != NULL && actionHandler != NULL)
92                 actionHandler->slotDimAngular();
93 }
94
95 void CadToolBarDim::drawDimLeader()
96 {
97         if (cadToolBar != NULL && actionHandler != NULL)
98                 actionHandler->slotDimLeader();
99 }
100
101 void CadToolBarDim::back()
102 {
103         if (cadToolBar != NULL)
104                 cadToolBar->back();
105 }