comparison gtk/dw.c @ 2036:48b91f535f82

GTK: More const changes... a few more commits to finish.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sun, 17 Nov 2019 05:16:04 +0000
parents 2dfce1ced00f
children f7c462f27829
comparison
equal deleted inserted replaced
2035:ea303d356419 2036:48b91f535f82
1157 usleep(period * 1000); 1157 usleep(period * 1000);
1158 #endif 1158 #endif
1159 } 1159 }
1160 1160
1161 /* Finds the translation function for a given signal name */ 1161 /* Finds the translation function for a given signal name */
1162 static void *_findsigfunc(char *signame) 1162 static void *_findsigfunc(const char *signame)
1163 { 1163 {
1164 int z; 1164 int z;
1165 1165
1166 for(z=0;z<SIGNALMAX;z++) 1166 for(z=0;z<SIGNALMAX;z++)
1167 { 1167 {
2350 * Displays a debug message on the console... 2350 * Displays a debug message on the console...
2351 * Parameters: 2351 * Parameters:
2352 * format: printf style format string. 2352 * format: printf style format string.
2353 * ...: Additional variables for use in the format. 2353 * ...: Additional variables for use in the format.
2354 */ 2354 */
2355 void API dw_debug(char *format, ...) 2355 void API dw_debug(const char *format, ...)
2356 { 2356 {
2357 va_list args; 2357 va_list args;
2358 char outbuf[1025] = {0}; 2358 char outbuf[1025] = {0};
2359 2359
2360 va_start(args, format); 2360 va_start(args, format);
2370 * title: The title of the message box. 2370 * title: The title of the message box.
2371 * flags: Defines buttons and icons to display 2371 * flags: Defines buttons and icons to display
2372 * format: printf style format string. 2372 * format: printf style format string.
2373 * ...: Additional variables for use in the format. 2373 * ...: Additional variables for use in the format.
2374 */ 2374 */
2375 int dw_messagebox(char *title, int flags, char *format, ...) 2375 int dw_messagebox(const char *title, int flags, const char *format, ...)
2376 { 2376 {
2377 HWND entrywindow, texttargetbox, imagetextbox, mainbox, okbutton, nobutton, yesbutton, cancelbutton, buttonbox, stext; 2377 HWND entrywindow, texttargetbox, imagetextbox, mainbox, okbutton, nobutton, yesbutton, cancelbutton, buttonbox, stext;
2378 ULONG flStyle = DW_FCF_TITLEBAR | DW_FCF_SHELLPOSITION | DW_FCF_DLGBORDER; 2378 ULONG flStyle = DW_FCF_TITLEBAR | DW_FCF_SHELLPOSITION | DW_FCF_DLGBORDER;
2379 DWDialog *dwwait; 2379 DWDialog *dwwait;
2380 va_list args; 2380 va_list args;
2836 DW_MUTEX_LOCK; 2836 DW_MUTEX_LOCK;
2837 gdk_window_reparent(GTK_WIDGET(handle)->window, newparent ? GTK_WIDGET(newparent)->window : GDK_ROOT_PARENT(), 0, 0); 2837 gdk_window_reparent(GTK_WIDGET(handle)->window, newparent ? GTK_WIDGET(newparent)->window : GDK_ROOT_PARENT(), 0, 0);
2838 DW_MUTEX_UNLOCK; 2838 DW_MUTEX_UNLOCK;
2839 } 2839 }
2840 2840
2841 static int _set_font(HWND handle, char *fontname) 2841 static int _set_font(HWND handle, const char *fontname)
2842 { 2842 {
2843 int retval = FALSE; 2843 int retval = FALSE;
2844 #if GTK_MAJOR_VERSION < 2 2844 #if GTK_MAJOR_VERSION < 2
2845 GtkStyle *style; 2845 GtkStyle *style;
2846 GdkFont *font = NULL; 2846 GdkFont *font = NULL;
2929 * Parameters: 2929 * Parameters:
2930 * currfont: current font 2930 * currfont: current font
2931 * Returns: 2931 * Returns:
2932 * A malloced buffer with the selected font or NULL on error. 2932 * A malloced buffer with the selected font or NULL on error.
2933 */ 2933 */
2934 char * API dw_font_choose(char *currfont) 2934 char * API dw_font_choose(const char *currfont)
2935 { 2935 {
2936 GtkFontSelectionDialog *fd; 2936 GtkFontSelectionDialog *fd;
2937 char *font = currfont ? strdup(currfont) : NULL; 2937 char *font = currfont ? strdup(currfont) : NULL;
2938 char *name = font ? strchr(font, '.') : NULL; 2938 char *name = font ? strchr(font, '.') : NULL;
2939 int _locked_by_me = FALSE; 2939 int _locked_by_me = FALSE;
2987 /* 2987 /*
2988 * Sets the default font used on text based widgets. 2988 * Sets the default font used on text based widgets.
2989 * Parameters: 2989 * Parameters:
2990 * fontname: Font name in Dynamic Windows format. 2990 * fontname: Font name in Dynamic Windows format.
2991 */ 2991 */
2992 void API dw_font_set_default(char *fontname) 2992 void API dw_font_set_default(const char *fontname)
2993 { 2993 {
2994 char *oldfont = _DWDefaultFont; 2994 char *oldfont = _DWDefaultFont;
2995 2995
2996 _DWDefaultFont = strdup(fontname); 2996 _DWDefaultFont = strdup(fontname);
2997 2997
3021 * Sets the font used by a specified window (widget) handle. 3021 * Sets the font used by a specified window (widget) handle.
3022 * Parameters: 3022 * Parameters:
3023 * handle: The window (widget) handle. 3023 * handle: The window (widget) handle.
3024 * fontname: Name and size of the font in the form "size.fontname" 3024 * fontname: Name and size of the font in the form "size.fontname"
3025 */ 3025 */
3026 int dw_window_set_font(HWND handle, char *fontname) 3026 int dw_window_set_font(HWND handle, const char *fontname)
3027 { 3027 {
3028 #if GTK_MAJOR_VERSION > 1 3028 #if GTK_MAJOR_VERSION > 1
3029 PangoFontDescription *pfont; 3029 PangoFontDescription *pfont;
3030 #else 3030 #else
3031 GdkFont *gdkfont; 3031 GdkFont *gdkfont;
3416 * Parameters: 3416 * Parameters:
3417 * owner: The Owner's window handle or HWND_DESKTOP. 3417 * owner: The Owner's window handle or HWND_DESKTOP.
3418 * title: The Window title. 3418 * title: The Window title.
3419 * flStyle: Style flags, see the PM reference. 3419 * flStyle: Style flags, see the PM reference.
3420 */ 3420 */
3421 HWND dw_window_new(HWND hwndOwner, char *title, unsigned long flStyle) 3421 HWND dw_window_new(HWND hwndOwner, const char *title, unsigned long flStyle)
3422 { 3422 {
3423 GtkWidget *tmp; 3423 GtkWidget *tmp;
3424 int _locked_by_me = FALSE; 3424 int _locked_by_me = FALSE;
3425 int flags = 0; 3425 int flags = 0;
3426 3426
3616 * Parameters: 3616 * Parameters:
3617 * type: Either DW_VERT (vertical) or DW_HORZ (horizontal). 3617 * type: Either DW_VERT (vertical) or DW_HORZ (horizontal).
3618 * pad: Number of pixels to pad around the box. 3618 * pad: Number of pixels to pad around the box.
3619 * title: Text to be displayined in the group outline. 3619 * title: Text to be displayined in the group outline.
3620 */ 3620 */
3621 HWND dw_groupbox_new(int type, int pad, char *title) 3621 HWND dw_groupbox_new(int type, int pad, const char *title)
3622 { 3622 {
3623 GtkWidget *tmp, *frame; 3623 GtkWidget *tmp, *frame;
3624 int _locked_by_me = FALSE; 3624 int _locked_by_me = FALSE;
3625 3625
3626 DW_MUTEX_LOCK; 3626 DW_MUTEX_LOCK;
3793 *menu = NULL; 3793 *menu = NULL;
3794 DW_MUTEX_UNLOCK; 3794 DW_MUTEX_UNLOCK;
3795 } 3795 }
3796 } 3796 }
3797 3797
3798 char _removetilde(char *dest, char *src) 3798 char _removetilde(char *dest, const char *src)
3799 { 3799 {
3800 int z, cur=0; 3800 int z, cur=0;
3801 char accel = '\0'; 3801 char accel = '\0';
3802 3802
3803 for(z=0;z<strlen(src);z++) 3803 for(z=0;z<strlen(src);z++)
3827 * flags: Extended attributes to set on the menu. 3827 * flags: Extended attributes to set on the menu.
3828 * end: If TRUE memu is positioned at the end of the menu. 3828 * end: If TRUE memu is positioned at the end of the menu.
3829 * check: If TRUE menu is "check"able. 3829 * check: If TRUE menu is "check"able.
3830 * submenu: Handle to an existing menu to be a submenu or NULL. 3830 * submenu: Handle to an existing menu to be a submenu or NULL.
3831 */ 3831 */
3832 HWND dw_menu_append_item(HMENUI menu, char *title, unsigned long id, unsigned long flags, int end, int check, HMENUI submenu) 3832 HWND dw_menu_append_item(HMENUI menu, const char *title, unsigned long id, unsigned long flags, int end, int check, HMENUI submenu)
3833 { 3833 {
3834 GtkWidget *tmphandle; 3834 GtkWidget *tmphandle;
3835 char accel, *tempbuf = malloc(strlen(title)+1); 3835 char accel, *tempbuf = malloc(strlen(title)+1);
3836 int _locked_by_me = FALSE, submenucount; 3836 int _locked_by_me = FALSE, submenucount;
3837 GtkAccelGroup *accel_group; 3837 GtkAccelGroup *accel_group;
3924 3924
3925 DW_MUTEX_UNLOCK; 3925 DW_MUTEX_UNLOCK;
3926 return tmphandle; 3926 return tmphandle;
3927 } 3927 }
3928 3928
3929 GtkWidget *_find_submenu_id(GtkWidget *start, char *name) 3929 GtkWidget *_find_submenu_id(GtkWidget *start, const char *name)
3930 { 3930 {
3931 GtkWidget *tmp; 3931 GtkWidget *tmp;
3932 int z, submenucount = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(start), "_dw_submenucount")); 3932 int z, submenucount = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(start), "_dw_submenucount"));
3933 3933
3934 if((tmp = gtk_object_get_data(GTK_OBJECT(start), name))) 3934 if((tmp = gtk_object_get_data(GTK_OBJECT(start), name)))
4229 * Create a new static text window (widget) to be packed. 4229 * Create a new static text window (widget) to be packed.
4230 * Parameters: 4230 * Parameters:
4231 * text: The text to be display by the static text widget. 4231 * text: The text to be display by the static text widget.
4232 * id: An ID to be used with dw_window_from_id() or 0L. 4232 * id: An ID to be used with dw_window_from_id() or 0L.
4233 */ 4233 */
4234 HWND dw_text_new(char *text, unsigned long id) 4234 HWND dw_text_new(const char *text, unsigned long id)
4235 { 4235 {
4236 GtkWidget *tmp; 4236 GtkWidget *tmp;
4237 int _locked_by_me = FALSE; 4237 int _locked_by_me = FALSE;
4238 4238
4239 DW_MUTEX_LOCK; 4239 DW_MUTEX_LOCK;
4254 * Create a new status text window (widget) to be packed. 4254 * Create a new status text window (widget) to be packed.
4255 * Parameters: 4255 * Parameters:
4256 * text: The text to be display by the static text widget. 4256 * text: The text to be display by the static text widget.
4257 * id: An ID to be used with dw_window_from_id() or 0L. 4257 * id: An ID to be used with dw_window_from_id() or 0L.
4258 */ 4258 */
4259 HWND dw_status_text_new(char *text, ULONG id) 4259 HWND dw_status_text_new(const char *text, ULONG id)
4260 { 4260 {
4261 GtkWidget *tmp, *frame; 4261 GtkWidget *tmp, *frame;
4262 int _locked_by_me = FALSE; 4262 int _locked_by_me = FALSE;
4263 4263
4264 DW_MUTEX_LOCK; 4264 DW_MUTEX_LOCK;
4326 * Create a new Entryfield window (widget) to be packed. 4326 * Create a new Entryfield window (widget) to be packed.
4327 * Parameters: 4327 * Parameters:
4328 * text: The default text to be in the entryfield widget. 4328 * text: The default text to be in the entryfield widget.
4329 * id: An ID to be used with dw_window_from_id() or 0L. 4329 * id: An ID to be used with dw_window_from_id() or 0L.
4330 */ 4330 */
4331 HWND dw_entryfield_new(char *text, unsigned long id) 4331 HWND dw_entryfield_new(const char *text, unsigned long id)
4332 { 4332 {
4333 GtkWidget *tmp; 4333 GtkWidget *tmp;
4334 int _locked_by_me = FALSE; 4334 int _locked_by_me = FALSE;
4335 4335
4336 DW_MUTEX_LOCK; 4336 DW_MUTEX_LOCK;
4351 * Create a new Entryfield (password) window (widget) to be packed. 4351 * Create a new Entryfield (password) window (widget) to be packed.
4352 * Parameters: 4352 * Parameters:
4353 * text: The default text to be in the entryfield widget. 4353 * text: The default text to be in the entryfield widget.
4354 * id: An ID to be used with dw_window_from_id() or 0L. 4354 * id: An ID to be used with dw_window_from_id() or 0L.
4355 */ 4355 */
4356 HWND dw_entryfield_password_new(char *text, ULONG id) 4356 HWND dw_entryfield_password_new(const char *text, ULONG id)
4357 { 4357 {
4358 GtkWidget *tmp; 4358 GtkWidget *tmp;
4359 int _locked_by_me = FALSE; 4359 int _locked_by_me = FALSE;
4360 4360
4361 DW_MUTEX_LOCK; 4361 DW_MUTEX_LOCK;
4377 * Create a new Combobox window (widget) to be packed. 4377 * Create a new Combobox window (widget) to be packed.
4378 * Parameters: 4378 * Parameters:
4379 * text: The default text to be in the combpbox widget. 4379 * text: The default text to be in the combpbox widget.
4380 * id: An ID to be used with dw_window_from_id() or 0L. 4380 * id: An ID to be used with dw_window_from_id() or 0L.
4381 */ 4381 */
4382 HWND dw_combobox_new(char *text, unsigned long id) 4382 HWND dw_combobox_new(const char *text, unsigned long id)
4383 { 4383 {
4384 GtkWidget *tmp; 4384 GtkWidget *tmp;
4385 int sigid, _locked_by_me = FALSE; 4385 int sigid, _locked_by_me = FALSE;
4386 gint cid; 4386 gint cid;
4387 4387
4406 * Create a new button window (widget) to be packed. 4406 * Create a new button window (widget) to be packed.
4407 * Parameters: 4407 * Parameters:
4408 * text: The text to be display by the static text widget. 4408 * text: The text to be display by the static text widget.
4409 * id: An ID to be used with dw_window_from_id() or 0L. 4409 * id: An ID to be used with dw_window_from_id() or 0L.
4410 */ 4410 */
4411 HWND dw_button_new(char *text, unsigned long id) 4411 HWND dw_button_new(const char *text, unsigned long id)
4412 { 4412 {
4413 GtkWidget *tmp; 4413 GtkWidget *tmp;
4414 int _locked_by_me = FALSE; 4414 int _locked_by_me = FALSE;
4415 4415
4416 DW_MUTEX_LOCK; 4416 DW_MUTEX_LOCK;
4421 dw_window_set_font(tmp, _DWDefaultFont); 4421 dw_window_set_font(tmp, _DWDefaultFont);
4422 DW_MUTEX_UNLOCK; 4422 DW_MUTEX_UNLOCK;
4423 return tmp; 4423 return tmp;
4424 } 4424 }
4425 4425
4426 void _create_tooltip(HWND handle, char *text) 4426 void _create_tooltip(HWND handle, const char *text)
4427 { 4427 {
4428 GtkTooltips *tooltips = (GtkTooltips *)gtk_object_get_data(GTK_OBJECT(handle), "_dw_tooltip"); 4428 GtkTooltips *tooltips = (GtkTooltips *)gtk_object_get_data(GTK_OBJECT(handle), "_dw_tooltip");
4429 4429
4430 if(!tooltips) 4430 if(!tooltips)
4431 { 4431 {
4448 * Create a new bitmap button window (widget) to be packed. 4448 * Create a new bitmap button window (widget) to be packed.
4449 * Parameters: 4449 * Parameters:
4450 * text: Bubble help text to be displayed. 4450 * text: Bubble help text to be displayed.
4451 * id: An ID of a bitmap in the resource file. 4451 * id: An ID of a bitmap in the resource file.
4452 */ 4452 */
4453 HWND dw_bitmapbutton_new(char *text, unsigned long id) 4453 HWND dw_bitmapbutton_new(const char *text, unsigned long id)
4454 { 4454 {
4455 GtkWidget *tmp; 4455 GtkWidget *tmp;
4456 GtkWidget *bitmap; 4456 GtkWidget *bitmap;
4457 int _locked_by_me = FALSE; 4457 int _locked_by_me = FALSE;
4458 4458
4481 * id: An ID to be used with dw_window_from_id() or 0L. 4481 * id: An ID to be used with dw_window_from_id() or 0L.
4482 * filename: Name of the file, omit extention to have 4482 * filename: Name of the file, omit extention to have
4483 * DW pick the appropriate file extension. 4483 * DW pick the appropriate file extension.
4484 * (BMP on OS/2 or Windows, XPM on Unix) 4484 * (BMP on OS/2 or Windows, XPM on Unix)
4485 */ 4485 */
4486 HWND dw_bitmapbutton_new_from_file(char *text, unsigned long id, char *filename) 4486 HWND dw_bitmapbutton_new_from_file(const char *text, unsigned long id, const char *filename)
4487 { 4487 {
4488 GtkWidget *tmp; 4488 GtkWidget *tmp;
4489 GtkWidget *bitmap; 4489 GtkWidget *bitmap;
4490 int _locked_by_me = FALSE; 4490 int _locked_by_me = FALSE;
4491 4491
4516 * id: An ID to be used with dw_window_from_id() or 0L. 4516 * id: An ID to be used with dw_window_from_id() or 0L.
4517 * data: Raw data of image. 4517 * data: Raw data of image.
4518 * (BMP on OS/2 or Windows, XPM on Unix) 4518 * (BMP on OS/2 or Windows, XPM on Unix)
4519 * len: Length of raw data 4519 * len: Length of raw data
4520 */ 4520 */
4521 HWND dw_bitmapbutton_new_from_data(char *text, unsigned long id, char *data, int len) 4521 HWND dw_bitmapbutton_new_from_data(const char *text, unsigned long id, const char *data, int len)
4522 { 4522 {
4523 GtkWidget *tmp; 4523 GtkWidget *tmp;
4524 GtkWidget *bitmap; 4524 GtkWidget *bitmap;
4525 int _locked_by_me = FALSE; 4525 int _locked_by_me = FALSE;
4526 4526
4545 * Create a new spinbutton window (widget) to be packed. 4545 * Create a new spinbutton window (widget) to be packed.
4546 * Parameters: 4546 * Parameters:
4547 * text: The text to be display by the static text widget. 4547 * text: The text to be display by the static text widget.
4548 * id: An ID to be used with dw_window_from_id() or 0L. 4548 * id: An ID to be used with dw_window_from_id() or 0L.
4549 */ 4549 */
4550 HWND dw_spinbutton_new(char *text, unsigned long id) 4550 HWND dw_spinbutton_new(const char *text, unsigned long id)
4551 { 4551 {
4552 GtkAdjustment *adj; 4552 GtkAdjustment *adj;
4553 GtkWidget *tmp; 4553 GtkWidget *tmp;
4554 int _locked_by_me = FALSE; 4554 int _locked_by_me = FALSE;
4555 4555
4570 * Create a new radiobutton window (widget) to be packed. 4570 * Create a new radiobutton window (widget) to be packed.
4571 * Parameters: 4571 * Parameters:
4572 * text: The text to be display by the static text widget. 4572 * text: The text to be display by the static text widget.
4573 * id: An ID to be used with dw_window_from_id() or 0L. 4573 * id: An ID to be used with dw_window_from_id() or 0L.
4574 */ 4574 */
4575 HWND dw_radiobutton_new(char *text, ULONG id) 4575 HWND dw_radiobutton_new(const char *text, ULONG id)
4576 { 4576 {
4577 /* This will have to be fixed in the future. */ 4577 /* This will have to be fixed in the future. */
4578 GtkWidget *tmp; 4578 GtkWidget *tmp;
4579 int _locked_by_me = FALSE; 4579 int _locked_by_me = FALSE;
4580 4580
4684 * Create a new checkbox window (widget) to be packed. 4684 * Create a new checkbox window (widget) to be packed.
4685 * Parameters: 4685 * Parameters:
4686 * text: The text to be display by the static text widget. 4686 * text: The text to be display by the static text widget.
4687 * id: An ID to be used with dw_window_from_id() or 0L. 4687 * id: An ID to be used with dw_window_from_id() or 0L.
4688 */ 4688 */
4689 HWND dw_checkbox_new(char *text, unsigned long id) 4689 HWND dw_checkbox_new(const char *text, unsigned long id)
4690 { 4690 {
4691 GtkWidget *tmp; 4691 GtkWidget *tmp;
4692 int _locked_by_me = FALSE; 4692 int _locked_by_me = FALSE;
4693 4693
4694 DW_MUTEX_LOCK; 4694 DW_MUTEX_LOCK;
4762 * (pass 0 if you use the filename param) 4762 * (pass 0 if you use the filename param)
4763 * filename: a path to a file (Bitmap on OS/2 or 4763 * filename: a path to a file (Bitmap on OS/2 or
4764 * Windows and a pixmap on Unix, pass 4764 * Windows and a pixmap on Unix, pass
4765 * NULL if you use the id param) 4765 * NULL if you use the id param)
4766 */ 4766 */
4767 void dw_window_set_bitmap(HWND handle, unsigned long id, char *filename) 4767 void dw_window_set_bitmap(HWND handle, unsigned long id, const char *filename)
4768 { 4768 {
4769 #if GTK_MAJOR_VERSION > 1 4769 #if GTK_MAJOR_VERSION > 1
4770 GdkPixbuf *pixbuf = NULL; 4770 GdkPixbuf *pixbuf = NULL;
4771 #else 4771 #else
4772 GdkBitmap *bitmap = NULL; 4772 GdkBitmap *bitmap = NULL;
4878 * data: the image data 4878 * data: the image data
4879 * Bitmap on Windows and a pixmap on Unix, pass 4879 * Bitmap on Windows and a pixmap on Unix, pass
4880 * NULL if you use the id param) 4880 * NULL if you use the id param)
4881 * len: length of data 4881 * len: length of data
4882 */ 4882 */
4883 void dw_window_set_bitmap_from_data(HWND handle, unsigned long id, char *data, int len) 4883 void dw_window_set_bitmap_from_data(HWND handle, unsigned long id, const char *data, int len)
4884 { 4884 {
4885 #if GTK_MAJOR_VERSION > 1 4885 #if GTK_MAJOR_VERSION > 1
4886 GdkPixbuf *pixbuf = NULL; 4886 GdkPixbuf *pixbuf = NULL;
4887 #else 4887 #else
4888 GdkBitmap *bitmap = NULL; 4888 GdkBitmap *bitmap = NULL;
4977 * Sets the text used for a given window. 4977 * Sets the text used for a given window.
4978 * Parameters: 4978 * Parameters:
4979 * handle: Handle to the window. 4979 * handle: Handle to the window.
4980 * text: The text associated with a given window. 4980 * text: The text associated with a given window.
4981 */ 4981 */
4982 void dw_window_set_text(HWND handle, char *text) 4982 void dw_window_set_text(HWND handle, const char *text)
4983 { 4983 {
4984 int _locked_by_me = FALSE; 4984 int _locked_by_me = FALSE;
4985 GtkWidget *tmp; 4985 GtkWidget *tmp;
4986 4986
4987 DW_MUTEX_LOCK; 4987 DW_MUTEX_LOCK;
5024 * Sets the text used for a given window's floating bubble help. 5024 * Sets the text used for a given window's floating bubble help.
5025 * Parameters: 5025 * Parameters:
5026 * handle: Handle to the window (widget). 5026 * handle: Handle to the window (widget).
5027 * bubbletext: The text in the floating bubble tooltip. 5027 * bubbletext: The text in the floating bubble tooltip.
5028 */ 5028 */
5029 void API dw_window_set_tooltip(HWND handle, char *bubbletext) 5029 void API dw_window_set_tooltip(HWND handle, const char *bubbletext)
5030 { 5030 {
5031 int _locked_by_me = FALSE; 5031 int _locked_by_me = FALSE;
5032 5032
5033 DW_MUTEX_LOCK; 5033 DW_MUTEX_LOCK;
5034 _create_tooltip(handle, bubbletext); 5034 _create_tooltip(handle, bubbletext);
5153 * Parameters: 5153 * Parameters:
5154 * handle: Handle to the MLE to be queried. 5154 * handle: Handle to the MLE to be queried.
5155 * buffer: Text buffer to be imported. 5155 * buffer: Text buffer to be imported.
5156 * startpoint: Point to start entering text. 5156 * startpoint: Point to start entering text.
5157 */ 5157 */
5158 unsigned int dw_mle_import(HWND handle, char *buffer, int startpoint) 5158 unsigned int dw_mle_import(HWND handle, const char *buffer, int startpoint)
5159 { 5159 {
5160 unsigned int tmppoint = startpoint; 5160 unsigned int tmppoint = startpoint;
5161 int _locked_by_me = FALSE; 5161 int _locked_by_me = FALSE;
5162 5162
5163 DW_MUTEX_LOCK; 5163 DW_MUTEX_LOCK;
5620 * handle: Handle to the MLE to be cleared. 5620 * handle: Handle to the MLE to be cleared.
5621 * text: Text to search for. 5621 * text: Text to search for.
5622 * point: Start point of search. 5622 * point: Start point of search.
5623 * flags: Search specific flags. 5623 * flags: Search specific flags.
5624 */ 5624 */
5625 int dw_mle_search(HWND handle, char *text, int point, unsigned long flags) 5625 int dw_mle_search(HWND handle, const char *text, int point, unsigned long flags)
5626 { 5626 {
5627 int _locked_by_me = FALSE, retval = 0; 5627 int _locked_by_me = FALSE, retval = 0;
5628 5628
5629 DW_MUTEX_LOCK; 5629 DW_MUTEX_LOCK;
5630 #if GTK_MAJOR_VERSION > 1 5630 #if GTK_MAJOR_VERSION > 1
6030 * title: The text title of the entry. 6030 * title: The text title of the entry.
6031 * icon: Handle to coresponding icon. 6031 * icon: Handle to coresponding icon.
6032 * parent: Parent handle or 0 if root. 6032 * parent: Parent handle or 0 if root.
6033 * itemdata: Item specific data. 6033 * itemdata: Item specific data.
6034 */ 6034 */
6035 HTREEITEM dw_tree_insert_after(HWND handle, HTREEITEM item, char *title, HICN icon, HTREEITEM parent, void *itemdata) 6035 HTREEITEM dw_tree_insert_after(HWND handle, HTREEITEM item, const char *title, HICN icon, HTREEITEM parent, void *itemdata)
6036 { 6036 {
6037 #if GTK_MAJOR_VERSION > 1 6037 #if GTK_MAJOR_VERSION > 1
6038 GtkWidget *tree; 6038 GtkWidget *tree;
6039 GtkTreeIter *iter; 6039 GtkTreeIter *iter;
6040 GtkTreeStore *store; 6040 GtkTreeStore *store;
6193 * title: The text title of the entry. 6193 * title: The text title of the entry.
6194 * icon: Handle to coresponding icon. 6194 * icon: Handle to coresponding icon.
6195 * parent: Parent handle or 0 if root. 6195 * parent: Parent handle or 0 if root.
6196 * itemdata: Item specific data. 6196 * itemdata: Item specific data.
6197 */ 6197 */
6198 HTREEITEM dw_tree_insert(HWND handle, char *title, HICN icon, HTREEITEM parent, void *itemdata) 6198 HTREEITEM dw_tree_insert(HWND handle, const char *title, HICN icon, HTREEITEM parent, void *itemdata)
6199 { 6199 {
6200 #if GTK_MAJOR_VERSION > 1 6200 #if GTK_MAJOR_VERSION > 1
6201 GtkWidget *tree; 6201 GtkWidget *tree;
6202 GtkTreeIter *iter; 6202 GtkTreeIter *iter;
6203 GtkTreeStore *store; 6203 GtkTreeStore *store;
6344 * handle: Handle to the tree containing the item. 6344 * handle: Handle to the tree containing the item.
6345 * item: Handle of the item to be modified. 6345 * item: Handle of the item to be modified.
6346 * title: The text title of the entry. 6346 * title: The text title of the entry.
6347 * icon: Handle to coresponding icon. 6347 * icon: Handle to coresponding icon.
6348 */ 6348 */
6349 void dw_tree_item_change(HWND handle, HTREEITEM item, char *title, HICN icon) 6349 void dw_tree_item_change(HWND handle, HTREEITEM item, const char *title, HICN icon)
6350 { 6350 {
6351 #if GTK_MAJOR_VERSION > 1 6351 #if GTK_MAJOR_VERSION > 1
6352 GtkWidget *tree; 6352 GtkWidget *tree;
6353 GtkTreeStore *store; 6353 GtkTreeStore *store;
6354 GdkPixbuf *pixbuf; 6354 GdkPixbuf *pixbuf;
6877 * Configures the main filesystem columnn title for localization. 6877 * Configures the main filesystem columnn title for localization.
6878 * Parameters: 6878 * Parameters:
6879 * handle: Handle to the container to be configured. 6879 * handle: Handle to the container to be configured.
6880 * title: The title to be displayed in the main column. 6880 * title: The title to be displayed in the main column.
6881 */ 6881 */
6882 void API dw_filesystem_set_column_title(HWND handle, char *title) 6882 void API dw_filesystem_set_column_title(HWND handle, const char *title)
6883 { 6883 {
6884 char *newtitle = strdup(title ? title : ""); 6884 char *newtitle = strdup(title ? title : "");
6885 6885
6886 dw_window_set_data(handle, "_dw_coltitle", newtitle); 6886 dw_window_set_data(handle, "_dw_coltitle", newtitle);
6887 } 6887 }
6958 * Parameters: 6958 * Parameters:
6959 * filename: Name of the file, omit extention to have 6959 * filename: Name of the file, omit extention to have
6960 * DW pick the appropriate file extension. 6960 * DW pick the appropriate file extension.
6961 * (ICO on OS/2 or Windows, XPM on Unix) 6961 * (ICO on OS/2 or Windows, XPM on Unix)
6962 */ 6962 */
6963 HICN API dw_icon_load_from_file(char *filename) 6963 HICN API dw_icon_load_from_file(const char *filename)
6964 { 6964 {
6965 int found = -1, _locked_by_me = FALSE; 6965 int found = -1, _locked_by_me = FALSE;
6966 #if GTK_MAJOR_VERSION > 1 6966 #if GTK_MAJOR_VERSION > 1
6967 GdkPixbuf *pixbuf; 6967 GdkPixbuf *pixbuf;
6968 #elif defined(USE_IMLIB) 6968 #elif defined(USE_IMLIB)
7069 * Obtains an icon from data. 7069 * Obtains an icon from data.
7070 * Parameters: 7070 * Parameters:
7071 * data: Source of data for image. 7071 * data: Source of data for image.
7072 * len: length of data 7072 * len: length of data
7073 */ 7073 */
7074 HICN API dw_icon_load_from_data(char *data, int len) 7074 HICN API dw_icon_load_from_data(const char *data, int len)
7075 { 7075 {
7076 int found = -1, _locked_by_me = FALSE; 7076 int found = -1, _locked_by_me = FALSE;
7077 char *file; 7077 char *file;
7078 FILE *fp; 7078 FILE *fp;
7079 #if GTK_MAJOR_VERSION > 1 7079 #if GTK_MAJOR_VERSION > 1
7268 7268
7269 /* 7269 /*
7270 * Internal representation of dw_container_set_item() extracted so we can pass 7270 * Internal representation of dw_container_set_item() extracted so we can pass
7271 * two data pointers; icon and text for dw_filesystem_set_item(). 7271 * two data pointers; icon and text for dw_filesystem_set_item().
7272 */ 7272 */
7273 void _dw_container_set_item(HWND handle, void *pointer, int column, int row, void *data, char *text) 7273 void _dw_container_set_item(HWND handle, void *pointer, int column, int row, void *data, const char *text)
7274 { 7274 {
7275 char numbuf[11] = {0}, textbuffer[101] = {0}; 7275 char numbuf[11] = {0}, textbuffer[101] = {0};
7276 int flag = 0; 7276 int flag = 0;
7277 GtkWidget *clist; 7277 GtkWidget *clist;
7278 int _locked_by_me = FALSE; 7278 int _locked_by_me = FALSE;
7415 * pointer: Pointer to the allocated memory in dw_container_alloc(). 7415 * pointer: Pointer to the allocated memory in dw_container_alloc().
7416 * column: Zero based column of data being set. 7416 * column: Zero based column of data being set.
7417 * row: Zero based row of data being set. 7417 * row: Zero based row of data being set.
7418 * data: Pointer to the data to be added. 7418 * data: Pointer to the data to be added.
7419 */ 7419 */
7420 void API dw_filesystem_change_file(HWND handle, int row, char *filename, HICN icon) 7420 void API dw_filesystem_change_file(HWND handle, int row, const char *filename, HICN icon)
7421 { 7421 {
7422 dw_filesystem_set_file(handle, NULL, row, filename, icon); 7422 dw_filesystem_set_file(handle, NULL, row, filename, icon);
7423 } 7423 }
7424 7424
7425 /* 7425 /*
7429 * pointer: Pointer to the allocated memory in dw_container_alloc(). 7429 * pointer: Pointer to the allocated memory in dw_container_alloc().
7430 * column: Zero based column of data being set. 7430 * column: Zero based column of data being set.
7431 * row: Zero based row of data being set. 7431 * row: Zero based row of data being set.
7432 * data: Pointer to the data to be added. 7432 * data: Pointer to the data to be added.
7433 */ 7433 */
7434 void dw_filesystem_set_file(HWND handle, void *pointer, int row, char *filename, HICN icon) 7434 void dw_filesystem_set_file(HWND handle, void *pointer, int row, const char *filename, HICN icon)
7435 { 7435 {
7436 _dw_container_set_item(handle, pointer, 0, row, (void *)&icon, filename); 7436 _dw_container_set_item(handle, pointer, 0, row, (void *)&icon, filename);
7437 } 7437 }
7438 7438
7439 /* 7439 /*
7602 * Parameters: 7602 * Parameters:
7603 * pointer: Pointer to the allocated memory in dw_container_alloc(). 7603 * pointer: Pointer to the allocated memory in dw_container_alloc().
7604 * row: Zero based row of data being set. 7604 * row: Zero based row of data being set.
7605 * title: String title of the item. 7605 * title: String title of the item.
7606 */ 7606 */
7607 void dw_container_set_row_title(void *pointer, int row, char *title) 7607 void dw_container_set_row_title(void *pointer, int row, const char *title)
7608 { 7608 {
7609 _dw_container_set_row_data(pointer, pointer, row, _DW_DATA_TYPE_STRING, title); 7609 _dw_container_set_row_data(pointer, pointer, row, _DW_DATA_TYPE_STRING, (void *)title);
7610 } 7610 }
7611 7611
7612 /* 7612 /*
7613 * Changes the title of a row already inserted in the container. 7613 * Changes the title of a row already inserted in the container.
7614 * Parameters: 7614 * Parameters:
7615 * handle: Handle to window (widget) of container. 7615 * handle: Handle to window (widget) of container.
7616 * row: Zero based row of data being set. 7616 * row: Zero based row of data being set.
7617 * title: String title of the item. 7617 * title: String title of the item.
7618 */ 7618 */
7619 void dw_container_change_row_title(HWND handle, int row, char *title) 7619 void dw_container_change_row_title(HWND handle, int row, const char *title)
7620 { 7620 {
7621 _dw_container_set_row_data(handle, NULL, row, _DW_DATA_TYPE_STRING, title); 7621 _dw_container_set_row_data(handle, NULL, row, _DW_DATA_TYPE_STRING, (void *)title);
7622 } 7622 }
7623 7623
7624 /* 7624 /*
7625 * Sets the data of a row in the container. 7625 * Sets the data of a row in the container.
7626 * Parameters: 7626 * Parameters:
7938 * Cursors the item with the text speficied, and scrolls to that item. 7938 * Cursors the item with the text speficied, and scrolls to that item.
7939 * Parameters: 7939 * Parameters:
7940 * handle: Handle to the window (widget) to be queried. 7940 * handle: Handle to the window (widget) to be queried.
7941 * text: Text usually returned by dw_container_query(). 7941 * text: Text usually returned by dw_container_query().
7942 */ 7942 */
7943 void dw_container_cursor(HWND handle, char *text) 7943 void dw_container_cursor(HWND handle, const char *text)
7944 { 7944 {
7945 _dw_container_cursor(handle, TRUE, text); 7945 _dw_container_cursor(handle, TRUE, (void *)text);
7946 } 7946 }
7947 7947
7948 /* 7948 /*
7949 * Cursors the item with the data speficied, and scrolls to that item. 7949 * Cursors the item with the data speficied, and scrolls to that item.
7950 * Parameters: 7950 * Parameters:
7998 * Deletes the item with the text speficied. 7998 * Deletes the item with the text speficied.
7999 * Parameters: 7999 * Parameters:
8000 * handle: Handle to the window (widget). 8000 * handle: Handle to the window (widget).
8001 * text: Text usually returned by dw_container_query(). 8001 * text: Text usually returned by dw_container_query().
8002 */ 8002 */
8003 void dw_container_delete_row(HWND handle, char *text) 8003 void dw_container_delete_row(HWND handle, const char *text)
8004 { 8004 {
8005 _dw_container_delete_row(handle, _DW_DATA_TYPE_STRING, text); 8005 _dw_container_delete_row(handle, _DW_DATA_TYPE_STRING, (void *)text);
8006 } 8006 }
8007 8007
8008 /* 8008 /*
8009 * Deletes the item with the data speficied. 8009 * Deletes the item with the data speficied.
8010 * Parameters: 8010 * Parameters:
8067 * Parameters: 8067 * Parameters:
8068 * handle: Window handle that will handle taskbar icon messages. 8068 * handle: Window handle that will handle taskbar icon messages.
8069 * icon: Icon handle to display in the taskbar. 8069 * icon: Icon handle to display in the taskbar.
8070 * bubbletext: Text to show when the mouse is above the icon. 8070 * bubbletext: Text to show when the mouse is above the icon.
8071 */ 8071 */
8072 void dw_taskbar_insert(HWND handle, HICN icon, char *bubbletext) 8072 void dw_taskbar_insert(HWND handle, HICN icon, const char *bubbletext)
8073 { 8073 {
8074 #if GTK_CHECK_VERSION(2,10,0) 8074 #if GTK_CHECK_VERSION(2,10,0)
8075 GtkStatusIcon *status; 8075 GtkStatusIcon *status;
8076 GdkPixbuf *pixbuf; 8076 GdkPixbuf *pixbuf;
8077 int _locked_by_me = FALSE; 8077 int _locked_by_me = FALSE;
8632 * pixmap: Handle to the pixmap. (choose only one of these) 8632 * pixmap: Handle to the pixmap. (choose only one of these)
8633 * x: X coordinate. 8633 * x: X coordinate.
8634 * y: Y coordinate. 8634 * y: Y coordinate.
8635 * text: Text to be displayed. 8635 * text: Text to be displayed.
8636 */ 8636 */
8637 void dw_draw_text(HWND handle, HPIXMAP pixmap, int x, int y, char *text) 8637 void dw_draw_text(HWND handle, HPIXMAP pixmap, int x, int y, const char *text)
8638 { 8638 {
8639 int _locked_by_me = FALSE; 8639 int _locked_by_me = FALSE;
8640 GdkGC *gc = NULL; 8640 GdkGC *gc = NULL;
8641 #if GTK_MAJOR_VERSION > 1 8641 #if GTK_MAJOR_VERSION > 1
8642 PangoFontDescription *font; 8642 PangoFontDescription *font;
8800 * pixmap: Handle to the pixmap. (choose only one of these) 8800 * pixmap: Handle to the pixmap. (choose only one of these)
8801 * text: Text to be queried. 8801 * text: Text to be queried.
8802 * width: Pointer to a variable to be filled in with the width. 8802 * width: Pointer to a variable to be filled in with the width.
8803 * height Pointer to a variable to be filled in with the height. 8803 * height Pointer to a variable to be filled in with the height.
8804 */ 8804 */
8805 void dw_font_text_extents_get(HWND handle, HPIXMAP pixmap, char *text, int *width, int *height) 8805 void dw_font_text_extents_get(HWND handle, HPIXMAP pixmap, const char *text, int *width, int *height)
8806 { 8806 {
8807 int _locked_by_me = FALSE; 8807 int _locked_by_me = FALSE;
8808 #if GTK_MAJOR_VERSION > 1 8808 #if GTK_MAJOR_VERSION > 1
8809 PangoFontDescription *font; 8809 PangoFontDescription *font;
8810 #else 8810 #else
8926 * DW pick the appropriate file extension. 8926 * DW pick the appropriate file extension.
8927 * (BMP on OS/2 or Windows, XPM on Unix) 8927 * (BMP on OS/2 or Windows, XPM on Unix)
8928 * Returns: 8928 * Returns:
8929 * A handle to a pixmap or NULL on failure. 8929 * A handle to a pixmap or NULL on failure.
8930 */ 8930 */
8931 HPIXMAP dw_pixmap_new_from_file(HWND handle, char *filename) 8931 HPIXMAP dw_pixmap_new_from_file(HWND handle, const char *filename)
8932 { 8932 {
8933 int _locked_by_me = FALSE; 8933 int _locked_by_me = FALSE;
8934 HPIXMAP pixmap; 8934 HPIXMAP pixmap;
8935 #ifdef USE_IMLIB 8935 #ifdef USE_IMLIB
8936 GdkImlibImage *image; 8936 GdkImlibImage *image;
8996 * DW pick the appropriate file extension. 8996 * DW pick the appropriate file extension.
8997 * (BMP on OS/2 or Windows, XPM on Unix) 8997 * (BMP on OS/2 or Windows, XPM on Unix)
8998 * Returns: 8998 * Returns:
8999 * A handle to a pixmap or NULL on failure. 8999 * A handle to a pixmap or NULL on failure.
9000 */ 9000 */
9001 HPIXMAP dw_pixmap_new_from_data(HWND handle, char *data, int len) 9001 HPIXMAP dw_pixmap_new_from_data(HWND handle, const char *data, int len)
9002 { 9002 {
9003 int _locked_by_me = FALSE; 9003 int _locked_by_me = FALSE;
9004 char *file; 9004 char *file;
9005 FILE *fp; 9005 FILE *fp;
9006 HPIXMAP pixmap; 9006 HPIXMAP pixmap;
9121 * passed to the application via a callback. 9121 * passed to the application via a callback.
9122 * fontname: Name and size of the font in the form "size.fontname" 9122 * fontname: Name and size of the font in the form "size.fontname"
9123 * Returns: 9123 * Returns:
9124 * DW_ERROR_NONE on success and DW_ERROR_GENERAL on failure. 9124 * DW_ERROR_NONE on success and DW_ERROR_GENERAL on failure.
9125 */ 9125 */
9126 int API dw_pixmap_set_font(HPIXMAP pixmap, char *fontname) 9126 int API dw_pixmap_set_font(HPIXMAP pixmap, const char *fontname)
9127 { 9127 {
9128 if(pixmap && fontname && *fontname) 9128 if(pixmap && fontname && *fontname)
9129 { 9129 {
9130 char *oldfont = pixmap->font; 9130 char *oldfont = pixmap->font;
9131 pixmap->font = strdup(fontname); 9131 pixmap->font = strdup(fontname);
9388 * Parameters: 9388 * Parameters:
9389 * name: Base name of the shared library. 9389 * name: Base name of the shared library.
9390 * handle: Pointer to a module handle, 9390 * handle: Pointer to a module handle,
9391 * will be filled in with the handle. 9391 * will be filled in with the handle.
9392 */ 9392 */
9393 int dw_module_load(char *name, HMOD *handle) 9393 int dw_module_load(const char *name, HMOD *handle)
9394 { 9394 {
9395 int len; 9395 int len;
9396 char *newname; 9396 char *newname;
9397 char errorbuf[1025] = {0}; 9397 char errorbuf[1025] = {0};
9398 9398
9431 * handle: Module handle returned by dw_module_load() 9431 * handle: Module handle returned by dw_module_load()
9432 * name: Name of the symbol you want the address of. 9432 * name: Name of the symbol you want the address of.
9433 * func: A pointer to a function pointer, to obtain 9433 * func: A pointer to a function pointer, to obtain
9434 * the address. 9434 * the address.
9435 */ 9435 */
9436 int dw_module_symbol(HMOD handle, char *name, void**func) 9436 int dw_module_symbol(HMOD handle, const char *name, void**func)
9437 { 9437 {
9438 if(!func || !name) 9438 if(!func || !name)
9439 return -1; 9439 return -1;
9440 9440
9441 if(strlen(name) == 0) 9441 if(strlen(name) == 0)
9810 * Parameters: 9810 * Parameters:
9811 * eve: Pointer to an event handle to receive handle. 9811 * eve: Pointer to an event handle to receive handle.
9812 * name: Name given to semaphore which can be opened 9812 * name: Name given to semaphore which can be opened
9813 * by other processes. 9813 * by other processes.
9814 */ 9814 */
9815 HEV dw_named_event_new(char *name) 9815 HEV dw_named_event_new(const char *name)
9816 { 9816 {
9817 struct sockaddr_un un; 9817 struct sockaddr_un un;
9818 int ev, *tmpsock = (int *)malloc(sizeof(int)*2); 9818 int ev, *tmpsock = (int *)malloc(sizeof(int)*2);
9819 DWTID dwthread; 9819 DWTID dwthread;
9820 9820
9860 * Parameters: 9860 * Parameters:
9861 * eve: Pointer to an event handle to receive handle. 9861 * eve: Pointer to an event handle to receive handle.
9862 * name: Name given to semaphore which can be opened 9862 * name: Name given to semaphore which can be opened
9863 * by other processes. 9863 * by other processes.
9864 */ 9864 */
9865 HEV dw_named_event_get(char *name) 9865 HEV dw_named_event_get(const char *name)
9866 { 9866 {
9867 struct sockaddr_un un; 9867 struct sockaddr_un un;
9868 int ev = socket(AF_UNIX, SOCK_STREAM, 0); 9868 int ev = socket(AF_UNIX, SOCK_STREAM, 0);
9869 if(ev < 0) 9869 if(ev < 0)
9870 return NULL; 9870 return NULL;
10043 * handle: A pointer to receive a SHM identifier. 10043 * handle: A pointer to receive a SHM identifier.
10044 * dest: A pointer to a pointer to receive the memory address. 10044 * dest: A pointer to a pointer to receive the memory address.
10045 * size: Size in bytes of the shared memory region to allocate. 10045 * size: Size in bytes of the shared memory region to allocate.
10046 * name: A string pointer to a unique memory name. 10046 * name: A string pointer to a unique memory name.
10047 */ 10047 */
10048 HSHM dw_named_memory_new(void **dest, int size, char *name) 10048 HSHM dw_named_memory_new(void **dest, int size, const char *name)
10049 { 10049 {
10050 char namebuf[1025] = {0}; 10050 char namebuf[1025] = {0};
10051 struct _dw_unix_shm *handle = malloc(sizeof(struct _dw_unix_shm)); 10051 struct _dw_unix_shm *handle = malloc(sizeof(struct _dw_unix_shm));
10052 10052
10053 mkdir("/tmp/.dw", S_IWGRP|S_IWOTH); 10053 mkdir("/tmp/.dw", S_IWGRP|S_IWOTH);
10089 * Parameters: 10089 * Parameters:
10090 * dest: A pointer to a pointer to receive the memory address. 10090 * dest: A pointer to a pointer to receive the memory address.
10091 * size: Size in bytes of the shared memory region to requested. 10091 * size: Size in bytes of the shared memory region to requested.
10092 * name: A string pointer to a unique memory name. 10092 * name: A string pointer to a unique memory name.
10093 */ 10093 */
10094 HSHM dw_named_memory_get(void **dest, int size, char *name) 10094 HSHM dw_named_memory_get(void **dest, int size, const char *name)
10095 { 10095 {
10096 char namebuf[1025] = {0}; 10096 char namebuf[1025] = {0};
10097 struct _dw_unix_shm *handle = malloc(sizeof(struct _dw_unix_shm)); 10097 struct _dw_unix_shm *handle = malloc(sizeof(struct _dw_unix_shm));
10098 10098
10099 mkdir("/tmp/.dw", S_IWGRP|S_IWOTH); 10099 mkdir("/tmp/.dw", S_IWGRP|S_IWOTH);
11348 * Parameters: 11348 * Parameters:
11349 * handle: Notebook handle. 11349 * handle: Notebook handle.
11350 * pageid: Page ID of the tab to set. 11350 * pageid: Page ID of the tab to set.
11351 * text: Pointer to the text to set. 11351 * text: Pointer to the text to set.
11352 */ 11352 */
11353 void dw_notebook_page_set_text(HWND handle, unsigned long pageid, char *text) 11353 void dw_notebook_page_set_text(HWND handle, unsigned long pageid, const char *text)
11354 { 11354 {
11355 GtkWidget *child; 11355 GtkWidget *child;
11356 int realpage, _locked_by_me = FALSE; 11356 int realpage, _locked_by_me = FALSE;
11357 11357
11358 DW_MUTEX_LOCK; 11358 DW_MUTEX_LOCK;
11381 * Parameters: 11381 * Parameters:
11382 * handle: Notebook handle. 11382 * handle: Notebook handle.
11383 * pageid: Page ID of the tab to set. 11383 * pageid: Page ID of the tab to set.
11384 * text: Pointer to the text to set. 11384 * text: Pointer to the text to set.
11385 */ 11385 */
11386 void dw_notebook_page_set_status_text(HWND handle, unsigned long pageid, char *text) 11386 void dw_notebook_page_set_status_text(HWND handle, unsigned long pageid, const char *text)
11387 { 11387 {
11388 /* TODO (if possible) */ 11388 /* TODO (if possible) */
11389 } 11389 }
11390 11390
11391 /* 11391 /*
11455 * Appends the specified text to the listbox's (or combobox) entry list. 11455 * Appends the specified text to the listbox's (or combobox) entry list.
11456 * Parameters: 11456 * Parameters:
11457 * handle: Handle to the listbox to be appended to. 11457 * handle: Handle to the listbox to be appended to.
11458 * text: Text to append into listbox. 11458 * text: Text to append into listbox.
11459 */ 11459 */
11460 void dw_listbox_append(HWND handle, char *text) 11460 void dw_listbox_append(HWND handle, const char *text)
11461 { 11461 {
11462 GtkWidget *handle2 = handle; 11462 GtkWidget *handle2 = handle;
11463 int _locked_by_me = FALSE; 11463 int _locked_by_me = FALSE;
11464 11464
11465 DW_MUTEX_LOCK; 11465 DW_MUTEX_LOCK;
11516 * Parameters: 11516 * Parameters:
11517 * handle: Handle to the listbox to be appended to. 11517 * handle: Handle to the listbox to be appended to.
11518 * text: Text to insert into listbox. 11518 * text: Text to insert into listbox.
11519 * pos: 0-based index into listbox. -1 will append 11519 * pos: 0-based index into listbox. -1 will append
11520 */ 11520 */
11521 void dw_listbox_insert(HWND handle, char *text, int pos) 11521 void dw_listbox_insert(HWND handle, const char *text, int pos)
11522 { 11522 {
11523 GtkWidget *handle2 = handle; 11523 GtkWidget *handle2 = handle;
11524 int _locked_by_me = FALSE; 11524 int _locked_by_me = FALSE;
11525 11525
11526 DW_MUTEX_LOCK; 11526 DW_MUTEX_LOCK;
11814 * Parameters: 11814 * Parameters:
11815 * handle: Handle to the listbox to be queried. 11815 * handle: Handle to the listbox to be queried.
11816 * index: Index into the list to be queried. 11816 * index: Index into the list to be queried.
11817 * buffer: Buffer where text will be copied. 11817 * buffer: Buffer where text will be copied.
11818 */ 11818 */
11819 void dw_listbox_set_text(HWND handle, unsigned int index, char *buffer) 11819 void dw_listbox_set_text(HWND handle, unsigned int index, const char *buffer)
11820 { 11820 {
11821 GtkWidget *handle2 = handle; 11821 GtkWidget *handle2 = handle;
11822 int _locked_by_me = FALSE; 11822 int _locked_by_me = FALSE;
11823 11823
11824 DW_MUTEX_LOCK; 11824 DW_MUTEX_LOCK;
12513 * Returns: 12513 * Returns:
12514 * NULL on error. A malloced buffer containing 12514 * NULL on error. A malloced buffer containing
12515 * the file path on success. 12515 * the file path on success.
12516 * 12516 *
12517 */ 12517 */
12518 char *dw_file_browse(char *title, char *defpath, char *ext, int flags) 12518 char *dw_file_browse(const char *title, const char *defpath, const char *ext, int flags)
12519 { 12519 {
12520 GtkWidget *filew; 12520 GtkWidget *filew;
12521 12521
12522 #if GTK_MAJOR_VERSION > 1 12522 #if GTK_MAJOR_VERSION > 1
12523 GtkFileChooserAction action; 12523 GtkFileChooserAction action;
12723 * type: Either DW_EXEC_CON or DW_EXEC_GUI. 12723 * type: Either DW_EXEC_CON or DW_EXEC_GUI.
12724 * params: An array of pointers to string arguements. 12724 * params: An array of pointers to string arguements.
12725 * Returns: 12725 * Returns:
12726 * -1 on error. 12726 * -1 on error.
12727 */ 12727 */
12728 int dw_exec(char *program, int type, char **params) 12728 int dw_exec(const char *program, int type, char **params)
12729 { 12729 {
12730 int ret = -1; 12730 int ret = -1;
12731 12731
12732 if((ret = fork()) == 0) 12732 if((ret = fork()) == 0)
12733 { 12733 {
12780 /* 12780 /*
12781 * Loads a web browser pointed at the given URL. 12781 * Loads a web browser pointed at the given URL.
12782 * Parameters: 12782 * Parameters:
12783 * url: Uniform resource locator. 12783 * url: Uniform resource locator.
12784 */ 12784 */
12785 int dw_browse(char *url) 12785 int dw_browse(const char *url)
12786 { 12786 {
12787 #if GTK_CHECK_VERSION(2,14,0) 12787 #if GTK_CHECK_VERSION(2,14,0)
12788 /* If possible load the URL/URI using gvfs... */ 12788 /* If possible load the URL/URI using gvfs... */
12789 if(gtk_show_uri(gdk_screen_get_default(), url, GDK_CURRENT_TIME, NULL)) 12789 if(gtk_show_uri(gdk_screen_get_default(), url, GDK_CURRENT_TIME, NULL))
12790 { 12790 {
12799 char *execargs[3], *browser = "firefox", *tmp; 12799 char *execargs[3], *browser = "firefox", *tmp;
12800 12800
12801 tmp = getenv( "DW_BROWSER" ); 12801 tmp = getenv( "DW_BROWSER" );
12802 if(tmp) browser = tmp; 12802 if(tmp) browser = tmp;
12803 execargs[0] = browser; 12803 execargs[0] = browser;
12804 execargs[1] = url; 12804 execargs[1] = (char *)url;
12805 execargs[2] = NULL; 12805 execargs[2] = NULL;
12806 12806
12807 return dw_exec(browser, DW_EXEC_GUI, execargs); 12807 return dw_exec(browser, DW_EXEC_GUI, execargs);
12808 } 12808 }
12809 } 12809 }
12864 * string: String buffer containt HTML code to 12864 * string: String buffer containt HTML code to
12865 * be rendered. 12865 * be rendered.
12866 * Returns: 12866 * Returns:
12867 * 0 on success. 12867 * 0 on success.
12868 */ 12868 */
12869 int dw_html_raw(HWND handle, char *string) 12869 int dw_html_raw(HWND handle, const char *string)
12870 { 12870 {
12871 #ifdef USE_WEBKIT 12871 #ifdef USE_WEBKIT
12872 int _locked_by_me = FALSE; 12872 int _locked_by_me = FALSE;
12873 WebKitWebView *web_view; 12873 WebKitWebView *web_view;
12874 12874
12892 * url: Universal Resource Locator of the web or 12892 * url: Universal Resource Locator of the web or
12893 * file object to be rendered. 12893 * file object to be rendered.
12894 * Returns: 12894 * Returns:
12895 * 0 on success. 12895 * 0 on success.
12896 */ 12896 */
12897 int dw_html_url(HWND handle, char *url) 12897 int dw_html_url(HWND handle, const char *url)
12898 { 12898 {
12899 #ifdef USE_WEBKIT 12899 #ifdef USE_WEBKIT
12900 int _locked_by_me = FALSE; 12900 int _locked_by_me = FALSE;
12901 WebKitWebView *web_view; 12901 WebKitWebView *web_view;
12902 12902
12921 * scriptdata: Data passed to the signal handler. 12921 * scriptdata: Data passed to the signal handler.
12922 * Notes: A DW_SIGNAL_HTML_RESULT event will be raised with scriptdata. 12922 * Notes: A DW_SIGNAL_HTML_RESULT event will be raised with scriptdata.
12923 * Returns: 12923 * Returns:
12924 * DW_ERROR_NONE (0) on success. 12924 * DW_ERROR_NONE (0) on success.
12925 */ 12925 */
12926 int dw_html_javascript_run(HWND handle, char *script, void *scriptdata) 12926 int dw_html_javascript_run(HWND handle, const char *script, void *scriptdata)
12927 { 12927 {
12928 #ifdef USE_WEBKIT 12928 #ifdef USE_WEBKIT
12929 int _locked_by_me = FALSE; 12929 int _locked_by_me = FALSE;
12930 WebKitWebView *web_view; 12930 WebKitWebView *web_view;
12931 12931
13039 /* 13039 /*
13040 * Sets the contents of the default clipboard to the supplied text. 13040 * Sets the contents of the default clipboard to the supplied text.
13041 * Parameters: 13041 * Parameters:
13042 * Text. 13042 * Text.
13043 */ 13043 */
13044 void dw_clipboard_set_text( char *str, int len ) 13044 void dw_clipboard_set_text(const char *str, int len)
13045 { 13045 {
13046 int _locked_by_me = FALSE; 13046 int _locked_by_me = FALSE;
13047 GtkClipboard *clipboard_object; 13047 GtkClipboard *clipboard_object;
13048 13048
13049 DW_MUTEX_LOCK; 13049 DW_MUTEX_LOCK;
13087 * drawfunc: The pointer to the function to be used as the callback. 13087 * drawfunc: The pointer to the function to be used as the callback.
13088 * drawdata: User data to be passed to the handler function. 13088 * drawdata: User data to be passed to the handler function.
13089 * Returns: 13089 * Returns:
13090 * A handle to the print object or NULL on failure. 13090 * A handle to the print object or NULL on failure.
13091 */ 13091 */
13092 HPRINT API dw_print_new(char *jobname, unsigned long flags, unsigned int pages, void *drawfunc, void *drawdata) 13092 HPRINT API dw_print_new(const char *jobname, unsigned long flags, unsigned int pages, void *drawfunc, void *drawdata)
13093 { 13093 {
13094 #if GTK_CHECK_VERSION(2,10,0) 13094 #if GTK_CHECK_VERSION(2,10,0)
13095 GtkPrintOperation *op; 13095 GtkPrintOperation *op;
13096 int _locked_by_me = FALSE; 13096 int _locked_by_me = FALSE;
13097 13097
13207 * Parameters: 13207 * Parameters:
13208 * window: Window handle of signal to be called back. 13208 * window: Window handle of signal to be called back.
13209 * dataname: A string pointer identifying which signal to be hooked. 13209 * dataname: A string pointer identifying which signal to be hooked.
13210 * data: User data to be passed to the handler function. 13210 * data: User data to be passed to the handler function.
13211 */ 13211 */
13212 void dw_window_set_data(HWND window, char *dataname, void *data) 13212 void dw_window_set_data(HWND window, const char *dataname, void *data)
13213 { 13213 {
13214 int _locked_by_me = FALSE; 13214 int _locked_by_me = FALSE;
13215 13215
13216 if(!window) 13216 if(!window)
13217 return; 13217 return;
13238 * Parameters: 13238 * Parameters:
13239 * window: Window handle of signal to be called back. 13239 * window: Window handle of signal to be called back.
13240 * dataname: A string pointer identifying which signal to be hooked. 13240 * dataname: A string pointer identifying which signal to be hooked.
13241 * data: User data to be passed to the handler function. 13241 * data: User data to be passed to the handler function.
13242 */ 13242 */
13243 void *dw_window_get_data(HWND window, char *dataname) 13243 void *dw_window_get_data(HWND window, const char *dataname)
13244 { 13244 {
13245 int _locked_by_me = FALSE; 13245 int _locked_by_me = FALSE;
13246 void *ret = NULL; 13246 void *ret = NULL;
13247 13247
13248 if(!window) 13248 if(!window)
13289 } 13289 }
13290 13290
13291 /* Get the actual signal window handle not the user window handle 13291 /* Get the actual signal window handle not the user window handle
13292 * Should mimic the code in dw_signal_connect() below. 13292 * Should mimic the code in dw_signal_connect() below.
13293 */ 13293 */
13294 static HWND _find_signal_window(HWND window, char *signame) 13294 static HWND _find_signal_window(HWND window, const char *signame)
13295 { 13295 {
13296 HWND thiswindow = window; 13296 HWND thiswindow = window;
13297 13297
13298 if(GTK_IS_SCROLLED_WINDOW(thiswindow)) 13298 if(GTK_IS_SCROLLED_WINDOW(thiswindow))
13299 thiswindow = (HWND)gtk_object_get_user_data(GTK_OBJECT(window)); 13299 thiswindow = (HWND)gtk_object_get_user_data(GTK_OBJECT(window));
13341 * window: Window handle of signal to be called back. 13341 * window: Window handle of signal to be called back.
13342 * signame: A string pointer identifying which signal to be hooked. 13342 * signame: A string pointer identifying which signal to be hooked.
13343 * sigfunc: The pointer to the function to be used as the callback. 13343 * sigfunc: The pointer to the function to be used as the callback.
13344 * data: User data to be passed to the handler function. 13344 * data: User data to be passed to the handler function.
13345 */ 13345 */
13346 void dw_signal_connect(HWND window, char *signame, void *sigfunc, void *data) 13346 void dw_signal_connect(HWND window, const char *signame, void *sigfunc, void *data)
13347 { 13347 {
13348 dw_signal_connect_data(window, signame, sigfunc, NULL, data); 13348 dw_signal_connect_data(window, signame, sigfunc, NULL, data);
13349 } 13349 }
13350 13350
13351 #define _DW_INTERNAL_CALLBACK_PARAMS 4 13351 #define _DW_INTERNAL_CALLBACK_PARAMS 4
13357 * signame: A string pointer identifying which signal to be hooked. 13357 * signame: A string pointer identifying which signal to be hooked.
13358 * sigfunc: The pointer to the function to be used as the callback. 13358 * sigfunc: The pointer to the function to be used as the callback.
13359 * discfunc: The pointer to the function called when this handler is removed. 13359 * discfunc: The pointer to the function called when this handler is removed.
13360 * data: User data to be passed to the handler function. 13360 * data: User data to be passed to the handler function.
13361 */ 13361 */
13362 void dw_signal_connect_data(HWND window, char *signame, void *sigfunc, void *discfunc, void *data) 13362 void dw_signal_connect_data(HWND window, const char *signame, void *sigfunc, void *discfunc, void *data)
13363 { 13363 {
13364 void *thisfunc = _findsigfunc(signame); 13364 void *thisfunc = _findsigfunc(signame);
13365 char *thisname = signame; 13365 char *thisname = (char *)signame;
13366 HWND thiswindow = window; 13366 HWND thiswindow = window;
13367 int sigid, _locked_by_me = FALSE; 13367 int sigid, _locked_by_me = FALSE;
13368 void **params = calloc(_DW_INTERNAL_CALLBACK_PARAMS, sizeof(void *)); 13368 void **params = calloc(_DW_INTERNAL_CALLBACK_PARAMS, sizeof(void *));
13369 gint cid; 13369 gint cid;
13370 13370
13577 /* 13577 /*
13578 * Removes callbacks for a given window with given name. 13578 * Removes callbacks for a given window with given name.
13579 * Parameters: 13579 * Parameters:
13580 * window: Window handle of callback to be removed. 13580 * window: Window handle of callback to be removed.
13581 */ 13581 */
13582 void dw_signal_disconnect_by_name(HWND window, char *signame) 13582 void dw_signal_disconnect_by_name(HWND window, const char *signame)
13583 { 13583 {
13584 int z, count; 13584 int z, count;
13585 void *thisfunc; 13585 void *thisfunc;
13586 int _locked_by_me = FALSE; 13586 int _locked_by_me = FALSE;
13587 void **params = alloca(sizeof(void *) * 3); 13587 void **params = alloca(sizeof(void *) * 3);
13660 * utf8string: UTF-8 encoded source string. 13660 * utf8string: UTF-8 encoded source string.
13661 * Returns: 13661 * Returns:
13662 * Wide string that needs to be freed with dw_free() 13662 * Wide string that needs to be freed with dw_free()
13663 * or NULL on failure. 13663 * or NULL on failure.
13664 */ 13664 */
13665 wchar_t * API dw_utf8_to_wchar(char *utf8string) 13665 wchar_t * API dw_utf8_to_wchar(const char *utf8string)
13666 { 13666 {
13667 wchar_t *retval = NULL, *freeme; 13667 wchar_t *retval = NULL, *freeme;
13668 13668
13669 if(sizeof(wchar_t) == sizeof(gunichar)) 13669 if(sizeof(wchar_t) == sizeof(gunichar))
13670 freeme = retval = (wchar_t *)g_utf8_to_ucs4(utf8string, -1, NULL, NULL, NULL); 13670 freeme = retval = (wchar_t *)g_utf8_to_ucs4(utf8string, -1, NULL, NULL, NULL);
13684 * wstring: Wide source string. 13684 * wstring: Wide source string.
13685 * Returns: 13685 * Returns:
13686 * UTF-8 encoded string that needs to be freed with dw_free() 13686 * UTF-8 encoded string that needs to be freed with dw_free()
13687 * or NULL on failure. 13687 * or NULL on failure.
13688 */ 13688 */
13689 char * API dw_wchar_to_utf8(wchar_t *wstring) 13689 char * API dw_wchar_to_utf8(const wchar_t *wstring)
13690 { 13690 {
13691 char *retval = NULL, *freeme; 13691 char *retval = NULL, *freeme;
13692 13692
13693 if(sizeof(wchar_t) == sizeof(gunichar)) 13693 if(sizeof(wchar_t) == sizeof(gunichar))
13694 freeme = retval = g_ucs4_to_utf8((gunichar *)wstring, -1, NULL, NULL, NULL); 13694 freeme = retval = g_ucs4_to_utf8((gunichar *)wstring, -1, NULL, NULL, NULL);