#include "FL/Fl.H"
#include "FL/Fl_Widget.H"
#include "FL/Fl_Group.H"
#include "fltktool.h"

void fltk_add_fd(int n, int events, void (*cb)(int, void*), void *v)
{
	printf("fltk_add_fd start!\n");
	Fl::add_fd(n, events, cb, v);
	printf("fltk_add_fd end!\n");
}

void fltk_remove_fd(int n, int events)
{
	printf("fltk_remove_fd start!\n");
	Fl::remove_fd(n, events);
	printf("fltk_remove_fd end!\n");
}

void fltk_add_handler(int (*ha)(int))
{
	Fl::add_handler(ha);
}

void fltk_remove_handler(int (*ha)(int))
{
	Fl::remove_handler(ha);
}

void fltk_focus(void *window)
{
	Fl::focus((Fl_Widget*)window);
}

void fltk_unfocus(void *window)
{
	if (window)
		Fl::focus(((Fl_Widget*)window)->parent());
}

