Lab4

Dependencies:   SeeedStudioTFTv2 TFT_fonts mbed

Fork of Seeed_TFT_Touch_Shield by Shields

ActionListener.h

Committer:
uswickra
Date:
2014-09-26
Revision:
4:ebcf8d366b91
Child:
6:ebffa73d4f95

File content as of revision 4:ebcf8d366b91:

#pragma once
#include <vector>
#include "mbed.h"

typedef enum { CORD, STR, CORD_STR } ActionType;

class ActionEvent{
public:
    //pixel x that event took place
    int x;  
    //pixel y that event took place
    int y;   
    
    char* string;
};

class ActionListener{
public:
    ActionListener();
    
    void registerForEvents(ActionListener* widg);
    
    void action(ActionType type, ActionEvent evnt);

protected:
    virtual void trigger_action( ActionType type, ActionEvent evnt)=0;
    
private:
    bool is_reg;
    ActionListener* target;
    vector<ActionListener*> children;    
       
};