| 1 |
/*************************************************************************** |
| 2 |
* Copyright (c) 2002 Jürgen Riegel <[email protected]> * |
| 3 |
* * |
| 4 |
* This file is part of the FreeCAD CAx development system. * |
| 5 |
* * |
| 6 |
* This library is free software; you can redistribute it and/or * |
| 7 |
* modify it under the terms of the GNU Library General Public * |
| 8 |
* License as published by the Free Software Foundation; either * |
| 9 |
* version 2 of the License, or (at your option) any later version. * |
| 10 |
* * |
| 11 |
* This library is distributed in the hope that it will be useful, * |
| 12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
| 13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
| 14 |
* GNU Library General Public License for more details. * |
| 15 |
* * |
| 16 |
* You should have received a copy of the GNU Library General Public * |
| 17 |
* License along with this library; see the file COPYING.LIB. If not, * |
| 18 |
* write to the Free Software Foundation, Inc., 59 Temple Place, * |
| 19 |
* Suite 330, Boston, MA 02111-1307, USA * |
| 20 |
* * |
| 21 |
***************************************************************************/ |
| 22 |
|
| 23 |
#ifndef GUI_DOCKWND_PROPERTYVIEW_H |
| 24 |
#define GUI_DOCKWND_PROPERTYVIEW_H |
| 25 |
|
| 26 |
#include "DockWindow.h" |
| 27 |
#include "Selection.h" |
| 28 |
|
| 29 |
|
| 30 |
class QPixmap; |
| 31 |
class QTabWidget; |
| 32 |
|
| 33 |
namespace App |
| 34 |
{ |
| 35 |
class Property; |
| 36 |
class PropertyContainer; |
| 37 |
class DocumentObject; |
| 38 |
} // namespace App |
| 39 |
|
| 40 |
namespace Gui |
| 41 |
{ |
| 42 |
namespace PropertyEditor |
| 43 |
{ |
| 44 |
|
| 45 |
class EditableListView; |
| 46 |
class EditableItem; |
| 47 |
class PropertyEditor; |
| 48 |
|
| 49 |
} // namespace PropertyEditor |
| 50 |
} // namespace Gui |
| 51 |
|
| 52 |
namespace Gui |
| 53 |
{ |
| 54 |
class ViewProvider; |
| 55 |
|
| 56 |
/** The property view class. |
| 57 |
*/ |
| 58 |
class PropertyView: public QWidget, public Gui::SelectionObserver |
| 59 |
{ |
| 60 |
Q_OBJECT |
| 61 |
|
| 62 |
public: |
| 63 |
explicit PropertyView(QWidget* parent = nullptr); |
| 64 |
~PropertyView() override; |
| 65 |
|
| 66 |
Gui::PropertyEditor::PropertyEditor* propertyEditorView; |
| 67 |
Gui::PropertyEditor::PropertyEditor* propertyEditorData; |
| 68 |
void clearPropertyItemSelection(); |
| 69 |
static bool showAll(); |
| 70 |
static void setShowAll(bool); |
| 71 |
static bool isPropertyHidden(const App::Property*); |
| 72 |
|
| 73 |
public Q_SLOTS: |
| 74 |
/// Stores a preference for the last tab selected |
| 75 |
void tabChanged(int index); |
| 76 |
void onTimer(); |
| 77 |
|
| 78 |
protected: |
| 79 |
void changeEvent(QEvent* e) override; |
| 80 |
void showEvent(QShowEvent*) override; |
| 81 |
void hideEvent(QHideEvent*) override; |
| 82 |
|
| 83 |
private: |
| 84 |
void onSelectionChanged(const SelectionChanges& msg) override; |
| 85 |
void slotChangePropertyData(const App::Property&); |
| 86 |
void slotChangePropertyView(const Gui::ViewProvider&, const App::Property&); |
| 87 |
void slotAppendDynamicProperty(const App::Property&); |
| 88 |
void slotRemoveDynamicProperty(const App::Property&); |
| 89 |
void slotRenameDynamicProperty(const App::Property&, const char* oldName); |
| 90 |
void slotChangePropertyEditor(const App::Document&, const App::Property&); |
| 91 |
void slotRollback(); |
| 92 |
void slotActiveDocument(const Gui::Document&); |
| 93 |
void slotDeleteDocument(const Gui::Document&); |
| 94 |
void slotDeletedViewObject(const Gui::ViewProvider&); |
| 95 |
void slotDeletedObject(const App::DocumentObject&); |
| 96 |
|
| 97 |
void checkEnable(const char* doc = nullptr); |
| 98 |
|
| 99 |
private: |
| 100 |
struct PropInfo; |
| 101 |
struct PropFind; |
| 102 |
using Connection = boost::signals2::connection; |
| 103 |
Connection connectPropData; |
| 104 |
Connection connectPropView; |
| 105 |
Connection connectPropAppend; |
| 106 |
Connection connectPropRemove; |
| 107 |
Connection connectPropRename; |
| 108 |
Connection connectPropChange; |
| 109 |
Connection connectUndoDocument; |
| 110 |
Connection connectRedoDocument; |
| 111 |
Connection connectActiveDoc; |
| 112 |
Connection connectDelDocument; |
| 113 |
Connection connectDelObject; |
| 114 |
Connection connectDelViewObject; |
| 115 |
Connection connectChangedDocument; |
| 116 |
QTabWidget* tabs; |
| 117 |
QTimer* timer; |
| 118 |
bool updating = false; |
| 119 |
}; |
| 120 |
|
| 121 |
namespace DockWnd |
| 122 |
{ |
| 123 |
|
| 124 |
/** A dock window with the embedded property view. |
| 125 |
*/ |
| 126 |
class PropertyDockView: public Gui::DockWindow |
| 127 |
{ |
| 128 |
Q_OBJECT |
| 129 |
|
| 130 |
public: |
| 131 |
explicit PropertyDockView(Gui::Document* pcDocument, QWidget* parent = nullptr); |
| 132 |
~PropertyDockView() override; |
| 133 |
}; |
| 134 |
|
| 135 |
} // namespace DockWnd |
| 136 |
} // namespace Gui |
| 137 |
|
| 138 |
#endif // GUI_DOCKWND_PROPERTYVIEW_H |