Mercurial > hg > tweakathon2ios
comparison UI code/sliderPanel.h @ 27:27cdf475aa4b
more fiddling
author | Robert Tubb <rt300@eecs.qmul.ac.uk> |
---|---|
date | Wed, 29 Oct 2014 15:38:38 +0000 |
parents | 8124f46eda65 |
children | 953db6518738 |
comparison
equal
deleted
inserted
replaced
26:8d7ae43b2edd | 27:27cdf475aa4b |
---|---|
20 #include "timeController.h" | 20 #include "timeController.h" |
21 #include "ButtronSlider.h" | 21 #include "ButtronSlider.h" |
22 #include "ButtronXY.h" | 22 #include "ButtronXY.h" |
23 #include "3Dbox.h" | 23 #include "3Dbox.h" |
24 #include "3DboxGL.h" | 24 #include "3DboxGL.h" |
25 #include "6Dbox.h" | |
25 #include "ButtronSlider.h" | 26 #include "ButtronSlider.h" |
26 // panel with sliders and xy pads | 27 // panel with sliders and xy pads |
28 | |
29 // AND 6DOF BOXES !!!!! | |
27 class SliderPanel : public UIElementContainer{ | 30 class SliderPanel : public UIElementContainer{ |
28 | 31 |
29 public: | 32 public: |
30 SliderPanel(float ax, | 33 SliderPanel(float ax, |
31 float ay, | 34 float ay, |
32 float awidth, | 35 float awidth, |
33 float aheight, | 36 float aheight, |
34 const UIProps& aprops, | 37 const UIProps& aprops, |
35 vector<controllerType> elemList); | 38 vector<controllerType> elemList); |
36 //------------------------ | 39 |
37 void showHint(bool value){ | 40 void setAndShowHint(vector<int> values, ofImage* texture); |
38 vector<UIElement *>::iterator UIitr; | 41 |
39 for(UIitr = subElements.begin(); UIitr < subElements.end(); UIitr++){ | 42 void showHint(bool value); |
40 | |
41 ButtronSlider* thisSlider = (ButtronSlider *)(*UIitr); | |
42 thisSlider->showHint(value); | |
43 } | |
44 } | |
45 // | 43 // |
46 void setHintValues(vector<int> vals){ | 44 void setHintValues(vector<int> vals); |
47 int i = 0; | 45 void setHintColor(ofColor c); |
48 for(auto UIitr = subElements.begin(); UIitr < subElements.end(); UIitr++){ | 46 void setSliderColors(ofColor c); |
49 ButtronSlider* thisSlider = (ButtronSlider *)(*UIitr); | 47 void flash(); |
50 thisSlider->setHintValue(vals[i]); | 48 void setBgColor(ofColor c); |
51 i++; | |
52 } | |
53 } | |
54 void setHintColor(ofColor c){ | |
55 vector<UIElement *>::iterator UIitr; | |
56 for(UIitr = subElements.begin(); UIitr < subElements.end(); UIitr++){ | |
57 (*UIitr)->setHintColor(c); | |
58 } | |
59 } | |
60 void setSliderColors(ofColor c){ | |
61 for(auto UIitr = subElements.begin(); UIitr < subElements.end(); UIitr++){ | |
62 ButtronSlider* thisSlider = (ButtronSlider *)(*UIitr); | |
63 thisSlider->setColor(c); | |
64 } | |
65 } | |
66 //------------------------ | |
67 void flash(){ | |
68 // turn hilight on and off | |
69 if (!flashing){ | |
70 vector<UIElement *>::iterator UIitr; | |
71 for(UIitr = subElements.begin(); UIitr < subElements.end(); UIitr++){ | |
72 (*UIitr)->setHighlight(true); | |
73 } | |
74 // set up timer | |
75 TimerCallbackFunction tcb; | |
76 tcb = boost::bind(&SliderPanel::flash, this); | |
77 timeController.scheduleEvent(tcb, 250); | |
78 flashing = true; | |
79 }else{ | |
80 vector<UIElement *>::iterator UIitr; | |
81 for(UIitr = subElements.begin(); UIitr < subElements.end(); UIitr++){ | |
82 (*UIitr)->setHighlight(false); | |
83 } | |
84 flashing = false; | |
85 } | |
86 | |
87 } | |
88 //------------------------ | |
89 void setBgColor(ofColor c){ | |
90 vector<UIElement *>::iterator UIitr; | |
91 for(UIitr = subElements.begin(); UIitr < subElements.end(); UIitr++){ | |
92 (*UIitr)->setColor(c); | |
93 } | |
94 } | |
95 //------------------------ | |
96 vector<UIElement*> generateControls(vector<controllerType> elemList, controlPanelType panelType); | 49 vector<UIElement*> generateControls(vector<controllerType> elemList, controlPanelType panelType); |
97 //------------------------ | 50 |
98 UIElement* getSlider(int index){ | 51 UIElement* getSlider(int index); |
99 if (index < subElements.size()){ | 52 void setHintTexture(ofImage* texture); |
100 return subElements[index]; | 53 |
101 }else{ | 54 void showValueIndicators(bool show); |
102 cout << "ERROR: index too big for sldiers" << endl; | |
103 return NULL; | |
104 } | |
105 }; | |
106 // TODO override touch thing to make revisitable | |
107 private: | 55 private: |
108 bool flashing; | 56 bool flashing; |
109 controlPanelType panelType; | 57 controlPanelType thisPanelType; |
110 }; | 58 }; |
111 | 59 |
112 #endif /* defined(__tweakathlon__sliderPanel__) */ | 60 #endif /* defined(__tweakathlon__sliderPanel__) */ |