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