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