Mercurial > dwindows
changeset 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 | 2407c8b46143 |
files | template/dw.c |
diffstat | 1 files changed, 73 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/template/dw.c Sat Dec 26 05:24:00 2020 +0000 +++ b/template/dw.c Sat Dec 26 16:12:24 2020 +0000 @@ -202,9 +202,9 @@ if(width > 0 && height > 0) { int pad = thisbox->items[z].pad; +#if 0 HWND handle = thisbox->items[z].hwnd; -#if 0 /* Here you put your platform specific placement widget placement code */ PlaceWidget(handle, currentx + pad, currenty + pad, width, height); @@ -346,7 +346,7 @@ * The appname is only required on Windows. If NULL is passed the detected * application name will be used, but a prettier name may be desired. */ -int API dw_app_id_set(const char * DW_UNUSED(appid), const char * DW_UNUSED(appname)) +int API dw_app_id_set(const char *appid, const char *appname) { return DW_ERROR_UNKNOWN; } @@ -570,6 +570,10 @@ int z, x = 0; Item *tmpitem, *thisitem; + /* Sanity checks */ + if(!box || box == item) + return; + thisbox = _dw_window_pointer_get(box); thisitem = thisbox->items; @@ -1206,8 +1210,10 @@ */ void API dw_mle_get_size(HWND handle, unsigned long *bytes, unsigned long *lines) { - *bytes = 0; - *lines = 0; + if(bytes) + *bytes = 0; + if(lines) + *lines = 0; } /* @@ -1954,6 +1960,16 @@ } /* + * Cursors the item with the data speficied, and scrolls to that item. + * Parameters: + * handle: Handle to the window (widget) to be queried. + * data: Data usually returned by dw_container_query(). + */ +void API dw_container_cursor_by_data(HWND handle, void *data) +{ +} + +/* * Deletes the item with the text speficied. * Parameters: * handle: Handle to the window (widget). @@ -1964,6 +1980,16 @@ } /* + * Deletes the item with the data speficied. + * Parameters: + * handle: Handle to the window (widget). + * data: Data usually returned by dw_container_query(). + */ +void API dw_container_delete_row_by_data(HWND handle, void *data) +{ +} + +/* * Optimizes the column widths so that all data is visible. * Parameters: * handle: Handle to the window (widget) to be optimized. @@ -3101,6 +3127,20 @@ */ void API dw_signal_connect(HWND window, const char *signame, void *sigfunc, void *data) { + dw_signal_connect_data(window, signame, sigfunc, NULL, data); +} + +/* + * Add a callback to a window event with a closure callback. + * Parameters: + * window: Window handle of signal to be called back. + * signame: A string pointer identifying which signal to be hooked. + * sigfunc: The pointer to the function to be used as the callback. + * discfunc: The pointer to the function called when this handler is removed. + * data: User data to be passed to the handler function. + */ +void API dw_signal_connect_data(HWND window, const char *signame, void *sigfunc, void *discfunc, void *data) +{ } /* @@ -3439,6 +3479,26 @@ } /* + * Generally an internal function called from a newly created + * thread to setup the Dynamic Windows environment for the thread. + * However it is exported so language bindings can call it when + * they create threads that require access to Dynamic Windows. + */ +void API _dw_init_thread(void) +{ +} + +/* + * Generally an internal function called from a terminating + * thread to cleanup the Dynamic Windows environment for the thread. + * However it is exported so language bindings can call it when + * they exit threads that require access to Dynamic Windows. + */ +void API _dw_deinit_thread(void) +{ +} + +/* * Creates a new thread with a starting point of func. * Parameters: * func: Function which will be run in the new thread. @@ -3468,6 +3528,13 @@ } /* + * Cleanly terminates a DW session, should be signal handler safe. + */ +void API dw_shutdown(void) +{ +} + +/* * Execute and external program in a seperate session. * Parameters: * program: Program name with optional path. @@ -3547,7 +3614,7 @@ * This will create a system notification that will show in the notifaction panel * on supported systems, which may be clicked to perform another task. */ -HWND API dw_notification_new(const char * DW_UNUSED(title), const char * DW_UNUSED(imagepath), const char * DW_UNUSED(description), ...) +HWND API dw_notification_new(const char *title, const char *imagepath, const char *description, ...) { return 0; } @@ -3559,7 +3626,7 @@ * Returns: * DW_ERROR_NONE on success, DW_ERROR_UNKNOWN on error or not supported. */ -int API dw_notification_send(HWND DW_UNUSED(notification)) +int API dw_notification_send(HWND notification) { return DW_ERROR_UNKNOWN; }