DlgFilletEdges.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (c) 2008 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_DLGFILLETEDGES_H
00024 #define PARTGUI_DLGFILLETEDGES_H
00025 
00026 #include <Gui/TaskView/TaskDialog.h>
00027 #include <Gui/TaskView/TaskView.h>
00028 #include <Gui/Selection.h>
00029 #include <QStandardItemModel>
00030 #include <QItemDelegate>
00031 
00032 namespace Part { class Fillet; }
00033 
00034 namespace PartGui {
00035 
00036 class Ui_DlgFilletEdges;
00037 class FilletRadiusDelegate : public QItemDelegate
00038 {
00039     Q_OBJECT
00040 
00041 public:
00042     FilletRadiusDelegate(QObject *parent = 0);
00043 
00044     QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
00045                           const QModelIndex &index) const;
00046 
00047     void setEditorData(QWidget *editor, const QModelIndex &index) const;
00048     void setModelData(QWidget *editor, QAbstractItemModel *model,
00049                       const QModelIndex &index) const;
00050 
00051     void updateEditorGeometry(QWidget *editor, 
00052         const QStyleOptionViewItem &option, const QModelIndex &index) const;
00053 };
00054 
00055 class FilletRadiusModel : public QStandardItemModel
00056 {
00057     Q_OBJECT
00058 
00059 public:
00060     FilletRadiusModel(QObject * parent = 0);
00061 
00062     Qt::ItemFlags flags (const QModelIndex & index) const;
00063     bool setData (const QModelIndex & index, const QVariant & value,
00064                   int role = Qt::EditRole);
00065 Q_SIGNALS:
00066     void toggleCheckState(const QModelIndex&);
00067 };
00068 
00069 class DlgFilletEdgesP;
00070 class DlgFilletEdges : public QWidget, public Gui::SelectionObserver
00071 {
00072     Q_OBJECT
00073 
00074 public:
00075     DlgFilletEdges(Part::Fillet*, QWidget* parent = 0, Qt::WFlags fl = 0);
00076     ~DlgFilletEdges();
00077     bool accept();
00078 
00079 protected:
00080     void findShapes();
00081     void setupFillet(const std::vector<App::DocumentObject*>&);
00082     void changeEvent(QEvent *e);
00083 
00084 private:
00085     void onSelectionChanged(const Gui::SelectionChanges& msg);
00086     void onDeleteObject(const App::DocumentObject&);
00087     void onDeleteDocument(const App::Document&);
00088 
00089 private Q_SLOTS:
00090     void on_shapeObject_activated(int);
00091     void on_selectAllButton_clicked();
00092     void on_selectNoneButton_clicked();
00093     void on_filletType_activated(int);
00094     void on_filletStartRadius_valueChanged(double);
00095     void on_filletEndRadius_valueChanged(double);
00096     void toggleCheckState(const QModelIndex&);
00097 
00098 private:
00099     std::auto_ptr<Ui_DlgFilletEdges> ui;
00100     std::auto_ptr<DlgFilletEdgesP> d;
00101 };
00102 
00103 class FilletEdgesDialog : public QDialog
00104 {
00105     Q_OBJECT
00106 
00107 public:
00108     FilletEdgesDialog(Part::Fillet* fillet, QWidget* parent = 0, Qt::WFlags fl = 0);
00109     ~FilletEdgesDialog();
00110     void accept();
00111 
00112 private:
00113     DlgFilletEdges* widget;
00114 };
00115 
00116 class TaskFilletEdges : public Gui::TaskView::TaskDialog
00117 {
00118     Q_OBJECT
00119 
00120 public:
00121     TaskFilletEdges(Part::Fillet*);
00122     ~TaskFilletEdges();
00123 
00124 public:
00125     virtual void open();
00126     virtual void clicked(int);
00127     virtual bool accept();
00128     virtual bool reject();
00129 
00130     virtual QDialogButtonBox::StandardButtons getStandardButtons() const
00131     { return QDialogButtonBox::Ok|QDialogButtonBox::Cancel; }
00132 
00133 private:
00134     DlgFilletEdges* widget;
00135     Gui::TaskView::TaskBox* taskbox;
00136 };
00137 
00138 } // namespace PartGui
00139 
00140 #endif // PARTGUI_DLGFILLETEDGES_H

Generated on Wed Nov 23 19:00:06 2011 for FreeCAD by  doxygen 1.6.1