| 1 |
/**************************************************************************** |
| 2 |
* Copyright (c) 2018 Zheng Lei (realthunder) <[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_TASKELEMENTCOLORS_H |
| 24 |
#define GUI_TASKELEMENTCOLORS_H |
| 25 |
|
| 26 |
#include <QListWidgetItem> |
| 27 |
#include "TaskView/TaskDialog.h" |
| 28 |
#include "TaskView/TaskView.h" |
| 29 |
|
| 30 |
|
| 31 |
namespace Gui |
| 32 |
{ |
| 33 |
class Document; |
| 34 |
class ViewProvider; |
| 35 |
class ViewProviderDocumentObject; |
| 36 |
|
| 37 |
class GuiExport ElementColors: public QWidget, public SelectionObserver |
| 38 |
{ |
| 39 |
Q_OBJECT |
| 40 |
|
| 41 |
public: |
| 42 |
explicit ElementColors(ViewProviderDocumentObject* vp, bool noHide = false); |
| 43 |
~ElementColors() override; |
| 44 |
|
| 45 |
bool accept(); |
| 46 |
bool reject(); |
| 47 |
|
| 48 |
private: |
| 49 |
void setupConnections(); |
| 50 |
void onRemoveSelectionClicked(); |
| 51 |
void onAddSelectionClicked(); |
| 52 |
void onRemoveAllClicked(); |
| 53 |
void onElementListItemDoubleClicked(QListWidgetItem* item); |
| 54 |
void onElementListItemSelectionChanged(); |
| 55 |
void onElementListItemEntered(QListWidgetItem* item); |
| 56 |
void onRecomputeClicked(bool checked); |
| 57 |
void onTopClicked(bool checked); |
| 58 |
void onHideSelectionClicked(); |
| 59 |
void onBoxSelectClicked(); |
| 60 |
|
| 61 |
protected: |
| 62 |
void onSelectionChanged(const SelectionChanges& msg) override; |
| 63 |
void changeEvent(QEvent* e) override; |
| 64 |
void leaveEvent(QEvent*) override; |
| 65 |
void slotDeleteDocument(const Document&); |
| 66 |
void slotDeleteObject(const ViewProvider&); |
| 67 |
|
| 68 |
private: |
| 69 |
class Private; |
| 70 |
Private* d; |
| 71 |
}; |
| 72 |
|
| 73 |
class GuiExport TaskElementColors: public TaskView::TaskDialog |
| 74 |
{ |
| 75 |
Q_OBJECT |
| 76 |
|
| 77 |
public: |
| 78 |
explicit TaskElementColors(ViewProviderDocumentObject* vp, bool noHide = false); |
| 79 |
~TaskElementColors() override; |
| 80 |
|
| 81 |
public: |
| 82 |
void open() override; |
| 83 |
bool accept() override; |
| 84 |
bool reject() override; |
| 85 |
void clicked(int) override; |
| 86 |
|
| 87 |
QDialogButtonBox::StandardButtons getStandardButtons() const override |
| 88 |
{ |
| 89 |
return QDialogButtonBox::Ok | QDialogButtonBox::Cancel; |
| 90 |
} |
| 91 |
|
| 92 |
private: |
| 93 |
ElementColors* widget; |
| 94 |
}; |
| 95 |
|
| 96 |
} // namespace Gui |
| 97 |
|
| 98 |
#endif // GUI_TASKELEMENTCOLORS_H |