Vuo  2.0.0
VuoInputEditorPoint2d.hh
Go to the documentation of this file.
1 
10 #pragma once
11 
13 #include "VuoDoubleSpinbox.hh"
14 
15 extern "C" {
16 #include "VuoPoint2d.h"
17 }
18 
23 {
24  Q_OBJECT
25  Q_PLUGIN_METADATA(IID "org.vuo.inputEditor" FILE "VuoInputEditorPoint2d.json")
26  Q_INTERFACES(VuoInputEditorFactory)
27 
28 public:
29  virtual VuoInputEditor * newInputEditor(void);
30 };
31 
52 {
53  Q_OBJECT
54 
55 protected:
56  void setUpDialog(QDialog &dialog, json_object *originalValue, json_object *details);
58 
62  virtual bool supportsTabbingBetweenPorts(void) { return true; }
63 
64 private:
65 
66  enum coord
67  {
68  coord_x,
69  coord_y
70  };
71 
72  VuoPoint2d current;
73  map<coord, double> suggestedMinForCoord;
74  map<coord, double> suggestedMaxForCoord;
75  map<coord, double> suggestedStepForCoord;
76 
77  map<coord, QSlider*> sliderForCoord;
78  map<coord, VuoDoubleSpinBox*> spinboxForCoord;
79 
80  bool getCoordFromQObject(QObject* sender, coord* whichCoord) VuoWarnUnusedResult;
81  void setCoord(coord c, double value);
82 
83  VuoDoubleSpinBox* initSpinBox(coord whichCoord, QDialog& dialog, double initialValue);
84  QSlider* initSlider(coord whichCoord, QDialog& dialog, double initialValue);
85 
86 private slots:
87 
88  void onSliderUpdate(int sliderValue);
89  void onSpinboxUpdate(QString spinboxValue);
90  void emitValueChanged();
91 };
92