3 * - By John Hodge (thePowersGang)
8 #include <axwin4/axwin.h>
11 tAxWin4_Window *CreateBGWin(int w, int h);
12 tAxWin4_Window *CreateTaskbar(int w, int h);
15 int main(int argc, const char *argv[])
17 assert( AxWin4_Connect("ipcpipe:///Devices/ipcpipe/axwin4") );
20 AxWin4_GetScreenDimensions(0, &w, &h);
22 tAxWin4_Window *bgwin = CreateBGWin(w, h);
23 tAxWin4_Window *menu = CreateTaskbar(w, h);
25 _SysDebug("Beginning queue");
26 while( AxWin4_WaitEventQueue(0) )
28 _SysDebug("Clean exit");
33 tAxWin4_Window *CreateBGWin(int w, int h)
35 tAxWin4_Window *bgwin = AxWin4_CreateWindow("background");
36 AxWin4_MoveWindow(bgwin, 0,0);
37 AxWin4_ResizeWindow(bgwin, w,h);
38 AxWin4_SetWindowFlags(bgwin, AXWIN4_WNDFLAG_NODECORATE|AXWIN4_WNDFLAG_KEEPBELOW);
40 // Load background image
41 uint32_t *buf = AxWin4_GetWindowBuffer(bgwin);
42 for( size_t y = 0; y < h; y ++ )
44 for(size_t x = 0; x < w; x ++ )
46 uint8_t r = y * 256 / h;
48 uint8_t b = x * 256 / w;
49 buf[y*w+x] = (r << 16) | (g << 8) | b;
52 //AxWin4_DamageRect(bgwin, 0, 0, w, h);
53 AxWin4_ShowWindow(bgwin, true);
58 tAxWin4_Window *CreateTaskbar(int w, int h)
61 tAxWin4_Window *win = AxWin4_CreateWindow("taskbar");
62 AxWin4_MoveWindow(win, 0, 0);
63 AxWin4_ResizeWindow(win, w, winheight);
65 AxWin4_SetWindowFlags(win, AXWIN4_WNDFLAG_NODECORATE);
67 AxWin4_ShowWindow(win, true);
72 void Taskbar_Redraw(tAxWin4_Window *win)
76 AxWin4_DrawControl(win, 0, 0, w, h, 0x01); // Standard button, suitable for a toolbar
77 AxWin4_DrawControl(win, 5, 5, h-10, h-10, 0x00); // Standard button
79 AxWin4_DamageRect(bgwin, 0, 0, w, h);