HAL
content_widget.h
Go to the documentation of this file.
1 // MIT License
2 //
3 // Copyright (c) 2019 Ruhr University Bochum, Chair for Embedded Security. All Rights reserved.
4 // Copyright (c) 2019 Marc Fyrbiak, Sebastian Wallat, Max Hoffmann ("ORIGINAL AUTHORS"). All rights reserved.
5 // Copyright (c) 2021 Max Planck Institute for Security and Privacy. All Rights reserved.
6 // Copyright (c) 2021 Jörn Langheinrich, Julian Speith, Nils Albartus, René Walendy, Simon Klix ("ORIGINAL AUTHORS"). All Rights reserved.
7 //
8 // Permission is hereby granted, free of charge, to any person obtaining a copy
9 // of this software and associated documentation files (the "Software"), to deal
10 // in the Software without restriction, including without limitation the rights
11 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 // copies of the Software, and to permit persons to whom the Software is
13 // furnished to do so, subject to the following conditions:
14 //
15 // The above copyright notice and this permission notice shall be included in all
16 // copies or substantial portions of the Software.
17 //
18 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 // SOFTWARE.
25 
26 #pragma once
27 
28 #include "gui/widget/widget.h"
29 
30 #include <QIcon>
31 #include <QList>
32 
33 class QShortcut;
34 class QVBoxLayout;
35 
36 namespace hal
37 {
38  class ContentAnchor;
39  class ContentFrame;
40  class Toolbar;
41 
50  class ContentWidget : public Widget
51  {
52  Q_OBJECT
55 
56  public:
63  explicit ContentWidget(QString name, QWidget* parent = nullptr);
64 
71  virtual void setupToolbar(Toolbar* Toolbar);
72 
80 
86  void repolish();
87 
93  QString name() const;
94 
100  QIcon icon() const;
101 
107  void setAnchor(ContentAnchor* anchor);
108 
114  void setIcon(QIcon icon);
115 
122  void set_name(const QString& name);
123 
127 
134 
142 
146 
152  void setIconStyle(const QString& style);
153 
159  void setIconPath(const QString& path);
161 
162  Q_SIGNALS:
163 
167  void removed();
168 
172  void detached();
173 
177  void reattached();
178 
182  void opened();
183 
187  void closed();
188 
194  void name_changed(const QString& name);
195 
196  public Q_SLOTS:
197 
201  void remove();
202 
206  void detach();
207 
211  void reattach();
212 
216  void open();
217 
221  void close();
222 
230 
234  virtual void restoreFromProject() {;}
235 
239  ContentFrame* detachedFrame() const;
240 
245  void setDetachedFrame(ContentFrame* df);
246 
247  private:
248  void closeEvent(QCloseEvent* event);
249 
250  QString mName;
251  QIcon mIcon;
252  ContentAnchor* mAnchor = nullptr;
253 
254  QString mIconStyle;
255  QString mIconPath;
256 
257  protected:
263  };
264 }
An abstract class that provides the interface for specific anchors (see SplitterAnchor or TabWidget )...
Wraps the ContentWidget class.
Definition: content_frame.h:45
Abstract class for Widgets within HAL's ContentArea.
virtual void setupToolbar(Toolbar *Toolbar)
QKeySequence mSearchKeysequence
QString name() const
virtual void restoreFromProject()
void set_name(const QString &name)
void setIconPath(const QString &path)
ContentFrame * mDetachedFrame
void setAnchor(ContentAnchor *anchor)
QIcon icon() const
QShortcut * mSearchShortcut
void name_changed(const QString &name)
void setIconStyle(const QString &style)
void handleSearchKeysequenceChanged(QKeySequence seq)
void setDetachedFrame(ContentFrame *df)
ContentWidget(QString name, QWidget *parent=nullptr)
ContentFrame * detachedFrame() const
void setIcon(QIcon icon)
virtual QList< QShortcut * > createShortcuts()
QVBoxLayout * mContentLayout
Toolbar for all ContentFrames and ContentWidgets.
Definition: toolbar.h:39
A QWidget customized for hal.
Definition: widget.h:41
Q_OBJECTQ_OBJECT
Q_PROPERTY(...)
Q_SIGNALSQ_SIGNALS
Q_SLOTSQ_SLOTS
QObject * parent() const const
virtual bool event(QEvent *event) override
QStyle * style() const const