Vuo  2.3.1
VuoInputEditorAnchor.hh
Go to the documentation of this file.
1 
10 #ifndef VUOINPUTEDITORANCHOR
11 #define VUOINPUTEDITORANCHOR
12 
13 #include "VuoInputEditor.hh"
15 
16 extern "C"
17 {
18  #include "VuoAnchor.h"
19 }
20 
25 {
26  Q_OBJECT
27  Q_PLUGIN_METADATA(IID "org.vuo.inputEditor" FILE "VuoInputEditorAnchor.json")
28  Q_INTERFACES(VuoInputEditorFactory)
29 
30 public:
31  virtual VuoInputEditor * newInputEditor(void);
32 };
33 
38 {
39  Q_OBJECT
40 
41 protected:
42  void setUpDialog(QDialog &dialog, json_object *originalValue, json_object *details);
44 
45 private:
46  QPushButton* matrix[9];
47  json_object* currentValue;
48  QIcon* renderIconWithLineSegments(const float* points, const unsigned int length);
49  QIcon* iconForAnchorIndex(const int anchor);
50 
51  // Return the index in ANCHOR_MAP that a VuoAnchor corresponds to.
52  int VuoAnchorToIndex(const VuoAnchor anchor);
53 
54  // corresponds to the matching button index (0-8)
55  const VuoAnchor ANCHOR_MAP[9] =
56  {
57  VuoAnchor_make(VuoHorizontalAlignment_Left, VuoVerticalAlignment_Top ),
58  VuoAnchor_make(VuoHorizontalAlignment_Center, VuoVerticalAlignment_Top ),
59  VuoAnchor_make(VuoHorizontalAlignment_Right, VuoVerticalAlignment_Top ),
60  VuoAnchor_make(VuoHorizontalAlignment_Left, VuoVerticalAlignment_Center),
61  VuoAnchor_make(VuoHorizontalAlignment_Center, VuoVerticalAlignment_Center),
62  VuoAnchor_make(VuoHorizontalAlignment_Right, VuoVerticalAlignment_Center),
63  VuoAnchor_make(VuoHorizontalAlignment_Left, VuoVerticalAlignment_Bottom),
64  VuoAnchor_make(VuoHorizontalAlignment_Center, VuoVerticalAlignment_Bottom),
65  VuoAnchor_make(VuoHorizontalAlignment_Right, VuoVerticalAlignment_Bottom)
66  };
67 
68 private slots:
69  void onSetAnchor();
70 };
71 
72 #endif