Mercurial > dwindows
comparison template/dw.c @ 2227:d9e1865fcba9
Fix template so when compiled and run it does not crash.
Add a few more missing function templates, including 2 internal ones.
Remove DW_UNUSED() from all functions so warnings are generated.
Eliminate compile warning by moving code into #if 0
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Sat, 26 Dec 2020 16:12:24 +0000 |
parents | 2de088fb5dd4 |
children | fad0821cb953 |
comparison
equal
deleted
inserted
replaced
2226:2de088fb5dd4 | 2227:d9e1865fcba9 |
---|---|
200 | 200 |
201 /* If the calculated size is valid... */ | 201 /* If the calculated size is valid... */ |
202 if(width > 0 && height > 0) | 202 if(width > 0 && height > 0) |
203 { | 203 { |
204 int pad = thisbox->items[z].pad; | 204 int pad = thisbox->items[z].pad; |
205 #if 0 | |
205 HWND handle = thisbox->items[z].hwnd; | 206 HWND handle = thisbox->items[z].hwnd; |
206 | 207 |
207 #if 0 | |
208 /* Here you put your platform specific placement widget placement code */ | 208 /* Here you put your platform specific placement widget placement code */ |
209 PlaceWidget(handle, currentx + pad, currenty + pad, width, height); | 209 PlaceWidget(handle, currentx + pad, currenty + pad, width, height); |
210 | 210 |
211 /* If any special handling needs to be done... like diving into | 211 /* If any special handling needs to be done... like diving into |
212 * controls that have sub-layouts... like notebooks or splitbars... | 212 * controls that have sub-layouts... like notebooks or splitbars... |
344 * it will create a unique ID in the form: org.dbsoft.dwindows.application | 344 * it will create a unique ID in the form: org.dbsoft.dwindows.application |
345 * or if the application name cannot be detected: org.dbsoft.dwindows.pid.# | 345 * or if the application name cannot be detected: org.dbsoft.dwindows.pid.# |
346 * The appname is only required on Windows. If NULL is passed the detected | 346 * The appname is only required on Windows. If NULL is passed the detected |
347 * application name will be used, but a prettier name may be desired. | 347 * application name will be used, but a prettier name may be desired. |
348 */ | 348 */ |
349 int API dw_app_id_set(const char * DW_UNUSED(appid), const char * DW_UNUSED(appname)) | 349 int API dw_app_id_set(const char *appid, const char *appname) |
350 { | 350 { |
351 return DW_ERROR_UNKNOWN; | 351 return DW_ERROR_UNKNOWN; |
352 } | 352 } |
353 | 353 |
354 /* | 354 /* |
568 { | 568 { |
569 Box *thisbox; | 569 Box *thisbox; |
570 int z, x = 0; | 570 int z, x = 0; |
571 Item *tmpitem, *thisitem; | 571 Item *tmpitem, *thisitem; |
572 | 572 |
573 /* Sanity checks */ | |
574 if(!box || box == item) | |
575 return; | |
576 | |
573 thisbox = _dw_window_pointer_get(box); | 577 thisbox = _dw_window_pointer_get(box); |
574 thisitem = thisbox->items; | 578 thisitem = thisbox->items; |
575 | 579 |
576 /* Do some sanity bounds checking */ | 580 /* Do some sanity bounds checking */ |
577 if(index < 0) | 581 if(index < 0) |
1204 * bytes: A pointer to a variable to return the total bytes. | 1208 * bytes: A pointer to a variable to return the total bytes. |
1205 * lines: A pointer to a variable to return the number of lines. | 1209 * lines: A pointer to a variable to return the number of lines. |
1206 */ | 1210 */ |
1207 void API dw_mle_get_size(HWND handle, unsigned long *bytes, unsigned long *lines) | 1211 void API dw_mle_get_size(HWND handle, unsigned long *bytes, unsigned long *lines) |
1208 { | 1212 { |
1209 *bytes = 0; | 1213 if(bytes) |
1210 *lines = 0; | 1214 *bytes = 0; |
1215 if(lines) | |
1216 *lines = 0; | |
1211 } | 1217 } |
1212 | 1218 |
1213 /* | 1219 /* |
1214 * Deletes text from an MLE box. | 1220 * Deletes text from an MLE box. |
1215 * Parameters: | 1221 * Parameters: |
1952 void API dw_container_cursor(HWND handle, const char *text) | 1958 void API dw_container_cursor(HWND handle, const char *text) |
1953 { | 1959 { |
1954 } | 1960 } |
1955 | 1961 |
1956 /* | 1962 /* |
1963 * Cursors the item with the data speficied, and scrolls to that item. | |
1964 * Parameters: | |
1965 * handle: Handle to the window (widget) to be queried. | |
1966 * data: Data usually returned by dw_container_query(). | |
1967 */ | |
1968 void API dw_container_cursor_by_data(HWND handle, void *data) | |
1969 { | |
1970 } | |
1971 | |
1972 /* | |
1957 * Deletes the item with the text speficied. | 1973 * Deletes the item with the text speficied. |
1958 * Parameters: | 1974 * Parameters: |
1959 * handle: Handle to the window (widget). | 1975 * handle: Handle to the window (widget). |
1960 * text: Text usually returned by dw_container_query(). | 1976 * text: Text usually returned by dw_container_query(). |
1961 */ | 1977 */ |
1962 void API dw_container_delete_row(HWND handle, const char *text) | 1978 void API dw_container_delete_row(HWND handle, const char *text) |
1979 { | |
1980 } | |
1981 | |
1982 /* | |
1983 * Deletes the item with the data speficied. | |
1984 * Parameters: | |
1985 * handle: Handle to the window (widget). | |
1986 * data: Data usually returned by dw_container_query(). | |
1987 */ | |
1988 void API dw_container_delete_row_by_data(HWND handle, void *data) | |
1963 { | 1989 { |
1964 } | 1990 } |
1965 | 1991 |
1966 /* | 1992 /* |
1967 * Optimizes the column widths so that all data is visible. | 1993 * Optimizes the column widths so that all data is visible. |
3098 * signame: A string pointer identifying which signal to be hooked. | 3124 * signame: A string pointer identifying which signal to be hooked. |
3099 * sigfunc: The pointer to the function to be used as the callback. | 3125 * sigfunc: The pointer to the function to be used as the callback. |
3100 * data: User data to be passed to the handler function. | 3126 * data: User data to be passed to the handler function. |
3101 */ | 3127 */ |
3102 void API dw_signal_connect(HWND window, const char *signame, void *sigfunc, void *data) | 3128 void API dw_signal_connect(HWND window, const char *signame, void *sigfunc, void *data) |
3129 { | |
3130 dw_signal_connect_data(window, signame, sigfunc, NULL, data); | |
3131 } | |
3132 | |
3133 /* | |
3134 * Add a callback to a window event with a closure callback. | |
3135 * Parameters: | |
3136 * window: Window handle of signal to be called back. | |
3137 * signame: A string pointer identifying which signal to be hooked. | |
3138 * sigfunc: The pointer to the function to be used as the callback. | |
3139 * discfunc: The pointer to the function called when this handler is removed. | |
3140 * data: User data to be passed to the handler function. | |
3141 */ | |
3142 void API dw_signal_connect_data(HWND window, const char *signame, void *sigfunc, void *discfunc, void *data) | |
3103 { | 3143 { |
3104 } | 3144 } |
3105 | 3145 |
3106 /* | 3146 /* |
3107 * Removes callbacks for a given window with given name. | 3147 * Removes callbacks for a given window with given name. |
3437 | 3477 |
3438 return rc; | 3478 return rc; |
3439 } | 3479 } |
3440 | 3480 |
3441 /* | 3481 /* |
3482 * Generally an internal function called from a newly created | |
3483 * thread to setup the Dynamic Windows environment for the thread. | |
3484 * However it is exported so language bindings can call it when | |
3485 * they create threads that require access to Dynamic Windows. | |
3486 */ | |
3487 void API _dw_init_thread(void) | |
3488 { | |
3489 } | |
3490 | |
3491 /* | |
3492 * Generally an internal function called from a terminating | |
3493 * thread to cleanup the Dynamic Windows environment for the thread. | |
3494 * However it is exported so language bindings can call it when | |
3495 * they exit threads that require access to Dynamic Windows. | |
3496 */ | |
3497 void API _dw_deinit_thread(void) | |
3498 { | |
3499 } | |
3500 | |
3501 /* | |
3442 * Creates a new thread with a starting point of func. | 3502 * Creates a new thread with a starting point of func. |
3443 * Parameters: | 3503 * Parameters: |
3444 * func: Function which will be run in the new thread. | 3504 * func: Function which will be run in the new thread. |
3445 * data: Parameter(s) passed to the function. | 3505 * data: Parameter(s) passed to the function. |
3446 * stack: Stack size of new thread (OS/2 and Windows only). | 3506 * stack: Stack size of new thread (OS/2 and Windows only). |
3463 * Returns the current thread's ID. | 3523 * Returns the current thread's ID. |
3464 */ | 3524 */ |
3465 DWTID API dw_thread_id(void) | 3525 DWTID API dw_thread_id(void) |
3466 { | 3526 { |
3467 return (DWTID)0; | 3527 return (DWTID)0; |
3528 } | |
3529 | |
3530 /* | |
3531 * Cleanly terminates a DW session, should be signal handler safe. | |
3532 */ | |
3533 void API dw_shutdown(void) | |
3534 { | |
3468 } | 3535 } |
3469 | 3536 |
3470 /* | 3537 /* |
3471 * Execute and external program in a seperate session. | 3538 * Execute and external program in a seperate session. |
3472 * Parameters: | 3539 * Parameters: |
3545 * or NULL if it fails or notifications are not supported by the system. | 3612 * or NULL if it fails or notifications are not supported by the system. |
3546 * Remarks: | 3613 * Remarks: |
3547 * This will create a system notification that will show in the notifaction panel | 3614 * This will create a system notification that will show in the notifaction panel |
3548 * on supported systems, which may be clicked to perform another task. | 3615 * on supported systems, which may be clicked to perform another task. |
3549 */ | 3616 */ |
3550 HWND API dw_notification_new(const char * DW_UNUSED(title), const char * DW_UNUSED(imagepath), const char * DW_UNUSED(description), ...) | 3617 HWND API dw_notification_new(const char *title, const char *imagepath, const char *description, ...) |
3551 { | 3618 { |
3552 return 0; | 3619 return 0; |
3553 } | 3620 } |
3554 | 3621 |
3555 /* | 3622 /* |
3557 * Parameters: | 3624 * Parameters: |
3558 * notification: The handle to the notification returned by dw_notification_new(). | 3625 * notification: The handle to the notification returned by dw_notification_new(). |
3559 * Returns: | 3626 * Returns: |
3560 * DW_ERROR_NONE on success, DW_ERROR_UNKNOWN on error or not supported. | 3627 * DW_ERROR_NONE on success, DW_ERROR_UNKNOWN on error or not supported. |
3561 */ | 3628 */ |
3562 int API dw_notification_send(HWND DW_UNUSED(notification)) | 3629 int API dw_notification_send(HWND notification) |
3563 { | 3630 { |
3564 return DW_ERROR_UNKNOWN; | 3631 return DW_ERROR_UNKNOWN; |
3565 } | 3632 } |
3566 | 3633 |
3567 /* | 3634 /* |