/* * Load Cursors * ------------ * This program tests the loadcursor function, which * allows the programmer to load a cursor from the * application's resources, or from an image file. */ #include char * filename = NULL; void next_cursor(button b) { window win; static int i = 0; static int which = 0; static cursor curs[5]; if (i == 0) { curs[i++] = ArrowCursor; curs[i++] = BlankCursor; curs[i++] = WatchCursor; curs[i++] = TextCursor; curs[i++] = HandCursor; } if (++which >= 5) which = 0; win = parentwindow(b); drawto(win); setcursor(curs[which]); settext(win, gettext(curs[which])); } void load_a_cursor(button b) { window win; cursor c; filename = askfilename(NULL, filename); if (filename) { c = loadcursor(filename); if (c) { win = parentwindow(b); drawto(win); setcursor(c); settext(win, filename); } } } void main(void) { rect r = rect(0,0,200,200); window w = newwindow("Load Cursor Test", rect(50,50,400,350), StandardWindow); setbackground(w, LightBlue); newbutton("Load", rect(10,10,90,30), load_a_cursor); newbutton("Next", rect(110,10,90,30), next_cursor); show(w); }