Mercurial > hg > tweakathon2ios
view UI code/Buttron.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 | fea11c3d1d94 |
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; }; virtual bool handleMyTouch(int x, int y, touchType ttype, int touchID); protected: Mode behaviourMode; }; #endif /* defined(__emptyExample__buttron__) */