Mercurial > hg > tweakathon2ios
view UI code/Buttron.h @ 42:2bd658b44c2d
buttons dont lite up
back to menu shows in more appropriate times
author | Robert Tubb <rt300@eecs.qmul.ac.uk> |
---|---|
date | Mon, 08 Dec 2014 18:29:10 +0000 |
parents | fea11c3d1d94 |
children | 4ad0d218f890 |
line wrap: on
line source
// // buttron.h // emptyExample // // Created by Robert Tubb on 30/04/2013. // // // this is a rectangualr thingy with border and on/off functionality #ifndef __emptyExample__buttron__ #define __emptyExample__buttron__ #include <iostream> #include "ofMain.h" #include "UIElement.h" #include "UIProperties.h" class Buttron : public UIElement{ public: typedef enum {TOGGLE,MOMENTARY} Mode; // should be in subclasss float thickness; // width of border float radius; // inner radius of corners, reccomended to be same as thickness ofColor foregroundHi; ofColor backgroundHi; ofColor foregroundLo; ofColor backgroundLo; ofColor fgInactive; bool pressed; // on and pressed can be different Buttron(); ~Buttron(){}; // this constructor sets up with defaults obtained from UIProperties (recoomemnded) Buttron(float x, float y, const UIProps& props ); Buttron(float x, float y, float width, float height, const UIProps& props ); Buttron(float x, float y, float width, float height, const UIProps& props, Mode mode ); Buttron(float x, float y, float width, float height, float thickness, float radius, ofColor foregroundHi, ofColor backgroundHi, ofColor foregroundLo, ofColor backgroundLo); void draw(); void drawOutline(); void drawTextLabel(); void setMode(Mode m){ behaviourMode = m; }; void turnOff(){ on = false; } virtual bool handleMyTouch(int x, int y, touchType ttype, int touchID); protected: Mode behaviourMode; }; #endif /* defined(__emptyExample__buttron__) */