Mercurial > dwindows
comparison os2/dw.c @ 2039:7f2fb0c602f0
OS/2: Last set of const changes, this time for OS/2.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Sun, 17 Nov 2019 06:55:05 +0000 |
parents | c30f4354966e |
children | ade83a05a7d8 |
comparison
equal
deleted
inserted
replaced
2038:133f29e9f488 | 2039:7f2fb0c602f0 |
---|---|
254 Root = new; | 254 Root = new; |
255 } | 255 } |
256 } | 256 } |
257 | 257 |
258 /* Finds the message number for a given signal name */ | 258 /* Finds the message number for a given signal name */ |
259 ULONG _findsigmessage(char *signame) | 259 ULONG _findsigmessage(const char *signame) |
260 { | 260 { |
261 int z; | 261 int z; |
262 | 262 |
263 for(z=0;z<SIGNALMAX;z++) | 263 for(z=0;z<SIGNALMAX;z++) |
264 { | 264 { |
4658 * Displays a debug message on the console... | 4658 * Displays a debug message on the console... |
4659 * Parameters: | 4659 * Parameters: |
4660 * format: printf style format string. | 4660 * format: printf style format string. |
4661 * ...: Additional variables for use in the format. | 4661 * ...: Additional variables for use in the format. |
4662 */ | 4662 */ |
4663 void API dw_debug(char *format, ...) | 4663 void API dw_debug(const char *format, ...) |
4664 { | 4664 { |
4665 va_list args; | 4665 va_list args; |
4666 char outbuf[1025] = { 0 }; | 4666 char outbuf[1025] = { 0 }; |
4667 | 4667 |
4668 va_start(args, format); | 4668 va_start(args, format); |
4692 * title: The title of the message box. | 4692 * title: The title of the message box. |
4693 * flags: flags to indicate buttons and icon | 4693 * flags: flags to indicate buttons and icon |
4694 * format: printf style format string. | 4694 * format: printf style format string. |
4695 * ...: Additional variables for use in the format. | 4695 * ...: Additional variables for use in the format. |
4696 */ | 4696 */ |
4697 int API dw_messagebox(char *title, int flags, char *format, ...) | 4697 int API dw_messagebox(const char *title, int flags, const char *format, ...) |
4698 { | 4698 { |
4699 va_list args; | 4699 va_list args; |
4700 char outbuf[1025] = { 0 }; | 4700 char outbuf[1025] = { 0 }; |
4701 int rc; | 4701 int rc; |
4702 | 4702 |
4978 * Parameters: | 4978 * Parameters: |
4979 * currfont: current font | 4979 * currfont: current font |
4980 * Returns: | 4980 * Returns: |
4981 * A malloced buffer with the selected font or NULL on error. | 4981 * A malloced buffer with the selected font or NULL on error. |
4982 */ | 4982 */ |
4983 char * API dw_font_choose(char *currfont) | 4983 char * API dw_font_choose(const char *currfont) |
4984 { | 4984 { |
4985 FONTDLG fd = { 0 }; | 4985 FONTDLG fd = { 0 }; |
4986 char *buf = calloc(1,100); | 4986 char *buf = calloc(1,100); |
4987 int size = 9; | 4987 int size = 9; |
4988 | 4988 |
5038 /* | 5038 /* |
5039 * Sets the default font used on text based widgets. | 5039 * Sets the default font used on text based widgets. |
5040 * Parameters: | 5040 * Parameters: |
5041 * fontname: Font name in Dynamic Windows format. | 5041 * fontname: Font name in Dynamic Windows format. |
5042 */ | 5042 */ |
5043 void API dw_font_set_default(char *fontname) | 5043 void API dw_font_set_default(const char *fontname) |
5044 { | 5044 { |
5045 char *oldfont = DefaultFont; | 5045 char *oldfont = DefaultFont; |
5046 | 5046 |
5047 DefaultFont = strdup(fontname); | 5047 DefaultFont = strdup(fontname); |
5048 free(oldfont); | 5048 free(oldfont); |
5475 * Sets the font used by a specified window (widget) handle. | 5475 * Sets the font used by a specified window (widget) handle. |
5476 * Parameters: | 5476 * Parameters: |
5477 * handle: The window (widget) handle. | 5477 * handle: The window (widget) handle. |
5478 * fontname: Name and size of the font in the form "size.fontname" | 5478 * fontname: Name and size of the font in the form "size.fontname" |
5479 */ | 5479 */ |
5480 int API dw_window_set_font(HWND handle, char *fontname) | 5480 int API dw_window_set_font(HWND handle, const char *fontname) |
5481 { | 5481 { |
5482 HWND group = (HWND)dw_window_get_data(handle, "_dw_buddy"); | 5482 HWND group = (HWND)dw_window_get_data(handle, "_dw_buddy"); |
5483 /* If we changed the font... */ | 5483 /* If we changed the font... */ |
5484 if(!WinSetPresParam(group ? group : handle, PP_FONTNAMESIZE, strlen(fontname)+1, fontname)) | 5484 if(!WinSetPresParam(group ? group : handle, PP_FONTNAMESIZE, strlen(fontname)+1, (void *)fontname)) |
5485 { | 5485 { |
5486 Item *item = _box_item(handle); | 5486 Item *item = _box_item(handle); |
5487 | 5487 |
5488 /* Check to see if any of the sizes need to be recalculated */ | 5488 /* Check to see if any of the sizes need to be recalculated */ |
5489 if(item && (item->origwidth == -1 || item->origheight == -1)) | 5489 if(item && (item->origwidth == -1 || item->origheight == -1)) |
5682 * Parameters: | 5682 * Parameters: |
5683 * owner: The Owner's window handle or HWND_DESKTOP. | 5683 * owner: The Owner's window handle or HWND_DESKTOP. |
5684 * title: The Window title. | 5684 * title: The Window title. |
5685 * flStyle: Style flags, see the PM reference. | 5685 * flStyle: Style flags, see the PM reference. |
5686 */ | 5686 */ |
5687 HWND API dw_window_new(HWND hwndOwner, char *title, ULONG flStyle) | 5687 HWND API dw_window_new(HWND hwndOwner, const char *title, ULONG flStyle) |
5688 { | 5688 { |
5689 HWND hwndframe; | 5689 HWND hwndframe; |
5690 Box *newbox = calloc(1, sizeof(Box)); | 5690 Box *newbox = calloc(1, sizeof(Box)); |
5691 WindowData *blah = calloc(1, sizeof(WindowData)); | 5691 WindowData *blah = calloc(1, sizeof(WindowData)); |
5692 ULONG winStyle = 0L; | 5692 ULONG winStyle = 0L; |
5835 * Parameters: | 5835 * Parameters: |
5836 * type: Either DW_VERT (vertical) or DW_HORZ (horizontal). | 5836 * type: Either DW_VERT (vertical) or DW_HORZ (horizontal). |
5837 * pad: Number of pixels to pad around the box. | 5837 * pad: Number of pixels to pad around the box. |
5838 * title: Text to be displayined in the group outline. | 5838 * title: Text to be displayined in the group outline. |
5839 */ | 5839 */ |
5840 HWND API dw_groupbox_new(int type, int pad, char *title) | 5840 HWND API dw_groupbox_new(int type, int pad, const char *title) |
5841 { | 5841 { |
5842 Box *newbox = calloc(1, sizeof(Box)); | 5842 Box *newbox = calloc(1, sizeof(Box)); |
5843 newbox->pad = pad; | 5843 newbox->pad = pad; |
5844 newbox->type = type; | 5844 newbox->type = type; |
5845 newbox->count = 0; | 5845 newbox->count = 0; |
6048 * end: If TRUE memu is positioned at the end of the menu. | 6048 * end: If TRUE memu is positioned at the end of the menu. |
6049 * check: If TRUE menu is "check"able. | 6049 * check: If TRUE menu is "check"able. |
6050 * flags: Extended attributes to set on the menu. | 6050 * flags: Extended attributes to set on the menu. |
6051 * submenu: Handle to an existing menu to be a submenu or NULL. | 6051 * submenu: Handle to an existing menu to be a submenu or NULL. |
6052 */ | 6052 */ |
6053 HWND API dw_menu_append_item(HMENUI menux, char *title, ULONG id, ULONG flags, int end, int check, HMENUI submenu) | 6053 HWND API dw_menu_append_item(HMENUI menux, const char *title, ULONG id, ULONG flags, int end, int check, HMENUI submenu) |
6054 { | 6054 { |
6055 MENUITEM miSubMenu; | 6055 MENUITEM miSubMenu; |
6056 char buffer[30]; | 6056 char buffer[30]; |
6057 int is_checked, is_disabled; | 6057 int is_checked, is_disabled; |
6058 | 6058 |
6361 * Create a new static text window (widget) to be packed. | 6361 * Create a new static text window (widget) to be packed. |
6362 * Parameters: | 6362 * Parameters: |
6363 * text: The text to be display by the static text widget. | 6363 * text: The text to be display by the static text widget. |
6364 * id: An ID to be used with dw_window_from_id() or 0L. | 6364 * id: An ID to be used with dw_window_from_id() or 0L. |
6365 */ | 6365 */ |
6366 HWND API dw_text_new(char *text, ULONG id) | 6366 HWND API dw_text_new(const char *text, ULONG id) |
6367 { | 6367 { |
6368 WindowData *blah = calloc(sizeof(WindowData), 1); | 6368 WindowData *blah = calloc(sizeof(WindowData), 1); |
6369 HWND tmp = WinCreateWindow(HWND_OBJECT, | 6369 HWND tmp = WinCreateWindow(HWND_OBJECT, |
6370 WC_STATIC, | 6370 WC_STATIC, |
6371 (PSZ)text, | 6371 (PSZ)text, |
6387 * Create a new status text window (widget) to be packed. | 6387 * Create a new status text window (widget) to be packed. |
6388 * Parameters: | 6388 * Parameters: |
6389 * text: The text to be display by the static text widget. | 6389 * text: The text to be display by the static text widget. |
6390 * id: An ID to be used with dw_window_from_id() or 0L. | 6390 * id: An ID to be used with dw_window_from_id() or 0L. |
6391 */ | 6391 */ |
6392 HWND API dw_status_text_new(char *text, ULONG id) | 6392 HWND API dw_status_text_new(const char *text, ULONG id) |
6393 { | 6393 { |
6394 WindowData *blah = calloc(sizeof(WindowData), 1); | 6394 WindowData *blah = calloc(sizeof(WindowData), 1); |
6395 HWND tmp = WinCreateWindow(HWND_OBJECT, | 6395 HWND tmp = WinCreateWindow(HWND_OBJECT, |
6396 WC_STATIC, | 6396 WC_STATIC, |
6397 (PSZ)text, | 6397 (PSZ)text, |
6445 * Create a new Entryfield window (widget) to be packed. | 6445 * Create a new Entryfield window (widget) to be packed. |
6446 * Parameters: | 6446 * Parameters: |
6447 * text: The default text to be in the entryfield widget. | 6447 * text: The default text to be in the entryfield widget. |
6448 * id: An ID to be used with dw_window_from_id() or 0L. | 6448 * id: An ID to be used with dw_window_from_id() or 0L. |
6449 */ | 6449 */ |
6450 HWND API dw_entryfield_new(char *text, ULONG id) | 6450 HWND API dw_entryfield_new(const char *text, ULONG id) |
6451 { | 6451 { |
6452 | 6452 |
6453 WindowData *blah = calloc(1, sizeof(WindowData)); | 6453 WindowData *blah = calloc(1, sizeof(WindowData)); |
6454 ENTRYFDATA efd = { sizeof(ENTRYFDATA), 32000, 0, 0 }; | 6454 ENTRYFDATA efd = { sizeof(ENTRYFDATA), 32000, 0, 0 }; |
6455 HWND tmp = WinCreateWindow(HWND_OBJECT, | 6455 HWND tmp = WinCreateWindow(HWND_OBJECT, |
6474 * Create a new Entryfield (password) window (widget) to be packed. | 6474 * Create a new Entryfield (password) window (widget) to be packed. |
6475 * Parameters: | 6475 * Parameters: |
6476 * text: The default text to be in the entryfield widget. | 6476 * text: The default text to be in the entryfield widget. |
6477 * id: An ID to be used with dw_window_from_id() or 0L. | 6477 * id: An ID to be used with dw_window_from_id() or 0L. |
6478 */ | 6478 */ |
6479 HWND API dw_entryfield_password_new(char *text, ULONG id) | 6479 HWND API dw_entryfield_password_new(const char *text, ULONG id) |
6480 { | 6480 { |
6481 WindowData *blah = calloc(1, sizeof(WindowData)); | 6481 WindowData *blah = calloc(1, sizeof(WindowData)); |
6482 HWND tmp = WinCreateWindow(HWND_OBJECT, | 6482 HWND tmp = WinCreateWindow(HWND_OBJECT, |
6483 WC_ENTRYFIELD, | 6483 WC_ENTRYFIELD, |
6484 (PSZ)text, | 6484 (PSZ)text, |
6501 * Create a new Combobox window (widget) to be packed. | 6501 * Create a new Combobox window (widget) to be packed. |
6502 * Parameters: | 6502 * Parameters: |
6503 * text: The default text to be in the combpbox widget. | 6503 * text: The default text to be in the combpbox widget. |
6504 * id: An ID to be used with dw_window_from_id() or 0L. | 6504 * id: An ID to be used with dw_window_from_id() or 0L. |
6505 */ | 6505 */ |
6506 HWND API dw_combobox_new(char *text, ULONG id) | 6506 HWND API dw_combobox_new(const char *text, ULONG id) |
6507 { | 6507 { |
6508 WindowData *blah = calloc(1, sizeof(WindowData)); | 6508 WindowData *blah = calloc(1, sizeof(WindowData)); |
6509 HWND frame = dw_box_new(DW_HORZ, 0); | 6509 HWND frame = dw_box_new(DW_HORZ, 0); |
6510 HWND tmp = WinCreateWindow(frame, | 6510 HWND tmp = WinCreateWindow(frame, |
6511 WC_COMBOBOX, | 6511 WC_COMBOBOX, |
6543 * Create a new button window (widget) to be packed. | 6543 * Create a new button window (widget) to be packed. |
6544 * Parameters: | 6544 * Parameters: |
6545 * text: The text to be display by the static text widget. | 6545 * text: The text to be display by the static text widget. |
6546 * id: An ID to be used with dw_window_from_id() or 0L. | 6546 * id: An ID to be used with dw_window_from_id() or 0L. |
6547 */ | 6547 */ |
6548 HWND API dw_button_new(char *text, ULONG id) | 6548 HWND API dw_button_new(const char *text, ULONG id) |
6549 { | 6549 { |
6550 WindowData *blah = calloc(1, sizeof(WindowData)); | 6550 WindowData *blah = calloc(1, sizeof(WindowData)); |
6551 HWND tmp = WinCreateWindow(HWND_OBJECT, | 6551 HWND tmp = WinCreateWindow(HWND_OBJECT, |
6552 WC_BUTTON, | 6552 WC_BUTTON, |
6553 (PSZ)text, | 6553 (PSZ)text, |
6604 * Create a new bitmap button window (widget) to be packed. | 6604 * Create a new bitmap button window (widget) to be packed. |
6605 * Parameters: | 6605 * Parameters: |
6606 * text: Bubble help text to be displayed. | 6606 * text: Bubble help text to be displayed. |
6607 * id: An ID of a bitmap in the resource file. | 6607 * id: An ID of a bitmap in the resource file. |
6608 */ | 6608 */ |
6609 HWND API dw_bitmapbutton_new(char *text, ULONG id) | 6609 HWND API dw_bitmapbutton_new(const char *text, ULONG id) |
6610 { | 6610 { |
6611 char idbuf[256], *name = NULL; | 6611 char idbuf[256], *name = NULL; |
6612 HWND tmp; | 6612 HWND tmp; |
6613 WindowData *blah = calloc(1, sizeof(WindowData)); | 6613 WindowData *blah = calloc(1, sizeof(WindowData)); |
6614 HPOINTER icon = WinLoadPointer(HWND_DESKTOP, 0L, id); | 6614 HPOINTER icon = WinLoadPointer(HWND_DESKTOP, 0L, id); |
6704 * id: An ID to be used with dw_window_from_id() or 0L. | 6704 * id: An ID to be used with dw_window_from_id() or 0L. |
6705 * filename: Name of the file, omit extention to have | 6705 * filename: Name of the file, omit extention to have |
6706 * DW pick the appropriate file extension. | 6706 * DW pick the appropriate file extension. |
6707 * (BMP on OS/2 or Windows, XPM on Unix) | 6707 * (BMP on OS/2 or Windows, XPM on Unix) |
6708 */ | 6708 */ |
6709 HWND API dw_bitmapbutton_new_from_file(char *text, unsigned long id, char *filename) | 6709 HWND API dw_bitmapbutton_new_from_file(const char *text, unsigned long id, const char *filename) |
6710 { | 6710 { |
6711 WindowData *blah = calloc(1, sizeof(WindowData)); | 6711 WindowData *blah = calloc(1, sizeof(WindowData)); |
6712 HWND tmp = WinCreateWindow(HWND_OBJECT, | 6712 HWND tmp = WinCreateWindow(HWND_OBJECT, |
6713 WC_BUTTON, | 6713 WC_BUTTON, |
6714 NULL, | 6714 NULL, |
6796 * id: An ID to be used with dw_window_from_id() or 0L. | 6796 * id: An ID to be used with dw_window_from_id() or 0L. |
6797 * data: The contents of the image | 6797 * data: The contents of the image |
6798 * (BMP or ICO on OS/2 or Windows, XPM on Unix) | 6798 * (BMP or ICO on OS/2 or Windows, XPM on Unix) |
6799 * len: length of str | 6799 * len: length of str |
6800 */ | 6800 */ |
6801 HWND API dw_bitmapbutton_new_from_data(char *text, unsigned long id, char *data, int len) | 6801 HWND API dw_bitmapbutton_new_from_data(const char *text, unsigned long id, const char *data, int len) |
6802 { | 6802 { |
6803 FILE *fp; | 6803 FILE *fp; |
6804 WindowData *blah = calloc(1, sizeof(WindowData)); | 6804 WindowData *blah = calloc(1, sizeof(WindowData)); |
6805 HWND tmp = WinCreateWindow(HWND_OBJECT, | 6805 HWND tmp = WinCreateWindow(HWND_OBJECT, |
6806 WC_BUTTON, | 6806 WC_BUTTON, |
6872 * Create a new spinbutton window (widget) to be packed. | 6872 * Create a new spinbutton window (widget) to be packed. |
6873 * Parameters: | 6873 * Parameters: |
6874 * text: The text to be display by the static text widget. | 6874 * text: The text to be display by the static text widget. |
6875 * id: An ID to be used with dw_window_from_id() or 0L. | 6875 * id: An ID to be used with dw_window_from_id() or 0L. |
6876 */ | 6876 */ |
6877 HWND API dw_spinbutton_new(char *text, ULONG id) | 6877 HWND API dw_spinbutton_new(const char *text, ULONG id) |
6878 { | 6878 { |
6879 WindowData *blah = calloc(sizeof(WindowData), 1); | 6879 WindowData *blah = calloc(sizeof(WindowData), 1); |
6880 HWND tmp = WinCreateWindow(HWND_OBJECT, | 6880 HWND tmp = WinCreateWindow(HWND_OBJECT, |
6881 WC_SPINBUTTON, | 6881 WC_SPINBUTTON, |
6882 (PSZ)text, | 6882 (PSZ)text, |
6905 * Create a new radiobutton window (widget) to be packed. | 6905 * Create a new radiobutton window (widget) to be packed. |
6906 * Parameters: | 6906 * Parameters: |
6907 * text: The text to be display by the static text widget. | 6907 * text: The text to be display by the static text widget. |
6908 * id: An ID to be used with dw_window_from_id() or 0L. | 6908 * id: An ID to be used with dw_window_from_id() or 0L. |
6909 */ | 6909 */ |
6910 HWND API dw_radiobutton_new(char *text, ULONG id) | 6910 HWND API dw_radiobutton_new(const char *text, ULONG id) |
6911 { | 6911 { |
6912 WindowData *blah = calloc(sizeof(WindowData), 1); | 6912 WindowData *blah = calloc(sizeof(WindowData), 1); |
6913 HWND tmp = WinCreateWindow(HWND_OBJECT, | 6913 HWND tmp = WinCreateWindow(HWND_OBJECT, |
6914 WC_BUTTON, | 6914 WC_BUTTON, |
6915 (PSZ)text, | 6915 (PSZ)text, |
7013 * Create a new checkbox window (widget) to be packed. | 7013 * Create a new checkbox window (widget) to be packed. |
7014 * Parameters: | 7014 * Parameters: |
7015 * text: The text to be display by the static text widget. | 7015 * text: The text to be display by the static text widget. |
7016 * id: An ID to be used with dw_window_from_id() or 0L. | 7016 * id: An ID to be used with dw_window_from_id() or 0L. |
7017 */ | 7017 */ |
7018 HWND API dw_checkbox_new(char *text, ULONG id) | 7018 HWND API dw_checkbox_new(const char *text, ULONG id) |
7019 { | 7019 { |
7020 WindowData *blah = calloc(1, sizeof(WindowData)); | 7020 WindowData *blah = calloc(1, sizeof(WindowData)); |
7021 HWND tmp = WinCreateWindow(HWND_OBJECT, | 7021 HWND tmp = WinCreateWindow(HWND_OBJECT, |
7022 WC_BUTTON, | 7022 WC_BUTTON, |
7023 (PSZ)text, | 7023 (PSZ)text, |
7471 * (pass 0 if you use the filename param) | 7471 * (pass 0 if you use the filename param) |
7472 * filename: a path to a file (Bitmap on OS/2 or | 7472 * filename: a path to a file (Bitmap on OS/2 or |
7473 * Windows and a pixmap on Unix, pass | 7473 * Windows and a pixmap on Unix, pass |
7474 * NULL if you use the id param) | 7474 * NULL if you use the id param) |
7475 */ | 7475 */ |
7476 void API dw_window_set_bitmap(HWND handle, unsigned long id, char *filename) | 7476 void API dw_window_set_bitmap(HWND handle, unsigned long id, const char *filename) |
7477 { | 7477 { |
7478 HBITMAP hbm = 0; | 7478 HBITMAP hbm = 0; |
7479 HPS hps = 0; | 7479 HPS hps = 0; |
7480 HDC hdc = 0; | 7480 HDC hdc = 0; |
7481 HPOINTER icon = 0; | 7481 HPOINTER icon = 0; |
7559 * (pass 0 if you use the filename param) | 7559 * (pass 0 if you use the filename param) |
7560 * filename: a path to a file (Bitmap on OS/2 or | 7560 * filename: a path to a file (Bitmap on OS/2 or |
7561 * Windows and a pixmap on Unix, pass | 7561 * Windows and a pixmap on Unix, pass |
7562 * NULL if you use the id param) | 7562 * NULL if you use the id param) |
7563 */ | 7563 */ |
7564 void API dw_window_set_bitmap_from_data(HWND handle, unsigned long id, char *data, int len) | 7564 void API dw_window_set_bitmap_from_data(HWND handle, unsigned long id, const char *data, int len) |
7565 { | 7565 { |
7566 HBITMAP hbm; | 7566 HBITMAP hbm; |
7567 HPS hps; | 7567 HPS hps; |
7568 HDC hdc; | 7568 HDC hdc; |
7569 unsigned long width, height; | 7569 unsigned long width, height; |
7623 * Sets the text used for a given window. | 7623 * Sets the text used for a given window. |
7624 * Parameters: | 7624 * Parameters: |
7625 * handle: Handle to the window. | 7625 * handle: Handle to the window. |
7626 * text: The text associsated with a given window. | 7626 * text: The text associsated with a given window. |
7627 */ | 7627 */ |
7628 void API dw_window_set_text(HWND handle, char *text) | 7628 void API dw_window_set_text(HWND handle, const char *text) |
7629 { | 7629 { |
7630 HWND entryfield = (HWND)dw_window_get_data(handle, "_dw_buddy"); | 7630 HWND entryfield = (HWND)dw_window_get_data(handle, "_dw_buddy"); |
7631 WinSetWindowText(entryfield ? entryfield : handle, (PSZ)text); | 7631 WinSetWindowText(entryfield ? entryfield : handle, (PSZ)text); |
7632 /* If we changed the text... */ | 7632 /* If we changed the text... */ |
7633 { | 7633 { |
7659 * Sets the text used for a given window's floating bubble help. | 7659 * Sets the text used for a given window's floating bubble help. |
7660 * Parameters: | 7660 * Parameters: |
7661 * handle: Handle to the window (widget). | 7661 * handle: Handle to the window (widget). |
7662 * bubbletext: The text in the floating bubble tooltip. | 7662 * bubbletext: The text in the floating bubble tooltip. |
7663 */ | 7663 */ |
7664 void API dw_window_set_tooltip(HWND handle, char *bubbletext) | 7664 void API dw_window_set_tooltip(HWND handle, const char *bubbletext) |
7665 { | 7665 { |
7666 HWND buddy = (HWND)dw_window_get_data(handle, "_dw_comboentry"); | 7666 HWND buddy = (HWND)dw_window_get_data(handle, "_dw_comboentry"); |
7667 WindowData *blah = (WindowData *)WinQueryWindowPtr(buddy ? buddy : handle, QWP_USER); | 7667 WindowData *blah = (WindowData *)WinQueryWindowPtr(buddy ? buddy : handle, QWP_USER); |
7668 char *text = bubbletext ? bubbletext : ""; | 7668 const char *text = bubbletext ? bubbletext : ""; |
7669 | 7669 |
7670 buddy = (HWND)dw_window_get_data(handle, "_dw_buddy"); | 7670 buddy = (HWND)dw_window_get_data(handle, "_dw_buddy"); |
7671 | 7671 |
7672 if(blah) | 7672 if(blah) |
7673 strncpy(blah->bubbletext, text, BUBBLE_HELP_MAX - 1); | 7673 strncpy(blah->bubbletext, text, BUBBLE_HELP_MAX - 1); |
8442 * Parameters: | 8442 * Parameters: |
8443 * handle: Notebook handle. | 8443 * handle: Notebook handle. |
8444 * pageid: Page ID of the tab to set. | 8444 * pageid: Page ID of the tab to set. |
8445 * text: Pointer to the text to set. | 8445 * text: Pointer to the text to set. |
8446 */ | 8446 */ |
8447 void API dw_notebook_page_set_text(HWND handle, ULONG pageid, char *text) | 8447 void API dw_notebook_page_set_text(HWND handle, ULONG pageid, const char *text) |
8448 { | 8448 { |
8449 WinSendMsg(handle, BKM_SETTABTEXT, | 8449 WinSendMsg(handle, BKM_SETTABTEXT, |
8450 MPFROMLONG(pageid), MPFROMP(text)); | 8450 MPFROMLONG(pageid), MPFROMP(text)); |
8451 } | 8451 } |
8452 | 8452 |
8455 * Parameters: | 8455 * Parameters: |
8456 * handle: Notebook handle. | 8456 * handle: Notebook handle. |
8457 * pageid: Page ID of the tab to set. | 8457 * pageid: Page ID of the tab to set. |
8458 * text: Pointer to the text to set. | 8458 * text: Pointer to the text to set. |
8459 */ | 8459 */ |
8460 void API dw_notebook_page_set_status_text(HWND handle, ULONG pageid, char *text) | 8460 void API dw_notebook_page_set_status_text(HWND handle, ULONG pageid, const char *text) |
8461 { | 8461 { |
8462 WinSendMsg(handle, BKM_SETSTATUSLINETEXT, | 8462 WinSendMsg(handle, BKM_SETSTATUSLINETEXT, |
8463 MPFROMLONG(pageid), MPFROMP(text)); | 8463 MPFROMLONG(pageid), MPFROMP(text)); |
8464 } | 8464 } |
8465 | 8465 |
8484 * Appends the specified text to the listbox's (or combobox) entry list. | 8484 * Appends the specified text to the listbox's (or combobox) entry list. |
8485 * Parameters: | 8485 * Parameters: |
8486 * handle: Handle to the listbox to be appended to. | 8486 * handle: Handle to the listbox to be appended to. |
8487 * text: Text to append into listbox. | 8487 * text: Text to append into listbox. |
8488 */ | 8488 */ |
8489 void API dw_listbox_append(HWND handle, char *text) | 8489 void API dw_listbox_append(HWND handle, const char *text) |
8490 { | 8490 { |
8491 WinSendMsg(handle, | 8491 WinSendMsg(handle, |
8492 LM_INSERTITEM, | 8492 LM_INSERTITEM, |
8493 MPFROMSHORT(LIT_END), | 8493 MPFROMSHORT(LIT_END), |
8494 MPFROMP(text)); | 8494 MPFROMP(text)); |
8499 * Parameters: | 8499 * Parameters: |
8500 * handle: Handle to the listbox to be inserted into. | 8500 * handle: Handle to the listbox to be inserted into. |
8501 * text: Text to insert into listbox. | 8501 * text: Text to insert into listbox. |
8502 * pos: 0-based position to insert text | 8502 * pos: 0-based position to insert text |
8503 */ | 8503 */ |
8504 void API dw_listbox_insert(HWND handle, char *text, int pos) | 8504 void API dw_listbox_insert(HWND handle, const char *text, int pos) |
8505 { | 8505 { |
8506 WinSendMsg(handle, | 8506 WinSendMsg(handle, |
8507 LM_INSERTITEM, | 8507 LM_INSERTITEM, |
8508 MPFROMSHORT(pos), | 8508 MPFROMSHORT(pos), |
8509 MPFROMP(text)); | 8509 MPFROMP(text)); |
8580 * Parameters: | 8580 * Parameters: |
8581 * handle: Handle to the listbox to be queried. | 8581 * handle: Handle to the listbox to be queried. |
8582 * index: Index into the list to be queried. | 8582 * index: Index into the list to be queried. |
8583 * buffer: Buffer where text will be copied. | 8583 * buffer: Buffer where text will be copied. |
8584 */ | 8584 */ |
8585 void API dw_listbox_set_text(HWND handle, unsigned int index, char *buffer) | 8585 void API dw_listbox_set_text(HWND handle, unsigned int index, const char *buffer) |
8586 { | 8586 { |
8587 WinSendMsg(handle, LM_SETITEMTEXT, MPFROMSHORT(index), (MPARAM)buffer); | 8587 WinSendMsg(handle, LM_SETITEMTEXT, MPFROMSHORT(index), (MPARAM)buffer); |
8588 } | 8588 } |
8589 | 8589 |
8590 /* | 8590 /* |
8657 * Parameters: | 8657 * Parameters: |
8658 * handle: Handle to the MLE to be queried. | 8658 * handle: Handle to the MLE to be queried. |
8659 * buffer: Text buffer to be imported. | 8659 * buffer: Text buffer to be imported. |
8660 * startpoint: Point to start entering text. | 8660 * startpoint: Point to start entering text. |
8661 */ | 8661 */ |
8662 unsigned int API dw_mle_import(HWND handle, char *buffer, int startpoint) | 8662 unsigned int API dw_mle_import(HWND handle, const char *buffer, int startpoint) |
8663 { | 8663 { |
8664 long point = startpoint < 0 ? 0 : startpoint; | 8664 long point = startpoint < 0 ? 0 : startpoint; |
8665 PBYTE mlebuf; | 8665 PBYTE mlebuf; |
8666 | 8666 |
8667 /* Work around 64K limit */ | 8667 /* Work around 64K limit */ |
8842 * handle: Handle to the MLE to be cleared. | 8842 * handle: Handle to the MLE to be cleared. |
8843 * text: Text to search for. | 8843 * text: Text to search for. |
8844 * point: Start point of search. | 8844 * point: Start point of search. |
8845 * flags: Search specific flags. | 8845 * flags: Search specific flags. |
8846 */ | 8846 */ |
8847 int API dw_mle_search(HWND handle, char *text, int point, unsigned long flags) | 8847 int API dw_mle_search(HWND handle, const char *text, int point, unsigned long flags) |
8848 { | 8848 { |
8849 MLE_SEARCHDATA msd; | 8849 MLE_SEARCHDATA msd; |
8850 | 8850 |
8851 /* This code breaks with structure packing set to 1 (/Sp1 in VAC) | 8851 /* This code breaks with structure packing set to 1 (/Sp1 in VAC) |
8852 * if this is needed we need to add a pragma here. | 8852 * if this is needed we need to add a pragma here. |
8853 */ | 8853 */ |
8854 msd.cb = sizeof(msd); | 8854 msd.cb = sizeof(msd); |
8855 msd.pchFind = text; | 8855 msd.pchFind = (char *)text; |
8856 msd.pchReplace = NULL; | 8856 msd.pchReplace = NULL; |
8857 msd.cchFind = strlen(text); | 8857 msd.cchFind = strlen(text); |
8858 msd.cchReplace = 0; | 8858 msd.cchReplace = 0; |
8859 msd.iptStart = point; | 8859 msd.iptStart = point; |
8860 msd.iptStop = -1; | 8860 msd.iptStop = -1; |
9093 * title: The text title of the entry. | 9093 * title: The text title of the entry. |
9094 * icon: Handle to coresponding icon. | 9094 * icon: Handle to coresponding icon. |
9095 * parent: Parent handle or 0 if root. | 9095 * parent: Parent handle or 0 if root. |
9096 * itemdata: Item specific data. | 9096 * itemdata: Item specific data. |
9097 */ | 9097 */ |
9098 HTREEITEM API dw_tree_insert_after(HWND handle, HTREEITEM item, char *title, HICN icon, HTREEITEM parent, void *itemdata) | 9098 HTREEITEM API dw_tree_insert_after(HWND handle, HTREEITEM item, const char *title, HICN icon, HTREEITEM parent, void *itemdata) |
9099 { | 9099 { |
9100 ULONG cbExtra; | 9100 ULONG cbExtra; |
9101 PCNRITEM pci; | 9101 PCNRITEM pci; |
9102 RECORDINSERT ri; | 9102 RECORDINSERT ri; |
9103 | 9103 |
9151 * title: The text title of the entry. | 9151 * title: The text title of the entry. |
9152 * icon: Handle to coresponding icon. | 9152 * icon: Handle to coresponding icon. |
9153 * parent: Parent handle or 0 if root. | 9153 * parent: Parent handle or 0 if root. |
9154 * itemdata: Item specific data. | 9154 * itemdata: Item specific data. |
9155 */ | 9155 */ |
9156 HTREEITEM API dw_tree_insert(HWND handle, char *title, HICN icon, HTREEITEM parent, void *itemdata) | 9156 HTREEITEM API dw_tree_insert(HWND handle, const char *title, HICN icon, HTREEITEM parent, void *itemdata) |
9157 { | 9157 { |
9158 return dw_tree_insert_after(handle, (HTREEITEM)CMA_END, title, icon, parent, itemdata); | 9158 return dw_tree_insert_after(handle, (HTREEITEM)CMA_END, title, icon, parent, itemdata); |
9159 } | 9159 } |
9160 | 9160 |
9161 /* | 9161 /* |
9164 * handle: Handle to the tree containing the item. | 9164 * handle: Handle to the tree containing the item. |
9165 * item: Handle of the item to be modified. | 9165 * item: Handle of the item to be modified. |
9166 * title: The text title of the entry. | 9166 * title: The text title of the entry. |
9167 * icon: Handle to coresponding icon. | 9167 * icon: Handle to coresponding icon. |
9168 */ | 9168 */ |
9169 void API dw_tree_item_change(HWND handle, HTREEITEM item, char *title, HICN icon) | 9169 void API dw_tree_item_change(HWND handle, HTREEITEM item, const char *title, HICN icon) |
9170 { | 9170 { |
9171 PCNRITEM pci = (PCNRITEM)item; | 9171 PCNRITEM pci = (PCNRITEM)item; |
9172 | 9172 |
9173 if(!pci) | 9173 if(!pci) |
9174 return; | 9174 return; |
9437 * Configures the main filesystem columnn title for localization. | 9437 * Configures the main filesystem columnn title for localization. |
9438 * Parameters: | 9438 * Parameters: |
9439 * handle: Handle to the container to be configured. | 9439 * handle: Handle to the container to be configured. |
9440 * title: The title to be displayed in the main column. | 9440 * title: The title to be displayed in the main column. |
9441 */ | 9441 */ |
9442 void API dw_filesystem_set_column_title(HWND handle, char *title) | 9442 void API dw_filesystem_set_column_title(HWND handle, const char *title) |
9443 { | 9443 { |
9444 char *newtitle = strdup(title ? title : ""); | 9444 char *newtitle = strdup(title ? title : ""); |
9445 | 9445 |
9446 dw_window_set_data(handle, "_dw_coltitle", newtitle); | 9446 dw_window_set_data(handle, "_dw_coltitle", newtitle); |
9447 } | 9447 } |
9566 * Parameters: | 9566 * Parameters: |
9567 * filename: Name of the file, omit extention to have | 9567 * filename: Name of the file, omit extention to have |
9568 * DW pick the appropriate file extension. | 9568 * DW pick the appropriate file extension. |
9569 * (ICO on OS/2 or Windows, XPM on Unix) | 9569 * (ICO on OS/2 or Windows, XPM on Unix) |
9570 */ | 9570 */ |
9571 HICN API dw_icon_load_from_file(char *filename) | 9571 HICN API dw_icon_load_from_file(const char *filename) |
9572 { | 9572 { |
9573 char *file = alloca(strlen(filename) + 6); | 9573 char *file = alloca(strlen(filename) + 6); |
9574 HPIXMAP src = alloca(sizeof(struct _hpixmap)); | 9574 HPIXMAP src = alloca(sizeof(struct _hpixmap)); |
9575 HICN icon = 0; | 9575 HICN icon = 0; |
9576 unsigned long defcol = DW_RGB(204, 204, 204); | 9576 unsigned long defcol = DW_RGB(204, 204, 204); |
9623 * Parameters: | 9623 * Parameters: |
9624 * filename: Name of the file, omit extention to have | 9624 * filename: Name of the file, omit extention to have |
9625 * DW pick the appropriate file extension. | 9625 * DW pick the appropriate file extension. |
9626 * (ICO on OS/2 or Windows, XPM on Unix) | 9626 * (ICO on OS/2 or Windows, XPM on Unix) |
9627 */ | 9627 */ |
9628 HICN API dw_icon_load_from_data(char *data, int len) | 9628 HICN API dw_icon_load_from_data(const char *data, int len) |
9629 { | 9629 { |
9630 HICN icon=0; | 9630 HICN icon=0; |
9631 char *file; | 9631 char *file; |
9632 FILE *fp; | 9632 FILE *fp; |
9633 | 9633 |
9912 * pointer: Pointer to the allocated memory in dw_container_alloc(). | 9912 * pointer: Pointer to the allocated memory in dw_container_alloc(). |
9913 * column: Zero based column of data being set. | 9913 * column: Zero based column of data being set. |
9914 * row: Zero based row of data being set. | 9914 * row: Zero based row of data being set. |
9915 * data: Pointer to the data to be added. | 9915 * data: Pointer to the data to be added. |
9916 */ | 9916 */ |
9917 void API dw_filesystem_change_file(HWND handle, int row, char *filename, HICN icon) | 9917 void API dw_filesystem_change_file(HWND handle, int row, const char *filename, HICN icon) |
9918 { | 9918 { |
9919 dw_container_change_item(handle, 0, row, (void *)&icon); | 9919 dw_container_change_item(handle, 0, row, (void *)&icon); |
9920 dw_container_change_item(handle, 1, row, (void *)&filename); | 9920 dw_container_change_item(handle, 1, row, (void *)&filename); |
9921 } | 9921 } |
9922 | 9922 |
9927 * pointer: Pointer to the allocated memory in dw_container_alloc(). | 9927 * pointer: Pointer to the allocated memory in dw_container_alloc(). |
9928 * column: Zero based column of data being set. | 9928 * column: Zero based column of data being set. |
9929 * row: Zero based row of data being set. | 9929 * row: Zero based row of data being set. |
9930 * data: Pointer to the data to be added. | 9930 * data: Pointer to the data to be added. |
9931 */ | 9931 */ |
9932 void API dw_filesystem_set_file(HWND handle, void *pointer, int row, char *filename, HICN icon) | 9932 void API dw_filesystem_set_file(HWND handle, void *pointer, int row, const char *filename, HICN icon) |
9933 { | 9933 { |
9934 dw_container_set_item(handle, pointer, 0, row, (void *)&icon); | 9934 dw_container_set_item(handle, pointer, 0, row, (void *)&icon); |
9935 dw_container_set_item(handle, pointer, 1, row, (void *)&filename); | 9935 dw_container_set_item(handle, pointer, 1, row, (void *)&filename); |
9936 } | 9936 } |
9937 | 9937 |
10023 * Parameters: | 10023 * Parameters: |
10024 * pointer: Pointer to the allocated memory in dw_container_alloc(). | 10024 * pointer: Pointer to the allocated memory in dw_container_alloc(). |
10025 * row: Zero based row of data being set. | 10025 * row: Zero based row of data being set. |
10026 * title: String title of the item. | 10026 * title: String title of the item. |
10027 */ | 10027 */ |
10028 void API dw_container_set_row_title(void *pointer, int row, char *title) | 10028 void API dw_container_set_row_title(void *pointer, int row, const char *title) |
10029 { | 10029 { |
10030 ContainerInfo *ci = (ContainerInfo *)pointer; | 10030 ContainerInfo *ci = (ContainerInfo *)pointer; |
10031 PRECORDCORE temp; | 10031 PRECORDCORE temp; |
10032 int z, currentcount; | 10032 int z, currentcount; |
10033 CNRINFO cnr; | 10033 CNRINFO cnr; |
10057 * Parameters: | 10057 * Parameters: |
10058 * handle: Handle to the container window (widget). | 10058 * handle: Handle to the container window (widget). |
10059 * row: Zero based row of data being set. | 10059 * row: Zero based row of data being set. |
10060 * title: String title of the item. | 10060 * title: String title of the item. |
10061 */ | 10061 */ |
10062 void API dw_container_change_row_title(HWND handle, int row, char *title) | 10062 void API dw_container_change_row_title(HWND handle, int row, const char *title) |
10063 { | 10063 { |
10064 PRECORDCORE pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)0L, MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER)); | 10064 PRECORDCORE pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)0L, MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER)); |
10065 int count = 0; | 10065 int count = 0; |
10066 | 10066 |
10067 while(pCore) | 10067 while(pCore) |
10365 * Cursors the item with the text speficied, and scrolls to that item. | 10365 * Cursors the item with the text speficied, and scrolls to that item. |
10366 * Parameters: | 10366 * Parameters: |
10367 * handle: Handle to the window (widget) to be queried. | 10367 * handle: Handle to the window (widget) to be queried. |
10368 * text: Text usually returned by dw_container_query(). | 10368 * text: Text usually returned by dw_container_query(). |
10369 */ | 10369 */ |
10370 void API dw_container_cursor(HWND handle, char *text) | 10370 void API dw_container_cursor(HWND handle, const char *text) |
10371 { | 10371 { |
10372 RECTL viewport, item; | 10372 RECTL viewport, item; |
10373 PRECORDCORE pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)0L, MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER)); | 10373 PRECORDCORE pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)0L, MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER)); |
10374 | 10374 |
10375 while(pCore) | 10375 while(pCore) |
10403 * Deletes the item with the text speficied. | 10403 * Deletes the item with the text speficied. |
10404 * Parameters: | 10404 * Parameters: |
10405 * handle: Handle to the window (widget). | 10405 * handle: Handle to the window (widget). |
10406 * text: Text usually returned by dw_container_query(). | 10406 * text: Text usually returned by dw_container_query(). |
10407 */ | 10407 */ |
10408 void API dw_container_delete_row(HWND handle, char *text) | 10408 void API dw_container_delete_row(HWND handle, const char *text) |
10409 { | 10409 { |
10410 PRECORDCORE pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)0L, MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER)); | 10410 PRECORDCORE pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)0L, MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER)); |
10411 | 10411 |
10412 while(pCore) | 10412 while(pCore) |
10413 { | 10413 { |
10531 * Parameters: | 10531 * Parameters: |
10532 * handle: Window handle that will handle taskbar icon messages. | 10532 * handle: Window handle that will handle taskbar icon messages. |
10533 * icon: Icon handle to display in the taskbar. | 10533 * icon: Icon handle to display in the taskbar. |
10534 * bubbletext: Text to show when the mouse is above the icon. | 10534 * bubbletext: Text to show when the mouse is above the icon. |
10535 */ | 10535 */ |
10536 void API dw_taskbar_insert(HWND handle, HICN icon, char *bubbletext) | 10536 void API dw_taskbar_insert(HWND handle, HICN icon, const char *bubbletext) |
10537 { | 10537 { |
10538 /* Make sure we have our server */ | 10538 /* Make sure we have our server */ |
10539 if(!hwndTrayServer) | 10539 if(!hwndTrayServer) |
10540 return; | 10540 return; |
10541 | 10541 |
10871 * pixmap: Handle to the pixmap. (choose only one of these) | 10871 * pixmap: Handle to the pixmap. (choose only one of these) |
10872 * x: X coordinate. | 10872 * x: X coordinate. |
10873 * y: Y coordinate. | 10873 * y: Y coordinate. |
10874 * text: Text to be displayed. | 10874 * text: Text to be displayed. |
10875 */ | 10875 */ |
10876 void API dw_draw_text(HWND handle, HPIXMAP pixmap, int x, int y, char *text) | 10876 void API dw_draw_text(HWND handle, HPIXMAP pixmap, int x, int y, const char *text) |
10877 { | 10877 { |
10878 HPS hps; | 10878 HPS hps; |
10879 int z, height; | 10879 int z, height; |
10880 RECTL rcl; | 10880 RECTL rcl; |
10881 char fontname[128]; | 10881 char fontname[128]; |
10928 * pixmap: Handle to the pixmap. (choose only one of these) | 10928 * pixmap: Handle to the pixmap. (choose only one of these) |
10929 * text: Text to be queried. | 10929 * text: Text to be queried. |
10930 * width: Pointer to a variable to be filled in with the width. | 10930 * width: Pointer to a variable to be filled in with the width. |
10931 * height Pointer to a variable to be filled in with the height. | 10931 * height Pointer to a variable to be filled in with the height. |
10932 */ | 10932 */ |
10933 void API dw_font_text_extents_get(HWND handle, HPIXMAP pixmap, char *text, int *width, int *height) | 10933 void API dw_font_text_extents_get(HWND handle, HPIXMAP pixmap, const char *text, int *width, int *height) |
10934 { | 10934 { |
10935 HPS hps; | 10935 HPS hps; |
10936 POINTL aptl[TXTBOX_COUNT]; | 10936 POINTL aptl[TXTBOX_COUNT]; |
10937 | 10937 |
10938 if(handle) | 10938 if(handle) |
11232 * DW pick the appropriate file extension. | 11232 * DW pick the appropriate file extension. |
11233 * (BMP on OS/2 or Windows, XPM on Unix) | 11233 * (BMP on OS/2 or Windows, XPM on Unix) |
11234 * Returns: | 11234 * Returns: |
11235 * A handle to a pixmap or NULL on failure. | 11235 * A handle to a pixmap or NULL on failure. |
11236 */ | 11236 */ |
11237 HPIXMAP API dw_pixmap_new_from_file(HWND handle, char *filename) | 11237 HPIXMAP API dw_pixmap_new_from_file(HWND handle, const char *filename) |
11238 { | 11238 { |
11239 HPIXMAP pixmap; | 11239 HPIXMAP pixmap; |
11240 char *file = alloca(strlen(filename) + 5); | 11240 char *file = alloca(strlen(filename) + 5); |
11241 | 11241 |
11242 if ( !file || !(pixmap = calloc(1,sizeof(struct _hpixmap))) ) | 11242 if ( !file || !(pixmap = calloc(1,sizeof(struct _hpixmap))) ) |
11282 * (BMP on OS/2 or Windows, XPM on Unix) | 11282 * (BMP on OS/2 or Windows, XPM on Unix) |
11283 * le: length of data | 11283 * le: length of data |
11284 * Returns: | 11284 * Returns: |
11285 * A handle to a pixmap or NULL on failure. | 11285 * A handle to a pixmap or NULL on failure. |
11286 */ | 11286 */ |
11287 HPIXMAP API dw_pixmap_new_from_data(HWND handle, char *data, int len) | 11287 HPIXMAP API dw_pixmap_new_from_data(HWND handle, const char *data, int len) |
11288 { | 11288 { |
11289 HPIXMAP pixmap; | 11289 HPIXMAP pixmap; |
11290 char *file; | 11290 char *file; |
11291 FILE *fp; | 11291 FILE *fp; |
11292 | 11292 |
11385 * passed to the application via a callback. | 11385 * passed to the application via a callback. |
11386 * fontname: Name and size of the font in the form "size.fontname" | 11386 * fontname: Name and size of the font in the form "size.fontname" |
11387 * Returns: | 11387 * Returns: |
11388 * DW_ERROR_NONE on success and DW_ERROR_GENERAL on failure. | 11388 * DW_ERROR_NONE on success and DW_ERROR_GENERAL on failure. |
11389 */ | 11389 */ |
11390 int API dw_pixmap_set_font(HPIXMAP pixmap, char *fontname) | 11390 int API dw_pixmap_set_font(HPIXMAP pixmap, const char *fontname) |
11391 { | 11391 { |
11392 if(pixmap && fontname && *fontname) | 11392 if(pixmap && fontname && *fontname) |
11393 { | 11393 { |
11394 if(!pixmap->font) | 11394 if(!pixmap->font) |
11395 pixmap->font = WinCreateWindow(HWND_OBJECT, WC_FRAME, NULL, 0,0,0,1,1, NULLHANDLE, HWND_TOP,0, NULL, NULL); | 11395 pixmap->font = WinCreateWindow(HWND_OBJECT, WC_FRAME, NULL, 0,0,0,1,1, NULLHANDLE, HWND_TOP,0, NULL, NULL); |
11396 WinSetPresParam(pixmap->font, PP_FONTNAMESIZE, strlen(fontname)+1, fontname); | 11396 WinSetPresParam(pixmap->font, PP_FONTNAMESIZE, strlen(fontname)+1, (void *)fontname); |
11397 return DW_ERROR_NONE; | 11397 return DW_ERROR_NONE; |
11398 } | 11398 } |
11399 return DW_ERROR_GENERAL; | 11399 return DW_ERROR_GENERAL; |
11400 } | 11400 } |
11401 | 11401 |
11569 * Parameters: | 11569 * Parameters: |
11570 * name: Base name of the shared library. | 11570 * name: Base name of the shared library. |
11571 * handle: Pointer to a module handle, | 11571 * handle: Pointer to a module handle, |
11572 * will be filled in with the handle. | 11572 * will be filled in with the handle. |
11573 */ | 11573 */ |
11574 int API dw_module_load(char *name, HMOD *handle) | 11574 int API dw_module_load(const char *name, HMOD *handle) |
11575 { | 11575 { |
11576 char objnamebuf[300] = ""; | 11576 char objnamebuf[300] = ""; |
11577 | 11577 |
11578 return DosLoadModule((PSZ)objnamebuf, sizeof(objnamebuf), (PSZ)name, handle); | 11578 return DosLoadModule((PSZ)objnamebuf, sizeof(objnamebuf), (PSZ)name, handle); |
11579 } | 11579 } |
11583 * handle: Module handle returned by dw_module_load() | 11583 * handle: Module handle returned by dw_module_load() |
11584 * name: Name of the symbol you want the address of. | 11584 * name: Name of the symbol you want the address of. |
11585 * func: A pointer to a function pointer, to obtain | 11585 * func: A pointer to a function pointer, to obtain |
11586 * the address. | 11586 * the address. |
11587 */ | 11587 */ |
11588 int API dw_module_symbol(HMOD handle, char *name, void**func) | 11588 int API dw_module_symbol(HMOD handle, const char *name, void**func) |
11589 { | 11589 { |
11590 return DosQueryProcAddr(handle, 0, (PSZ)name, (PFN*)func); | 11590 return DosQueryProcAddr(handle, 0, (PSZ)name, (PFN*)func); |
11591 } | 11591 } |
11592 | 11592 |
11593 /* Frees the shared library previously opened. | 11593 /* Frees the shared library previously opened. |
11742 * Parameters: | 11742 * Parameters: |
11743 * eve: Pointer to an event handle to receive handle. | 11743 * eve: Pointer to an event handle to receive handle. |
11744 * name: Name given to semaphore which can be opened | 11744 * name: Name given to semaphore which can be opened |
11745 * by other processes. | 11745 * by other processes. |
11746 */ | 11746 */ |
11747 HEV API dw_named_event_new(char *name) | 11747 HEV API dw_named_event_new(const char *name) |
11748 { | 11748 { |
11749 char *semname = malloc(strlen(name)+8); | 11749 char *semname = malloc(strlen(name)+8); |
11750 HEV ev = 0; | 11750 HEV ev = 0; |
11751 | 11751 |
11752 if(!semname) | 11752 if(!semname) |
11765 * Parameters: | 11765 * Parameters: |
11766 * eve: Pointer to an event handle to receive handle. | 11766 * eve: Pointer to an event handle to receive handle. |
11767 * name: Name given to semaphore which can be opened | 11767 * name: Name given to semaphore which can be opened |
11768 * by other processes. | 11768 * by other processes. |
11769 */ | 11769 */ |
11770 HEV API dw_named_event_get(char *name) | 11770 HEV API dw_named_event_get(const char *name) |
11771 { | 11771 { |
11772 char *semname = malloc(strlen(name)+8); | 11772 char *semname = malloc(strlen(name)+8); |
11773 HEV ev; | 11773 HEV ev; |
11774 | 11774 |
11775 if(!semname) | 11775 if(!semname) |
11872 * handle: A pointer to receive a SHM identifier. | 11872 * handle: A pointer to receive a SHM identifier. |
11873 * dest: A pointer to a pointer to receive the memory address. | 11873 * dest: A pointer to a pointer to receive the memory address. |
11874 * size: Size in bytes of the shared memory region to allocate. | 11874 * size: Size in bytes of the shared memory region to allocate. |
11875 * name: A string pointer to a unique memory name. | 11875 * name: A string pointer to a unique memory name. |
11876 */ | 11876 */ |
11877 HSHM API dw_named_memory_new(void **dest, int size, char *name) | 11877 HSHM API dw_named_memory_new(void **dest, int size, const char *name) |
11878 { | 11878 { |
11879 char namebuf[1024]; | 11879 char namebuf[1024]; |
11880 | 11880 |
11881 sprintf(namebuf, "\\sharemem\\%s", name); | 11881 sprintf(namebuf, "\\sharemem\\%s", name); |
11882 | 11882 |
11891 * Parameters: | 11891 * Parameters: |
11892 * dest: A pointer to a pointer to receive the memory address. | 11892 * dest: A pointer to a pointer to receive the memory address. |
11893 * size: Size in bytes of the shared memory region to requested. | 11893 * size: Size in bytes of the shared memory region to requested. |
11894 * name: A string pointer to a unique memory name. | 11894 * name: A string pointer to a unique memory name. |
11895 */ | 11895 */ |
11896 HSHM API dw_named_memory_get(void **dest, int size, char *name) | 11896 HSHM API dw_named_memory_get(void **dest, int size, const char *name) |
11897 { | 11897 { |
11898 char namebuf[1024]; | 11898 char namebuf[1024]; |
11899 | 11899 |
11900 size = size; | 11900 size = size; |
11901 sprintf(namebuf, "\\sharemem\\%s", name); | 11901 sprintf(namebuf, "\\sharemem\\%s", name); |
12334 /* | 12334 /* |
12335 * Sets the contents of the default clipboard to the supplied text. | 12335 * Sets the contents of the default clipboard to the supplied text. |
12336 * Parameters: | 12336 * Parameters: |
12337 * Text. | 12337 * Text. |
12338 */ | 12338 */ |
12339 void API dw_clipboard_set_text( char *str, int len ) | 12339 void API dw_clipboard_set_text(const char *str, int len) |
12340 { | 12340 { |
12341 static PVOID shared; | 12341 static PVOID shared; |
12342 PVOID old = shared, src = str; | 12342 PVOID old = shared, src = (PVOID)str; |
12343 int buflen = len + 1; | 12343 int buflen = len + 1; |
12344 | 12344 |
12345 WinOpenClipbrd(dwhab); /* Open clipboard */ | 12345 WinOpenClipbrd(dwhab); /* Open clipboard */ |
12346 WinEmptyClipbrd(dwhab); /* Empty clipboard */ | 12346 WinEmptyClipbrd(dwhab); /* Empty clipboard */ |
12347 | 12347 |
12607 * Returns: | 12607 * Returns: |
12608 * NULL on error. A malloced buffer containing | 12608 * NULL on error. A malloced buffer containing |
12609 * the file path on success. | 12609 * the file path on success. |
12610 * | 12610 * |
12611 */ | 12611 */ |
12612 char * API dw_file_browse(char *title, char *defpath, char *ext, int flags) | 12612 char * API dw_file_browse(const char *title, const char *defpath, const char *ext, int flags) |
12613 { | 12613 { |
12614 if(flags == DW_DIRECTORY_OPEN) | 12614 if(flags == DW_DIRECTORY_OPEN) |
12615 { | 12615 { |
12616 HWND window, hbox, vbox, tree, button; | 12616 HWND window, hbox, vbox, tree, button; |
12617 DWDialog *dwwait; | 12617 DWDialog *dwwait; |
12745 * type: Either DW_EXEC_CON or DW_EXEC_GUI. | 12745 * type: Either DW_EXEC_CON or DW_EXEC_GUI. |
12746 * params: An array of pointers to string arguements. | 12746 * params: An array of pointers to string arguements. |
12747 * Returns: | 12747 * Returns: |
12748 * -1 on error. | 12748 * -1 on error. |
12749 */ | 12749 */ |
12750 int API dw_exec(char *program, int type, char **params) | 12750 int API dw_exec(const char *program, int type, char **params) |
12751 { | 12751 { |
12752 type = type; /* keep compiler happy */ | 12752 type = type; /* keep compiler happy */ |
12753 #ifdef __EMX__ | 12753 #ifdef __EMX__ |
12754 return spawnvp(P_NOWAIT, program, (char * const *)params); | 12754 return spawnvp(P_NOWAIT, program, (char * const *)params); |
12755 #else | 12755 #else |
12760 /* | 12760 /* |
12761 * Loads a web browser pointed at the given URL. | 12761 * Loads a web browser pointed at the given URL. |
12762 * Parameters: | 12762 * Parameters: |
12763 * url: Uniform resource locator. | 12763 * url: Uniform resource locator. |
12764 */ | 12764 */ |
12765 int API dw_browse(char *url) | 12765 int API dw_browse(const char *url) |
12766 { | 12766 { |
12767 char *execargs[3], browser[1024], *olddir, *newurl = NULL; | 12767 char *execargs[3], browser[1024], *olddir, *newurl = NULL; |
12768 int len, ret; | 12768 int len, ret; |
12769 | 12769 |
12770 olddir = _getcwd(NULL, 1024); | 12770 olddir = _getcwd(NULL, 1024); |
12779 (PSZ)"DefaultBrowserExe", NULL, (PSZ)browser, 1024); | 12779 (PSZ)"DefaultBrowserExe", NULL, (PSZ)browser, 1024); |
12780 | 12780 |
12781 len = strlen(browser) - strlen("explore.exe"); | 12781 len = strlen(browser) - strlen("explore.exe"); |
12782 | 12782 |
12783 execargs[0] = browser; | 12783 execargs[0] = browser; |
12784 execargs[1] = url; | 12784 execargs[1] = (char *)url; |
12785 execargs[2] = NULL; | 12785 execargs[2] = NULL; |
12786 | 12786 |
12787 /* Special case for Web Explorer, it requires file:/// instead | 12787 /* Special case for Web Explorer, it requires file:/// instead |
12788 * of file:// so I am handling it here. | 12788 * of file:// so I am handling it here. |
12789 */ | 12789 */ |
12837 * string: String buffer containt HTML code to | 12837 * string: String buffer containt HTML code to |
12838 * be rendered. | 12838 * be rendered. |
12839 * Returns: | 12839 * Returns: |
12840 * 0 on success. | 12840 * 0 on success. |
12841 */ | 12841 */ |
12842 int API dw_html_raw(HWND handle, char *string) | 12842 int API dw_html_raw(HWND handle, const char *string) |
12843 { | 12843 { |
12844 handle = handle; | 12844 handle = handle; |
12845 string = string; | 12845 string = string; |
12846 return -1; | 12846 return DW_ERROR_UNKNOWN; |
12847 } | 12847 } |
12848 | 12848 |
12849 /* | 12849 /* |
12850 * Render file or web page in the embedded HTML widget.. | 12850 * Render file or web page in the embedded HTML widget.. |
12851 * Parameters: | 12851 * Parameters: |
12853 * url: Universal Resource Locator of the web or | 12853 * url: Universal Resource Locator of the web or |
12854 * file object to be rendered. | 12854 * file object to be rendered. |
12855 * Returns: | 12855 * Returns: |
12856 * 0 on success. | 12856 * 0 on success. |
12857 */ | 12857 */ |
12858 int API dw_html_url(HWND handle, char *url) | 12858 int API dw_html_url(HWND handle, const char *url) |
12859 { | 12859 { |
12860 handle = handle; | 12860 handle = handle; |
12861 url = url; | 12861 url = url; |
12862 return -1; | 12862 return DW_ERROR_UNKNOWN; |
12863 } | 12863 } |
12864 | 12864 |
12865 /* | 12865 /* |
12866 * Executes the javascript contained in "script" in the HTML window. | 12866 * Executes the javascript contained in "script" in the HTML window. |
12867 * Parameters: | 12867 * Parameters: |
12870 * scriptdata: Data passed to the signal handler. | 12870 * scriptdata: Data passed to the signal handler. |
12871 * Notes: A DW_SIGNAL_HTML_RESULT event will be raised with scriptdata. | 12871 * Notes: A DW_SIGNAL_HTML_RESULT event will be raised with scriptdata. |
12872 * Returns: | 12872 * Returns: |
12873 * DW_ERROR_NONE (0) on success. | 12873 * DW_ERROR_NONE (0) on success. |
12874 */ | 12874 */ |
12875 int dw_html_javascript_run(HWND handle, char *script, void *scriptdata) | 12875 int dw_html_javascript_run(HWND handle, const char *script, void *scriptdata) |
12876 { | 12876 { |
12877 handle = handle; | 12877 handle = handle; |
12878 script = script; | 12878 script = script; |
12879 scriptdata = scriptdata; | 12879 scriptdata = scriptdata; |
12880 return DW_ERROR_UNKNOWN; | 12880 return DW_ERROR_UNKNOWN; |
12997 * drawfunc: The pointer to the function to be used as the callback. | 12997 * drawfunc: The pointer to the function to be used as the callback. |
12998 * drawdata: User data to be passed to the handler function. | 12998 * drawdata: User data to be passed to the handler function. |
12999 * Returns: | 12999 * Returns: |
13000 * A handle to the print object or NULL on failure. | 13000 * A handle to the print object or NULL on failure. |
13001 */ | 13001 */ |
13002 HPRINT API dw_print_new(char *jobname, unsigned long flags, unsigned int pages, void *drawfunc, void *drawdata) | 13002 HPRINT API dw_print_new(const char *jobname, unsigned long flags, unsigned int pages, void *drawfunc, void *drawdata) |
13003 { | 13003 { |
13004 char printername[32], tmpbuf[20]; | 13004 char printername[32], tmpbuf[20]; |
13005 HWND window, hbox, vbox, printerlist, button, text; | 13005 HWND window, hbox, vbox, printerlist, button, text; |
13006 DWDialog *dwwait; | 13006 DWDialog *dwwait; |
13007 DWPrint *print; | 13007 DWPrint *print; |
13015 if(!drawfunc || !(print = calloc(1, sizeof(DWPrint)))) | 13015 if(!drawfunc || !(print = calloc(1, sizeof(DWPrint)))) |
13016 return NULL; | 13016 return NULL; |
13017 | 13017 |
13018 print->drawfunc = (int (API_FUNC)(HPRINT, HPIXMAP, int, void *))drawfunc; | 13018 print->drawfunc = (int (API_FUNC)(HPRINT, HPIXMAP, int, void *))drawfunc; |
13019 print->drawdata = drawdata; | 13019 print->drawdata = drawdata; |
13020 print->jobname = jobname ? jobname : "Dynamic Windows Print Job"; | 13020 print->jobname = strdup(jobname ? jobname : "Dynamic Windows Print Job"); |
13021 print->startpage = 1; | 13021 print->startpage = 1; |
13022 print->endpage = pages; | 13022 print->endpage = pages; |
13023 print->flags = flags; | 13023 print->flags = flags; |
13024 | 13024 |
13025 /* Check to see how much space we need for the printer list */ | 13025 /* Check to see how much space we need for the printer list */ |
13222 } | 13222 } |
13223 else | 13223 else |
13224 DevEscape(p->hdc, DEVESC_ABORTDOC, 0, NULL, NULL, NULL); | 13224 DevEscape(p->hdc, DEVESC_ABORTDOC, 0, NULL, NULL, NULL); |
13225 /* Free memory */ | 13225 /* Free memory */ |
13226 dw_pixmap_destroy(pixmap); | 13226 dw_pixmap_destroy(pixmap); |
13227 if(p->jobname) | |
13228 free(p->jobname); | |
13227 if(p->printername) | 13229 if(p->printername) |
13228 free(p->printername); | 13230 free(p->printername); |
13229 free(p); | 13231 free(p); |
13230 return result; | 13232 return result; |
13231 } | 13233 } |
13287 | 13289 |
13288 /* Functions for managing the user data lists that are associated with | 13290 /* Functions for managing the user data lists that are associated with |
13289 * a given window handle. Used in dw_window_set_data() and | 13291 * a given window handle. Used in dw_window_set_data() and |
13290 * dw_window_get_data(). | 13292 * dw_window_get_data(). |
13291 */ | 13293 */ |
13292 UserData *_find_userdata(UserData **root, char *varname) | 13294 UserData *_find_userdata(UserData **root, const char *varname) |
13293 { | 13295 { |
13294 UserData *tmp = *root; | 13296 UserData *tmp = *root; |
13295 | 13297 |
13296 while(tmp) | 13298 while(tmp) |
13297 { | 13299 { |
13300 tmp = tmp->next; | 13302 tmp = tmp->next; |
13301 } | 13303 } |
13302 return NULL; | 13304 return NULL; |
13303 } | 13305 } |
13304 | 13306 |
13305 int _new_userdata(UserData **root, char *varname, void *data) | 13307 int _new_userdata(UserData **root, const char *varname, void *data) |
13306 { | 13308 { |
13307 UserData *new = _find_userdata(root, varname); | 13309 UserData *new = _find_userdata(root, varname); |
13308 | 13310 |
13309 if(new) | 13311 if(new) |
13310 { | 13312 { |
13338 } | 13340 } |
13339 } | 13341 } |
13340 return FALSE; | 13342 return FALSE; |
13341 } | 13343 } |
13342 | 13344 |
13343 int _remove_userdata(UserData **root, char *varname, int all) | 13345 int _remove_userdata(UserData **root, const char *varname, int all) |
13344 { | 13346 { |
13345 UserData *prev = NULL, *tmp = *root; | 13347 UserData *prev = NULL, *tmp = *root; |
13346 | 13348 |
13347 while(tmp) | 13349 while(tmp) |
13348 { | 13350 { |
13382 * Parameters: | 13384 * Parameters: |
13383 * window: Window handle of signal to be called back. | 13385 * window: Window handle of signal to be called back. |
13384 * dataname: A string pointer identifying which signal to be hooked. | 13386 * dataname: A string pointer identifying which signal to be hooked. |
13385 * data: User data to be passed to the handler function. | 13387 * data: User data to be passed to the handler function. |
13386 */ | 13388 */ |
13387 void API dw_window_set_data(HWND window, char *dataname, void *data) | 13389 void API dw_window_set_data(HWND window, const char *dataname, void *data) |
13388 { | 13390 { |
13389 WindowData *blah = (WindowData *)WinQueryWindowPtr(window, QWP_USER); | 13391 WindowData *blah = (WindowData *)WinQueryWindowPtr(window, QWP_USER); |
13390 | 13392 |
13391 if(!blah) | 13393 if(!blah) |
13392 { | 13394 { |
13413 * Parameters: | 13415 * Parameters: |
13414 * window: Window handle of signal to be called back. | 13416 * window: Window handle of signal to be called back. |
13415 * dataname: A string pointer identifying which signal to be hooked. | 13417 * dataname: A string pointer identifying which signal to be hooked. |
13416 * data: User data to be passed to the handler function. | 13418 * data: User data to be passed to the handler function. |
13417 */ | 13419 */ |
13418 void * API dw_window_get_data(HWND window, char *dataname) | 13420 void * API dw_window_get_data(HWND window, const char *dataname) |
13419 { | 13421 { |
13420 WindowData *blah = (WindowData *)WinQueryWindowPtr(window, QWP_USER); | 13422 WindowData *blah = (WindowData *)WinQueryWindowPtr(window, QWP_USER); |
13421 | 13423 |
13422 if(blah && blah->root && dataname) | 13424 if(blah && blah->root && dataname) |
13423 { | 13425 { |
13498 * window: Window handle of signal to be called back. | 13500 * window: Window handle of signal to be called back. |
13499 * signame: A string pointer identifying which signal to be hooked. | 13501 * signame: A string pointer identifying which signal to be hooked. |
13500 * sigfunc: The pointer to the function to be used as the callback. | 13502 * sigfunc: The pointer to the function to be used as the callback. |
13501 * data: User data to be passed to the handler function. | 13503 * data: User data to be passed to the handler function. |
13502 */ | 13504 */ |
13503 void API dw_signal_connect(HWND window, char *signame, void *sigfunc, void *data) | 13505 void API dw_signal_connect(HWND window, const char *signame, void *sigfunc, void *data) |
13504 { | 13506 { |
13505 dw_signal_connect_data(window, signame, sigfunc, NULL, data); | 13507 dw_signal_connect_data(window, signame, sigfunc, NULL, data); |
13506 } | 13508 } |
13507 | 13509 |
13508 /* | 13510 /* |
13512 * signame: A string pointer identifying which signal to be hooked. | 13514 * signame: A string pointer identifying which signal to be hooked. |
13513 * sigfunc: The pointer to the function to be used as the callback. | 13515 * sigfunc: The pointer to the function to be used as the callback. |
13514 * discfunc: The pointer to the function called when this handler is removed. | 13516 * discfunc: The pointer to the function called when this handler is removed. |
13515 * data: User data to be passed to the handler function. | 13517 * data: User data to be passed to the handler function. |
13516 */ | 13518 */ |
13517 void API dw_signal_connect_data(HWND window, char *signame, void *sigfunc, void *discfunc, void *data) | 13519 void API dw_signal_connect_data(HWND window, const char *signame, void *sigfunc, void *discfunc, void *data) |
13518 { | 13520 { |
13519 ULONG message = 0, id = 0; | 13521 ULONG message = 0, id = 0; |
13520 | 13522 |
13521 if(window && signame && sigfunc) | 13523 if(window && signame && sigfunc) |
13522 { | 13524 { |
13548 /* | 13550 /* |
13549 * Removes callbacks for a given window with given name. | 13551 * Removes callbacks for a given window with given name. |
13550 * Parameters: | 13552 * Parameters: |
13551 * window: Window handle of callback to be removed. | 13553 * window: Window handle of callback to be removed. |
13552 */ | 13554 */ |
13553 void API dw_signal_disconnect_by_name(HWND window, char *signame) | 13555 void API dw_signal_disconnect_by_name(HWND window, const char *signame) |
13554 { | 13556 { |
13555 SignalHandler *prev = NULL, *tmp = Root; | 13557 SignalHandler *prev = NULL, *tmp = Root; |
13556 ULONG message; | 13558 ULONG message; |
13557 | 13559 |
13558 if(!window || !signame || (message = _findsigmessage(signame)) == 0) | 13560 if(!window || !signame || (message = _findsigmessage(signame)) == 0) |
13748 * utf8string: UTF-8 encoded source string. | 13750 * utf8string: UTF-8 encoded source string. |
13749 * Returns: | 13751 * Returns: |
13750 * Wide string that needs to be freed with dw_free() | 13752 * Wide string that needs to be freed with dw_free() |
13751 * or NULL on failure. | 13753 * or NULL on failure. |
13752 */ | 13754 */ |
13753 wchar_t * API dw_utf8_to_wchar(char *utf8string) | 13755 wchar_t * API dw_utf8_to_wchar(const char *utf8string) |
13754 { | 13756 { |
13755 #ifdef UNICODE | 13757 #ifdef UNICODE |
13756 return _UTF8toWide(utf8string); | 13758 return _UTF8toWide((char *)utf8string); |
13757 #else | 13759 #else |
13758 return NULL; | 13760 return NULL; |
13759 #endif | 13761 #endif |
13760 } | 13762 } |
13761 | 13763 |
13765 * wstring: Wide source string. | 13767 * wstring: Wide source string. |
13766 * Returns: | 13768 * Returns: |
13767 * UTF-8 encoded string that needs to be freed with dw_free() | 13769 * UTF-8 encoded string that needs to be freed with dw_free() |
13768 * or NULL on failure. | 13770 * or NULL on failure. |
13769 */ | 13771 */ |
13770 char * API dw_wchar_to_utf8(wchar_t *wstring) | 13772 char * API dw_wchar_to_utf8(const wchar_t *wstring) |
13771 { | 13773 { |
13772 #ifdef UNICODE | 13774 #ifdef UNICODE |
13773 return _WideToUTF8(wstring); | 13775 return _WideToUTF8((wchar_t *)wstring); |
13774 #else | 13776 #else |
13775 return NULL; | 13777 return NULL; |
13776 #endif | 13778 #endif |
13777 } | 13779 } |