QtPdWidgets  2.3.1
ClipImage.h
Go to the documentation of this file.
1 /*****************************************************************************
2  *
3  * Copyright (C) 2019 Florian Pose <fp@igh-essen.com>
4  *
5  * This file is part of the QtPdWidgets library.
6  *
7  * The QtPdWidgets library is free software: you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public License as
9  * published by the Free Software Foundation, either version 3 of the License,
10  * or (at your option) any later version.
11  *
12  * The QtPdWidgets 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 GNU Lesser
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public License
18  * along with the QtPdWidgets Library. If not, see
19  * <http://www.gnu.org/licenses/>.
20  *
21  ****************************************************************************/
22 
23 #ifndef PD_CLIPIMAGE_H
24 #define PD_CLIPIMAGE_H
25 
26 #include <QFrame>
27 
28 #include "Export.h"
29 #include <QtPdCom1/ScalarSubscriber.h>
30 
31 namespace Pd {
32 
33 /****************************************************************************/
34 
36  public QFrame, QtPdCom::ScalarSubscriber
37 {
38  Q_OBJECT
39  Q_ENUMS(ClipMode)
40  Q_PROPERTY(QString background
41  READ getBackground WRITE setBackground RESET resetBackground)
42  Q_PROPERTY(QString foreground
43  READ getForeground WRITE setForeground RESET resetForeground)
44  Q_PROPERTY(ClipMode clipMode
45  READ getClipMode WRITE setClipMode RESET resetClipMode)
46 
47  public:
48  ClipImage(QWidget * = 0);
49  ~ClipImage();
50 
51  QSize sizeHint() const;
52 
53  QString getBackground() const;
54  void setBackground(const QString &);
55  void resetBackground();
56 
57  QString getForeground() const;
58  void setForeground(const QString &);
59  void resetForeground();
60 
61  enum ClipMode {
62  Bar,
63  Clock
64  };
65  ClipMode getClipMode() const;
66  void setClipMode(ClipMode);
67  void resetClipMode();
68 
69  private:
71  std::unique_ptr<Impl> impl;
72 
73  PD_PRIVATE void resizeEvent(QResizeEvent *) override;
74  PD_PRIVATE void paintEvent(QPaintEvent *) override;
75 
76  PD_PRIVATE void newValues(std::chrono::nanoseconds) override;
77  PD_PRIVATE void stateChange(PdCom::Subscription::State) override;
78 };
79 
80 } // namespace
81 
82 /****************************************************************************/
83 
84 #endif
Definition: Bar.h:36
#define PD_PRIVATE
Definition: Export.h:28
#define PD_PUBLIC
Definition: Export.h:33
std::unique_ptr< Impl > impl
Definition: ClipImage.h:71
Definition: ClipImage.h:35
Definition: ClipImage.h:62
ClipMode
Definition: ClipImage.h:61
Definition: ClipImage.cpp:34