Hi all,
I am implementing some events (callbacks), and have come across a problem that I daresay has a simple solution.
The problem is that one of the inputs into my callback function is a struct that I declare later on, and it doesn't like it because the struct doesn't exist yet. The problem is that I can't move the declaration of the struct above the declaration of the callback function either, because the struct itself contains one of these callbacks!!
example:
Code:
typedef void (*eGPD_onButtonPress)( tGPD_widget, unsigned short, unsigned short, char, char);
typedef void (*eGPD_onMouseIn)( tGPD_widget );
typedef void (*eGPD_onMouseOut)( tGPD_widget );
typedef struct tGPD_widget{
char type;
void *object;
unsigned short x;
unsigned short y;
tGPD_list *children;
struct tGPD_widget *parent;
char redraw;
eGPD_onMouseIn onMouseIn;
eGPD_onMouseOut onMouseOut;
}tGPD_widget;
As you can see, tGPD_widget contains two events/callbacks (so far) which also have tGPD_widgets as inputs.
How do I properly define these?
EDIT: If I remove the references to tGPD_widget from the callback definitions, it compiles and runs ok - however i do want the tGPD_widget input in there!