comparison UI code/TextPanel.mm @ 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 8124f46eda65
comparison
equal deleted inserted replaced
-1:000000000000 0:a223551fdc1f
1 //
2 // TextPanel.mm
3 // tweakathlon
4 //
5 // Created by Robert Tubb on 05/03/2014.
6 //
7 //
8
9 #include "TextPanel.h"
10
11 TextPanel::TextPanel(string text, int ax, int ay,int aw,int ah, const UIProps& props):
12 UIElement(ax,ay,aw,ah, props)
13
14
15 {
16 labelName = text;
17 foregroundHi = props.buttonHi;
18 backgroundHi = props.generalBackground;
19 foregroundLo = props.buttonLo;
20 backgroundLo = props.generalBackground;
21 verdana16 = props.verdana16;
22 bigFont = props.bigFont;
23 smallFont = props.smallFont;
24 transparent = true;
25 };
26
27 //------------------------------------------------------------------
28 void TextPanel::draw(){
29 if (hidden) return;
30 if(!transparent) UIElement::draw(); // should do background
31 ofSetColor(foregroundHi);
32
33 // TODO check for fitting inside??
34 if(fontSize == SMALLFONT){
35 smallFont.drawString(theText, x, y + 8);
36 }else if(fontSize == LARGEFONT){
37 bigFont.drawString(theText, x, y + 8);
38 }else{
39 verdana16.drawString(theText, x, y + 8);
40 }
41
42 //ofRect(x,y,width,height);
43 }