diff dw.h @ 2034:89d62197124b

Visual C in C++ mode complains about missing const declarations in paramaters. So adding const to any string parameters which are not written to. Probably going to require changes to the other platforms due to header changes.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sun, 17 Nov 2019 03:13:37 +0000
parents 6f1adc77de02
children ea303d356419
line wrap: on
line diff
--- a/dw.h	Sat Nov 16 09:43:17 2019 +0000
+++ b/dw.h	Sun Nov 17 03:13:37 2019 +0000
@@ -1580,37 +1580,37 @@
 int API dw_window_lower(HWND handle);
 int API dw_window_destroy(HWND handle);
 void API dw_window_redraw(HWND handle);
-int API dw_window_set_font(HWND handle, char *fontname);
+int API dw_window_set_font(HWND handle, const char *fontname);
 char * API dw_window_get_font(HWND handle);
 int API dw_window_set_color(HWND handle, unsigned long fore, unsigned long back);
-HWND API dw_window_new(HWND hwndOwner, char *title, unsigned long flStyle);
+HWND API dw_window_new(HWND hwndOwner, const char *title, unsigned long flStyle);
 HWND API dw_box_new(int type, int pad);
 HWND API dw_scrollbox_new(int type, int pad);
 int API dw_scrollbox_get_pos( HWND handle, int orient );
 int API dw_scrollbox_get_range( HWND handle, int orient );
-HWND API dw_groupbox_new(int type, int pad, char *title);
+HWND API dw_groupbox_new(int type, int pad, const char *title);
 DW_DEPRECATED(HWND API dw_mdi_new(unsigned long id), "Due to lack of full Mac support consider avoiding this function.");
 HWND API dw_bitmap_new(unsigned long id);
-HWND API dw_bitmapbutton_new(char *text, unsigned long id);
-HWND API dw_bitmapbutton_new_from_file(char *text, unsigned long id, char *filename);
-HWND API dw_bitmapbutton_new_from_data(char *text, unsigned long id, char *str, int len);
+HWND API dw_bitmapbutton_new(const char *text, unsigned long id);
+HWND API dw_bitmapbutton_new_from_file(const char *text, unsigned long id, const char *filename);
+HWND API dw_bitmapbutton_new_from_data(const char *text, unsigned long id, const char *str, int len);
 HWND API dw_container_new(unsigned long id, int multi);
 HWND API dw_tree_new(unsigned long id);
-HWND API dw_text_new(char *text, unsigned long id);
-HWND API dw_status_text_new(char *text, unsigned long id);
+HWND API dw_text_new(const char *text, unsigned long id);
+HWND API dw_status_text_new(const char *text, unsigned long id);
 HWND API dw_mle_new(unsigned long id);
 HWND API dw_entryfield_new(char *text, unsigned long id);
-HWND API dw_entryfield_password_new(char *text, ULONG id);
+HWND API dw_entryfield_password_new(const char *text, ULONG id);
 HWND API dw_combobox_new(char *text, unsigned long id);
 HWND API dw_button_new(char *text, unsigned long id);
-HWND API dw_spinbutton_new(char *text, unsigned long id);
+HWND API dw_spinbutton_new(char const *text, unsigned long id);
 HWND API dw_radiobutton_new(char *text, ULONG id);
 HWND API dw_percent_new(unsigned long id);
 HWND API dw_slider_new(int vertical, int increments, ULONG id);
 HWND API dw_scrollbar_new(int vertical, ULONG id);
 HWND API dw_checkbox_new(char *text, unsigned long id);
 HWND API dw_listbox_new(unsigned long id, int multi);
-void API dw_listbox_append(HWND handle, char *text);
+void API dw_listbox_append(HWND handle, const char *text);
 void API dw_listbox_insert(HWND handle, char *text, int pos);
 void API dw_listbox_list_append(HWND handle, char **text, int count);
 void API dw_listbox_clear(HWND handle);
@@ -1619,7 +1619,7 @@
 void API dw_listbox_select(HWND handle, int index, int state);
 void API dw_listbox_delete(HWND handle, int index);
 void API dw_listbox_get_text(HWND handle, unsigned int index, char *buffer, unsigned int length);
-void API dw_listbox_set_text(HWND handle, unsigned int index, char *buffer);
+void API dw_listbox_set_text(HWND handle, unsigned int index, const char *buffer);
 int API dw_listbox_selected(HWND handle);
 int API dw_listbox_selected_multi(HWND handle, int where);
 void API dw_percent_set_pos(HWND handle, unsigned int position);
@@ -1636,11 +1636,11 @@
 void API dw_window_set_gravity(HWND handle, int horz, int vert);
 void API dw_window_set_style(HWND handle, unsigned long style, unsigned long mask);
 void API dw_window_set_icon(HWND handle, HICN icon);
-void API dw_window_set_bitmap(HWND handle, unsigned long id, char *filename);
-void API dw_window_set_bitmap_from_data(HWND handle, unsigned long id, char *data, int len);
+void API dw_window_set_bitmap(HWND handle, unsigned long id, const char *filename);
+void API dw_window_set_bitmap_from_data(HWND handle, unsigned long id, const char *data, int len);
 char * API dw_window_get_text(HWND handle);
-void API dw_window_set_text(HWND handle, char *text);
-void API dw_window_set_tooltip(HWND handle, char *bubbletext);
+void API dw_window_set_text(HWND handle, const char *text);
+void API dw_window_set_tooltip(HWND handle, const char *bubbletext);
 int API dw_window_set_border(HWND handle, int border);
 void API dw_window_disable(HWND handle);
 void API dw_window_enable(HWND handle);
@@ -1670,11 +1670,11 @@
 long API dw_spinbutton_get_pos(HWND handle);
 int API dw_checkbox_get(HWND handle);
 void API dw_checkbox_set(HWND handle, int value);
-HTREEITEM API dw_tree_insert(HWND handle, char *title, HICN icon, HTREEITEM parent, void *itemdata);
-HTREEITEM API dw_tree_insert_after(HWND handle, HTREEITEM item, char *title, HICN icon, HTREEITEM parent, void *itemdata);
+HTREEITEM API dw_tree_insert(HWND handle, const char *title, HICN icon, HTREEITEM parent, void *itemdata);
+HTREEITEM API dw_tree_insert_after(HWND handle, HTREEITEM item, const char *title, HICN icon, HTREEITEM parent, void *itemdata);
 void API dw_tree_clear(HWND handle);
 void API dw_tree_item_delete(HWND handle, HTREEITEM item);
-void API dw_tree_item_change(HWND handle, HTREEITEM item, char *title, HICN icon);
+void API dw_tree_item_change(HWND handle, HTREEITEM item, const char *title, HICN icon);
 void API dw_tree_item_expand(HWND handle, HTREEITEM item);
 void API dw_tree_item_collapse(HWND handle, HTREEITEM item);
 void API dw_tree_item_select(HWND handle, HTREEITEM item);
@@ -1684,15 +1684,15 @@
 HTREEITEM API dw_tree_get_parent(HWND handle, HTREEITEM item);
 int API dw_container_setup(HWND handle, unsigned long *flags, char **titles, int count, int separator);
 HICN API dw_icon_load(unsigned long module, unsigned long id);
-HICN API dw_icon_load_from_file(char *filename);
-HICN API dw_icon_load_from_data(char *data, int len);
+HICN API dw_icon_load_from_file(const char *filename);
+HICN API dw_icon_load_from_data(const char *data, int len);
 void API dw_icon_free(HICN handle);
 void * API dw_container_alloc(HWND handle, int rowcount);
 void API dw_container_set_item(HWND handle, void *pointer, int column, int row, void *data);
 void API dw_container_change_item(HWND handle, int column, int row, void *data);
 void API dw_container_set_column_width(HWND handle, int column, int width);
-void API dw_container_set_row_title(void *pointer, int row, char *title);
-void API dw_container_change_row_title(HWND handle, int row, char *title);
+void API dw_container_set_row_title(void *pointer, int row, const char *title);
+void API dw_container_change_row_title(HWND handle, int row, const char *title);
 void API dw_container_set_row_data(void *pointer, int row, void *data);
 void API dw_container_change_row_data(HWND handle, int row, void *data);
 void API dw_container_insert(HWND handle, void *pointer, int rowcount);
@@ -1701,21 +1701,21 @@
 char * API dw_container_query_start(HWND handle, unsigned long flags);
 char * API dw_container_query_next(HWND handle, unsigned long flags);
 void API dw_container_scroll(HWND handle, int direction, long rows);
-void API dw_container_cursor(HWND handle, char *text);
+void API dw_container_cursor(HWND handle, const char *text);
 void API dw_container_cursor_by_data(HWND handle, void *data);
-void API dw_container_delete_row(HWND handle, char *text);
+void API dw_container_delete_row(HWND handle, const char *text);
 void API dw_container_delete_row_by_data(HWND handle, void *data);
 void API dw_container_optimize(HWND handle);
 void API dw_container_set_stripe(HWND handle, unsigned long oddcolor, unsigned long evencolor);
-void API dw_filesystem_set_column_title(HWND handle, char *title);
+void API dw_filesystem_set_column_title(HWND handle, const char *title);
 int API dw_filesystem_setup(HWND handle, unsigned long *flags, char **titles, int count);
 void API dw_filesystem_set_item(HWND handle, void *pointer, int column, int row, void *data);
-void API dw_filesystem_set_file(HWND handle, void *pointer, int row, char *filename, HICN icon);
+void API dw_filesystem_set_file(HWND handle, void *pointer, int row, const char *filename, HICN icon);
 void API dw_filesystem_change_item(HWND handle, int column, int row, void *data);
-void API dw_filesystem_change_file(HWND handle, int row, char *filename, HICN icon);
+void API dw_filesystem_change_file(HWND handle, int row, const char *filename, HICN icon);
 int API dw_container_get_column_type(HWND handle, int column);
 int API dw_filesystem_get_column_type(HWND handle, int column);
-void API dw_taskbar_insert(HWND handle, HICN icon, char *bubbletext);
+void API dw_taskbar_insert(HWND handle, HICN icon, const char *bubbletext);
 void API dw_taskbar_delete(HWND handle, HICN icon);
 int API dw_screen_width(void);
 int API dw_screen_height(void);
@@ -1723,8 +1723,8 @@
 HWND API dw_notebook_new(unsigned long id, int top);
 unsigned long API dw_notebook_page_new(HWND handle, unsigned long flags, int front);
 void API dw_notebook_page_destroy(HWND handle, unsigned int pageid);
-void API dw_notebook_page_set_text(HWND handle, unsigned long pageid, char *text);
-void API dw_notebook_page_set_status_text(HWND handle, unsigned long pageid, char *text);
+void API dw_notebook_page_set_text(HWND handle, unsigned long pageid, const char *text);
+void API dw_notebook_page_set_status_text(HWND handle, unsigned long pageid, const char *text);
 void API dw_notebook_page_set(HWND handle, unsigned int pageid);
 unsigned long API dw_notebook_page_get(HWND handle);
 void API dw_notebook_pack(HWND handle, unsigned long pageid, HWND page);
@@ -1762,73 +1762,73 @@
 void API dw_color_foreground_set(unsigned long value);
 void API dw_color_background_set(unsigned long value);
 unsigned long API dw_color_choose(unsigned long value);
-char * API dw_font_choose(char *currfont);
+char * API dw_font_choose(const char *currfont);
 void API dw_draw_point(HWND handle, HPIXMAP pixmap, int x, int y);
 void API dw_draw_line(HWND handle, HPIXMAP pixmap, int x1, int y1, int x2, int y2);
 void API dw_draw_rect(HWND handle, HPIXMAP pixmap, int fill, int x, int y, int width, int height);
 void API dw_draw_polygon(HWND handle, HPIXMAP pixmap, int fill, int npoints, int *x, int *y);
 void API dw_draw_arc(HWND handle, HPIXMAP pixmap, int flags, int xorigin, int yorigin, int x1, int y1, int x2, int y2);
-void API dw_draw_text(HWND handle, HPIXMAP pixmap, int x, int y, char *text);
-void API dw_font_text_extents_get(HWND handle, HPIXMAP pixmap, char *text, int *width, int *height);
-void API dw_font_set_default(char *fontname);
+void API dw_draw_text(HWND handle, HPIXMAP pixmap, int x, int y, const char *text);
+void API dw_font_text_extents_get(HWND handle, HPIXMAP pixmap, const char *text, int *width, int *height);
+void API dw_font_set_default(const char *fontname);
 void API dw_flush(void);
 void API dw_pixmap_bitblt(HWND dest, HPIXMAP destp, int xdest, int ydest, int width, int height, HWND src, HPIXMAP srcp, int xsrc, int ysrc);
 int API dw_pixmap_stretch_bitblt(HWND dest, HPIXMAP destp, int xdest, int ydest, int width, int height, HWND src, HPIXMAP srcp, int xsrc, int ysrc, int srcwidth, int srcheight);
 HPIXMAP API dw_pixmap_new(HWND handle, unsigned long width, unsigned long height, int depth);
-HPIXMAP API dw_pixmap_new_from_file(HWND handle, char *filename);
-HPIXMAP API dw_pixmap_new_from_data(HWND handle, char *data, int len);
+HPIXMAP API dw_pixmap_new_from_file(HWND handle, const char *filename);
+HPIXMAP API dw_pixmap_new_from_data(HWND handle, const char *data, int len);
 HPIXMAP API dw_pixmap_grab(HWND handle, ULONG id);
 void API dw_pixmap_set_transparent_color( HPIXMAP pixmap, ULONG color );
-int API dw_pixmap_set_font(HPIXMAP pixmap, char *fontname);
+int API dw_pixmap_set_font(HPIXMAP pixmap, const char *fontname);
 void API dw_pixmap_destroy(HPIXMAP pixmap);
 void API dw_beep(int freq, int dur);
-void API dw_debug(char *format, ...);
-int API dw_messagebox(char *title, int flags, char *format, ...);
+void API dw_debug(const char *format, ...);
+int API dw_messagebox(const char *title, int flags, const char *format, ...);
 void API dw_environment_query(DWEnv *env);
-int API dw_exec(char *program, int type, char **params);
+int API dw_exec(const char *program, int type, char **params);
 int API dw_browse(char *url);
-char * API dw_file_browse(char *title, char *defpath, char *ext, int flags);
+char * API dw_file_browse(const char *title, const char *defpath, char *ext, int flags);
 char * API dw_user_dir(void);
 char * API dw_app_dir(void);
 DWDialog * API dw_dialog_new(void *data);
 int API dw_dialog_dismiss(DWDialog *dialog, void *result);
 void * API dw_dialog_wait(DWDialog *dialog);
-void API dw_window_set_data(HWND window, char *dataname, void *data);
-void * API dw_window_get_data(HWND window, char *dataname);
+void API dw_window_set_data(HWND window, const char *dataname, void *data);
+void * API dw_window_get_data(HWND window, const char *dataname);
 int API dw_module_load(char *name, HMOD *handle);
-int API dw_module_symbol(HMOD handle, char *name, void**func);
+int API dw_module_symbol(HMOD handle, const char *name, void**func);
 int API dw_module_close(HMOD handle);
 int API dw_timer_connect(int interval, void *sigfunc, void *data);
 void API dw_timer_disconnect(int id);
-void API dw_signal_connect(HWND window, char *signame, void *sigfunc, void *data);
-void API dw_signal_connect_data(HWND window, char *signame, void *sigfunc, void *discfunc, void *data);
+void API dw_signal_connect(HWND window, const char *signame, void *sigfunc, void *data);
+void API dw_signal_connect_data(HWND window, const char *signame, void *sigfunc, void *discfunc, void *data);
 void API dw_signal_disconnect_by_window(HWND window);
 void API dw_signal_disconnect_by_data(HWND window, void *data);
-void API dw_signal_disconnect_by_name(HWND window, char *signame);
-HEV API dw_named_event_new(char *name);
-HEV API dw_named_event_get(char *name);
+void API dw_signal_disconnect_by_name(HWND window, const char *signame);
+HEV API dw_named_event_new(const char *name);
+HEV API dw_named_event_get(const char *name);
 int API dw_named_event_reset(HEV eve);
 int API dw_named_event_post(HEV eve);
 int API dw_named_event_wait(HEV eve, unsigned long timeout);
 int API dw_named_event_close(HEV eve);
-HSHM API dw_named_memory_new(void **dest, int size, char *name);
-HSHM API dw_named_memory_get(void **dest, int size, char *name);
+HSHM API dw_named_memory_new(void **dest, int size, const char *name);
+HSHM API dw_named_memory_get(void **dest, int size, const char *name);
 int API dw_named_memory_free(HSHM handle, void *ptr);
 void API dw_html_action(HWND hwnd, int action);
-int API dw_html_raw(HWND hwnd, char *string);
-int API dw_html_url(HWND hwnd, char *url);
-int API dw_html_javascript_run(HWND hwnd, char *script, void *scriptdata);
+int API dw_html_raw(HWND hwnd, const char *string);
+int API dw_html_url(HWND hwnd, const char *url);
+int API dw_html_javascript_run(HWND hwnd, const char *script, void *scriptdata);
 HWND API dw_html_new(unsigned long id);
 char * API dw_clipboard_get_text(void);
-void API dw_clipboard_set_text( char *str, int len );
+void API dw_clipboard_set_text(const char *str, int len);
 HWND API dw_calendar_new(unsigned long id);
-void API dw_calendar_set_date( HWND window, unsigned int year, unsigned int month, unsigned int day );
-void API dw_calendar_get_date( HWND window, unsigned int *year, unsigned int *month, unsigned int *day );
+void API dw_calendar_set_date(HWND window, unsigned int year, unsigned int month, unsigned int day);
+void API dw_calendar_get_date(HWND window, unsigned int *year, unsigned int *month, unsigned int *day);
 HPRINT API dw_print_new(char *jobname, unsigned long flags, unsigned int pages, void *drawfunc, void *drawdata);
 int API dw_print_run(HPRINT print, unsigned long flags);
 void API dw_print_cancel(HPRINT print);
-wchar_t * API dw_utf8_to_wchar(char *utf8string);
-char * API dw_wchar_to_utf8(wchar_t *wstring);
+wchar_t * API dw_utf8_to_wchar(const char *utf8string);
+char * API dw_wchar_to_utf8(const wchar_t *wstring);
 /* Exported for language bindings */
 void API _dw_init_thread(void);
 void API _dw_deinit_thread(void);