Mercurial > hg > tweakathon2ios
view UI code/sliderPanel.h @ 21:5cf2b80909fc
Hints and sliders show ok for training sequences.
author | Robert Tubb <rt300@eecs.qmul.ac.uk> |
---|---|
date | Wed, 22 Oct 2014 18:12:12 +0100 |
parents | f83635861187 |
children | 8124f46eda65 |
line wrap: on
line source
// // sliderPanel.h // tweakathlon // // Created by Robert Tubb on 11/02/2014. // // #ifndef __tweakathlon__sliderPanel__ #define __tweakathlon__sliderPanel__ #include <iostream> #include "UIElementContainer.h" #include <iostream> #include "globalVariables.h" #include "ofMain.h" #include "UIElement.h" #include "boost/bind.hpp" #include "boost/function.hpp" #include "timeController.h" #include "ButtronSlider.h" #include "ButtronXY.h" #include "3Dbox.h" #include "3DboxGL.h" #include "ButtronSlider.h" // panel with sliders and xy pads class SliderPanel : public UIElementContainer{ public: SliderPanel(float ax, float ay, float awidth, float aheight, const UIProps& aprops, vector<controllerType> elemList); //------------------------ void showHint(bool value){ vector<UIElement *>::iterator UIitr; for(UIitr = subElements.begin(); UIitr < subElements.end(); UIitr++){ ButtronSlider* thisSlider = (ButtronSlider *)(*UIitr); thisSlider->showHint(value); } } // void setHintValues(vector<int> vals){ int i = 0; for(auto UIitr = subElements.begin(); UIitr < subElements.end(); UIitr++){ ButtronSlider* thisSlider = (ButtronSlider *)(*UIitr); thisSlider->setHintValue(vals[i]); i++; } } void setHintColor(ofColor c){ vector<UIElement *>::iterator UIitr; for(UIitr = subElements.begin(); UIitr < subElements.end(); UIitr++){ (*UIitr)->setHintColor(c); } } //------------------------ void flash(){ // turn hilight on and off if (!flashing){ vector<UIElement *>::iterator UIitr; for(UIitr = subElements.begin(); UIitr < subElements.end(); UIitr++){ (*UIitr)->setHighlight(true); } // set up timer TimerCallbackFunction tcb; tcb = boost::bind(&SliderPanel::flash, this); timeController.scheduleEvent(tcb, 250); flashing = true; }else{ vector<UIElement *>::iterator UIitr; for(UIitr = subElements.begin(); UIitr < subElements.end(); UIitr++){ (*UIitr)->setHighlight(false); } flashing = false; } } //------------------------ void setBgColor(ofColor c){ vector<UIElement *>::iterator UIitr; for(UIitr = subElements.begin(); UIitr < subElements.end(); UIitr++){ (*UIitr)->setColor(c); } } //------------------------ vector<UIElement*> generateControls(vector<controllerType> elemList, controlPanelType panelType); //------------------------ UIElement* getSlider(int index){ if (index < subElements.size()){ return subElements[index]; }else{ cout << "ERROR: index too big for sldiers" << endl; return NULL; } }; // TODO override touch thing to make revisitable private: bool flashing; controlPanelType panelType; }; #endif /* defined(__tweakathlon__sliderPanel__) */