// cadtoolbarpolylines.cpp
//
+// Part of the Architektonas Project
// Originally part of QCad Community Edition by Andrew Mustun
// Extensively rewritten and refactored by James L. Hammons
-// (C) 2010 Underground Software
+// Portions copyright (C) 2001-2003 RibbonSoft
+// Copyright (C) 2010 Underground Software
+// See the README and GPLv2 files for licensing and warranty information
//
// JLH = James L. Hammons <jlhamm@acm.org>
//
#include "cadtoolbarpolylines.h"
#include "cadtoolbar.h"
-#include "qg_actionhandler.h"
+#include "createqtactions.h"
-CadToolBarPolylines::CadToolBarPolylines(QWidget * parent/*= 0*/, Qt::WindowFlags flags/*= 0*/):
- QWidget(parent, flags), actionHandler(NULL), cadToolBar(NULL)
+CadToolBarPolylines::CadToolBarPolylines(CadToolBar * parent, Qt::WindowFlags flags/*= 0*/):
+ QWidget((QWidget *)parent, flags)
{
- ui.setupUi(this);
-}
-
-CadToolBarPolylines::~CadToolBarPolylines()
-{
-}
-
-void CadToolBarPolylines::mousePressEvent(QMouseEvent * e)
-{
- if (e->button() == Qt::RightButton && cadToolBar != NULL)
- {
- cadToolBar->back();
- e->accept();
- }
-}
+ QGridLayout * gridLayout = new QGridLayout(this);
+ gridLayout->setSpacing(0);
+ gridLayout->setContentsMargins(0, 0, 0, 0);
-void CadToolBarPolylines::contextMenuEvent(QContextMenuEvent * e)
-{
- e->accept();
-}
-
-void CadToolBarPolylines::setCadToolBar(CadToolBar * tb)
-{
- cadToolBar = tb;
+ gridLayout->addWidget(parent->CreateBackButton(this), 0, 0, 1, 2);
- if (tb != NULL)
- actionHandler = tb->getActionHandler();
- else
- RS_DEBUG->print(RS_Debug::D_ERROR, "CadToolBarPolylines::setCadToolBar(): No valid toolbar set.");
+ gridLayout->addWidget(parent->CreateToolButton(actionDrawPolyline), 1, 0, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionPolylineAdd), 1, 1, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionPolylineAppend), 2, 0, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionPolylineDel), 2, 1, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionPolylineDelBetween), 3, 0, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionPolylineTrim), 3, 1, 1, 1);
}
-void CadToolBarPolylines::drawPolyline()
-{
- if (cadToolBar != NULL && actionHandler != NULL)
- actionHandler->slotDrawPolyline();
-}
-
-void CadToolBarPolylines::polylineAdd()
-{
- if (cadToolBar != NULL && actionHandler != NULL)
- actionHandler->slotPolylineAdd();
-}
-
-void CadToolBarPolylines::polylineAppend()
-{
- if (cadToolBar != NULL && actionHandler != NULL)
- actionHandler->slotPolylineAppend();
-}
-
-void CadToolBarPolylines::polylineDel()
-{
- if (cadToolBar != NULL && actionHandler != NULL)
- actionHandler->slotPolylineDel();
-}
-
-void CadToolBarPolylines::polylineDelBetween()
-{
- if (cadToolBar != NULL && actionHandler != NULL)
- actionHandler->slotPolylineDelBetween();
-}
-
-void CadToolBarPolylines::polylineTrim()
-{
- if (cadToolBar != NULL && actionHandler != NULL)
- actionHandler->slotPolylineTrim();
-}
-
-void CadToolBarPolylines::back()
+CadToolBarPolylines::~CadToolBarPolylines()
{
- if (cadToolBar != NULL)
- cadToolBar->back();
}