#include #include #include #include "izilla.h" #include "desktop.h" //Variables ttk_desktopdata * d; //Function Definitions TWidget * ttk_new_desktop_widget(int x, int y, int w, int h, TApItem * background) { TWidget * wid; wid = ttk_new_widget(x,y); wid->w = w; wid->h = h; wid->name = "desktop"; wid->draw = draw_desktop_widget; wid->update = update_desktop_widget_surface; wid->destroy = destroy_desktop_widget; wid->data = ttk_new_desktopdata(background); update_desktop_widget_surface(wid); return wid; } ttk_desktopdata * ttk_new_desktopdata(TApItem * wallpaper) { d = (ttk_desktopdata *)calloc(1, sizeof(ttk_desktopdata)); d->background = wallpaper->img; return d; } int desktop_handle_click(ttk_point point) { //Nothing for now return TTK_EV_CLICK; } void draw_desktop_widget(TWidget * wid, ttk_surface srf) { ttk_blit_image(wid->srf, base_win->srf, wid->x, wid->y); } void update_desktop_widget_surface(TWidget * wid) { ttk_blit_image(d->background, wid->srf, 0, 0); } void destroy_desktop_widget(TWidget * wid) { free(wid->data); ttk_free_widget(wid); }