annotate UI code/sliderPanel.h @ 14:f83635861187

rewrote sequence controller. ticks show relevant UI modes. images show for preset textures (but greenish?)
author Robert Tubb <rt300@eecs.qmul.ac.uk>
date Tue, 21 Oct 2014 16:39:39 +0100
parents 851833072cf1
children 5cf2b80909fc
rev   line source
rt300@0 1 //
rt300@0 2 // sliderPanel.h
rt300@0 3 // tweakathlon
rt300@0 4 //
rt300@0 5 // Created by Robert Tubb on 11/02/2014.
rt300@0 6 //
rt300@0 7 //
rt300@0 8
rt300@0 9 #ifndef __tweakathlon__sliderPanel__
rt300@0 10 #define __tweakathlon__sliderPanel__
rt300@0 11
rt300@0 12 #include <iostream>
rt300@0 13 #include "UIElementContainer.h"
rt300@0 14 #include <iostream>
rt300@0 15 #include "globalVariables.h"
rt300@0 16 #include "ofMain.h"
rt300@0 17 #include "UIElement.h"
rt300@0 18 #include "boost/bind.hpp"
rt300@0 19 #include "boost/function.hpp"
rt300@0 20 #include "timeController.h"
rt300@0 21 #include "ButtronSlider.h"
rt300@0 22 #include "ButtronXY.h"
rt300@0 23 #include "3Dbox.h"
rt300@0 24 #include "3DboxGL.h"
rt300@0 25 // panel with sliders and xy pads
rt300@0 26 class SliderPanel : public UIElementContainer{
rt300@0 27
rt300@0 28 public:
rt300@0 29 SliderPanel(float ax,
rt300@0 30 float ay,
rt300@0 31 float awidth,
rt300@0 32 float aheight,
rt300@0 33 const UIProps& aprops,
rt300@0 34 vector<controllerType> elemList);
rt300@0 35 //------------------------
rt300@0 36 void showHint(bool value){
rt300@0 37 vector<UIElement *>::iterator UIitr;
rt300@0 38 for(UIitr = subElements.begin(); UIitr < subElements.end(); UIitr++){
rt300@0 39 (*UIitr)->showHint(value);
rt300@0 40 }
rt300@0 41 }
rt300@0 42 //
rt300@14 43 void setHintValues(vector<int> vals){
rt300@14 44 auto valItr = vals.begin();
rt300@14 45 for(auto UIitr = subElements.begin(); UIitr < subElements.end(); UIitr++){
rt300@14 46 if (++valItr != vals.end()){
rt300@14 47 (*UIitr)->setHintValue(*valItr);
rt300@14 48 }
rt300@14 49 }
rt300@14 50 }
rt300@0 51 void setHintColor(ofColor c){
rt300@0 52 vector<UIElement *>::iterator UIitr;
rt300@0 53 for(UIitr = subElements.begin(); UIitr < subElements.end(); UIitr++){
rt300@0 54 (*UIitr)->setHintColor(c);
rt300@0 55 }
rt300@0 56 }
rt300@0 57 //------------------------
rt300@0 58 void flash(){
rt300@0 59 // turn hilight on and off
rt300@0 60 if (!flashing){
rt300@0 61 vector<UIElement *>::iterator UIitr;
rt300@0 62 for(UIitr = subElements.begin(); UIitr < subElements.end(); UIitr++){
rt300@0 63 (*UIitr)->setHighlight(true);
rt300@0 64 }
rt300@0 65 // set up timer
rt300@0 66 TimerCallbackFunction tcb;
rt300@0 67 tcb = boost::bind(&SliderPanel::flash, this);
rt300@0 68 timeController.scheduleEvent(tcb, 250);
rt300@0 69 flashing = true;
rt300@0 70 }else{
rt300@0 71 vector<UIElement *>::iterator UIitr;
rt300@0 72 for(UIitr = subElements.begin(); UIitr < subElements.end(); UIitr++){
rt300@0 73 (*UIitr)->setHighlight(false);
rt300@0 74 }
rt300@0 75 flashing = false;
rt300@0 76 }
rt300@0 77
rt300@0 78 }
rt300@0 79 //------------------------
rt300@14 80 void setBgColor(ofColor c){
rt300@14 81 vector<UIElement *>::iterator UIitr;
rt300@14 82 for(UIitr = subElements.begin(); UIitr < subElements.end(); UIitr++){
rt300@14 83 (*UIitr)->setColor(c);
rt300@14 84 }
rt300@14 85 }
rt300@14 86 //------------------------
rt300@0 87 vector<UIElement*> generateControls(vector<controllerType> elemList, controlPanelType panelType);
rt300@0 88 //------------------------
rt300@2 89 UIElement* getSlider(int index){
rt300@2 90 if (index < subElements.size()){
rt300@2 91 return subElements[index];
rt300@2 92 }else{
rt300@2 93 cout << "ERROR: index too big for sldiers" << endl;
rt300@2 94 return NULL;
rt300@2 95 }
rt300@2 96 };
rt300@0 97 // TODO override touch thing to make revisitable
rt300@0 98 private:
rt300@0 99 bool flashing;
rt300@0 100 controlPanelType panelType;
rt300@0 101 };
rt300@0 102
rt300@0 103 #endif /* defined(__tweakathlon__sliderPanel__) */