Mercurial > hg > tweakathon2ios
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/UI code/sliderPanel.h Fri Oct 10 11:46:42 2014 +0100 @@ -0,0 +1,81 @@ +// +// 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" +// 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++){ + (*UIitr)->showHint(value); + } + } + // + 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; + } + + } + //------------------------ + vector<UIElement*> generateControls(vector<controllerType> elemList, controlPanelType panelType); + //------------------------ + + // TODO override touch thing to make revisitable +private: + bool flashing; + controlPanelType panelType; +}; + +#endif /* defined(__tweakathlon__sliderPanel__) */