view UI code/IconPanel.h @ 19:bd23c1b922be

Explore preset saving slot stuff kind of works.
author Robert Tubb <rt300@eecs.qmul.ac.uk>
date Wed, 22 Oct 2014 16:29:31 +0100
parents f83635861187
children 953db6518738
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;
};


#endif /* defined(__riftathon__IconPanel__) */