Mercurial > dwindows
comparison gtk3/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 | 2cbbbc850b8d |
children | 2c56a8e245e8 |
comparison
equal
deleted
inserted
replaced
2035:ea303d356419 | 2036:48b91f535f82 |
---|---|
1109 usleep(period * 1000); | 1109 usleep(period * 1000); |
1110 #endif | 1110 #endif |
1111 } | 1111 } |
1112 | 1112 |
1113 /* Finds the translation function for a given signal name */ | 1113 /* Finds the translation function for a given signal name */ |
1114 static void *_findsigfunc(char *signame) | 1114 static void *_findsigfunc(const char *signame) |
1115 { | 1115 { |
1116 int z; | 1116 int z; |
1117 | 1117 |
1118 for(z=0;z<SIGNALMAX;z++) | 1118 for(z=0;z<SIGNALMAX;z++) |
1119 { | 1119 { |
2230 * Displays a debug message on the console... | 2230 * Displays a debug message on the console... |
2231 * Parameters: | 2231 * Parameters: |
2232 * format: printf style format string. | 2232 * format: printf style format string. |
2233 * ...: Additional variables for use in the format. | 2233 * ...: Additional variables for use in the format. |
2234 */ | 2234 */ |
2235 void API dw_debug(char *format, ...) | 2235 void API dw_debug(const char *format, ...) |
2236 { | 2236 { |
2237 va_list args; | 2237 va_list args; |
2238 char outbuf[1025] = {0}; | 2238 char outbuf[1025] = {0}; |
2239 | 2239 |
2240 va_start(args, format); | 2240 va_start(args, format); |
2250 * title: The title of the message box. | 2250 * title: The title of the message box. |
2251 * flags: Defines buttons and icons to display | 2251 * flags: Defines buttons and icons to display |
2252 * format: printf style format string. | 2252 * format: printf style format string. |
2253 * ...: Additional variables for use in the format. | 2253 * ...: Additional variables for use in the format. |
2254 */ | 2254 */ |
2255 int dw_messagebox(char *title, int flags, char *format, ...) | 2255 int dw_messagebox(const char *title, int flags, const char *format, ...) |
2256 { | 2256 { |
2257 GtkMessageType gtkicon = GTK_MESSAGE_OTHER; | 2257 GtkMessageType gtkicon = GTK_MESSAGE_OTHER; |
2258 GtkButtonsType gtkbuttons = GTK_BUTTONS_OK; | 2258 GtkButtonsType gtkbuttons = GTK_BUTTONS_OK; |
2259 GtkWidget *dialog; | 2259 GtkWidget *dialog; |
2260 int response, _locked_by_me = FALSE; | 2260 int response, _locked_by_me = FALSE; |
2575 /* | 2575 /* |
2576 * Sets the default font used on text based widgets. | 2576 * Sets the default font used on text based widgets. |
2577 * Parameters: | 2577 * Parameters: |
2578 * fontname: Font name in Dynamic Windows format. | 2578 * fontname: Font name in Dynamic Windows format. |
2579 */ | 2579 */ |
2580 void API dw_font_set_default(char *fontname) | 2580 void API dw_font_set_default(const char *fontname) |
2581 { | 2581 { |
2582 char *oldfont = _DWDefaultFont; | 2582 char *oldfont = _DWDefaultFont; |
2583 | 2583 |
2584 _DWDefaultFont = strdup(fontname); | 2584 _DWDefaultFont = strdup(fontname); |
2585 | 2585 |
2637 * Sets the font used by a specified window (widget) handle. | 2637 * Sets the font used by a specified window (widget) handle. |
2638 * Parameters: | 2638 * Parameters: |
2639 * handle: The window (widget) handle. | 2639 * handle: The window (widget) handle. |
2640 * fontname: Name and size of the font in the form "size.fontname" | 2640 * fontname: Name and size of the font in the form "size.fontname" |
2641 */ | 2641 */ |
2642 int dw_window_set_font(HWND handle, char *fontname) | 2642 int dw_window_set_font(HWND handle, const char *fontname) |
2643 { | 2643 { |
2644 GtkWidget *handle2 = handle; | 2644 GtkWidget *handle2 = handle; |
2645 char *font = strdup(fontname); | 2645 char *font = strdup(fontname); |
2646 int _locked_by_me = FALSE; | 2646 int _locked_by_me = FALSE; |
2647 gpointer data; | 2647 gpointer data; |
2685 * Parameters: | 2685 * Parameters: |
2686 * currfont: current font | 2686 * currfont: current font |
2687 * Returns: | 2687 * Returns: |
2688 * A malloced buffer with the selected font or NULL on error. | 2688 * A malloced buffer with the selected font or NULL on error. |
2689 */ | 2689 */ |
2690 char * API dw_font_choose(char *currfont) | 2690 char * API dw_font_choose(const char *currfont) |
2691 { | 2691 { |
2692 GtkFontChooser *fd; | 2692 GtkFontChooser *fd; |
2693 char *font = currfont ? strdup(currfont) : NULL; | 2693 char *font = currfont ? strdup(currfont) : NULL; |
2694 char *name = font ? strchr(font, '.') : NULL; | 2694 char *name = font ? strchr(font, '.') : NULL; |
2695 int _locked_by_me = FALSE; | 2695 int _locked_by_me = FALSE; |
3017 * Parameters: | 3017 * Parameters: |
3018 * owner: The Owner's window handle or HWND_DESKTOP. | 3018 * owner: The Owner's window handle or HWND_DESKTOP. |
3019 * title: The Window title. | 3019 * title: The Window title. |
3020 * flStyle: Style flags, see the PM reference. | 3020 * flStyle: Style flags, see the PM reference. |
3021 */ | 3021 */ |
3022 HWND dw_window_new(HWND hwndOwner, char *title, unsigned long flStyle) | 3022 HWND dw_window_new(HWND hwndOwner, const char *title, unsigned long flStyle) |
3023 { | 3023 { |
3024 GtkWidget *tmp; | 3024 GtkWidget *tmp; |
3025 int _locked_by_me = FALSE; | 3025 int _locked_by_me = FALSE; |
3026 int flags = 0; | 3026 int flags = 0; |
3027 | 3027 |
3221 * Parameters: | 3221 * Parameters: |
3222 * type: Either DW_VERT (vertical) or DW_HORZ (horizontal). | 3222 * type: Either DW_VERT (vertical) or DW_HORZ (horizontal). |
3223 * pad: Number of pixels to pad around the box. | 3223 * pad: Number of pixels to pad around the box. |
3224 * title: Text to be displayined in the group outline. | 3224 * title: Text to be displayined in the group outline. |
3225 */ | 3225 */ |
3226 HWND dw_groupbox_new(int type, int pad, char *title) | 3226 HWND dw_groupbox_new(int type, int pad, const char *title) |
3227 { | 3227 { |
3228 GtkWidget *tmp, *frame; | 3228 GtkWidget *tmp, *frame; |
3229 int _locked_by_me = FALSE; | 3229 int _locked_by_me = FALSE; |
3230 | 3230 |
3231 DW_MUTEX_LOCK; | 3231 DW_MUTEX_LOCK; |
3389 *menu = NULL; | 3389 *menu = NULL; |
3390 DW_MUTEX_UNLOCK; | 3390 DW_MUTEX_UNLOCK; |
3391 } | 3391 } |
3392 } | 3392 } |
3393 | 3393 |
3394 char _removetilde(char *dest, char *src) | 3394 char _removetilde(char *dest, const char *src) |
3395 { | 3395 { |
3396 int z, cur=0; | 3396 int z, cur=0; |
3397 char accel = '\0'; | 3397 char accel = '\0'; |
3398 | 3398 |
3399 for(z=0;z<strlen(src);z++) | 3399 for(z=0;z<strlen(src);z++) |
3423 * flags: Extended attributes to set on the menu. | 3423 * flags: Extended attributes to set on the menu. |
3424 * end: If TRUE memu is positioned at the end of the menu. | 3424 * end: If TRUE memu is positioned at the end of the menu. |
3425 * check: If TRUE menu is "check"able. | 3425 * check: If TRUE menu is "check"able. |
3426 * submenu: Handle to an existing menu to be a submenu or NULL. | 3426 * submenu: Handle to an existing menu to be a submenu or NULL. |
3427 */ | 3427 */ |
3428 HWND dw_menu_append_item(HMENUI menu, char *title, unsigned long id, unsigned long flags, int end, int check, HMENUI submenu) | 3428 HWND dw_menu_append_item(HMENUI menu, const char *title, unsigned long id, unsigned long flags, int end, int check, HMENUI submenu) |
3429 { | 3429 { |
3430 GtkWidget *tmphandle; | 3430 GtkWidget *tmphandle; |
3431 char accel, *tempbuf = malloc(strlen(title)+1); | 3431 char accel, *tempbuf = malloc(strlen(title)+1); |
3432 int _locked_by_me = FALSE, submenucount; | 3432 int _locked_by_me = FALSE, submenucount; |
3433 GtkAccelGroup *accel_group; | 3433 GtkAccelGroup *accel_group; |
3513 | 3513 |
3514 DW_MUTEX_UNLOCK; | 3514 DW_MUTEX_UNLOCK; |
3515 return tmphandle; | 3515 return tmphandle; |
3516 } | 3516 } |
3517 | 3517 |
3518 GtkWidget *_find_submenu_id(GtkWidget *start, char *name) | 3518 GtkWidget *_find_submenu_id(GtkWidget *start, const char *name) |
3519 { | 3519 { |
3520 GtkWidget *tmp; | 3520 GtkWidget *tmp; |
3521 int z, submenucount = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(start), "_dw_submenucount")); | 3521 int z, submenucount = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(start), "_dw_submenucount")); |
3522 | 3522 |
3523 if((tmp = g_object_get_data(G_OBJECT(start), name))) | 3523 if((tmp = g_object_get_data(G_OBJECT(start), name))) |
3858 * Create a new static text window (widget) to be packed. | 3858 * Create a new static text window (widget) to be packed. |
3859 * Parameters: | 3859 * Parameters: |
3860 * text: The text to be display by the static text widget. | 3860 * text: The text to be display by the static text widget. |
3861 * id: An ID to be used with dw_window_from_id() or 0L. | 3861 * id: An ID to be used with dw_window_from_id() or 0L. |
3862 */ | 3862 */ |
3863 HWND dw_text_new(char *text, unsigned long id) | 3863 HWND dw_text_new(const char *text, unsigned long id) |
3864 { | 3864 { |
3865 GtkWidget *tmp; | 3865 GtkWidget *tmp; |
3866 int _locked_by_me = FALSE; | 3866 int _locked_by_me = FALSE; |
3867 | 3867 |
3868 DW_MUTEX_LOCK; | 3868 DW_MUTEX_LOCK; |
3887 * Create a new status text window (widget) to be packed. | 3887 * Create a new status text window (widget) to be packed. |
3888 * Parameters: | 3888 * Parameters: |
3889 * text: The text to be display by the static text widget. | 3889 * text: The text to be display by the static text widget. |
3890 * id: An ID to be used with dw_window_from_id() or 0L. | 3890 * id: An ID to be used with dw_window_from_id() or 0L. |
3891 */ | 3891 */ |
3892 HWND dw_status_text_new(char *text, ULONG id) | 3892 HWND dw_status_text_new(const char *text, ULONG id) |
3893 { | 3893 { |
3894 GtkWidget *tmp, *frame; | 3894 GtkWidget *tmp, *frame; |
3895 int _locked_by_me = FALSE; | 3895 int _locked_by_me = FALSE; |
3896 | 3896 |
3897 DW_MUTEX_LOCK; | 3897 DW_MUTEX_LOCK; |
3950 * Create a new Entryfield window (widget) to be packed. | 3950 * Create a new Entryfield window (widget) to be packed. |
3951 * Parameters: | 3951 * Parameters: |
3952 * text: The default text to be in the entryfield widget. | 3952 * text: The default text to be in the entryfield widget. |
3953 * id: An ID to be used with dw_window_from_id() or 0L. | 3953 * id: An ID to be used with dw_window_from_id() or 0L. |
3954 */ | 3954 */ |
3955 HWND dw_entryfield_new(char *text, unsigned long id) | 3955 HWND dw_entryfield_new(const char *text, unsigned long id) |
3956 { | 3956 { |
3957 GtkWidget *tmp; | 3957 GtkWidget *tmp; |
3958 int _locked_by_me = FALSE; | 3958 int _locked_by_me = FALSE; |
3959 | 3959 |
3960 DW_MUTEX_LOCK; | 3960 DW_MUTEX_LOCK; |
3976 * Create a new Entryfield (password) window (widget) to be packed. | 3976 * Create a new Entryfield (password) window (widget) to be packed. |
3977 * Parameters: | 3977 * Parameters: |
3978 * text: The default text to be in the entryfield widget. | 3978 * text: The default text to be in the entryfield widget. |
3979 * id: An ID to be used with dw_window_from_id() or 0L. | 3979 * id: An ID to be used with dw_window_from_id() or 0L. |
3980 */ | 3980 */ |
3981 HWND dw_entryfield_password_new(char *text, ULONG id) | 3981 HWND dw_entryfield_password_new(const char *text, ULONG id) |
3982 { | 3982 { |
3983 GtkWidget *tmp; | 3983 GtkWidget *tmp; |
3984 int _locked_by_me = FALSE; | 3984 int _locked_by_me = FALSE; |
3985 | 3985 |
3986 DW_MUTEX_LOCK; | 3986 DW_MUTEX_LOCK; |
4003 * Create a new Combobox window (widget) to be packed. | 4003 * Create a new Combobox window (widget) to be packed. |
4004 * Parameters: | 4004 * Parameters: |
4005 * text: The default text to be in the combpbox widget. | 4005 * text: The default text to be in the combpbox widget. |
4006 * id: An ID to be used with dw_window_from_id() or 0L. | 4006 * id: An ID to be used with dw_window_from_id() or 0L. |
4007 */ | 4007 */ |
4008 HWND dw_combobox_new(char *text, unsigned long id) | 4008 HWND dw_combobox_new(const char *text, unsigned long id) |
4009 { | 4009 { |
4010 GtkWidget *tmp; | 4010 GtkWidget *tmp; |
4011 GtkListStore *store; | 4011 GtkListStore *store; |
4012 int _locked_by_me = FALSE; | 4012 int _locked_by_me = FALSE; |
4013 | 4013 |
4030 * Create a new button window (widget) to be packed. | 4030 * Create a new button window (widget) to be packed. |
4031 * Parameters: | 4031 * Parameters: |
4032 * text: The text to be display by the static text widget. | 4032 * text: The text to be display by the static text widget. |
4033 * id: An ID to be used with dw_window_from_id() or 0L. | 4033 * id: An ID to be used with dw_window_from_id() or 0L. |
4034 */ | 4034 */ |
4035 HWND dw_button_new(char *text, unsigned long id) | 4035 HWND dw_button_new(const char *text, unsigned long id) |
4036 { | 4036 { |
4037 GtkWidget *tmp; | 4037 GtkWidget *tmp; |
4038 int _locked_by_me = FALSE; | 4038 int _locked_by_me = FALSE; |
4039 | 4039 |
4040 DW_MUTEX_LOCK; | 4040 DW_MUTEX_LOCK; |
4051 * Create a new bitmap button window (widget) to be packed. | 4051 * Create a new bitmap button window (widget) to be packed. |
4052 * Parameters: | 4052 * Parameters: |
4053 * text: Bubble help text to be displayed. | 4053 * text: Bubble help text to be displayed. |
4054 * id: An ID of a bitmap in the resource file. | 4054 * id: An ID of a bitmap in the resource file. |
4055 */ | 4055 */ |
4056 HWND dw_bitmapbutton_new(char *text, unsigned long id) | 4056 HWND dw_bitmapbutton_new(const char *text, unsigned long id) |
4057 { | 4057 { |
4058 GtkWidget *tmp; | 4058 GtkWidget *tmp; |
4059 GtkWidget *bitmap; | 4059 GtkWidget *bitmap; |
4060 int _locked_by_me = FALSE; | 4060 int _locked_by_me = FALSE; |
4061 | 4061 |
4087 * id: An ID to be used with dw_window_from_id() or 0L. | 4087 * id: An ID to be used with dw_window_from_id() or 0L. |
4088 * filename: Name of the file, omit extention to have | 4088 * filename: Name of the file, omit extention to have |
4089 * DW pick the appropriate file extension. | 4089 * DW pick the appropriate file extension. |
4090 * (BMP on OS/2 or Windows, XPM on Unix) | 4090 * (BMP on OS/2 or Windows, XPM on Unix) |
4091 */ | 4091 */ |
4092 HWND dw_bitmapbutton_new_from_file(char *text, unsigned long id, char *filename) | 4092 HWND dw_bitmapbutton_new_from_file(const char *text, unsigned long id, const char *filename) |
4093 { | 4093 { |
4094 GtkWidget *tmp; | 4094 GtkWidget *tmp; |
4095 GtkWidget *bitmap; | 4095 GtkWidget *bitmap; |
4096 int _locked_by_me = FALSE; | 4096 int _locked_by_me = FALSE; |
4097 | 4097 |
4123 * id: An ID to be used with dw_window_from_id() or 0L. | 4123 * id: An ID to be used with dw_window_from_id() or 0L. |
4124 * data: Raw data of image. | 4124 * data: Raw data of image. |
4125 * (BMP on OS/2 or Windows, XPM on Unix) | 4125 * (BMP on OS/2 or Windows, XPM on Unix) |
4126 * len: Length of raw data | 4126 * len: Length of raw data |
4127 */ | 4127 */ |
4128 HWND dw_bitmapbutton_new_from_data(char *text, unsigned long id, char *data, int len) | 4128 HWND dw_bitmapbutton_new_from_data(const char *text, unsigned long id, const char *data, int len) |
4129 { | 4129 { |
4130 GtkWidget *tmp; | 4130 GtkWidget *tmp; |
4131 GtkWidget *bitmap; | 4131 GtkWidget *bitmap; |
4132 int _locked_by_me = FALSE; | 4132 int _locked_by_me = FALSE; |
4133 | 4133 |
4155 * Create a new spinbutton window (widget) to be packed. | 4155 * Create a new spinbutton window (widget) to be packed. |
4156 * Parameters: | 4156 * Parameters: |
4157 * text: The text to be display by the static text widget. | 4157 * text: The text to be display by the static text widget. |
4158 * id: An ID to be used with dw_window_from_id() or 0L. | 4158 * id: An ID to be used with dw_window_from_id() or 0L. |
4159 */ | 4159 */ |
4160 HWND dw_spinbutton_new(char *text, unsigned long id) | 4160 HWND dw_spinbutton_new(const char *text, unsigned long id) |
4161 { | 4161 { |
4162 GtkAdjustment *adj; | 4162 GtkAdjustment *adj; |
4163 GtkWidget *tmp; | 4163 GtkWidget *tmp; |
4164 int _locked_by_me = FALSE; | 4164 int _locked_by_me = FALSE; |
4165 | 4165 |
4182 * Create a new radiobutton window (widget) to be packed. | 4182 * Create a new radiobutton window (widget) to be packed. |
4183 * Parameters: | 4183 * Parameters: |
4184 * text: The text to be display by the static text widget. | 4184 * text: The text to be display by the static text widget. |
4185 * id: An ID to be used with dw_window_from_id() or 0L. | 4185 * id: An ID to be used with dw_window_from_id() or 0L. |
4186 */ | 4186 */ |
4187 HWND dw_radiobutton_new(char *text, ULONG id) | 4187 HWND dw_radiobutton_new(const char *text, ULONG id) |
4188 { | 4188 { |
4189 /* This will have to be fixed in the future. */ | 4189 /* This will have to be fixed in the future. */ |
4190 GtkWidget *tmp; | 4190 GtkWidget *tmp; |
4191 int _locked_by_me = FALSE; | 4191 int _locked_by_me = FALSE; |
4192 | 4192 |
4289 * Create a new checkbox window (widget) to be packed. | 4289 * Create a new checkbox window (widget) to be packed. |
4290 * Parameters: | 4290 * Parameters: |
4291 * text: The text to be display by the static text widget. | 4291 * text: The text to be display by the static text widget. |
4292 * id: An ID to be used with dw_window_from_id() or 0L. | 4292 * id: An ID to be used with dw_window_from_id() or 0L. |
4293 */ | 4293 */ |
4294 HWND dw_checkbox_new(char *text, unsigned long id) | 4294 HWND dw_checkbox_new(const char *text, unsigned long id) |
4295 { | 4295 { |
4296 GtkWidget *tmp; | 4296 GtkWidget *tmp; |
4297 int _locked_by_me = FALSE; | 4297 int _locked_by_me = FALSE; |
4298 | 4298 |
4299 DW_MUTEX_LOCK; | 4299 DW_MUTEX_LOCK; |
4388 * (pass 0 if you use the filename param) | 4388 * (pass 0 if you use the filename param) |
4389 * filename: a path to a file (Bitmap on OS/2 or | 4389 * filename: a path to a file (Bitmap on OS/2 or |
4390 * Windows and a pixmap on Unix, pass | 4390 * Windows and a pixmap on Unix, pass |
4391 * NULL if you use the id param) | 4391 * NULL if you use the id param) |
4392 */ | 4392 */ |
4393 void dw_window_set_bitmap(HWND handle, unsigned long id, char *filename) | 4393 void dw_window_set_bitmap(HWND handle, unsigned long id, const char *filename) |
4394 { | 4394 { |
4395 GdkPixbuf *tmp = NULL; | 4395 GdkPixbuf *tmp = NULL; |
4396 int found_ext = 0; | 4396 int found_ext = 0; |
4397 int i; | 4397 int i; |
4398 int _locked_by_me = FALSE; | 4398 int _locked_by_me = FALSE; |
4465 * data: the image data | 4465 * data: the image data |
4466 * Bitmap on Windows and a pixmap on Unix, pass | 4466 * Bitmap on Windows and a pixmap on Unix, pass |
4467 * NULL if you use the id param) | 4467 * NULL if you use the id param) |
4468 * len: length of data | 4468 * len: length of data |
4469 */ | 4469 */ |
4470 void dw_window_set_bitmap_from_data(HWND handle, unsigned long id, char *data, int len) | 4470 void dw_window_set_bitmap_from_data(HWND handle, unsigned long id, const char *data, int len) |
4471 { | 4471 { |
4472 GdkPixbuf *tmp = NULL; | 4472 GdkPixbuf *tmp = NULL; |
4473 int _locked_by_me = FALSE; | 4473 int _locked_by_me = FALSE; |
4474 char *file; | 4474 char *file; |
4475 FILE *fp; | 4475 FILE *fp; |
4525 * Sets the text used for a given window. | 4525 * Sets the text used for a given window. |
4526 * Parameters: | 4526 * Parameters: |
4527 * handle: Handle to the window. | 4527 * handle: Handle to the window. |
4528 * text: The text associated with a given window. | 4528 * text: The text associated with a given window. |
4529 */ | 4529 */ |
4530 void dw_window_set_text(HWND handle, char *text) | 4530 void dw_window_set_text(HWND handle, const char *text) |
4531 { | 4531 { |
4532 int _locked_by_me = FALSE; | 4532 int _locked_by_me = FALSE; |
4533 GtkWidget *tmp; | 4533 GtkWidget *tmp; |
4534 | 4534 |
4535 DW_MUTEX_LOCK; | 4535 DW_MUTEX_LOCK; |
4565 * Sets the text used for a given window's floating bubble help. | 4565 * Sets the text used for a given window's floating bubble help. |
4566 * Parameters: | 4566 * Parameters: |
4567 * handle: Handle to the window (widget). | 4567 * handle: Handle to the window (widget). |
4568 * bubbletext: The text in the floating bubble tooltip. | 4568 * bubbletext: The text in the floating bubble tooltip. |
4569 */ | 4569 */ |
4570 void API dw_window_set_tooltip(HWND handle, char *bubbletext) | 4570 void API dw_window_set_tooltip(HWND handle, const char *bubbletext) |
4571 { | 4571 { |
4572 int _locked_by_me = FALSE; | 4572 int _locked_by_me = FALSE; |
4573 | 4573 |
4574 DW_MUTEX_LOCK; | 4574 DW_MUTEX_LOCK; |
4575 if(bubbletext && *bubbletext) | 4575 if(bubbletext && *bubbletext) |
4672 * Parameters: | 4672 * Parameters: |
4673 * handle: Handle to the MLE to be queried. | 4673 * handle: Handle to the MLE to be queried. |
4674 * buffer: Text buffer to be imported. | 4674 * buffer: Text buffer to be imported. |
4675 * startpoint: Point to start entering text. | 4675 * startpoint: Point to start entering text. |
4676 */ | 4676 */ |
4677 unsigned int dw_mle_import(HWND handle, char *buffer, int startpoint) | 4677 unsigned int dw_mle_import(HWND handle, const char *buffer, int startpoint) |
4678 { | 4678 { |
4679 unsigned int tmppoint = startpoint; | 4679 unsigned int tmppoint = startpoint; |
4680 int _locked_by_me = FALSE; | 4680 int _locked_by_me = FALSE; |
4681 | 4681 |
4682 DW_MUTEX_LOCK; | 4682 DW_MUTEX_LOCK; |
4963 * handle: Handle to the MLE to be cleared. | 4963 * handle: Handle to the MLE to be cleared. |
4964 * text: Text to search for. | 4964 * text: Text to search for. |
4965 * point: Start point of search. | 4965 * point: Start point of search. |
4966 * flags: Search specific flags. | 4966 * flags: Search specific flags. |
4967 */ | 4967 */ |
4968 int dw_mle_search(HWND handle, char *text, int point, unsigned long flags) | 4968 int dw_mle_search(HWND handle, const char *text, int point, unsigned long flags) |
4969 { | 4969 { |
4970 int _locked_by_me = FALSE, retval = 0; | 4970 int _locked_by_me = FALSE, retval = 0; |
4971 | 4971 |
4972 DW_MUTEX_LOCK; | 4972 DW_MUTEX_LOCK; |
4973 if(GTK_IS_SCROLLED_WINDOW(handle)) | 4973 if(GTK_IS_SCROLLED_WINDOW(handle)) |
5293 * title: The text title of the entry. | 5293 * title: The text title of the entry. |
5294 * icon: Handle to coresponding icon. | 5294 * icon: Handle to coresponding icon. |
5295 * parent: Parent handle or 0 if root. | 5295 * parent: Parent handle or 0 if root. |
5296 * itemdata: Item specific data. | 5296 * itemdata: Item specific data. |
5297 */ | 5297 */ |
5298 HTREEITEM dw_tree_insert_after(HWND handle, HTREEITEM item, char *title, HICN icon, HTREEITEM parent, void *itemdata) | 5298 HTREEITEM dw_tree_insert_after(HWND handle, HTREEITEM item, const char *title, HICN icon, HTREEITEM parent, void *itemdata) |
5299 { | 5299 { |
5300 GtkWidget *tree; | 5300 GtkWidget *tree; |
5301 GtkTreeIter *iter; | 5301 GtkTreeIter *iter; |
5302 GtkTreeStore *store; | 5302 GtkTreeStore *store; |
5303 GdkPixbuf *pixbuf; | 5303 GdkPixbuf *pixbuf; |
5332 * title: The text title of the entry. | 5332 * title: The text title of the entry. |
5333 * icon: Handle to coresponding icon. | 5333 * icon: Handle to coresponding icon. |
5334 * parent: Parent handle or 0 if root. | 5334 * parent: Parent handle or 0 if root. |
5335 * itemdata: Item specific data. | 5335 * itemdata: Item specific data. |
5336 */ | 5336 */ |
5337 HTREEITEM dw_tree_insert(HWND handle, char *title, HICN icon, HTREEITEM parent, void *itemdata) | 5337 HTREEITEM dw_tree_insert(HWND handle, const char *title, HICN icon, HTREEITEM parent, void *itemdata) |
5338 { | 5338 { |
5339 GtkWidget *tree; | 5339 GtkWidget *tree; |
5340 GtkTreeIter *iter; | 5340 GtkTreeIter *iter; |
5341 GtkTreeStore *store; | 5341 GtkTreeStore *store; |
5342 GdkPixbuf *pixbuf; | 5342 GdkPixbuf *pixbuf; |
5370 * handle: Handle to the tree containing the item. | 5370 * handle: Handle to the tree containing the item. |
5371 * item: Handle of the item to be modified. | 5371 * item: Handle of the item to be modified. |
5372 * title: The text title of the entry. | 5372 * title: The text title of the entry. |
5373 * icon: Handle to coresponding icon. | 5373 * icon: Handle to coresponding icon. |
5374 */ | 5374 */ |
5375 void dw_tree_item_change(HWND handle, HTREEITEM item, char *title, HICN icon) | 5375 void dw_tree_item_change(HWND handle, HTREEITEM item, const char *title, HICN icon) |
5376 { | 5376 { |
5377 GtkWidget *tree; | 5377 GtkWidget *tree; |
5378 GtkTreeStore *store; | 5378 GtkTreeStore *store; |
5379 GdkPixbuf *pixbuf; | 5379 GdkPixbuf *pixbuf; |
5380 int _locked_by_me = FALSE; | 5380 int _locked_by_me = FALSE; |
5833 * Configures the main filesystem columnn title for localization. | 5833 * Configures the main filesystem columnn title for localization. |
5834 * Parameters: | 5834 * Parameters: |
5835 * handle: Handle to the container to be configured. | 5835 * handle: Handle to the container to be configured. |
5836 * title: The title to be displayed in the main column. | 5836 * title: The title to be displayed in the main column. |
5837 */ | 5837 */ |
5838 void API dw_filesystem_set_column_title(HWND handle, char *title) | 5838 void API dw_filesystem_set_column_title(HWND handle, const char *title) |
5839 { | 5839 { |
5840 char *newtitle = strdup(title ? title : ""); | 5840 char *newtitle = strdup(title ? title : ""); |
5841 | 5841 |
5842 g_object_set_data(G_OBJECT(handle), "_dw_coltitle", newtitle); | 5842 g_object_set_data(G_OBJECT(handle), "_dw_coltitle", newtitle); |
5843 } | 5843 } |
5910 * Parameters: | 5910 * Parameters: |
5911 * filename: Name of the file, omit extention to have | 5911 * filename: Name of the file, omit extention to have |
5912 * DW pick the appropriate file extension. | 5912 * DW pick the appropriate file extension. |
5913 * (ICO on OS/2 or Windows, XPM on Unix) | 5913 * (ICO on OS/2 or Windows, XPM on Unix) |
5914 */ | 5914 */ |
5915 HICN API dw_icon_load_from_file(char *filename) | 5915 HICN API dw_icon_load_from_file(const char *filename) |
5916 { | 5916 { |
5917 int _locked_by_me = FALSE; | 5917 int _locked_by_me = FALSE; |
5918 char *file = alloca(strlen(filename) + 6); | 5918 char *file = alloca(strlen(filename) + 6); |
5919 int i, found_ext = 0; | 5919 int i, found_ext = 0; |
5920 HICN ret = 0; | 5920 HICN ret = 0; |
5954 * Obtains an icon from data. | 5954 * Obtains an icon from data. |
5955 * Parameters: | 5955 * Parameters: |
5956 * data: Source of data for image. | 5956 * data: Source of data for image. |
5957 * len: length of data | 5957 * len: length of data |
5958 */ | 5958 */ |
5959 HICN API dw_icon_load_from_data(char *data, int len) | 5959 HICN API dw_icon_load_from_data(const char *data, int len) |
5960 { | 5960 { |
5961 int _locked_by_me = FALSE; | 5961 int _locked_by_me = FALSE; |
5962 char *file; | 5962 char *file; |
5963 FILE *fp; | 5963 FILE *fp; |
5964 HICN ret = 0; | 5964 HICN ret = 0; |
6180 * pointer: Pointer to the allocated memory in dw_container_alloc(). | 6180 * pointer: Pointer to the allocated memory in dw_container_alloc(). |
6181 * column: Zero based column of data being set. | 6181 * column: Zero based column of data being set. |
6182 * row: Zero based row of data being set. | 6182 * row: Zero based row of data being set. |
6183 * data: Pointer to the data to be added. | 6183 * data: Pointer to the data to be added. |
6184 */ | 6184 */ |
6185 void API dw_filesystem_change_file(HWND handle, int row, char *filename, HICN icon) | 6185 void API dw_filesystem_change_file(HWND handle, int row, const char *filename, HICN icon) |
6186 { | 6186 { |
6187 dw_filesystem_set_file(handle, NULL, row, filename, icon); | 6187 dw_filesystem_set_file(handle, NULL, row, filename, icon); |
6188 } | 6188 } |
6189 | 6189 |
6190 /* | 6190 /* |
6194 * pointer: Pointer to the allocated memory in dw_container_alloc(). | 6194 * pointer: Pointer to the allocated memory in dw_container_alloc(). |
6195 * column: Zero based column of data being set. | 6195 * column: Zero based column of data being set. |
6196 * row: Zero based row of data being set. | 6196 * row: Zero based row of data being set. |
6197 * data: Pointer to the data to be added. | 6197 * data: Pointer to the data to be added. |
6198 */ | 6198 */ |
6199 void dw_filesystem_set_file(HWND handle, void *pointer, int row, char *filename, HICN icon) | 6199 void dw_filesystem_set_file(HWND handle, void *pointer, int row, const char *filename, HICN icon) |
6200 { | 6200 { |
6201 void *data[2] = { (void *)&icon, (void *)filename }; | 6201 void *data[2] = { (void *)&icon, (void *)filename }; |
6202 | 6202 |
6203 _dw_container_set_item(handle, pointer, 0, row, (void *)data); | 6203 _dw_container_set_item(handle, pointer, 0, row, (void *)data); |
6204 } | 6204 } |
6359 * Parameters: | 6359 * Parameters: |
6360 * pointer: Pointer to the allocated memory in dw_container_alloc(). | 6360 * pointer: Pointer to the allocated memory in dw_container_alloc(). |
6361 * row: Zero based row of data being set. | 6361 * row: Zero based row of data being set. |
6362 * title: String title of the item. | 6362 * title: String title of the item. |
6363 */ | 6363 */ |
6364 void dw_container_set_row_title(void *pointer, int row, char *title) | 6364 void dw_container_set_row_title(void *pointer, int row, const char *title) |
6365 { | 6365 { |
6366 _dw_container_set_row_data(pointer, pointer, row, _DW_DATA_TYPE_STRING, title); | 6366 _dw_container_set_row_data(pointer, pointer, row, _DW_DATA_TYPE_STRING, (void *)title); |
6367 } | 6367 } |
6368 | 6368 |
6369 /* | 6369 /* |
6370 * Changes the title of a row already inserted in the container. | 6370 * Changes the title of a row already inserted in the container. |
6371 * Parameters: | 6371 * Parameters: |
6372 * handle: Handle to window (widget) of container. | 6372 * handle: Handle to window (widget) of container. |
6373 * row: Zero based row of data being set. | 6373 * row: Zero based row of data being set. |
6374 * title: String title of the item. | 6374 * title: String title of the item. |
6375 */ | 6375 */ |
6376 void dw_container_change_row_title(HWND handle, int row, char *title) | 6376 void dw_container_change_row_title(HWND handle, int row, const char *title) |
6377 { | 6377 { |
6378 _dw_container_set_row_data(handle, NULL, row, _DW_DATA_TYPE_STRING, title); | 6378 _dw_container_set_row_data(handle, NULL, row, _DW_DATA_TYPE_STRING, (void *)title); |
6379 } | 6379 } |
6380 | 6380 |
6381 /* | 6381 /* |
6382 * Sets the data of a row in the container. | 6382 * Sets the data of a row in the container. |
6383 * Parameters: | 6383 * Parameters: |
6797 * Cursors the item with the text speficied, and scrolls to that item. | 6797 * Cursors the item with the text speficied, and scrolls to that item. |
6798 * Parameters: | 6798 * Parameters: |
6799 * handle: Handle to the window (widget) to be queried. | 6799 * handle: Handle to the window (widget) to be queried. |
6800 * text: Text usually returned by dw_container_query(). | 6800 * text: Text usually returned by dw_container_query(). |
6801 */ | 6801 */ |
6802 void dw_container_cursor(HWND handle, char *text) | 6802 void dw_container_cursor(HWND handle, const char *text) |
6803 { | 6803 { |
6804 _dw_container_cursor(handle, text, TRUE); | 6804 _dw_container_cursor(handle, (void *)text, TRUE); |
6805 } | 6805 } |
6806 | 6806 |
6807 /* | 6807 /* |
6808 * Cursors the item with the text speficied, and scrolls to that item. | 6808 * Cursors the item with the text speficied, and scrolls to that item. |
6809 * Parameters: | 6809 * Parameters: |
6848 * Deletes the item with the text speficied. | 6848 * Deletes the item with the text speficied. |
6849 * Parameters: | 6849 * Parameters: |
6850 * handle: Handle to the window (widget). | 6850 * handle: Handle to the window (widget). |
6851 * text: Text usually returned by dw_container_query(). | 6851 * text: Text usually returned by dw_container_query(). |
6852 */ | 6852 */ |
6853 void dw_container_delete_row(HWND handle, char *text) | 6853 void dw_container_delete_row(HWND handle, const char *text) |
6854 { | 6854 { |
6855 _dw_container_delete_row(handle, text, TRUE); | 6855 _dw_container_delete_row(handle, (void *)text, TRUE); |
6856 } | 6856 } |
6857 | 6857 |
6858 /* | 6858 /* |
6859 * Deletes the item with the text speficied. | 6859 * Deletes the item with the text speficied. |
6860 * Parameters: | 6860 * Parameters: |
6906 * Parameters: | 6906 * Parameters: |
6907 * handle: Window handle that will handle taskbar icon messages. | 6907 * handle: Window handle that will handle taskbar icon messages. |
6908 * icon: Icon handle to display in the taskbar. | 6908 * icon: Icon handle to display in the taskbar. |
6909 * bubbletext: Text to show when the mouse is above the icon. | 6909 * bubbletext: Text to show when the mouse is above the icon. |
6910 */ | 6910 */ |
6911 void dw_taskbar_insert(HWND handle, HICN icon, char *bubbletext) | 6911 void dw_taskbar_insert(HWND handle, HICN icon, const char *bubbletext) |
6912 { | 6912 { |
6913 GtkStatusIcon *status; | 6913 GtkStatusIcon *status; |
6914 GdkPixbuf *pixbuf; | 6914 GdkPixbuf *pixbuf; |
6915 int _locked_by_me = FALSE; | 6915 int _locked_by_me = FALSE; |
6916 | 6916 |
7498 * pixmap: Handle to the pixmap. (choose only one of these) | 7498 * pixmap: Handle to the pixmap. (choose only one of these) |
7499 * x: X coordinate. | 7499 * x: X coordinate. |
7500 * y: Y coordinate. | 7500 * y: Y coordinate. |
7501 * text: Text to be displayed. | 7501 * text: Text to be displayed. |
7502 */ | 7502 */ |
7503 void dw_draw_text(HWND handle, HPIXMAP pixmap, int x, int y, char *text) | 7503 void dw_draw_text(HWND handle, HPIXMAP pixmap, int x, int y, const char *text) |
7504 { | 7504 { |
7505 int _locked_by_me = FALSE; | 7505 int _locked_by_me = FALSE; |
7506 cairo_t *cr = NULL; | 7506 cairo_t *cr = NULL; |
7507 PangoFontDescription *font; | 7507 PangoFontDescription *font; |
7508 char *tmpname, *fontname = "monospace 10"; | 7508 char *tmpname, *fontname = "monospace 10"; |
7607 * pixmap: Handle to the pixmap. (choose only one of these) | 7607 * pixmap: Handle to the pixmap. (choose only one of these) |
7608 * text: Text to be queried. | 7608 * text: Text to be queried. |
7609 * width: Pointer to a variable to be filled in with the width. | 7609 * width: Pointer to a variable to be filled in with the width. |
7610 * height Pointer to a variable to be filled in with the height. | 7610 * height Pointer to a variable to be filled in with the height. |
7611 */ | 7611 */ |
7612 void dw_font_text_extents_get(HWND handle, HPIXMAP pixmap, char *text, int *width, int *height) | 7612 void dw_font_text_extents_get(HWND handle, HPIXMAP pixmap, const char *text, int *width, int *height) |
7613 { | 7613 { |
7614 int _locked_by_me = FALSE; | 7614 int _locked_by_me = FALSE; |
7615 PangoFontDescription *font; | 7615 PangoFontDescription *font; |
7616 char *fontname = NULL; | 7616 char *fontname = NULL; |
7617 int free_fontname = 0; | 7617 int free_fontname = 0; |
7715 * DW pick the appropriate file extension. | 7715 * DW pick the appropriate file extension. |
7716 * (BMP on OS/2 or Windows, XPM on Unix) | 7716 * (BMP on OS/2 or Windows, XPM on Unix) |
7717 * Returns: | 7717 * Returns: |
7718 * A handle to a pixmap or NULL on failure. | 7718 * A handle to a pixmap or NULL on failure. |
7719 */ | 7719 */ |
7720 HPIXMAP dw_pixmap_new_from_file(HWND handle, char *filename) | 7720 HPIXMAP dw_pixmap_new_from_file(HWND handle, const char *filename) |
7721 { | 7721 { |
7722 int _locked_by_me = FALSE; | 7722 int _locked_by_me = FALSE; |
7723 HPIXMAP pixmap; | 7723 HPIXMAP pixmap; |
7724 char *file = alloca(strlen(filename) + 6); | 7724 char *file = alloca(strlen(filename) + 6); |
7725 int found_ext = 0; | 7725 int found_ext = 0; |
7769 * DW pick the appropriate file extension. | 7769 * DW pick the appropriate file extension. |
7770 * (BMP on OS/2 or Windows, XPM on Unix) | 7770 * (BMP on OS/2 or Windows, XPM on Unix) |
7771 * Returns: | 7771 * Returns: |
7772 * A handle to a pixmap or NULL on failure. | 7772 * A handle to a pixmap or NULL on failure. |
7773 */ | 7773 */ |
7774 HPIXMAP dw_pixmap_new_from_data(HWND handle, char *data, int len) | 7774 HPIXMAP dw_pixmap_new_from_data(HWND handle, const char *data, int len) |
7775 { | 7775 { |
7776 int _locked_by_me = FALSE; | 7776 int _locked_by_me = FALSE; |
7777 char *file; | 7777 char *file; |
7778 FILE *fp; | 7778 FILE *fp; |
7779 HPIXMAP pixmap; | 7779 HPIXMAP pixmap; |
7861 * passed to the application via a callback. | 7861 * passed to the application via a callback. |
7862 * fontname: Name and size of the font in the form "size.fontname" | 7862 * fontname: Name and size of the font in the form "size.fontname" |
7863 * Returns: | 7863 * Returns: |
7864 * DW_ERROR_NONE on success and DW_ERROR_GENERAL on failure. | 7864 * DW_ERROR_NONE on success and DW_ERROR_GENERAL on failure. |
7865 */ | 7865 */ |
7866 int API dw_pixmap_set_font(HPIXMAP pixmap, char *fontname) | 7866 int API dw_pixmap_set_font(HPIXMAP pixmap, const char *fontname) |
7867 { | 7867 { |
7868 if(pixmap && fontname && *fontname) | 7868 if(pixmap && fontname && *fontname) |
7869 { | 7869 { |
7870 char *oldfont = pixmap->font; | 7870 char *oldfont = pixmap->font; |
7871 pixmap->font = strdup(fontname); | 7871 pixmap->font = strdup(fontname); |
8032 * Parameters: | 8032 * Parameters: |
8033 * name: Base name of the shared library. | 8033 * name: Base name of the shared library. |
8034 * handle: Pointer to a module handle, | 8034 * handle: Pointer to a module handle, |
8035 * will be filled in with the handle. | 8035 * will be filled in with the handle. |
8036 */ | 8036 */ |
8037 int dw_module_load(char *name, HMOD *handle) | 8037 int dw_module_load(const char *name, HMOD *handle) |
8038 { | 8038 { |
8039 int len; | 8039 int len; |
8040 char *newname; | 8040 char *newname; |
8041 char errorbuf[1025] = {0}; | 8041 char errorbuf[1025] = {0}; |
8042 | 8042 |
8075 * handle: Module handle returned by dw_module_load() | 8075 * handle: Module handle returned by dw_module_load() |
8076 * name: Name of the symbol you want the address of. | 8076 * name: Name of the symbol you want the address of. |
8077 * func: A pointer to a function pointer, to obtain | 8077 * func: A pointer to a function pointer, to obtain |
8078 * the address. | 8078 * the address. |
8079 */ | 8079 */ |
8080 int dw_module_symbol(HMOD handle, char *name, void**func) | 8080 int dw_module_symbol(HMOD handle, const char *name, void**func) |
8081 { | 8081 { |
8082 if(!func || !name) | 8082 if(!func || !name) |
8083 return -1; | 8083 return -1; |
8084 | 8084 |
8085 if(strlen(name) == 0) | 8085 if(strlen(name) == 0) |
8452 * Parameters: | 8452 * Parameters: |
8453 * eve: Pointer to an event handle to receive handle. | 8453 * eve: Pointer to an event handle to receive handle. |
8454 * name: Name given to semaphore which can be opened | 8454 * name: Name given to semaphore which can be opened |
8455 * by other processes. | 8455 * by other processes. |
8456 */ | 8456 */ |
8457 HEV dw_named_event_new(char *name) | 8457 HEV dw_named_event_new(const char *name) |
8458 { | 8458 { |
8459 struct sockaddr_un un; | 8459 struct sockaddr_un un; |
8460 int ev, *tmpsock = (int *)malloc(sizeof(int)*2); | 8460 int ev, *tmpsock = (int *)malloc(sizeof(int)*2); |
8461 DWTID dwthread; | 8461 DWTID dwthread; |
8462 | 8462 |
8502 * Parameters: | 8502 * Parameters: |
8503 * eve: Pointer to an event handle to receive handle. | 8503 * eve: Pointer to an event handle to receive handle. |
8504 * name: Name given to semaphore which can be opened | 8504 * name: Name given to semaphore which can be opened |
8505 * by other processes. | 8505 * by other processes. |
8506 */ | 8506 */ |
8507 HEV dw_named_event_get(char *name) | 8507 HEV dw_named_event_get(const char *name) |
8508 { | 8508 { |
8509 struct sockaddr_un un; | 8509 struct sockaddr_un un; |
8510 int ev = socket(AF_UNIX, SOCK_STREAM, 0); | 8510 int ev = socket(AF_UNIX, SOCK_STREAM, 0); |
8511 if(ev < 0) | 8511 if(ev < 0) |
8512 return NULL; | 8512 return NULL; |
8685 * handle: A pointer to receive a SHM identifier. | 8685 * handle: A pointer to receive a SHM identifier. |
8686 * dest: A pointer to a pointer to receive the memory address. | 8686 * dest: A pointer to a pointer to receive the memory address. |
8687 * size: Size in bytes of the shared memory region to allocate. | 8687 * size: Size in bytes of the shared memory region to allocate. |
8688 * name: A string pointer to a unique memory name. | 8688 * name: A string pointer to a unique memory name. |
8689 */ | 8689 */ |
8690 HSHM dw_named_memory_new(void **dest, int size, char *name) | 8690 HSHM dw_named_memory_new(void **dest, int size, const char *name) |
8691 { | 8691 { |
8692 char namebuf[1025]; | 8692 char namebuf[1025]; |
8693 struct _dw_unix_shm *handle = malloc(sizeof(struct _dw_unix_shm)); | 8693 struct _dw_unix_shm *handle = malloc(sizeof(struct _dw_unix_shm)); |
8694 | 8694 |
8695 mkdir("/tmp/.dw", S_IWGRP|S_IWOTH); | 8695 mkdir("/tmp/.dw", S_IWGRP|S_IWOTH); |
8731 * Parameters: | 8731 * Parameters: |
8732 * dest: A pointer to a pointer to receive the memory address. | 8732 * dest: A pointer to a pointer to receive the memory address. |
8733 * size: Size in bytes of the shared memory region to requested. | 8733 * size: Size in bytes of the shared memory region to requested. |
8734 * name: A string pointer to a unique memory name. | 8734 * name: A string pointer to a unique memory name. |
8735 */ | 8735 */ |
8736 HSHM dw_named_memory_get(void **dest, int size, char *name) | 8736 HSHM dw_named_memory_get(void **dest, int size, const char *name) |
8737 { | 8737 { |
8738 char namebuf[1025]; | 8738 char namebuf[1025]; |
8739 struct _dw_unix_shm *handle = malloc(sizeof(struct _dw_unix_shm)); | 8739 struct _dw_unix_shm *handle = malloc(sizeof(struct _dw_unix_shm)); |
8740 | 8740 |
8741 mkdir("/tmp/.dw", S_IWGRP|S_IWOTH); | 8741 mkdir("/tmp/.dw", S_IWGRP|S_IWOTH); |
10099 * Parameters: | 10099 * Parameters: |
10100 * handle: Notebook handle. | 10100 * handle: Notebook handle. |
10101 * pageid: Page ID of the tab to set. | 10101 * pageid: Page ID of the tab to set. |
10102 * text: Pointer to the text to set. | 10102 * text: Pointer to the text to set. |
10103 */ | 10103 */ |
10104 void dw_notebook_page_set_text(HWND handle, unsigned long pageid, char *text) | 10104 void dw_notebook_page_set_text(HWND handle, unsigned long pageid, const char *text) |
10105 { | 10105 { |
10106 GtkWidget *child; | 10106 GtkWidget *child; |
10107 int realpage, _locked_by_me = FALSE; | 10107 int realpage, _locked_by_me = FALSE; |
10108 | 10108 |
10109 DW_MUTEX_LOCK; | 10109 DW_MUTEX_LOCK; |
10132 * Parameters: | 10132 * Parameters: |
10133 * handle: Notebook handle. | 10133 * handle: Notebook handle. |
10134 * pageid: Page ID of the tab to set. | 10134 * pageid: Page ID of the tab to set. |
10135 * text: Pointer to the text to set. | 10135 * text: Pointer to the text to set. |
10136 */ | 10136 */ |
10137 void dw_notebook_page_set_status_text(HWND handle, unsigned long pageid, char *text) | 10137 void dw_notebook_page_set_status_text(HWND handle, unsigned long pageid, const char *text) |
10138 { | 10138 { |
10139 /* TODO (if possible) */ | 10139 /* TODO (if possible) */ |
10140 } | 10140 } |
10141 | 10141 |
10142 /* | 10142 /* |
10206 * Appends the specified text to the listbox's (or combobox) entry list. | 10206 * Appends the specified text to the listbox's (or combobox) entry list. |
10207 * Parameters: | 10207 * Parameters: |
10208 * handle: Handle to the listbox to be appended to. | 10208 * handle: Handle to the listbox to be appended to. |
10209 * text: Text to append into listbox. | 10209 * text: Text to append into listbox. |
10210 */ | 10210 */ |
10211 void dw_listbox_append(HWND handle, char *text) | 10211 void dw_listbox_append(HWND handle, const char *text) |
10212 { | 10212 { |
10213 dw_listbox_insert(handle, text, -1); | 10213 dw_listbox_insert(handle, text, -1); |
10214 } | 10214 } |
10215 | 10215 |
10216 /* | 10216 /* |
10219 * Parameters: | 10219 * Parameters: |
10220 * handle: Handle to the listbox to be appended to. | 10220 * handle: Handle to the listbox to be appended to. |
10221 * text: Text to insert into listbox. | 10221 * text: Text to insert into listbox. |
10222 * pos: 0-based index into listbox. -1 will append | 10222 * pos: 0-based index into listbox. -1 will append |
10223 */ | 10223 */ |
10224 void dw_listbox_insert(HWND handle, char *text, int pos) | 10224 void dw_listbox_insert(HWND handle, const char *text, int pos) |
10225 { | 10225 { |
10226 GtkWidget *handle2 = handle; | 10226 GtkWidget *handle2 = handle; |
10227 GtkListStore *store = NULL; | 10227 GtkListStore *store = NULL; |
10228 int _locked_by_me = FALSE; | 10228 int _locked_by_me = FALSE; |
10229 | 10229 |
10502 * Parameters: | 10502 * Parameters: |
10503 * handle: Handle to the listbox to be queried. | 10503 * handle: Handle to the listbox to be queried. |
10504 * index: Index into the list to be queried. | 10504 * index: Index into the list to be queried. |
10505 * buffer: Buffer where text will be copied. | 10505 * buffer: Buffer where text will be copied. |
10506 */ | 10506 */ |
10507 void dw_listbox_set_text(HWND handle, unsigned int index, char *buffer) | 10507 void dw_listbox_set_text(HWND handle, unsigned int index, const char *buffer) |
10508 { | 10508 { |
10509 GtkWidget *handle2 = handle; | 10509 GtkWidget *handle2 = handle; |
10510 GtkListStore *store = NULL; | 10510 GtkListStore *store = NULL; |
10511 int _locked_by_me = FALSE; | 10511 int _locked_by_me = FALSE; |
10512 | 10512 |
11052 * Returns: | 11052 * Returns: |
11053 * NULL on error. A malloced buffer containing | 11053 * NULL on error. A malloced buffer containing |
11054 * the file path on success. | 11054 * the file path on success. |
11055 * | 11055 * |
11056 */ | 11056 */ |
11057 char *dw_file_browse(char *title, char *defpath, char *ext, int flags) | 11057 char *dw_file_browse(const char *title, const char *defpath, const char *ext, int flags) |
11058 { | 11058 { |
11059 GtkWidget *filew; | 11059 GtkWidget *filew; |
11060 | 11060 |
11061 GtkFileChooserAction action; | 11061 GtkFileChooserAction action; |
11062 GtkFileFilter *filter1 = NULL; | 11062 GtkFileFilter *filter1 = NULL; |
11188 * type: Either DW_EXEC_CON or DW_EXEC_GUI. | 11188 * type: Either DW_EXEC_CON or DW_EXEC_GUI. |
11189 * params: An array of pointers to string arguements. | 11189 * params: An array of pointers to string arguements. |
11190 * Returns: | 11190 * Returns: |
11191 * -1 on error. | 11191 * -1 on error. |
11192 */ | 11192 */ |
11193 int dw_exec(char *program, int type, char **params) | 11193 int dw_exec(const char *program, int type, char **params) |
11194 { | 11194 { |
11195 int ret = -1; | 11195 int ret = -1; |
11196 | 11196 |
11197 if((ret = fork()) == 0) | 11197 if((ret = fork()) == 0) |
11198 { | 11198 { |
11245 /* | 11245 /* |
11246 * Loads a web browser pointed at the given URL. | 11246 * Loads a web browser pointed at the given URL. |
11247 * Parameters: | 11247 * Parameters: |
11248 * url: Uniform resource locator. | 11248 * url: Uniform resource locator. |
11249 */ | 11249 */ |
11250 int dw_browse(char *url) | 11250 int dw_browse(const char *url) |
11251 { | 11251 { |
11252 /* If possible load the URL/URI using gvfs... */ | 11252 /* If possible load the URL/URI using gvfs... */ |
11253 if(gtk_show_uri(gdk_screen_get_default(), url, GDK_CURRENT_TIME, NULL)) | 11253 if(gtk_show_uri(gdk_screen_get_default(), url, GDK_CURRENT_TIME, NULL)) |
11254 { | 11254 { |
11255 return DW_ERROR_NONE; | 11255 return DW_ERROR_NONE; |
11262 char *execargs[3], *browser = "firefox", *tmp; | 11262 char *execargs[3], *browser = "firefox", *tmp; |
11263 | 11263 |
11264 tmp = getenv( "DW_BROWSER" ); | 11264 tmp = getenv( "DW_BROWSER" ); |
11265 if(tmp) browser = tmp; | 11265 if(tmp) browser = tmp; |
11266 execargs[0] = browser; | 11266 execargs[0] = browser; |
11267 execargs[1] = url; | 11267 execargs[1] = (char *)url; |
11268 execargs[2] = NULL; | 11268 execargs[2] = NULL; |
11269 | 11269 |
11270 return dw_exec(browser, DW_EXEC_GUI, execargs); | 11270 return dw_exec(browser, DW_EXEC_GUI, execargs); |
11271 } | 11271 } |
11272 } | 11272 } |
11351 * string: String buffer containt HTML code to | 11351 * string: String buffer containt HTML code to |
11352 * be rendered. | 11352 * be rendered. |
11353 * Returns: | 11353 * Returns: |
11354 * 0 on success. | 11354 * 0 on success. |
11355 */ | 11355 */ |
11356 int dw_html_raw(HWND handle, char *string) | 11356 int dw_html_raw(HWND handle, const char *string) |
11357 { | 11357 { |
11358 #ifdef USE_WEBKIT | 11358 #ifdef USE_WEBKIT |
11359 int _locked_by_me = FALSE; | 11359 int _locked_by_me = FALSE; |
11360 WebKitWebView *web_view; | 11360 WebKitWebView *web_view; |
11361 | 11361 |
11383 * url: Universal Resource Locator of the web or | 11383 * url: Universal Resource Locator of the web or |
11384 * file object to be rendered. | 11384 * file object to be rendered. |
11385 * Returns: | 11385 * Returns: |
11386 * 0 on success. | 11386 * 0 on success. |
11387 */ | 11387 */ |
11388 int dw_html_url(HWND handle, char *url) | 11388 int dw_html_url(HWND handle, const char *url) |
11389 { | 11389 { |
11390 #ifdef USE_WEBKIT | 11390 #ifdef USE_WEBKIT |
11391 int _locked_by_me = FALSE; | 11391 int _locked_by_me = FALSE; |
11392 WebKitWebView *web_view; | 11392 WebKitWebView *web_view; |
11393 | 11393 |
11416 * scriptdata: Data passed to the signal handler. | 11416 * scriptdata: Data passed to the signal handler. |
11417 * Notes: A DW_SIGNAL_HTML_RESULT event will be raised with scriptdata. | 11417 * Notes: A DW_SIGNAL_HTML_RESULT event will be raised with scriptdata. |
11418 * Returns: | 11418 * Returns: |
11419 * DW_ERROR_NONE (0) on success. | 11419 * DW_ERROR_NONE (0) on success. |
11420 */ | 11420 */ |
11421 int dw_html_javascript_run(HWND handle, char *script, void *scriptdata) | 11421 int dw_html_javascript_run(HWND handle, const char *script, void *scriptdata) |
11422 { | 11422 { |
11423 #ifdef USE_WEBKIT | 11423 #ifdef USE_WEBKIT |
11424 int _locked_by_me = FALSE; | 11424 int _locked_by_me = FALSE; |
11425 WebKitWebView *web_view; | 11425 WebKitWebView *web_view; |
11426 | 11426 |
11543 /* | 11543 /* |
11544 * Sets the contents of the default clipboard to the supplied text. | 11544 * Sets the contents of the default clipboard to the supplied text. |
11545 * Parameters: | 11545 * Parameters: |
11546 * Text. | 11546 * Text. |
11547 */ | 11547 */ |
11548 void dw_clipboard_set_text( char *str, int len ) | 11548 void dw_clipboard_set_text(const char *str, int len) |
11549 { | 11549 { |
11550 int _locked_by_me = FALSE; | 11550 int _locked_by_me = FALSE; |
11551 GtkClipboard *clipboard_object; | 11551 GtkClipboard *clipboard_object; |
11552 | 11552 |
11553 DW_MUTEX_LOCK; | 11553 DW_MUTEX_LOCK; |
11589 * drawfunc: The pointer to the function to be used as the callback. | 11589 * drawfunc: The pointer to the function to be used as the callback. |
11590 * drawdata: User data to be passed to the handler function. | 11590 * drawdata: User data to be passed to the handler function. |
11591 * Returns: | 11591 * Returns: |
11592 * A handle to the print object or NULL on failure. | 11592 * A handle to the print object or NULL on failure. |
11593 */ | 11593 */ |
11594 HPRINT API dw_print_new(char *jobname, unsigned long flags, unsigned int pages, void *drawfunc, void *drawdata) | 11594 HPRINT API dw_print_new(const char *jobname, unsigned long flags, unsigned int pages, void *drawfunc, void *drawdata) |
11595 { | 11595 { |
11596 GtkPrintOperation *op; | 11596 GtkPrintOperation *op; |
11597 int _locked_by_me = FALSE; | 11597 int _locked_by_me = FALSE; |
11598 | 11598 |
11599 if(!drawfunc) | 11599 if(!drawfunc) |
11699 * Parameters: | 11699 * Parameters: |
11700 * window: Window handle of signal to be called back. | 11700 * window: Window handle of signal to be called back. |
11701 * dataname: A string pointer identifying which signal to be hooked. | 11701 * dataname: A string pointer identifying which signal to be hooked. |
11702 * data: User data to be passed to the handler function. | 11702 * data: User data to be passed to the handler function. |
11703 */ | 11703 */ |
11704 void dw_window_set_data(HWND window, char *dataname, void *data) | 11704 void dw_window_set_data(HWND window, const char *dataname, void *data) |
11705 { | 11705 { |
11706 HWND thiswindow = window; | 11706 HWND thiswindow = window; |
11707 int _locked_by_me = FALSE; | 11707 int _locked_by_me = FALSE; |
11708 | 11708 |
11709 if(!window) | 11709 if(!window) |
11724 * Parameters: | 11724 * Parameters: |
11725 * window: Window handle of signal to be called back. | 11725 * window: Window handle of signal to be called back. |
11726 * dataname: A string pointer identifying which signal to be hooked. | 11726 * dataname: A string pointer identifying which signal to be hooked. |
11727 * data: User data to be passed to the handler function. | 11727 * data: User data to be passed to the handler function. |
11728 */ | 11728 */ |
11729 void *dw_window_get_data(HWND window, char *dataname) | 11729 void *dw_window_get_data(HWND window, const char *dataname) |
11730 { | 11730 { |
11731 HWND thiswindow = window; | 11731 HWND thiswindow = window; |
11732 int _locked_by_me = FALSE; | 11732 int _locked_by_me = FALSE; |
11733 void *ret = NULL; | 11733 void *ret = NULL; |
11734 | 11734 |
11816 } | 11816 } |
11817 | 11817 |
11818 /* Get the actual signal window handle not the user window handle | 11818 /* Get the actual signal window handle not the user window handle |
11819 * Should mimic the code in dw_signal_connect() below. | 11819 * Should mimic the code in dw_signal_connect() below. |
11820 */ | 11820 */ |
11821 static HWND _find_signal_window(HWND window, char *signame) | 11821 static HWND _find_signal_window(HWND window, const char *signame) |
11822 { | 11822 { |
11823 HWND thiswindow = window; | 11823 HWND thiswindow = window; |
11824 | 11824 |
11825 if(GTK_IS_SCROLLED_WINDOW(thiswindow)) | 11825 if(GTK_IS_SCROLLED_WINDOW(thiswindow)) |
11826 thiswindow = (HWND)g_object_get_data(G_OBJECT(window), "_dw_user"); | 11826 thiswindow = (HWND)g_object_get_data(G_OBJECT(window), "_dw_user"); |
11837 * window: Window handle of signal to be called back. | 11837 * window: Window handle of signal to be called back. |
11838 * signame: A string pointer identifying which signal to be hooked. | 11838 * signame: A string pointer identifying which signal to be hooked. |
11839 * sigfunc: The pointer to the function to be used as the callback. | 11839 * sigfunc: The pointer to the function to be used as the callback. |
11840 * data: User data to be passed to the handler function. | 11840 * data: User data to be passed to the handler function. |
11841 */ | 11841 */ |
11842 void dw_signal_connect(HWND window, char *signame, void *sigfunc, void *data) | 11842 void dw_signal_connect(HWND window, const char *signame, void *sigfunc, void *data) |
11843 { | 11843 { |
11844 dw_signal_connect_data(window, signame, sigfunc, NULL, data); | 11844 dw_signal_connect_data(window, signame, sigfunc, NULL, data); |
11845 } | 11845 } |
11846 | 11846 |
11847 /* Internal function to free any allocated signal data.. | 11847 /* Internal function to free any allocated signal data.. |
11876 * signame: A string pointer identifying which signal to be hooked. | 11876 * signame: A string pointer identifying which signal to be hooked. |
11877 * sigfunc: The pointer to the function to be used as the callback. | 11877 * sigfunc: The pointer to the function to be used as the callback. |
11878 * discfunc: The pointer to the function called when this handler is removed. | 11878 * discfunc: The pointer to the function called when this handler is removed. |
11879 * data: User data to be passed to the handler function. | 11879 * data: User data to be passed to the handler function. |
11880 */ | 11880 */ |
11881 void dw_signal_connect_data(HWND window, char *signame, void *sigfunc, void *discfunc, void *data) | 11881 void dw_signal_connect_data(HWND window, const char *signame, void *sigfunc, void *discfunc, void *data) |
11882 { | 11882 { |
11883 void *thisfunc = _findsigfunc(signame); | 11883 void *thisfunc = _findsigfunc(signame); |
11884 char *thisname = signame; | 11884 char *thisname = (char *)signame; |
11885 HWND thiswindow = window; | 11885 HWND thiswindow = window; |
11886 int sigid, _locked_by_me = FALSE; | 11886 int sigid, _locked_by_me = FALSE; |
11887 void **params = calloc(_DW_INTERNAL_CALLBACK_PARAMS, sizeof(void *)); | 11887 void **params = calloc(_DW_INTERNAL_CALLBACK_PARAMS, sizeof(void *)); |
11888 gint cid; | 11888 gint cid; |
11889 | 11889 |
12055 /* | 12055 /* |
12056 * Removes callbacks for a given window with given name. | 12056 * Removes callbacks for a given window with given name. |
12057 * Parameters: | 12057 * Parameters: |
12058 * window: Window handle of callback to be removed. | 12058 * window: Window handle of callback to be removed. |
12059 */ | 12059 */ |
12060 void dw_signal_disconnect_by_name(HWND window, char *signame) | 12060 void dw_signal_disconnect_by_name(HWND window, const char *signame) |
12061 { | 12061 { |
12062 int z, count; | 12062 int z, count; |
12063 void *thisfunc; | 12063 void *thisfunc; |
12064 int _locked_by_me = FALSE; | 12064 int _locked_by_me = FALSE; |
12065 void **params = alloca(sizeof(void *) * 3); | 12065 void **params = alloca(sizeof(void *) * 3); |
12138 * utf8string: UTF-8 encoded source string. | 12138 * utf8string: UTF-8 encoded source string. |
12139 * Returns: | 12139 * Returns: |
12140 * Wide string that needs to be freed with dw_free() | 12140 * Wide string that needs to be freed with dw_free() |
12141 * or NULL on failure. | 12141 * or NULL on failure. |
12142 */ | 12142 */ |
12143 wchar_t * API dw_utf8_to_wchar(char *utf8string) | 12143 wchar_t * API dw_utf8_to_wchar(const char *utf8string) |
12144 { | 12144 { |
12145 wchar_t *retval = NULL, *freeme; | 12145 wchar_t *retval = NULL, *freeme; |
12146 | 12146 |
12147 if(sizeof(wchar_t) == sizeof(gunichar)) | 12147 if(sizeof(wchar_t) == sizeof(gunichar)) |
12148 freeme = retval = (wchar_t *)g_utf8_to_ucs4(utf8string, -1, NULL, NULL, NULL); | 12148 freeme = retval = (wchar_t *)g_utf8_to_ucs4(utf8string, -1, NULL, NULL, NULL); |
12162 * wstring: Wide source string. | 12162 * wstring: Wide source string. |
12163 * Returns: | 12163 * Returns: |
12164 * UTF-8 encoded string that needs to be freed with dw_free() | 12164 * UTF-8 encoded string that needs to be freed with dw_free() |
12165 * or NULL on failure. | 12165 * or NULL on failure. |
12166 */ | 12166 */ |
12167 char * API dw_wchar_to_utf8(wchar_t *wstring) | 12167 char * API dw_wchar_to_utf8(const wchar_t *wstring) |
12168 { | 12168 { |
12169 char *retval = NULL, *freeme; | 12169 char *retval = NULL, *freeme; |
12170 | 12170 |
12171 if(sizeof(wchar_t) == sizeof(gunichar)) | 12171 if(sizeof(wchar_t) == sizeof(gunichar)) |
12172 freeme = retval = g_ucs4_to_utf8((gunichar *)wstring, -1, NULL, NULL, NULL); | 12172 freeme = retval = g_ucs4_to_utf8((gunichar *)wstring, -1, NULL, NULL, NULL); |