annotate UI code/Buttron.h @ 52:89944ab3e129 tip

fix oF linker errors ios8
author Robert Tubb <rt300@eecs.qmul.ac.uk>
date Tue, 03 Feb 2015 13:18:23 +0000
parents d810aa9ca03a
children
rev   line source
rt300@0 1 //
rt300@0 2 // buttron.h
rt300@0 3 // emptyExample
rt300@0 4 //
rt300@0 5 // Created by Robert Tubb on 30/04/2013.
rt300@0 6 //
rt300@0 7 //
rt300@0 8
rt300@0 9
rt300@0 10 // this is a rectangualr thingy with border and on/off functionality
rt300@0 11
rt300@0 12 #ifndef __emptyExample__buttron__
rt300@0 13 #define __emptyExample__buttron__
rt300@0 14
rt300@0 15 #include <iostream>
rt300@0 16 #include "ofMain.h"
rt300@0 17 #include "UIElement.h"
rt300@0 18 #include "UIProperties.h"
rt300@0 19
rt300@0 20 class Buttron : public UIElement{
rt300@0 21
rt300@0 22 public:
rt300@0 23 typedef enum {TOGGLE,MOMENTARY} Mode; // should be in subclasss
rt300@0 24
rt300@0 25 float thickness; // width of border
rt300@0 26 float radius; // inner radius of corners, reccomended to be same as thickness
rt300@0 27 ofColor foregroundHi;
rt300@0 28 ofColor backgroundHi;
rt300@0 29 ofColor foregroundLo;
rt300@0 30 ofColor backgroundLo;
rt300@0 31 ofColor fgInactive;
rt300@0 32
rt300@0 33 bool pressed; // on and pressed can be different
rt300@0 34
rt300@0 35 Buttron();
rt300@0 36 ~Buttron(){};
rt300@0 37
rt300@0 38 // this constructor sets up with defaults obtained from UIProperties (recoomemnded)
rt300@0 39 Buttron(float x,
rt300@0 40 float y,
rt300@0 41 const UIProps& props
rt300@0 42 );
rt300@0 43 Buttron(float x,
rt300@0 44 float y,
rt300@0 45 float width,
rt300@0 46 float height,
rt300@0 47 const UIProps& props
rt300@0 48 );
rt300@0 49 Buttron(float x,
rt300@0 50 float y,
rt300@0 51 float width,
rt300@0 52 float height,
rt300@0 53 const UIProps& props,
rt300@0 54 Mode mode
rt300@0 55 );
rt300@0 56
rt300@0 57 Buttron(float x,
rt300@0 58 float y,
rt300@0 59 float width,
rt300@0 60 float height,
rt300@0 61 float thickness,
rt300@0 62 float radius,
rt300@0 63 ofColor foregroundHi,
rt300@0 64 ofColor backgroundHi,
rt300@0 65 ofColor foregroundLo,
rt300@0 66 ofColor backgroundLo);
rt300@0 67 void draw();
rt300@0 68 void drawOutline();
rt300@0 69 void drawTextLabel();
rt300@0 70 void setMode(Mode m){
rt300@0 71 behaviourMode = m;
rt300@0 72 };
rt300@38 73 void turnOff(){
rt300@38 74 on = false;
rt300@38 75 }
rt300@43 76 void turnOn(){
rt300@43 77 on = true;
rt300@43 78 }
rt300@0 79 virtual bool handleMyTouch(int x, int y, touchType ttype, int touchID);
rt300@44 80 void setBgImage(ofImage * img){
rt300@44 81 bgImage = img;
rt300@44 82 }
rt300@0 83 protected:
rt300@0 84 Mode behaviourMode;
rt300@44 85 ofImage * bgImage;
rt300@0 86 };
rt300@0 87
rt300@0 88
rt300@0 89 #endif /* defined(__emptyExample__buttron__) */