00001 /*************************************************************************** 00002 * Copyright (c) 2007 Werner Mayer <wmayer[at]users.sourceforge.net> * 00003 * * 00004 * This file is part of the FreeCAD CAx development system. * 00005 * * 00006 * This library is free software; you can redistribute it and/or * 00007 * modify it under the terms of the GNU Library General Public * 00008 * License as published by the Free Software Foundation; either * 00009 * version 2 of the License, or (at your option) any later version. * 00010 * * 00011 * This library is distributed in the hope that it will be useful, * 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00014 * GNU Library General Public License for more details. * 00015 * * 00016 * You should have received a copy of the GNU Library General Public * 00017 * License along with this library; see the file COPYING.LIB. If not, * 00018 * write to the Free Software Foundation, Inc., 59 Temple Place, * 00019 * Suite 330, Boston, MA 02111-1307, USA * 00020 * * 00021 ***************************************************************************/ 00022 00023 #ifndef PARTGUI_DLGBOOLEANOPERATION_H 00024 #define PARTGUI_DLGBOOLEANOPERATION_H 00025 00026 #include <Gui/TaskView/TaskDialog.h> 00027 #include <Gui/TaskView/TaskView.h> 00028 #include <boost/signals.hpp> 00029 00030 class QTreeWidgetItem; 00031 00032 namespace App { 00033 class DocumentObject; 00034 class Property; 00035 } 00036 namespace PartGui { 00037 00038 typedef boost::signals::connection Connection; 00039 class Ui_DlgBooleanOperation; 00040 class DlgBooleanOperation : public QWidget 00041 { 00042 Q_OBJECT 00043 00044 public: 00045 DlgBooleanOperation(QWidget* parent = 0); 00046 ~DlgBooleanOperation(); 00047 void accept(); 00048 00049 private: 00050 void findShapes(); 00051 bool indexOfCurrentItem(QTreeWidgetItem*, int&, int&) const; 00052 void slotCreatedObject(const App::DocumentObject&); 00053 void slotChangedObject(const App::DocumentObject&, const App::Property&); 00054 bool hasSolids(const App::DocumentObject*) const; 00055 00056 protected: 00057 void changeEvent(QEvent *e); 00058 00059 public Q_SLOTS: 00060 void on_swapButton_clicked(); 00061 00062 private Q_SLOTS: 00063 void currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*); 00064 00065 private: 00066 Ui_DlgBooleanOperation* ui; 00067 Connection connectNewObject; 00068 Connection connectModObject; 00069 std::list<const App::DocumentObject*> observe; 00070 }; 00071 00072 class TaskBooleanOperation : public Gui::TaskView::TaskDialog 00073 { 00074 Q_OBJECT 00075 00076 public: 00077 TaskBooleanOperation(); 00078 ~TaskBooleanOperation(); 00079 00080 public: 00081 void clicked(int); 00082 00083 virtual QDialogButtonBox::StandardButtons getStandardButtons() const 00084 { return QDialogButtonBox::Apply | QDialogButtonBox::Close; } 00085 virtual bool isAllowedAlterDocument(void) const 00086 { return true; } 00087 virtual bool needsFullSpace() const 00088 { return true; } 00089 00090 private: 00091 DlgBooleanOperation* widget; 00092 Gui::TaskView::TaskBox* taskbox; 00093 }; 00094 00095 } // namespace PartGui 00096 00097 #endif // PARTGUI_DLGBOOLEANOPERATION_H