view UI code/IconPanel.h @ 43:4ad0d218f890

can skip runs if it crashed etc.
author Robert Tubb <rt300@eecs.qmul.ac.uk>
date Mon, 15 Dec 2014 12:51:09 +0000
parents 953db6518738
children
line wrap: on
line source
//
//  IconPanel.h
//  riftathon
//
//  Created by Robert Tubb on 20/10/2014.
//
//

#ifndef __riftathon__IconPanel__
#define __riftathon__IconPanel__

#include <iostream>

#include <iostream>
#include "ofMain.h"
#include "UIElement.h"
#include "UIProperties.h"

class IconPanel : public UIElement{
    
public:

    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
    
    IconPanel();
    ~IconPanel(){};
    
    // this constructor sets up with defaults obtained from UIProperties (recoomemnded)

    IconPanel(float x,
            float y,
            float width,
            float height,
            const UIProps& props
            );
       void draw();
    void drawOutline();
    void drawTextLabel();
    void drawTexture();
    void drawTick();
    void drawCross();
    void setTextAndImage(string text, ofImage* image, bool isFilled){
        setLabel(text);
        textureImage = image;
        hasBeenSet = true;
        showTick = isFilled;
    }
    
    virtual bool handleMyTouch(int x, int y, touchType ttype, int touchID);
    
protected:

    ofImage* textureImage;
    bool hasBeenSet;
    bool showTick;
    bool showCross;
};


#endif /* defined(__riftathon__IconPanel__) */