annotate UI code/Buttron.h @ 13:ab3e0e980c82
Sequence conrtollrer FINALLY works.
author |
Robert Tubb <rt300@eecs.qmul.ac.uk> |
date |
Mon, 20 Oct 2014 19:36:39 +0100 |
parents |
a223551fdc1f |
children |
fea11c3d1d94 |
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@0
|
73 virtual bool handleMyTouch(int x, int y, touchType ttype, int touchID);
|
rt300@0
|
74
|
rt300@0
|
75 protected:
|
rt300@0
|
76 Mode behaviourMode;
|
rt300@0
|
77
|
rt300@0
|
78 };
|
rt300@0
|
79
|
rt300@0
|
80
|
rt300@0
|
81 #endif /* defined(__emptyExample__buttron__) */
|