Debian Codegraph @

src/Gui/TaskView/TaskWatcher.h

raw
1 // SPDX-License-Identifier: LGPL-2.1-or-later
2 /***************************************************************************
3 * Copyright (c) 2009 Jürgen Riegel <[email protected]> *
4 * *
5 * This file is part of the FreeCAD CAx development system. *
6 * *
7 * This library is free software; you can redistribute it and/or *
8 * modify it under the terms of the GNU Library General Public *
9 * License as published by the Free Software Foundation; either *
10 * version 2 of the License, or (at your option) any later version. *
11 * *
12 * This library is distributed in the hope that it will be useful, *
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 * GNU Library General Public License for more details. *
16 * *
17 * You should have received a copy of the GNU Library General Public *
18 * License along with this library; see the file COPYING.LIB. If not, *
19 * write to the Free Software Foundation, Inc., 59 Temple Place, *
20 * Suite 330, Boston, MA 02111-1307, USA *
21 * *
22 ***************************************************************************/
23
24
25 #ifndef GUI_TASKVIEW_TASKWATCHER_H
26 #define GUI_TASKVIEW_TASKWATCHER_H
27
28 #include <vector>
29 #include <QObject>
30
31 #include <Gui/Selection/SelectionFilter.h>
32
33
34 namespace Gui
35 {
36 namespace TaskView
37 {
38
39 class TaskContent;
40
41 /// Father class of watcher classes
42 class GuiExport TaskWatcher: public QObject, public Gui::SelectionFilter
43 {
44 Q_OBJECT
45
46 public:
47 explicit TaskWatcher(const char* Filter);
48 ~TaskWatcher() override;
49
50 QWidget* addTaskBox(QWidget* widget, bool expandable = true, QWidget* parent = nullptr);
51 QWidget* addTaskBox(
52 const QPixmap& icon,
53 QWidget* widget,
54 bool expandable = true,
55 QWidget* parent = nullptr
56 );
57 QWidget* addTaskBoxWithoutHeader(QWidget* widget);
58
59 std::vector<QWidget*>& getWatcherContent();
60
61 public:
62 /// is called wenn the document or the Selection changes.
63 virtual bool shouldShow();
64
65 protected:
66 /// List of TaskBoxes of that dialog
67 std::vector<QWidget*> Content;
68 };
69
70 // --------------------------------------------------------------------------
71
72 /// Special watcher class for showing commands dependene on the selection
73 class GuiExport TaskWatcherCommands: public TaskWatcher
74 {
75 Q_OBJECT
76
77 public:
78 TaskWatcherCommands(const char* Filter, const char* commands[], const char* name, const char* pixmap);
79
80 public:
81 /// is called wenn the document or the Selection changes.
82 bool shouldShow() override;
83 };
84
85 // --------------------------------------------------------------------------
86
87 /// Special watcher class for showing commands when active document is empty
88 class GuiExport TaskWatcherCommandsEmptyDoc: public TaskWatcherCommands
89 {
90 Q_OBJECT
91
92 public:
93 TaskWatcherCommandsEmptyDoc(const char* commands[], const char* name, const char* pixmap);
94
95 public:
96 /// is called wenn the document or the Selection changes.
97 bool shouldShow() override;
98 };
99
100 // --------------------------------------------------------------------------
101
102 /// Special watcher class for showing commands when there is nothing selected
103 class GuiExport TaskWatcherCommandsEmptySelection: public TaskWatcherCommands
104 {
105 Q_OBJECT
106
107 public:
108 TaskWatcherCommandsEmptySelection(const char* commands[], const char* name, const char* pixmap);
109 ~TaskWatcherCommandsEmptySelection() override;
110
111 public:
112 /// is called wenn the document or the Selection changes.
113 bool shouldShow() override;
114 };
115
116
117 } // namespace TaskView
118 } // namespace Gui
119
120 #endif // GUI_TASKVIEW_TASKWATCHER_H