Debian Codegraph @

src/Gui/TaskView/TaskOrientation.h

raw
1 // SPDX-License-Identifier: LGPL-2.1-or-later
2
3 /***************************************************************************
4 * Copyright (c) 2023 Werner Mayer <wmayer[at]users.sourceforge.net> *
5 * *
6 * This file is part of FreeCAD. *
7 * *
8 * FreeCAD is free software: you can redistribute it and/or modify it *
9 * under the terms of the GNU Lesser General Public License as *
10 * published by the Free Software Foundation, either version 2.1 of the *
11 * License, or (at your option) any later version. *
12 * *
13 * FreeCAD is distributed in the hope that it will be useful, but *
14 * WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
16 * Lesser General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU Lesser General Public *
19 * License along with FreeCAD. If not, see *
20 * <https://www.gnu.org/licenses/>. *
21 * *
22 **************************************************************************/
23
24 #ifndef GUI_TASKORIENTATION_H
25 #define GUI_TASKORIENTATION_H
26
27 #include <Gui/TaskView/TaskDialog.h>
28 #include <App/DocumentObserver.h>
29 #include <App/GeoFeature.h>
30 #include <memory>
31
32 namespace Gui
33 {
34
35 class Ui_TaskOrientation;
36 class TaskOrientation: public QWidget
37 {
38 Q_OBJECT
39
40 public:
41 explicit TaskOrientation(App::GeoFeature* obj, QWidget* parent = nullptr);
42 ~TaskOrientation() override;
43
44 void open();
45 void accept();
46 void reject();
47
48 private:
49 void restore(const Base::Placement&);
50 void onPreview();
51 void updateIcon();
52 void updatePlacement();
53
54 private:
55 std::unique_ptr<Ui_TaskOrientation> ui;
56 App::WeakPtrT<App::GeoFeature> feature;
57 };
58
59 class TaskOrientationDialog: public Gui::TaskView::TaskDialog
60 {
61 Q_OBJECT
62
63 public:
64 explicit TaskOrientationDialog(App::GeoFeature* obj);
65
66 public:
67 void open() override;
68 bool accept() override;
69 bool reject() override;
70
71 QDialogButtonBox::StandardButtons getStandardButtons() const override
72 {
73 return QDialogButtonBox::Ok | QDialogButtonBox::Cancel;
74 }
75
76 private:
77 TaskOrientation* widget;
78 };
79
80 } // namespace Gui
81
82 #endif // GUI_TASKORIENTATION_H