annotate UI code/sliderPanel.h @ 0:a223551fdc1f

First commit - copy from tweakathlon.
author Robert Tubb <rt300@eecs.qmul.ac.uk>
date Fri, 10 Oct 2014 11:46:42 +0100
parents
children 851833072cf1
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@0 43 void setHintColor(ofColor c){
rt300@0 44 vector<UIElement *>::iterator UIitr;
rt300@0 45 for(UIitr = subElements.begin(); UIitr < subElements.end(); UIitr++){
rt300@0 46 (*UIitr)->setHintColor(c);
rt300@0 47 }
rt300@0 48 }
rt300@0 49 //------------------------
rt300@0 50 void flash(){
rt300@0 51 // turn hilight on and off
rt300@0 52 if (!flashing){
rt300@0 53 vector<UIElement *>::iterator UIitr;
rt300@0 54 for(UIitr = subElements.begin(); UIitr < subElements.end(); UIitr++){
rt300@0 55 (*UIitr)->setHighlight(true);
rt300@0 56 }
rt300@0 57 // set up timer
rt300@0 58 TimerCallbackFunction tcb;
rt300@0 59 tcb = boost::bind(&SliderPanel::flash, this);
rt300@0 60 timeController.scheduleEvent(tcb, 250);
rt300@0 61 flashing = true;
rt300@0 62 }else{
rt300@0 63 vector<UIElement *>::iterator UIitr;
rt300@0 64 for(UIitr = subElements.begin(); UIitr < subElements.end(); UIitr++){
rt300@0 65 (*UIitr)->setHighlight(false);
rt300@0 66 }
rt300@0 67 flashing = false;
rt300@0 68 }
rt300@0 69
rt300@0 70 }
rt300@0 71 //------------------------
rt300@0 72 vector<UIElement*> generateControls(vector<controllerType> elemList, controlPanelType panelType);
rt300@0 73 //------------------------
rt300@0 74
rt300@0 75 // TODO override touch thing to make revisitable
rt300@0 76 private:
rt300@0 77 bool flashing;
rt300@0 78 controlPanelType panelType;
rt300@0 79 };
rt300@0 80
rt300@0 81 #endif /* defined(__tweakathlon__sliderPanel__) */