comparison mac/dw.m @ 2035:ea303d356419

Mac: Const changes to match the Windows changes.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sun, 17 Nov 2019 04:07:39 +0000
parents 5ca399fb2d6f
children a00e73284c97
comparison
equal deleted inserted replaced
2034:89d62197124b 2035:ea303d356419
373 ".jpeg", 373 ".jpeg",
374 ".tiff", 374 ".tiff",
375 ".bmp" 375 ".bmp"
376 }; 376 };
377 377
378 char *_dw_get_image_extension( char *filename ) 378 char *_dw_get_image_extension(const char *filename)
379 { 379 {
380 char *file = alloca(strlen(filename) + 6); 380 char *file = alloca(strlen(filename) + 6);
381 int found_ext = 0,i; 381 int found_ext = 0,i;
382 382
383 /* Try various extentions */ 383 /* Try various extentions */
461 SignalHandler *Root = NULL; 461 SignalHandler *Root = NULL;
462 462
463 /* Some internal prototypes */ 463 /* Some internal prototypes */
464 static void _do_resize(Box *thisbox, int x, int y); 464 static void _do_resize(Box *thisbox, int x, int y);
465 void _handle_resize_events(Box *thisbox); 465 void _handle_resize_events(Box *thisbox);
466 int _remove_userdata(UserData **root, char *varname, int all); 466 int _remove_userdata(UserData **root, const char *varname, int all);
467 int _dw_main_iteration(NSDate *date); 467 int _dw_main_iteration(NSDate *date);
468 NSGraphicsContext *_dw_draw_context(NSBitmapImageRep *image); 468 NSGraphicsContext *_dw_draw_context(NSBitmapImageRep *image);
469 typedef id (*DWIMP)(id, SEL, ...); 469 typedef id (*DWIMP)(id, SEL, ...);
470 470
471 /* Internal function to queue a window redraw */ 471 /* Internal function to queue a window redraw */
2327 -(int)addRow:(NSArray *)input; 2327 -(int)addRow:(NSArray *)input;
2328 -(int)addRows:(int)number; 2328 -(int)addRows:(int)number;
2329 -(void)tableView:(NSTableView *)tableView willDisplayCell:(id)cell forTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row; 2329 -(void)tableView:(NSTableView *)tableView willDisplayCell:(id)cell forTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row;
2330 -(void)editCell:(id)input at:(int)row and:(int)col; 2330 -(void)editCell:(id)input at:(int)row and:(int)col;
2331 -(void)removeRow:(int)row; 2331 -(void)removeRow:(int)row;
2332 -(void)setRow:(int)row title:(void *)input; 2332 -(void)setRow:(int)row title:(const char *)input;
2333 -(void *)getRowTitle:(int)row; 2333 -(void *)getRowTitle:(int)row;
2334 -(id)getRow:(int)row and:(int)col; 2334 -(id)getRow:(int)row and:(int)col;
2335 -(int)cellType:(int)col; 2335 -(int)cellType:(int)col;
2336 -(int)lastAddPoint; 2336 -(int)lastAddPoint;
2337 -(int)lastQueryPoint; 2337 -(int)lastQueryPoint;
2579 } 2579 }
2580 if(oldtitle) 2580 if(oldtitle)
2581 free(oldtitle); 2581 free(oldtitle);
2582 } 2582 }
2583 } 2583 }
2584 -(void)setRow:(int)row title:(void *)input 2584 -(void)setRow:(int)row title:(const char *)input
2585 { 2585 {
2586 if(titles && input) 2586 if(titles && input)
2587 { 2587 {
2588 void *oldtitle = [titles pointerAtIndex:row]; 2588 void *oldtitle = [titles pointerAtIndex:row];
2589 void *newtitle = input ? (void *)strdup((char *)input) : NULL; 2589 void *newtitle = input ? (void *)strdup(input) : NULL;
2590 [titles replacePointerAtIndex:row withPointer:newtitle]; 2590 [titles replacePointerAtIndex:row withPointer:newtitle];
2591 if(oldtitle) 2591 if(oldtitle)
2592 free(oldtitle); 2592 free(oldtitle);
2593 } 2593 }
2594 } 2594 }
3301 Root = new; 3301 Root = new;
3302 } 3302 }
3303 } 3303 }
3304 3304
3305 /* Finds the message number for a given signal name */ 3305 /* Finds the message number for a given signal name */
3306 ULONG _findsigmessage(char *signame) 3306 ULONG _findsigmessage(const char *signame)
3307 { 3307 {
3308 int z; 3308 int z;
3309 3309
3310 for(z=0;z<SIGNALMAX;z++) 3310 for(z=0;z<SIGNALMAX;z++)
3311 { 3311 {
3937 * Displays a debug message on the console... 3937 * Displays a debug message on the console...
3938 * Parameters: 3938 * Parameters:
3939 * format: printf style format string. 3939 * format: printf style format string.
3940 * ...: Additional variables for use in the format. 3940 * ...: Additional variables for use in the format.
3941 */ 3941 */
3942 void API dw_debug(char *format, ...) 3942 void API dw_debug(const char *format, ...)
3943 { 3943 {
3944 va_list args; 3944 va_list args;
3945 char outbuf[1025] = {0}; 3945 char outbuf[1025] = {0};
3946 3946
3947 va_start(args, format); 3947 va_start(args, format);
3957 * title: The title of the message box. 3957 * title: The title of the message box.
3958 * flags: flags to indicate buttons and icon 3958 * flags: flags to indicate buttons and icon
3959 * format: printf style format string. 3959 * format: printf style format string.
3960 * ...: Additional variables for use in the format. 3960 * ...: Additional variables for use in the format.
3961 */ 3961 */
3962 int API dw_messagebox(char *title, int flags, char *format, ...) 3962 int API dw_messagebox(const char *title, int flags, const char *format, ...)
3963 { 3963 {
3964 NSInteger iResponse; 3964 NSInteger iResponse;
3965 NSString *button1 = @"OK"; 3965 NSString *button1 = @"OK";
3966 NSString *button2 = nil; 3966 NSString *button2 = nil;
3967 NSString *button3 = nil; 3967 NSString *button3 = nil;
4030 * Returns: 4030 * Returns:
4031 * NULL on error. A malloced buffer containing 4031 * NULL on error. A malloced buffer containing
4032 * the file path on success. 4032 * the file path on success.
4033 * 4033 *
4034 */ 4034 */
4035 char * API dw_file_browse(char *title, char *defpath, char *ext, int flags) 4035 char * API dw_file_browse(const char *title, const char *defpath, const char *ext, int flags)
4036 { 4036 {
4037 char temp[PATH_MAX+1]; 4037 char temp[PATH_MAX+1];
4038 char *file = NULL, *path = NULL; 4038 char *file = NULL, *path = NULL;
4039 DW_LOCAL_POOL_IN; 4039 DW_LOCAL_POOL_IN;
4040 4040
4220 /* 4220 /*
4221 * Sets the contents of the default clipboard to the supplied text. 4221 * Sets the contents of the default clipboard to the supplied text.
4222 * Parameters: 4222 * Parameters:
4223 * Text. 4223 * Text.
4224 */ 4224 */
4225 void dw_clipboard_set_text( char *str, int len) 4225 void dw_clipboard_set_text(const char *str, int len)
4226 { 4226 {
4227 NSPasteboard *pasteboard = [NSPasteboard generalPasteboard]; 4227 NSPasteboard *pasteboard = [NSPasteboard generalPasteboard];
4228 SEL scc = NSSelectorFromString(@"clearContents"); 4228 SEL scc = NSSelectorFromString(@"clearContents");
4229 4229
4230 if([pasteboard respondsToSelector:scc]) 4230 if([pasteboard respondsToSelector:scc])
4320 * Parameters: 4320 * Parameters:
4321 * type: Either DW_VERT (vertical) or DW_HORZ (horizontal). 4321 * type: Either DW_VERT (vertical) or DW_HORZ (horizontal).
4322 * pad: Number of pixels to pad around the box. 4322 * pad: Number of pixels to pad around the box.
4323 * title: Text to be displayined in the group outline. 4323 * title: Text to be displayined in the group outline.
4324 */ 4324 */
4325 HWND API dw_groupbox_new(int type, int pad, char *title) 4325 HWND API dw_groupbox_new(int type, int pad, const char *title)
4326 { 4326 {
4327 NSBox *groupbox = [[DWGroupBox alloc] init]; 4327 NSBox *groupbox = [[DWGroupBox alloc] init];
4328 DWBox *thisbox = dw_box_new(type, pad); 4328 DWBox *thisbox = dw_box_new(type, pad);
4329 Box *box = [thisbox box]; 4329 Box *box = [thisbox box];
4330 4330
5058 * Create a new Entryfield (password) window (widget) to be packed. 5058 * Create a new Entryfield (password) window (widget) to be packed.
5059 * Parameters: 5059 * Parameters:
5060 * text: The default text to be in the entryfield widget. 5060 * text: The default text to be in the entryfield widget.
5061 * id: An ID to be used with dw_window_from_id() or 0L. 5061 * id: An ID to be used with dw_window_from_id() or 0L.
5062 */ 5062 */
5063 HWND API dw_entryfield_password_new(char *text, ULONG cid) 5063 HWND API dw_entryfield_password_new(const char *text, ULONG cid)
5064 { 5064 {
5065 DWEntryFieldPassword *entry = [[DWEntryFieldPassword alloc] init]; 5065 DWEntryFieldPassword *entry = [[DWEntryFieldPassword alloc] init];
5066 [entry setStringValue:[ NSString stringWithUTF8String:text ]]; 5066 [entry setStringValue:[ NSString stringWithUTF8String:text ]];
5067 [entry setTag:cid]; 5067 [entry setTag:cid];
5068 [[entry cell] setScrollable:YES]; 5068 [[entry cell] setScrollable:YES];
5089 * Create a new bitmap button window (widget) to be packed. 5089 * Create a new bitmap button window (widget) to be packed.
5090 * Parameters: 5090 * Parameters:
5091 * text: Bubble help text to be displayed. 5091 * text: Bubble help text to be displayed.
5092 * id: An ID of a bitmap in the resource file. 5092 * id: An ID of a bitmap in the resource file.
5093 */ 5093 */
5094 HWND API dw_bitmapbutton_new(char *text, ULONG resid) 5094 HWND API dw_bitmapbutton_new(const char *text, ULONG resid)
5095 { 5095 {
5096 NSBundle *bundle = [NSBundle mainBundle]; 5096 NSBundle *bundle = [NSBundle mainBundle];
5097 NSString *respath = [bundle resourcePath]; 5097 NSString *respath = [bundle resourcePath];
5098 NSString *filepath = [respath stringByAppendingFormat:@"/%lu.png", resid]; 5098 NSString *filepath = [respath stringByAppendingFormat:@"/%lu.png", resid];
5099 NSImage *image = [[NSImage alloc] initWithContentsOfFile:filepath]; 5099 NSImage *image = [[NSImage alloc] initWithContentsOfFile:filepath];
5115 * id: An ID to be used with dw_window_from_id() or 0L. 5115 * id: An ID to be used with dw_window_from_id() or 0L.
5116 * filename: Name of the file, omit extention to have 5116 * filename: Name of the file, omit extention to have
5117 * DW pick the appropriate file extension. 5117 * DW pick the appropriate file extension.
5118 * (BMP on OS/2 or Windows, XPM on Unix) 5118 * (BMP on OS/2 or Windows, XPM on Unix)
5119 */ 5119 */
5120 HWND API dw_bitmapbutton_new_from_file(char *text, unsigned long cid, char *filename) 5120 HWND API dw_bitmapbutton_new_from_file(const char *text, unsigned long cid, const char *filename)
5121 { 5121 {
5122 char *ext = _dw_get_image_extension( filename ); 5122 char *ext = _dw_get_image_extension(filename);
5123 5123
5124 NSString *nstr = [ NSString stringWithUTF8String:filename ]; 5124 NSString *nstr = [ NSString stringWithUTF8String:filename ];
5125 NSImage *image = [[NSImage alloc] initWithContentsOfFile:nstr]; 5125 NSImage *image = [[NSImage alloc] initWithContentsOfFile:nstr];
5126 5126
5127 if(!image && ext) 5127 if(!image && ext)
5147 * id: An ID to be used with dw_window_from_id() or 0L. 5147 * id: An ID to be used with dw_window_from_id() or 0L.
5148 * data: The contents of the image 5148 * data: The contents of the image
5149 * (BMP or ICO on OS/2 or Windows, XPM on Unix) 5149 * (BMP or ICO on OS/2 or Windows, XPM on Unix)
5150 * len: length of str 5150 * len: length of str
5151 */ 5151 */
5152 HWND API dw_bitmapbutton_new_from_data(char *text, unsigned long cid, char *data, int len) 5152 HWND API dw_bitmapbutton_new_from_data(const char *text, unsigned long cid, const char *data, int len)
5153 { 5153 {
5154 NSData *thisdata = [NSData dataWithBytes:data length:len]; 5154 NSData *thisdata = [NSData dataWithBytes:data length:len];
5155 NSImage *image = [[NSImage alloc] initWithData:thisdata]; 5155 NSImage *image = [[NSImage alloc] initWithData:thisdata];
5156 DWButton *button = _button_new("", cid); 5156 DWButton *button = _button_new("", cid);
5157 if(image) 5157 if(image)
5168 * Create a new spinbutton window (widget) to be packed. 5168 * Create a new spinbutton window (widget) to be packed.
5169 * Parameters: 5169 * Parameters:
5170 * text: The text to be display by the static text widget. 5170 * text: The text to be display by the static text widget.
5171 * id: An ID to be used with dw_window_from_id() or 0L. 5171 * id: An ID to be used with dw_window_from_id() or 0L.
5172 */ 5172 */
5173 HWND API dw_spinbutton_new(char *text, ULONG cid) 5173 HWND API dw_spinbutton_new(const char *text, ULONG cid)
5174 { 5174 {
5175 DWSpinButton *spinbutton = [[DWSpinButton alloc] init]; 5175 DWSpinButton *spinbutton = [[DWSpinButton alloc] init];
5176 NSStepper *stepper = [spinbutton stepper]; 5176 NSStepper *stepper = [spinbutton stepper];
5177 NSTextField *textfield = [spinbutton textfield]; 5177 NSTextField *textfield = [spinbutton textfield];
5178 [stepper setIncrement:1]; 5178 [stepper setIncrement:1];
5512 * Appends the specified text to the listbox's (or combobox) entry list. 5512 * Appends the specified text to the listbox's (or combobox) entry list.
5513 * Parameters: 5513 * Parameters:
5514 * handle: Handle to the listbox to be appended to. 5514 * handle: Handle to the listbox to be appended to.
5515 * text: Text to append into listbox. 5515 * text: Text to append into listbox.
5516 */ 5516 */
5517 DW_FUNCTION_DEFINITION(dw_listbox_append, void, HWND handle, char *text) 5517 DW_FUNCTION_DEFINITION(dw_listbox_append, void, HWND handle, const char *text)
5518 DW_FUNCTION_ADD_PARAM2(handle, text) 5518 DW_FUNCTION_ADD_PARAM2(handle, text)
5519 DW_FUNCTION_NO_RETURN(dw_listbox_append) 5519 DW_FUNCTION_NO_RETURN(dw_listbox_append)
5520 DW_FUNCTION_RESTORE_PARAM2(handle, HWND, text, char *) 5520 DW_FUNCTION_RESTORE_PARAM2(handle, HWND, text, char *)
5521 { 5521 {
5522 DW_FUNCTION_INIT; 5522 DW_FUNCTION_INIT;
5763 * Parameters: 5763 * Parameters:
5764 * handle: Handle to the listbox to be queried. 5764 * handle: Handle to the listbox to be queried.
5765 * index: Index into the list to be queried. 5765 * index: Index into the list to be queried.
5766 * buffer: Buffer where text will be copied. 5766 * buffer: Buffer where text will be copied.
5767 */ 5767 */
5768 DW_FUNCTION_DEFINITION(dw_listbox_set_text, void, HWND handle, unsigned int index, char *buffer) 5768 DW_FUNCTION_DEFINITION(dw_listbox_set_text, void, HWND handle, unsigned int index, const char *buffer)
5769 DW_FUNCTION_ADD_PARAM3(handle, index, buffer) 5769 DW_FUNCTION_ADD_PARAM3(handle, index, buffer)
5770 DW_FUNCTION_NO_RETURN(dw_listbox_set_text) 5770 DW_FUNCTION_NO_RETURN(dw_listbox_set_text)
5771 DW_FUNCTION_RESTORE_PARAM3(handle, HWND, index, unsigned int, buffer, char *) 5771 DW_FUNCTION_RESTORE_PARAM3(handle, HWND, index, unsigned int, buffer, char *)
5772 { 5772 {
5773 DW_FUNCTION_INIT; 5773 DW_FUNCTION_INIT;
6267 * Create a new status text window (widget) to be packed. 6267 * Create a new status text window (widget) to be packed.
6268 * Parameters: 6268 * Parameters:
6269 * text: The text to be display by the static text widget. 6269 * text: The text to be display by the static text widget.
6270 * id: An ID to be used with dw_window_from_id() or 0L. 6270 * id: An ID to be used with dw_window_from_id() or 0L.
6271 */ 6271 */
6272 HWND API dw_status_text_new(char *text, ULONG cid) 6272 HWND API dw_status_text_new(const char *text, ULONG cid)
6273 { 6273 {
6274 NSBox *border = [[NSBox alloc] init]; 6274 NSBox *border = [[NSBox alloc] init];
6275 NSTextField *textfield = dw_text_new(text, cid); 6275 NSTextField *textfield = dw_text_new(text, cid);
6276 6276
6277 [border setBorderType:NSGrooveBorder]; 6277 [border setBorderType:NSGrooveBorder];
6289 * Create a new static text window (widget) to be packed. 6289 * Create a new static text window (widget) to be packed.
6290 * Parameters: 6290 * Parameters:
6291 * text: The text to be display by the static text widget. 6291 * text: The text to be display by the static text widget.
6292 * id: An ID to be used with dw_window_from_id() or 0L. 6292 * id: An ID to be used with dw_window_from_id() or 0L.
6293 */ 6293 */
6294 HWND API dw_text_new(char *text, ULONG cid) 6294 HWND API dw_text_new(const char *text, ULONG cid)
6295 { 6295 {
6296 DWText *textfield = [[DWText alloc] init]; 6296 DWText *textfield = [[DWText alloc] init];
6297 [textfield setEditable:NO]; 6297 [textfield setEditable:NO];
6298 [textfield setSelectable:NO]; 6298 [textfield setSelectable:NO];
6299 [textfield setBordered:NO]; 6299 [textfield setBordered:NO];
6562 * pixmap: Handle to the pixmap. (choose only one of these) 6562 * pixmap: Handle to the pixmap. (choose only one of these)
6563 * x: X coordinate. 6563 * x: X coordinate.
6564 * y: Y coordinate. 6564 * y: Y coordinate.
6565 * text: Text to be displayed. 6565 * text: Text to be displayed.
6566 */ 6566 */
6567 DW_FUNCTION_DEFINITION(dw_draw_text, void, HWND handle, HPIXMAP pixmap, int x, int y, char *text) 6567 DW_FUNCTION_DEFINITION(dw_draw_text, void, HWND handle, HPIXMAP pixmap, int x, int y, const char *text)
6568 DW_FUNCTION_ADD_PARAM5(handle, pixmap, x, y, text) 6568 DW_FUNCTION_ADD_PARAM5(handle, pixmap, x, y, text)
6569 DW_FUNCTION_NO_RETURN(dw_draw_text) 6569 DW_FUNCTION_NO_RETURN(dw_draw_text)
6570 DW_FUNCTION_RESTORE_PARAM5(handle, HWND, pixmap, HPIXMAP, x, int, y, int, text, char *) 6570 DW_FUNCTION_RESTORE_PARAM5(handle, HWND, pixmap, HPIXMAP, x, int, y, int, text, const char *)
6571 { 6571 {
6572 DW_FUNCTION_INIT; 6572 DW_FUNCTION_INIT;
6573 DW_LOCAL_POOL_IN; 6573 DW_LOCAL_POOL_IN;
6574 id image = handle; 6574 id image = handle;
6575 NSString *nstr = [ NSString stringWithUTF8String:text ]; 6575 NSString *nstr = [ NSString stringWithUTF8String:text ];
6635 * pixmap: Handle to the pixmap. (choose only one of these) 6635 * pixmap: Handle to the pixmap. (choose only one of these)
6636 * text: Text to be queried. 6636 * text: Text to be queried.
6637 * width: Pointer to a variable to be filled in with the width. 6637 * width: Pointer to a variable to be filled in with the width.
6638 * height Pointer to a variable to be filled in with the height. 6638 * height Pointer to a variable to be filled in with the height.
6639 */ 6639 */
6640 void API dw_font_text_extents_get(HWND handle, HPIXMAP pixmap, char *text, int *width, int *height) 6640 void API dw_font_text_extents_get(HWND handle, HPIXMAP pixmap, const char *text, int *width, int *height)
6641 { 6641 {
6642 id object = handle; 6642 id object = handle;
6643 NSString *nstr; 6643 NSString *nstr;
6644 NSFont *font = nil; 6644 NSFont *font = nil;
6645 DW_LOCAL_POOL_IN; 6645 DW_LOCAL_POOL_IN;
6974 * title: The text title of the entry. 6974 * title: The text title of the entry.
6975 * icon: Handle to coresponding icon. 6975 * icon: Handle to coresponding icon.
6976 * parent: Parent handle or 0 if root. 6976 * parent: Parent handle or 0 if root.
6977 * itemdata: Item specific data. 6977 * itemdata: Item specific data.
6978 */ 6978 */
6979 DW_FUNCTION_DEFINITION(dw_tree_insert_after, HTREEITEM, HWND handle, HTREEITEM item, char *title, HICN icon, HTREEITEM parent, void *itemdata) 6979 DW_FUNCTION_DEFINITION(dw_tree_insert_after, HTREEITEM, HWND handle, HTREEITEM item, const char *title, HICN icon, HTREEITEM parent, void *itemdata)
6980 DW_FUNCTION_ADD_PARAM6(handle, item, title, icon, parent, itemdata) 6980 DW_FUNCTION_ADD_PARAM6(handle, item, title, icon, parent, itemdata)
6981 DW_FUNCTION_RETURN(dw_tree_insert_after, HTREEITEM) 6981 DW_FUNCTION_RETURN(dw_tree_insert_after, HTREEITEM)
6982 DW_FUNCTION_RESTORE_PARAM6(handle, HWND, item, HTREEITEM, title, char *, icon, HICN, parent, HTREEITEM, itemdata, void *) 6982 DW_FUNCTION_RESTORE_PARAM6(handle, HWND, item, HTREEITEM, title, char *, icon, HICN, parent, HTREEITEM, itemdata, void *)
6983 { 6983 {
6984 DW_FUNCTION_INIT; 6984 DW_FUNCTION_INIT;
7007 * title: The text title of the entry. 7007 * title: The text title of the entry.
7008 * icon: Handle to coresponding icon. 7008 * icon: Handle to coresponding icon.
7009 * parent: Parent handle or 0 if root. 7009 * parent: Parent handle or 0 if root.
7010 * itemdata: Item specific data. 7010 * itemdata: Item specific data.
7011 */ 7011 */
7012 HTREEITEM API dw_tree_insert(HWND handle, char *title, HICN icon, HTREEITEM parent, void *itemdata) 7012 HTREEITEM API dw_tree_insert(HWND handle, const char *title, HICN icon, HTREEITEM parent, void *itemdata)
7013 { 7013 {
7014 return dw_tree_insert_after(handle, NULL, title, icon, parent, itemdata); 7014 return dw_tree_insert_after(handle, NULL, title, icon, parent, itemdata);
7015 } 7015 }
7016 7016
7017 /* 7017 /*
7058 * handle: Handle to the tree containing the item. 7058 * handle: Handle to the tree containing the item.
7059 * item: Handle of the item to be modified. 7059 * item: Handle of the item to be modified.
7060 * title: The text title of the entry. 7060 * title: The text title of the entry.
7061 * icon: Handle to coresponding icon. 7061 * icon: Handle to coresponding icon.
7062 */ 7062 */
7063 DW_FUNCTION_DEFINITION(dw_tree_item_change, void, HWND handle, HTREEITEM item, char *title, HICN icon) 7063 DW_FUNCTION_DEFINITION(dw_tree_item_change, void, HWND handle, HTREEITEM item, const char *title, HICN icon)
7064 DW_FUNCTION_ADD_PARAM4(handle, item, title, icon) 7064 DW_FUNCTION_ADD_PARAM4(handle, item, title, icon)
7065 DW_FUNCTION_NO_RETURN(dw_tree_item_change) 7065 DW_FUNCTION_NO_RETURN(dw_tree_item_change)
7066 DW_FUNCTION_RESTORE_PARAM4(handle, HWND, item, HTREEITEM, title, char *, icon, HICN) 7066 DW_FUNCTION_RESTORE_PARAM4(handle, HWND, item, HTREEITEM, title, char *, icon, HICN)
7067 { 7067 {
7068 DW_FUNCTION_INIT; 7068 DW_FUNCTION_INIT;
7295 * Configures the main filesystem columnn title for localization. 7295 * Configures the main filesystem columnn title for localization.
7296 * Parameters: 7296 * Parameters:
7297 * handle: Handle to the container to be configured. 7297 * handle: Handle to the container to be configured.
7298 * title: The title to be displayed in the main column. 7298 * title: The title to be displayed in the main column.
7299 */ 7299 */
7300 void API dw_filesystem_set_column_title(HWND handle, char *title) 7300 void API dw_filesystem_set_column_title(HWND handle, const char *title)
7301 { 7301 {
7302 char *newtitle = strdup(title ? title : ""); 7302 char *newtitle = strdup(title ? title : "");
7303 7303
7304 dw_window_set_data(handle, "_dw_coltitle", newtitle); 7304 dw_window_set_data(handle, "_dw_coltitle", newtitle);
7305 } 7305 }
7470 * pointer: Pointer to the allocated memory in dw_container_alloc(). 7470 * pointer: Pointer to the allocated memory in dw_container_alloc().
7471 * column: Zero based column of data being set. 7471 * column: Zero based column of data being set.
7472 * row: Zero based row of data being set. 7472 * row: Zero based row of data being set.
7473 * data: Pointer to the data to be added. 7473 * data: Pointer to the data to be added.
7474 */ 7474 */
7475 void API dw_filesystem_change_file(HWND handle, int row, char *filename, HICN icon) 7475 void API dw_filesystem_change_file(HWND handle, int row, const char *filename, HICN icon)
7476 { 7476 {
7477 dw_filesystem_set_file(handle, NULL, row, filename, icon); 7477 dw_filesystem_set_file(handle, NULL, row, filename, icon);
7478 } 7478 }
7479 7479
7480 /* 7480 /*
7484 * pointer: Pointer to the allocated memory in dw_container_alloc(). 7484 * pointer: Pointer to the allocated memory in dw_container_alloc().
7485 * column: Zero based column of data being set. 7485 * column: Zero based column of data being set.
7486 * row: Zero based row of data being set. 7486 * row: Zero based row of data being set.
7487 * data: Pointer to the data to be added. 7487 * data: Pointer to the data to be added.
7488 */ 7488 */
7489 DW_FUNCTION_DEFINITION(dw_filesystem_set_file, void, HWND handle, void *pointer, int row, char *filename, HICN icon) 7489 DW_FUNCTION_DEFINITION(dw_filesystem_set_file, void, HWND handle, void *pointer, int row, const char *filename, HICN icon)
7490 DW_FUNCTION_ADD_PARAM5(handle, pointer, row, filename, icon) 7490 DW_FUNCTION_ADD_PARAM5(handle, pointer, row, filename, icon)
7491 DW_FUNCTION_NO_RETURN(dw_filesystem_set_file) 7491 DW_FUNCTION_NO_RETURN(dw_filesystem_set_file)
7492 DW_FUNCTION_RESTORE_PARAM5(handle, HWND, pointer, void *, row, int, filename, char *, icon, HICN) 7492 DW_FUNCTION_RESTORE_PARAM5(handle, HWND, pointer, void *, row, int, filename, char *, icon, HICN)
7493 { 7493 {
7494 DW_FUNCTION_INIT; 7494 DW_FUNCTION_INIT;
7613 * Parameters: 7613 * Parameters:
7614 * pointer: Pointer to the allocated memory in dw_container_alloc(). 7614 * pointer: Pointer to the allocated memory in dw_container_alloc().
7615 * row: Zero based row of data being set. 7615 * row: Zero based row of data being set.
7616 * title: String title of the item. 7616 * title: String title of the item.
7617 */ 7617 */
7618 DW_FUNCTION_DEFINITION(dw_container_set_row_title, void, void *pointer, int row, char *title) 7618 DW_FUNCTION_DEFINITION(dw_container_set_row_title, void, void *pointer, int row, const char *title)
7619 DW_FUNCTION_ADD_PARAM3(pointer, row, title) 7619 DW_FUNCTION_ADD_PARAM3(pointer, row, title)
7620 DW_FUNCTION_NO_RETURN(dw_container_set_row_title) 7620 DW_FUNCTION_NO_RETURN(dw_container_set_row_title)
7621 DW_FUNCTION_RESTORE_PARAM3(pointer, void *, row, int, title, char *) 7621 DW_FUNCTION_RESTORE_PARAM3(pointer, void *, row, int, title, char *)
7622 { 7622 {
7623 DW_FUNCTION_INIT; 7623 DW_FUNCTION_INIT;
7653 * Parameters: 7653 * Parameters:
7654 * handle: Handle to window (widget) of container. 7654 * handle: Handle to window (widget) of container.
7655 * row: Zero based row of data being set. 7655 * row: Zero based row of data being set.
7656 * title: String title of the item. 7656 * title: String title of the item.
7657 */ 7657 */
7658 DW_FUNCTION_DEFINITION(dw_container_change_row_title, void, HWND handle, int row, char *title) 7658 DW_FUNCTION_DEFINITION(dw_container_change_row_title, void, HWND handle, int row, const char *title)
7659 DW_FUNCTION_ADD_PARAM3(handle, row, title) 7659 DW_FUNCTION_ADD_PARAM3(handle, row, title)
7660 DW_FUNCTION_NO_RETURN(dw_container_change_row_title) 7660 DW_FUNCTION_NO_RETURN(dw_container_change_row_title)
7661 DW_FUNCTION_RESTORE_PARAM3(handle, HWND, row, int, title, char *) 7661 DW_FUNCTION_RESTORE_PARAM3(handle, HWND, row, int, title, char *)
7662 { 7662 {
7663 DW_FUNCTION_INIT; 7663 DW_FUNCTION_INIT;
7882 * Cursors the item with the text speficied, and scrolls to that item. 7882 * Cursors the item with the text speficied, and scrolls to that item.
7883 * Parameters: 7883 * Parameters:
7884 * handle: Handle to the window (widget) to be queried. 7884 * handle: Handle to the window (widget) to be queried.
7885 * text: Text usually returned by dw_container_query(). 7885 * text: Text usually returned by dw_container_query().
7886 */ 7886 */
7887 DW_FUNCTION_DEFINITION(dw_container_cursor, void, HWND handle, char *text) 7887 DW_FUNCTION_DEFINITION(dw_container_cursor, void, HWND handle, const char *text)
7888 DW_FUNCTION_ADD_PARAM2(handle, text) 7888 DW_FUNCTION_ADD_PARAM2(handle, text)
7889 DW_FUNCTION_NO_RETURN(dw_container_cursor) 7889 DW_FUNCTION_NO_RETURN(dw_container_cursor)
7890 DW_FUNCTION_RESTORE_PARAM2(handle, HWND, text, char *) 7890 DW_FUNCTION_RESTORE_PARAM2(handle, HWND, text, char *)
7891 { 7891 {
7892 DW_FUNCTION_INIT; 7892 DW_FUNCTION_INIT;
7954 * Deletes the item with the text speficied. 7954 * Deletes the item with the text speficied.
7955 * Parameters: 7955 * Parameters:
7956 * handle: Handle to the window (widget). 7956 * handle: Handle to the window (widget).
7957 * text: Text usually returned by dw_container_query(). 7957 * text: Text usually returned by dw_container_query().
7958 */ 7958 */
7959 DW_FUNCTION_DEFINITION(dw_container_delete_row, void, HWND handle, char *text) 7959 DW_FUNCTION_DEFINITION(dw_container_delete_row, void, HWND handle, const char *text)
7960 DW_FUNCTION_ADD_PARAM2(handle, text) 7960 DW_FUNCTION_ADD_PARAM2(handle, text)
7961 DW_FUNCTION_NO_RETURN(dw_container_delete_row) 7961 DW_FUNCTION_NO_RETURN(dw_container_delete_row)
7962 DW_FUNCTION_RESTORE_PARAM2(handle, HWND, text, char *) 7962 DW_FUNCTION_RESTORE_PARAM2(handle, HWND, text, char *)
7963 { 7963 {
7964 DW_FUNCTION_INIT; 7964 DW_FUNCTION_INIT;
8033 * Parameters: 8033 * Parameters:
8034 * handle: Window handle that will handle taskbar icon messages. 8034 * handle: Window handle that will handle taskbar icon messages.
8035 * icon: Icon handle to display in the taskbar. 8035 * icon: Icon handle to display in the taskbar.
8036 * bubbletext: Text to show when the mouse is above the icon. 8036 * bubbletext: Text to show when the mouse is above the icon.
8037 */ 8037 */
8038 void API dw_taskbar_insert(HWND handle, HICN icon, char *bubbletext) 8038 void API dw_taskbar_insert(HWND handle, HICN icon, const char *bubbletext)
8039 { 8039 {
8040 #ifdef BUILDING_FOR_YOSEMITE 8040 #ifdef BUILDING_FOR_YOSEMITE
8041 NSStatusItem *item = [[[NSStatusBar systemStatusBar] statusItemWithLength:NSSquareStatusItemLength] retain]; 8041 NSStatusItem *item = [[[NSStatusBar systemStatusBar] statusItemWithLength:NSSquareStatusItemLength] retain];
8042 NSStatusBarButton *button = [item button]; 8042 NSStatusBarButton *button = [item button];
8043 NSImage *image = icon; 8043 NSImage *image = icon;
8116 * Parameters: 8116 * Parameters:
8117 * filename: Name of the file, omit extention to have 8117 * filename: Name of the file, omit extention to have
8118 * DW pick the appropriate file extension. 8118 * DW pick the appropriate file extension.
8119 * (ICO on OS/2 or Windows, XPM on Unix) 8119 * (ICO on OS/2 or Windows, XPM on Unix)
8120 */ 8120 */
8121 HICN API dw_icon_load_from_file(char *filename) 8121 HICN API dw_icon_load_from_file(const char *filename)
8122 { 8122 {
8123 char *ext = _dw_get_image_extension( filename ); 8123 char *ext = _dw_get_image_extension( filename );
8124 8124
8125 NSString *nstr = [ NSString stringWithUTF8String:filename ]; 8125 NSString *nstr = [ NSString stringWithUTF8String:filename ];
8126 NSImage *image = [[NSImage alloc] initWithContentsOfFile:nstr]; 8126 NSImage *image = [[NSImage alloc] initWithContentsOfFile:nstr];
8138 * Parameters: 8138 * Parameters:
8139 * filename: Name of the file, omit extention to have 8139 * filename: Name of the file, omit extention to have
8140 * DW pick the appropriate file extension. 8140 * DW pick the appropriate file extension.
8141 * (ICO on OS/2 or Windows, XPM on Unix) 8141 * (ICO on OS/2 or Windows, XPM on Unix)
8142 */ 8142 */
8143 HICN API dw_icon_load_from_data(char *data, int len) 8143 HICN API dw_icon_load_from_data(const char *data, int len)
8144 { 8144 {
8145 NSData *thisdata = [NSData dataWithBytes:data length:len]; 8145 NSData *thisdata = [NSData dataWithBytes:data length:len];
8146 NSImage *image = [[NSImage alloc] initWithData:thisdata]; 8146 NSImage *image = [[NSImage alloc] initWithData:thisdata];
8147 _icon_resize(image); 8147 _icon_resize(image);
8148 return image; 8148 return image;
8285 } 8285 }
8286 return retval; 8286 return retval;
8287 } 8287 }
8288 8288
8289 /* Internal function to convert fontname to NSFont */ 8289 /* Internal function to convert fontname to NSFont */
8290 NSFont *_dw_font_by_name(char *fontname) 8290 NSFont *_dw_font_by_name(const char *fontname)
8291 { 8291 {
8292 char *fontcopy = strdup(fontname); 8292 char *fontcopy = strdup(fontname);
8293 char *name = strchr(fontcopy, '.'); 8293 char *name = strchr(fontcopy, '.');
8294 NSFont *font = nil; 8294 NSFont *font = nil;
8295 8295
8387 * DW pick the appropriate file extension. 8387 * DW pick the appropriate file extension.
8388 * (BMP on OS/2 or Windows, XPM on Unix) 8388 * (BMP on OS/2 or Windows, XPM on Unix)
8389 * Returns: 8389 * Returns:
8390 * A handle to a pixmap or NULL on failure. 8390 * A handle to a pixmap or NULL on failure.
8391 */ 8391 */
8392 HPIXMAP API dw_pixmap_new_from_file(HWND handle, char *filename) 8392 HPIXMAP API dw_pixmap_new_from_file(HWND handle, const char *filename)
8393 { 8393 {
8394 HPIXMAP pixmap; 8394 HPIXMAP pixmap;
8395 DW_LOCAL_POOL_IN; 8395 DW_LOCAL_POOL_IN;
8396 char *ext = _dw_get_image_extension( filename ); 8396 char *ext = _dw_get_image_extension( filename );
8397 8397
8441 * (BMP on OS/2 or Windows, XPM on Unix) 8441 * (BMP on OS/2 or Windows, XPM on Unix)
8442 * le: length of data 8442 * le: length of data
8443 * Returns: 8443 * Returns:
8444 * A handle to a pixmap or NULL on failure. 8444 * A handle to a pixmap or NULL on failure.
8445 */ 8445 */
8446 HPIXMAP API dw_pixmap_new_from_data(HWND handle, char *data, int len) 8446 HPIXMAP API dw_pixmap_new_from_data(HWND handle, const char *data, int len)
8447 { 8447 {
8448 HPIXMAP pixmap; 8448 HPIXMAP pixmap;
8449 DW_LOCAL_POOL_IN; 8449 DW_LOCAL_POOL_IN;
8450 8450
8451 if(!(pixmap = calloc(1,sizeof(struct _hpixmap)))) 8451 if(!(pixmap = calloc(1,sizeof(struct _hpixmap))))
8555 * passed to the application via a callback. 8555 * passed to the application via a callback.
8556 * fontname: Name and size of the font in the form "size.fontname" 8556 * fontname: Name and size of the font in the form "size.fontname"
8557 * Returns: 8557 * Returns:
8558 * DW_ERROR_NONE on success and DW_ERROR_GENERAL on failure. 8558 * DW_ERROR_NONE on success and DW_ERROR_GENERAL on failure.
8559 */ 8559 */
8560 int API dw_pixmap_set_font(HPIXMAP pixmap, char *fontname) 8560 int API dw_pixmap_set_font(HPIXMAP pixmap, const char *fontname)
8561 { 8561 {
8562 if(pixmap) 8562 if(pixmap)
8563 { 8563 {
8564 NSFont *font = _dw_font_by_name(fontname); 8564 NSFont *font = _dw_font_by_name(fontname);
8565 8565
8779 * string: String buffer containt HTML code to 8779 * string: String buffer containt HTML code to
8780 * be rendered. 8780 * be rendered.
8781 * Returns: 8781 * Returns:
8782 * 0 on success. 8782 * 0 on success.
8783 */ 8783 */
8784 int API dw_html_raw(HWND handle, char *string) 8784 int API dw_html_raw(HWND handle, const char *string)
8785 { 8785 {
8786 DWWebView *html = handle; 8786 DWWebView *html = handle;
8787 #if WK_API_ENABLED 8787 #if WK_API_ENABLED
8788 [html loadHTMLString:[ NSString stringWithUTF8String:string ] baseURL:nil]; 8788 [html loadHTMLString:[ NSString stringWithUTF8String:string ] baseURL:nil];
8789 #else 8789 #else
8799 * url: Universal Resource Locator of the web or 8799 * url: Universal Resource Locator of the web or
8800 * file object to be rendered. 8800 * file object to be rendered.
8801 * Returns: 8801 * Returns:
8802 * 0 on success. 8802 * 0 on success.
8803 */ 8803 */
8804 int API dw_html_url(HWND handle, char *url) 8804 int API dw_html_url(HWND handle, const char *url)
8805 { 8805 {
8806 DWWebView *html = handle; 8806 DWWebView *html = handle;
8807 #if WK_API_ENABLED 8807 #if WK_API_ENABLED
8808 [html loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[ NSString stringWithUTF8String:url ]]]]; 8808 [html loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[ NSString stringWithUTF8String:url ]]]];
8809 #else 8809 #else
8820 * scriptdata: Data passed to the signal handler. 8820 * scriptdata: Data passed to the signal handler.
8821 * Notes: A DW_SIGNAL_HTML_RESULT event will be raised with scriptdata. 8821 * Notes: A DW_SIGNAL_HTML_RESULT event will be raised with scriptdata.
8822 * Returns: 8822 * Returns:
8823 * DW_ERROR_NONE (0) on success. 8823 * DW_ERROR_NONE (0) on success.
8824 */ 8824 */
8825 int dw_html_javascript_run(HWND handle, char *script, void *scriptdata) 8825 int dw_html_javascript_run(HWND handle, const char *script, void *scriptdata)
8826 { 8826 {
8827 DWWebView *html = handle; 8827 DWWebView *html = handle;
8828 DW_LOCAL_POOL_IN; 8828 DW_LOCAL_POOL_IN;
8829 8829
8830 #if WK_API_ENABLED 8830 #if WK_API_ENABLED
9264 * Parameters: 9264 * Parameters:
9265 * handle: Notebook handle. 9265 * handle: Notebook handle.
9266 * pageid: Page ID of the tab to set. 9266 * pageid: Page ID of the tab to set.
9267 * text: Pointer to the text to set. 9267 * text: Pointer to the text to set.
9268 */ 9268 */
9269 void API dw_notebook_page_set_text(HWND handle, ULONG pageid, char *text) 9269 void API dw_notebook_page_set_text(HWND handle, ULONG pageid, const char *text)
9270 { 9270 {
9271 DWNotebook *notebook = handle; 9271 DWNotebook *notebook = handle;
9272 DWNotebookPage *notepage = _notepage_from_id(notebook, pageid); 9272 DWNotebookPage *notepage = _notepage_from_id(notebook, pageid);
9273 9273
9274 if(notepage != nil) 9274 if(notepage != nil)
9282 * Parameters: 9282 * Parameters:
9283 * handle: Notebook handle. 9283 * handle: Notebook handle.
9284 * pageid: Page ID of the tab to set. 9284 * pageid: Page ID of the tab to set.
9285 * text: Pointer to the text to set. 9285 * text: Pointer to the text to set.
9286 */ 9286 */
9287 void API dw_notebook_page_set_status_text(HWND handle, ULONG pageid, char *text) 9287 void API dw_notebook_page_set_status_text(HWND handle, ULONG pageid, const char *text)
9288 { 9288 {
9289 /* Note supported here... do nothing */ 9289 /* Note supported here... do nothing */
9290 } 9290 }
9291 9291
9292 /* 9292 /*
9321 * Parameters: 9321 * Parameters:
9322 * owner: The Owner's window handle or HWND_DESKTOP. 9322 * owner: The Owner's window handle or HWND_DESKTOP.
9323 * title: The Window title. 9323 * title: The Window title.
9324 * flStyle: Style flags, see the PM reference. 9324 * flStyle: Style flags, see the PM reference.
9325 */ 9325 */
9326 DW_FUNCTION_DEFINITION(dw_window_new, HWND, HWND hwndOwner, char *title, ULONG flStyle) 9326 DW_FUNCTION_DEFINITION(dw_window_new, HWND, HWND hwndOwner, const char *title, ULONG flStyle)
9327 DW_FUNCTION_ADD_PARAM3(hwndOwner, title, flStyle) 9327 DW_FUNCTION_ADD_PARAM3(hwndOwner, title, flStyle)
9328 DW_FUNCTION_RETURN(dw_window_new, HWND) 9328 DW_FUNCTION_RETURN(dw_window_new, HWND)
9329 DW_FUNCTION_RESTORE_PARAM3(hwndOwner, HWND, title, char *, flStyle, ULONG) 9329 DW_FUNCTION_RESTORE_PARAM3(hwndOwner, HWND, title, char *, flStyle, ULONG)
9330 { 9330 {
9331 DW_FUNCTION_INIT; 9331 DW_FUNCTION_INIT;
9798 * Parameters: 9798 * Parameters:
9799 * currfont: current font 9799 * currfont: current font
9800 * Returns: 9800 * Returns:
9801 * A malloced buffer with the selected font or NULL on error. 9801 * A malloced buffer with the selected font or NULL on error.
9802 */ 9802 */
9803 char * API dw_font_choose(char *currfont) 9803 char * API dw_font_choose(const char *currfont)
9804 { 9804 {
9805 /* Create the Color Chooser Dialog class. */ 9805 /* Create the Color Chooser Dialog class. */
9806 static DWFontChoose *fontDlg = nil; 9806 static DWFontChoose *fontDlg = nil;
9807 static NSFontManager *fontManager = nil; 9807 static NSFontManager *fontManager = nil;
9808 DWDialog *dialog; 9808 DWDialog *dialog;
9887 * Sets the font used by a specified window (widget) handle. 9887 * Sets the font used by a specified window (widget) handle.
9888 * Parameters: 9888 * Parameters:
9889 * handle: The window (widget) handle. 9889 * handle: The window (widget) handle.
9890 * fontname: Name and size of the font in the form "size.fontname" 9890 * fontname: Name and size of the font in the form "size.fontname"
9891 */ 9891 */
9892 int API dw_window_set_font(HWND handle, char *fontname) 9892 int API dw_window_set_font(HWND handle, const char *fontname)
9893 { 9893 {
9894 NSFont *font = _dw_font_by_name(fontname); 9894 NSFont *font = _dw_font_by_name(fontname);
9895 9895
9896 if(font) 9896 if(font)
9897 { 9897 {
10093 * Sets the text used for a given window. 10093 * Sets the text used for a given window.
10094 * Parameters: 10094 * Parameters:
10095 * handle: Handle to the window. 10095 * handle: Handle to the window.
10096 * text: The text associsated with a given window. 10096 * text: The text associsated with a given window.
10097 */ 10097 */
10098 DW_FUNCTION_DEFINITION(dw_window_set_text, void, HWND handle, char *text) 10098 DW_FUNCTION_DEFINITION(dw_window_set_text, void, HWND handle, const char *text)
10099 DW_FUNCTION_ADD_PARAM2(handle, text) 10099 DW_FUNCTION_ADD_PARAM2(handle, text)
10100 DW_FUNCTION_NO_RETURN(dw_window_set_text) 10100 DW_FUNCTION_NO_RETURN(dw_window_set_text)
10101 DW_FUNCTION_RESTORE_PARAM2(handle, HWND, text, char *) 10101 DW_FUNCTION_RESTORE_PARAM2(handle, HWND, text, char *)
10102 { 10102 {
10103 DW_FUNCTION_INIT; 10103 DW_FUNCTION_INIT;
10146 * Sets the text used for a given window's floating bubble help. 10146 * Sets the text used for a given window's floating bubble help.
10147 * Parameters: 10147 * Parameters:
10148 * handle: Handle to the window (widget). 10148 * handle: Handle to the window (widget).
10149 * bubbletext: The text in the floating bubble tooltip. 10149 * bubbletext: The text in the floating bubble tooltip.
10150 */ 10150 */
10151 DW_FUNCTION_DEFINITION(dw_window_set_tooltip, void, HWND handle, char *bubbletext) 10151 DW_FUNCTION_DEFINITION(dw_window_set_tooltip, void, HWND handle, const char *bubbletext)
10152 DW_FUNCTION_ADD_PARAM2(handle, bubbletext) 10152 DW_FUNCTION_ADD_PARAM2(handle, bubbletext)
10153 DW_FUNCTION_NO_RETURN(dw_window_set_tooltip) 10153 DW_FUNCTION_NO_RETURN(dw_window_set_tooltip)
10154 DW_FUNCTION_RESTORE_PARAM2(handle, HWND, bubbletext, char *) 10154 DW_FUNCTION_RESTORE_PARAM2(handle, HWND, bubbletext, char *)
10155 { 10155 {
10156 DW_FUNCTION_INIT; 10156 DW_FUNCTION_INIT;
10232 * (pass 0 if you use the filename param) 10232 * (pass 0 if you use the filename param)
10233 * filename: a path to a file (Bitmap on OS/2 or 10233 * filename: a path to a file (Bitmap on OS/2 or
10234 * Windows and a pixmap on Unix, pass 10234 * Windows and a pixmap on Unix, pass
10235 * NULL if you use the id param) 10235 * NULL if you use the id param)
10236 */ 10236 */
10237 void API dw_window_set_bitmap_from_data(HWND handle, unsigned long cid, char *data, int len) 10237 void API dw_window_set_bitmap_from_data(HWND handle, unsigned long cid, const char *data, int len)
10238 { 10238 {
10239 id object = handle; 10239 id object = handle;
10240 10240
10241 if([ object isKindOfClass:[ NSImageView class ] ] || [ object isKindOfClass:[ NSButton class ]]) 10241 if([ object isKindOfClass:[ NSImageView class ] ] || [ object isKindOfClass:[ NSButton class ]])
10242 { 10242 {
10275 * (pass 0 if you use the filename param) 10275 * (pass 0 if you use the filename param)
10276 * filename: a path to a file (Bitmap on OS/2 or 10276 * filename: a path to a file (Bitmap on OS/2 or
10277 * Windows and a pixmap on Unix, pass 10277 * Windows and a pixmap on Unix, pass
10278 * NULL if you use the id param) 10278 * NULL if you use the id param)
10279 */ 10279 */
10280 void API dw_window_set_bitmap(HWND handle, unsigned long resid, char *filename) 10280 void API dw_window_set_bitmap(HWND handle, unsigned long resid, const char *filename)
10281 { 10281 {
10282 id object = handle; 10282 id object = handle;
10283 DW_LOCAL_POOL_IN; 10283 DW_LOCAL_POOL_IN;
10284 10284
10285 if([ object isKindOfClass:[ NSImageView class ] ] || [ object isKindOfClass:[ NSButton class ]]) 10285 if([ object isKindOfClass:[ NSImageView class ] ] || [ object isKindOfClass:[ NSButton class ]])
10739 10739
10740 /* Functions for managing the user data lists that are associated with 10740 /* Functions for managing the user data lists that are associated with
10741 * a given window handle. Used in dw_window_set_data() and 10741 * a given window handle. Used in dw_window_set_data() and
10742 * dw_window_get_data(). 10742 * dw_window_get_data().
10743 */ 10743 */
10744 UserData *_find_userdata(UserData **root, char *varname) 10744 UserData *_find_userdata(UserData **root, const char *varname)
10745 { 10745 {
10746 UserData *tmp = *root; 10746 UserData *tmp = *root;
10747 10747
10748 while(tmp) 10748 while(tmp)
10749 { 10749 {
10752 tmp = tmp->next; 10752 tmp = tmp->next;
10753 } 10753 }
10754 return NULL; 10754 return NULL;
10755 } 10755 }
10756 10756
10757 int _new_userdata(UserData **root, char *varname, void *data) 10757 int _new_userdata(UserData **root, const char *varname, void *data)
10758 { 10758 {
10759 UserData *new = _find_userdata(root, varname); 10759 UserData *new = _find_userdata(root, varname);
10760 10760
10761 if(new) 10761 if(new)
10762 { 10762 {
10790 } 10790 }
10791 } 10791 }
10792 return FALSE; 10792 return FALSE;
10793 } 10793 }
10794 10794
10795 int _remove_userdata(UserData **root, char *varname, int all) 10795 int _remove_userdata(UserData **root, const char *varname, int all)
10796 { 10796 {
10797 UserData *prev = NULL, *tmp = *root; 10797 UserData *prev = NULL, *tmp = *root;
10798 10798
10799 while(tmp) 10799 while(tmp)
10800 { 10800 {
10834 * Parameters: 10834 * Parameters:
10835 * window: Window handle of signal to be called back. 10835 * window: Window handle of signal to be called back.
10836 * dataname: A string pointer identifying which signal to be hooked. 10836 * dataname: A string pointer identifying which signal to be hooked.
10837 * data: User data to be passed to the handler function. 10837 * data: User data to be passed to the handler function.
10838 */ 10838 */
10839 void dw_window_set_data(HWND window, char *dataname, void *data) 10839 void dw_window_set_data(HWND window, const char *dataname, void *data)
10840 { 10840 {
10841 id object = window; 10841 id object = window;
10842 if([object isMemberOfClass:[DWWindow class]]) 10842 if([object isMemberOfClass:[DWWindow class]])
10843 { 10843 {
10844 NSWindow *win = window; 10844 NSWindow *win = window;
10876 * Parameters: 10876 * Parameters:
10877 * window: Window handle of signal to be called back. 10877 * window: Window handle of signal to be called back.
10878 * dataname: A string pointer identifying which signal to be hooked. 10878 * dataname: A string pointer identifying which signal to be hooked.
10879 * data: User data to be passed to the handler function. 10879 * data: User data to be passed to the handler function.
10880 */ 10880 */
10881 void *dw_window_get_data(HWND window, char *dataname) 10881 void *dw_window_get_data(HWND window, const char *dataname)
10882 { 10882 {
10883 id object = window; 10883 id object = window;
10884 if([object isMemberOfClass:[DWWindow class]]) 10884 if([object isMemberOfClass:[DWWindow class]])
10885 { 10885 {
10886 NSWindow *win = window; 10886 NSWindow *win = window;
10986 * window: Window handle of signal to be called back. 10986 * window: Window handle of signal to be called back.
10987 * signame: A string pointer identifying which signal to be hooked. 10987 * signame: A string pointer identifying which signal to be hooked.
10988 * sigfunc: The pointer to the function to be used as the callback. 10988 * sigfunc: The pointer to the function to be used as the callback.
10989 * data: User data to be passed to the handler function. 10989 * data: User data to be passed to the handler function.
10990 */ 10990 */
10991 void API dw_signal_connect(HWND window, char *signame, void *sigfunc, void *data) 10991 void API dw_signal_connect(HWND window, const char *signame, void *sigfunc, void *data)
10992 { 10992 {
10993 dw_signal_connect_data(window, signame, sigfunc, NULL, data); 10993 dw_signal_connect_data(window, signame, sigfunc, NULL, data);
10994 } 10994 }
10995 10995
10996 /* 10996 /*
11000 * signame: A string pointer identifying which signal to be hooked. 11000 * signame: A string pointer identifying which signal to be hooked.
11001 * sigfunc: The pointer to the function to be used as the callback. 11001 * sigfunc: The pointer to the function to be used as the callback.
11002 * discfunc: The pointer to the function called when this handler is removed. 11002 * discfunc: The pointer to the function called when this handler is removed.
11003 * data: User data to be passed to the handler function. 11003 * data: User data to be passed to the handler function.
11004 */ 11004 */
11005 void API dw_signal_connect_data(HWND window, char *signame, void *sigfunc, void *discfunc, void *data) 11005 void API dw_signal_connect_data(HWND window, const char *signame, void *sigfunc, void *discfunc, void *data)
11006 { 11006 {
11007 ULONG message = 0, msgid = 0; 11007 ULONG message = 0, msgid = 0;
11008 11008
11009 /* Handle special case of application delete signal */ 11009 /* Handle special case of application delete signal */
11010 if(!window && signame && strcmp(signame, DW_SIGNAL_DELETE) == 0) 11010 if(!window && signame && strcmp(signame, DW_SIGNAL_DELETE) == 0)
11024 /* 11024 /*
11025 * Removes callbacks for a given window with given name. 11025 * Removes callbacks for a given window with given name.
11026 * Parameters: 11026 * Parameters:
11027 * window: Window handle of callback to be removed. 11027 * window: Window handle of callback to be removed.
11028 */ 11028 */
11029 void API dw_signal_disconnect_by_name(HWND window, char *signame) 11029 void API dw_signal_disconnect_by_name(HWND window, const char *signame)
11030 { 11030 {
11031 SignalHandler *prev = NULL, *tmp = Root; 11031 SignalHandler *prev = NULL, *tmp = Root;
11032 ULONG message; 11032 ULONG message;
11033 11033
11034 if(!window || !signame || (message = _findsigmessage(signame)) == 0) 11034 if(!window || !signame || (message = _findsigmessage(signame)) == 0)
11207 * handle: Module handle returned by dw_module_load() 11207 * handle: Module handle returned by dw_module_load()
11208 * name: Name of the symbol you want the address of. 11208 * name: Name of the symbol you want the address of.
11209 * func: A pointer to a function pointer, to obtain 11209 * func: A pointer to a function pointer, to obtain
11210 * the address. 11210 * the address.
11211 */ 11211 */
11212 int dw_module_symbol(HMOD handle, char *name, void**func) 11212 int dw_module_symbol(HMOD handle, const char *name, void**func)
11213 { 11213 {
11214 if(!func || !name) 11214 if(!func || !name)
11215 return -1; 11215 return -1;
11216 11216
11217 if(strlen(name) == 0) 11217 if(strlen(name) == 0)
11594 * Parameters: 11594 * Parameters:
11595 * eve: Pointer to an event handle to receive handle. 11595 * eve: Pointer to an event handle to receive handle.
11596 * name: Name given to semaphore which can be opened 11596 * name: Name given to semaphore which can be opened
11597 * by other processes. 11597 * by other processes.
11598 */ 11598 */
11599 HEV dw_named_event_new(char *name) 11599 HEV dw_named_event_new(const char *name)
11600 { 11600 {
11601 struct sockaddr_un un; 11601 struct sockaddr_un un;
11602 int ev, *tmpsock = (int *)malloc(sizeof(int)*2); 11602 int ev, *tmpsock = (int *)malloc(sizeof(int)*2);
11603 HEV eve; 11603 HEV eve;
11604 DWTID dwthread; 11604 DWTID dwthread;
11655 * Parameters: 11655 * Parameters:
11656 * eve: Pointer to an event handle to receive handle. 11656 * eve: Pointer to an event handle to receive handle.
11657 * name: Name given to semaphore which can be opened 11657 * name: Name given to semaphore which can be opened
11658 * by other processes. 11658 * by other processes.
11659 */ 11659 */
11660 HEV dw_named_event_get(char *name) 11660 HEV dw_named_event_get(const char *name)
11661 { 11661 {
11662 struct sockaddr_un un; 11662 struct sockaddr_un un;
11663 HEV eve; 11663 HEV eve;
11664 int ev = socket(AF_UNIX, SOCK_STREAM, 0); 11664 int ev = socket(AF_UNIX, SOCK_STREAM, 0);
11665 if(ev < 0) 11665 if(ev < 0)
11863 /* 11863 /*
11864 * Sets the default font used on text based widgets. 11864 * Sets the default font used on text based widgets.
11865 * Parameters: 11865 * Parameters:
11866 * fontname: Font name in Dynamic Windows format. 11866 * fontname: Font name in Dynamic Windows format.
11867 */ 11867 */
11868 void API dw_font_set_default(char *fontname) 11868 void API dw_font_set_default(const char *fontname)
11869 { 11869 {
11870 NSFont *oldfont = DWDefaultFont; 11870 NSFont *oldfont = DWDefaultFont;
11871 DWDefaultFont = _dw_font_by_name(fontname); 11871 DWDefaultFont = _dw_font_by_name(fontname);
11872 [DWDefaultFont retain]; 11872 [DWDefaultFont retain];
11873 [oldfont release]; 11873 [oldfont release];
11971 * handle: A pointer to receive a SHM identifier. 11971 * handle: A pointer to receive a SHM identifier.
11972 * dest: A pointer to a pointer to receive the memory address. 11972 * dest: A pointer to a pointer to receive the memory address.
11973 * size: Size in bytes of the shared memory region to allocate. 11973 * size: Size in bytes of the shared memory region to allocate.
11974 * name: A string pointer to a unique memory name. 11974 * name: A string pointer to a unique memory name.
11975 */ 11975 */
11976 HSHM dw_named_memory_new(void **dest, int size, char *name) 11976 HSHM dw_named_memory_new(void **dest, int size, const char *name)
11977 { 11977 {
11978 char namebuf[1025] = {0}; 11978 char namebuf[1025] = {0};
11979 struct _dw_unix_shm *handle = malloc(sizeof(struct _dw_unix_shm)); 11979 struct _dw_unix_shm *handle = malloc(sizeof(struct _dw_unix_shm));
11980 11980
11981 mkdir("/tmp/.dw", S_IWGRP|S_IWOTH); 11981 mkdir("/tmp/.dw", S_IWGRP|S_IWOTH);
12012 * Parameters: 12012 * Parameters:
12013 * dest: A pointer to a pointer to receive the memory address. 12013 * dest: A pointer to a pointer to receive the memory address.
12014 * size: Size in bytes of the shared memory region to requested. 12014 * size: Size in bytes of the shared memory region to requested.
12015 * name: A string pointer to a unique memory name. 12015 * name: A string pointer to a unique memory name.
12016 */ 12016 */
12017 HSHM dw_named_memory_get(void **dest, int size, char *name) 12017 HSHM dw_named_memory_get(void **dest, int size, const char *name)
12018 { 12018 {
12019 char namebuf[1025]; 12019 char namebuf[1025];
12020 struct _dw_unix_shm *handle = malloc(sizeof(struct _dw_unix_shm)); 12020 struct _dw_unix_shm *handle = malloc(sizeof(struct _dw_unix_shm));
12021 12021
12022 mkdir("/tmp/.dw", S_IWGRP|S_IWOTH); 12022 mkdir("/tmp/.dw", S_IWGRP|S_IWOTH);
12115 * type: Either DW_EXEC_CON or DW_EXEC_GUI. 12115 * type: Either DW_EXEC_CON or DW_EXEC_GUI.
12116 * params: An array of pointers to string arguements. 12116 * params: An array of pointers to string arguements.
12117 * Returns: 12117 * Returns:
12118 * -1 on error. 12118 * -1 on error.
12119 */ 12119 */
12120 int dw_exec(char *program, int type, char **params) 12120 int dw_exec(const char *program, int type, char **params)
12121 { 12121 {
12122 int ret = -1; 12122 int ret = -1;
12123 12123
12124 if(type == DW_EXEC_GUI) 12124 if(type == DW_EXEC_GUI)
12125 { 12125 {
12382 * utf8string: UTF-8 encoded source string. 12382 * utf8string: UTF-8 encoded source string.
12383 * Returns: 12383 * Returns:
12384 * Wide string that needs to be freed with dw_free() 12384 * Wide string that needs to be freed with dw_free()
12385 * or NULL on failure. 12385 * or NULL on failure.
12386 */ 12386 */
12387 wchar_t * API dw_utf8_to_wchar(char *utf8string) 12387 wchar_t * API dw_utf8_to_wchar(const char *utf8string)
12388 { 12388 {
12389 size_t buflen = strlen(utf8string) + 1; 12389 size_t buflen = strlen(utf8string) + 1;
12390 wchar_t *temp = malloc(buflen * sizeof(wchar_t)); 12390 wchar_t *temp = malloc(buflen * sizeof(wchar_t));
12391 if(temp) 12391 if(temp)
12392 mbstowcs(temp, utf8string, buflen); 12392 mbstowcs(temp, utf8string, buflen);
12399 * wstring: Wide source string. 12399 * wstring: Wide source string.
12400 * Returns: 12400 * Returns:
12401 * UTF-8 encoded string that needs to be freed with dw_free() 12401 * UTF-8 encoded string that needs to be freed with dw_free()
12402 * or NULL on failure. 12402 * or NULL on failure.
12403 */ 12403 */
12404 char * API dw_wchar_to_utf8(wchar_t *wstring) 12404 char * API dw_wchar_to_utf8(const wchar_t *wstring)
12405 { 12405 {
12406 size_t bufflen = 8 * wcslen(wstring) + 1; 12406 size_t bufflen = 8 * wcslen(wstring) + 1;
12407 char *temp = malloc(bufflen); 12407 char *temp = malloc(bufflen);
12408 if(temp) 12408 if(temp)
12409 wcstombs(temp, wstring, bufflen); 12409 wcstombs(temp, wstring, bufflen);