#include <fspanel.h>

#define TEXTPAD 6

applet_info_t info_g;


applet_info_t get_applet_info( void )
{    
  
    return info_g;
}

set_applet_info( applet_info_t inf )
{
    info_g = inf;

    if( info_g.width == -1 )
    {
        info_g.width = 60;
    }
}

int gui_draw( int x, void *token )
{
	char *time_str;
	time_t now;
	int width, old_x; //, x = WINWIDTH - time_width - (TEXTPAD * 4);
    int winheight;
    
    winheight = panel_get_winheight();
	old_x = x;

	width = info_g.width;

	now = time (0);
	time_str = (char*) ctime (&now) + 11;

	gui_draw_vline ( x);
	x += TEXTPAD;

/*set_foreground (3); *//* white *//* it's already 3 from gui_draw_vline() */
	draw_line ( x + 1, winheight - 2, old_x + width - TEXTPAD,
				  winheight - 2);
	draw_line ( old_x + width - TEXTPAD, 2, old_x + width - TEXTPAD,
				  winheight - 2);

	set_foreground (1);			  /* mid gray */
	fill_rect ( x + 1, 2, width - (TEXTPAD * 2) - 1, winheight - 4);

	set_foreground (4);			  /* darkest gray */
	draw_line ( x, 2, x + width - (TEXTPAD * 2) - 1, 2);
	draw_line ( x, 2, x, winheight - 2);

	set_foreground (5);
	XDrawString ( x_get_display(),
                  x_get_window(),
                  x_get_foregroundGC(),
                  x + TEXTPAD - 1,
                  panel_get_y_text_origin(),
                  time_str, 5);

    return x + width;
}

int gui_button_press ( int x, int y, int button, void *token )
{


}

int event_notification( void *token )
{

}

int gui_button_release ( int x, int y, int button, void *token )
{

}

