listbox newmultilist(char * string_list[], rect r, scrollfn fn); int isselected(listbox b, int index);
listbox newdroplist(char * string_list[], rect r, scrollfn fn); listbox newdropfield(char * string_list[], rect r, scrollfn fn);
char * askpassword(char *question, char *default_answer);
textbox newtextarea(char *text, rect r); field newpassword(char *text, rect r);
control newpicture(image img, rect r); button newimagebutton(image img, rect r, actionfn fn); checkbox newimagecheckbox(image img, rect r, actionfn fn); void setimage(button b, image img);
bitmap imagetobitmap(image img); image scaleimage(image src, rect dr, rect sr); void drawimage(image img, rect dr, rect sr); void drawmonochrome(image img, rect dr, rect sr); void drawgreyscale(image img, rect dr, rect sr); void drawgrayscale(image img, rect dr, rect sr); void drawdarker(image img, rect dr, rect sr); void drawbrighter(image img, rect dr, rect sr);
Notes on new image functions:
Timer function modified:
typedef void (*timerfn)(void *data); void settimerfn(timerfn timeout, void *data);This allows timers to receive a data pointer.
Changed the dialogs to use these constants (defined in graphapp.h):
#define YES 1 #define NO -1 // note the swap #define CANCEL 0 // note the swapThis allows all functions to return CANCEL if they have been cancelled (including those which return strings). Check all instances of the following functions: askokcancel, askyesno and askyesnocancel. In particular the expression
if (askyesno("?")) ...
always evaluates to true! So check carefully...
Changed createcursor to be called newcursor (the old newcursor becomes createcursor)
Added a new font function:
rect strrect(font f, char *str);This replaces strsize because it is more logical.
Bug-fixes:
There is a new graphapp.h header file.
typedef struct imagedata {
int depth;
int width;
int height;
int cmapsize;
rgb * cmap;
byte * pixels;
} * image;
button newimagebutton(image img, rect r); void setbuttonimage(button b, image img);
cursor loadcursor(char *filename); // can now load image files void createcursor(point, image); // create from image