tilde~
Puredata Qt-based GUI
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
UIBox.h
Go to the documentation of this file.
1 // (c) 2017 Alex Nadzharov
2 // License: GPL3
3 
4 #ifndef CM_BOX_H
5 #define CM_BOX_H
6 
7 #include <QLineEdit>
8 #include <QMainWindow>
9 #include <QtGui>
10 
11 #include "UIObject.h"
12 
13 #include <QGraphicsSceneMouseEvent>
14 #include <QGraphicsView>
15 
16 // #include "pdServer.hpp"
17 
19 
20 using namespace std;
21 
22 class QGraphicsProxyWidget;
23 
24 namespace tilde {
25 
26 class UIBox;
27 
28 class CanvasBoxObserver : public CanvasObserver {
29  UIBox* _box;
30 
31 public:
33 
34  void setUIBox(UIBox* b);
35 
36  virtual void inletAdded();
37  virtual void outletAdded();
38 
39  virtual void inletRemoved();
40  virtual void outletRemoved();
41 };
42 
46 class UIBox : public UIObject {
47 
48  Q_OBJECT
49 
50 private:
51  // for abstracions
52  bool _isAbstraction;
53  QString _abstractionPath;
54 
55  PatchWindowController* _subpatchController;
56 
57  //TEMP
58  bool _isSubpatch;
59  bool isSubpatch();
60 
61  bool isGraphOnParentSubpatch();
62 
63  QGraphicsProxyWidget* _subpatchCanvasProxy;
64 
65  CanvasBoxObserver* _boxObserver;
66 
67 public:
68  explicit UIBox();
69 
70  static UIObject* createObj(QString data);
71 
72  PatchWindowController* subpatchController() { return _subpatchController; };
73  virtual void setSubpatchController(PatchWindowController* cwindow) { _subpatchController = cwindow; };
74 
75  virtual void paint(QPainter* p, const QStyleOptionGraphicsItem* option, QWidget*);
76 
77  void objectPressEvent(QGraphicsSceneMouseEvent* event);
78  void objectMoveEvent(QGraphicsSceneMouseEvent* event);
79 
80  void mouseReleaseEvent(QGraphicsSceneMouseEvent* ev);
81 
82  void fromQString(QString message);
83 
84  void sync();
85 
86  virtual string asPdFileString();
87 
88  virtual void autoResize();
89 
90 signals:
91 
92  void mouseMoved();
93  void rightClicked();
94 
95 public slots:
96  void propertyEmbed();
97 };
98 }
99 
100 #endif // CM_BOX_H
PatchWindowController * subpatchController()
Definition: UIBox.h:72
CanvasBoxObserver()
Definition: UIBox.h:32
The Patch window controller.
Definition: PatchWindowController.h:48
Definition: UIBox.h:28
Definition: UIObject.h:44
virtual void setSubpatchController(PatchWindowController *cwindow)
Definition: UIBox.h:73
gui object: standard object box
Definition: UIBox.h:46