Mercurial > hg > tweakathon2ios
view UI code/sliderPanel.h @ 26:8d7ae43b2edd
BLOODY FIIDDLY MOFO THIS ONE
author | Robert Tubb <rt300@eecs.qmul.ac.uk> |
---|---|
date | Tue, 28 Oct 2014 19:15:28 +0000 |
parents | 8124f46eda65 |
children | 27cdf475aa4b |
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 setSliderColors(ofColor c){ for(auto UIitr = subElements.begin(); UIitr < subElements.end(); UIitr++){ ButtronSlider* thisSlider = (ButtronSlider *)(*UIitr); thisSlider->setColor(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__) */