comparison os2/dw.c @ 2162:a3f105431028

OS2: Switch to using DW_UNUSED() instead of old hack.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Wed, 30 Sep 2020 05:53:45 +0000
parents 663467f6eee4
children 4d2619f31ebd
comparison
equal deleted inserted replaced
2161:a1bf891d5990 2162:a3f105431028
276 HTREEITEM parent; 276 HTREEITEM parent;
277 277
278 } CNRITEM, *PCNRITEM; 278 } CNRITEM, *PCNRITEM;
279 279
280 280
281 int _null_key(HWND window, int key, void *data) 281 int _null_key(HWND DW_UNUSED(window), int DW_UNUSED(key), void * DW_UNUSED(data))
282 { 282 {
283 window = window; /* keep compiler happy */
284 key = key; /* keep compiler happy */
285 data = data; /* keep compiler happy */
286 return TRUE; 283 return TRUE;
287 } 284 }
288 285
289 /* Internal function to queue a window redraw */ 286 /* Internal function to queue a window redraw */
290 void _dw_redraw(HWND window, int skip) 287 void _dw_redraw(HWND window, int skip)
9188 * Gets the text an item in a tree window (widget). 9185 * Gets the text an item in a tree window (widget).
9189 * Parameters: 9186 * Parameters:
9190 * handle: Handle to the tree containing the item. 9187 * handle: Handle to the tree containing the item.
9191 * item: Handle of the item to be modified. 9188 * item: Handle of the item to be modified.
9192 */ 9189 */
9193 char * API dw_tree_get_title(HWND handle, HTREEITEM item) 9190 char * API dw_tree_get_title(HWND DW_UNUSED(handle), HTREEITEM item)
9194 { 9191 {
9195 PCNRITEM pci = (PCNRITEM)item; 9192 PCNRITEM pci = (PCNRITEM)item;
9196 9193
9197 handle = handle; /* keep compiler happy */
9198 if(pci && pci->rc.pszIcon) 9194 if(pci && pci->rc.pszIcon)
9199 return strdup((char *)pci->rc.pszIcon); 9195 return strdup((char *)pci->rc.pszIcon);
9200 return NULL; 9196 return NULL;
9201 } 9197 }
9202 9198
9204 * Gets the text an item in a tree window (widget). 9200 * Gets the text an item in a tree window (widget).
9205 * Parameters: 9201 * Parameters:
9206 * handle: Handle to the tree containing the item. 9202 * handle: Handle to the tree containing the item.
9207 * item: Handle of the item to be modified. 9203 * item: Handle of the item to be modified.
9208 */ 9204 */
9209 HTREEITEM API dw_tree_get_parent(HWND handle, HTREEITEM item) 9205 HTREEITEM API dw_tree_get_parent(HWND DW_UNUSED(handle), HTREEITEM item)
9210 { 9206 {
9211 PCNRITEM pci = (PCNRITEM)item; 9207 PCNRITEM pci = (PCNRITEM)item;
9212 9208
9213 handle = handle; /* keep compiler happy */
9214 if(pci) 9209 if(pci)
9215 return pci->parent; 9210 return pci->parent;
9216 return (HTREEITEM)0; 9211 return (HTREEITEM)0;
9217 } 9212 }
9218 9213
9221 * Parameters: 9216 * Parameters:
9222 * handle: Handle to the tree containing the item. 9217 * handle: Handle to the tree containing the item.
9223 * item: Handle of the item to be modified. 9218 * item: Handle of the item to be modified.
9224 * itemdata: User defined data to be associated with item. 9219 * itemdata: User defined data to be associated with item.
9225 */ 9220 */
9226 void API dw_tree_item_set_data(HWND handle, HTREEITEM item, void *itemdata) 9221 void API dw_tree_item_set_data(HWND DW_UNUSED(handle), HTREEITEM item, void *itemdata)
9227 { 9222 {
9228 PCNRITEM pci = (PCNRITEM)item; 9223 PCNRITEM pci = (PCNRITEM)item;
9229 9224
9230 handle = handle; /* keep compiler happy */
9231 if(!pci) 9225 if(!pci)
9232 return; 9226 return;
9233 9227
9234 pci->user = itemdata; 9228 pci->user = itemdata;
9235 } 9229 }
9238 * Gets the item data of a tree item. 9232 * Gets the item data of a tree item.
9239 * Parameters: 9233 * Parameters:
9240 * handle: Handle to the tree containing the item. 9234 * handle: Handle to the tree containing the item.
9241 * item: Handle of the item to be modified. 9235 * item: Handle of the item to be modified.
9242 */ 9236 */
9243 void * API dw_tree_item_get_data(HWND handle, HTREEITEM item) 9237 void * API dw_tree_item_get_data(HWND DW_UNUSED(handle), HTREEITEM item)
9244 { 9238 {
9245 PCNRITEM pci = (PCNRITEM)item; 9239 PCNRITEM pci = (PCNRITEM)item;
9246 9240
9247 handle = handle; /* keep compiler happy */
9248 if(!pci) 9241 if(!pci)
9249 return NULL; 9242 return NULL;
9250 return pci->user; 9243 return pci->user;
9251 } 9244 }
9252 9245
9997 * oddcolor: Odd row background color in DW_RGB format or a default color index. 9990 * oddcolor: Odd row background color in DW_RGB format or a default color index.
9998 * evencolor: Even row background color in DW_RGB format or a default color index. 9991 * evencolor: Even row background color in DW_RGB format or a default color index.
9999 * DW_RGB_TRANSPARENT will disable coloring rows. 9992 * DW_RGB_TRANSPARENT will disable coloring rows.
10000 * DW_CLR_DEFAULT will use the system default alternating row colors. 9993 * DW_CLR_DEFAULT will use the system default alternating row colors.
10001 */ 9994 */
10002 void API dw_container_set_stripe(HWND handle, unsigned long oddcolor, unsigned long evencolor) 9995 void API dw_container_set_stripe(HWND DW_UNUSED(handle), unsigned long DW_UNUSED(oddcolor), unsigned long DW_UNUSED(evencolor))
10003 { 9996 {
10004 /* Don't think this is possible on OS/2 */ 9997 /* Don't think this is possible on OS/2 */
10005 } 9998 }
10006 9999
10007 /* 10000 /*
10009 * Parameters: 10002 * Parameters:
10010 * handle: Handle to window (widget) of container. 10003 * handle: Handle to window (widget) of container.
10011 * column: Zero based column of width being set. 10004 * column: Zero based column of width being set.
10012 * width: Width of column in pixels. 10005 * width: Width of column in pixels.
10013 */ 10006 */
10014 void API dw_container_set_column_width(HWND handle, int column, int width) 10007 void API dw_container_set_column_width(HWND DW_UNUSED(handle), int DW_UNUSED(column), int DW_UNUSED(width))
10015 { 10008 {
10016 handle = handle; /* keep compiler happy */
10017 column = column; /* keep compiler happy */
10018 width = width; /* keep compiler happy */
10019 } 10009 }
10020 10010
10021 /* 10011 /*
10022 * Sets the title of a row in the container. 10012 * Sets the title of a row in the container.
10023 * Parameters: 10013 * Parameters:
10264 * handle: Handle to the window (widget) to be scrolled. 10254 * handle: Handle to the window (widget) to be scrolled.
10265 * direction: DW_SCROLL_UP, DW_SCROLL_DOWN, DW_SCROLL_TOP or 10255 * direction: DW_SCROLL_UP, DW_SCROLL_DOWN, DW_SCROLL_TOP or
10266 * DW_SCROLL_BOTTOM. (rows is ignored for last two) 10256 * DW_SCROLL_BOTTOM. (rows is ignored for last two)
10267 * rows: The number of rows to be scrolled. 10257 * rows: The number of rows to be scrolled.
10268 */ 10258 */
10269 void API dw_container_scroll(HWND handle, int direction, long rows) 10259 void API dw_container_scroll(HWND handle, int direction, long DW_UNUSED(rows))
10270 { 10260 {
10271 rows = rows; /* keep compiler happy */
10272 switch(direction) 10261 switch(direction)
10273 { 10262 {
10274 case DW_SCROLL_TOP: 10263 case DW_SCROLL_TOP:
10275 WinSendMsg(handle, CM_SCROLLWINDOW, MPFROMSHORT(CMA_VERTICAL), MPFROMLONG(-10000000)); 10264 WinSendMsg(handle, CM_SCROLLWINDOW, MPFROMSHORT(CMA_VERTICAL), MPFROMLONG(-10000000));
10276 break; 10265 break;
11595 * handle: Module handle returned by dw_module_load() 11584 * handle: Module handle returned by dw_module_load()
11596 */ 11585 */
11597 int API dw_module_close(HMOD handle) 11586 int API dw_module_close(HMOD handle)
11598 { 11587 {
11599 DosFreeModule(handle); 11588 DosFreeModule(handle);
11600 return 0; 11589 return DW_ERROR_NONE;
11601 } 11590 }
11602 11591
11603 /* 11592 /*
11604 * Returns the handle to an unnamed mutex semaphore. 11593 * Returns the handle to an unnamed mutex semaphore.
11605 */ 11594 */
12404 * or NULL if it fails or notifications are not supported by the system. 12393 * or NULL if it fails or notifications are not supported by the system.
12405 * Remarks: 12394 * Remarks:
12406 * This will create a system notification that will show in the notifaction panel 12395 * This will create a system notification that will show in the notifaction panel
12407 * on supported systems, which may be clicked to perform another task. 12396 * on supported systems, which may be clicked to perform another task.
12408 */ 12397 */
12409 HWND API dw_notification_new(const char *title, const char *imagepath, const char *description, ...) 12398 HWND API dw_notification_new(const char * DW_UNUSED(title), const char * DW_UNUSED(imagepath), const char * DW_UNUSED(description), ...)
12410 { 12399 {
12411 return 0; 12400 return 0;
12412 } 12401 }
12413 12402
12414 /* 12403 /*
12416 * Parameters: 12405 * Parameters:
12417 * notification: The handle to the notification returned by dw_notification_new(). 12406 * notification: The handle to the notification returned by dw_notification_new().
12418 * Returns: 12407 * Returns:
12419 * DW_ERROR_NONE on success, DW_ERROR_UNKNOWN on error or not supported. 12408 * DW_ERROR_NONE on success, DW_ERROR_UNKNOWN on error or not supported.
12420 */ 12409 */
12421 int API dw_notification_send(HWND notification) 12410 int API dw_notification_send(HWND DW_UNUSED(notification))
12422 { 12411 {
12423 return DW_ERROR_UNKNOWN; 12412 return DW_ERROR_UNKNOWN;
12424 } 12413 }
12425 12414
12426 /* 12415 /*
12777 * type: Either DW_EXEC_CON or DW_EXEC_GUI. 12766 * type: Either DW_EXEC_CON or DW_EXEC_GUI.
12778 * params: An array of pointers to string arguements. 12767 * params: An array of pointers to string arguements.
12779 * Returns: 12768 * Returns:
12780 * -1 on error. 12769 * -1 on error.
12781 */ 12770 */
12782 int API dw_exec(const char *program, int type, char **params) 12771 int API dw_exec(const char *program, int DW_UNUSED(type), char **params)
12783 { 12772 {
12784 type = type; /* keep compiler happy */
12785 #ifdef __EMX__ 12773 #ifdef __EMX__
12786 return spawnvp(P_NOWAIT, program, (char * const *)params); 12774 return spawnvp(P_NOWAIT, program, (char * const *)params);
12787 #else 12775 #else
12788 return spawnvp(P_NOWAIT, program, (const char * const *)params); 12776 return spawnvp(P_NOWAIT, program, (const char * const *)params);
12789 #endif 12777 #endif
12854 * Causes the embedded HTML widget to take action. 12842 * Causes the embedded HTML widget to take action.
12855 * Parameters: 12843 * Parameters:
12856 * handle: Handle to the window. 12844 * handle: Handle to the window.
12857 * action: One of the DW_HTML_* constants. 12845 * action: One of the DW_HTML_* constants.
12858 */ 12846 */
12859 void API dw_html_action(HWND handle, int action) 12847 void API dw_html_action(HWND DW_UNUSED(handle), int DW_UNUSED(action))
12860 { 12848 {
12861 handle = handle;
12862 action = action;
12863 } 12849 }
12864 12850
12865 /* 12851 /*
12866 * Render raw HTML code in the embedded HTML widget.. 12852 * Render raw HTML code in the embedded HTML widget..
12867 * Parameters: 12853 * Parameters:
12869 * string: String buffer containt HTML code to 12855 * string: String buffer containt HTML code to
12870 * be rendered. 12856 * be rendered.
12871 * Returns: 12857 * Returns:
12872 * 0 on success. 12858 * 0 on success.
12873 */ 12859 */
12874 int API dw_html_raw(HWND handle, const char *string) 12860 int API dw_html_raw(HWND DW_UNUSED(handle), const char * DW_UNUSED(string))
12875 { 12861 {
12876 handle = handle;
12877 string = string;
12878 return DW_ERROR_UNKNOWN; 12862 return DW_ERROR_UNKNOWN;
12879 } 12863 }
12880 12864
12881 /* 12865 /*
12882 * Render file or web page in the embedded HTML widget.. 12866 * Render file or web page in the embedded HTML widget..
12885 * url: Universal Resource Locator of the web or 12869 * url: Universal Resource Locator of the web or
12886 * file object to be rendered. 12870 * file object to be rendered.
12887 * Returns: 12871 * Returns:
12888 * 0 on success. 12872 * 0 on success.
12889 */ 12873 */
12890 int API dw_html_url(HWND handle, const char *url) 12874 int API dw_html_url(HWND DW_UNUSED(handle), const char * DW_UNUSED(url))
12891 { 12875 {
12892 handle = handle;
12893 url = url;
12894 return DW_ERROR_UNKNOWN; 12876 return DW_ERROR_UNKNOWN;
12895 } 12877 }
12896 12878
12897 /* 12879 /*
12898 * Executes the javascript contained in "script" in the HTML window. 12880 * Executes the javascript contained in "script" in the HTML window.
12902 * scriptdata: Data passed to the signal handler. 12884 * scriptdata: Data passed to the signal handler.
12903 * Notes: A DW_SIGNAL_HTML_RESULT event will be raised with scriptdata. 12885 * Notes: A DW_SIGNAL_HTML_RESULT event will be raised with scriptdata.
12904 * Returns: 12886 * Returns:
12905 * DW_ERROR_NONE (0) on success. 12887 * DW_ERROR_NONE (0) on success.
12906 */ 12888 */
12907 int dw_html_javascript_run(HWND handle, const char *script, void *scriptdata) 12889 int dw_html_javascript_run(HWND DW_UNUSED(handle), const char * DW_UNUSED(script), void * DW_UNUSED(scriptdata))
12908 { 12890 {
12909 handle = handle;
12910 script = script;
12911 scriptdata = scriptdata;
12912 return DW_ERROR_UNKNOWN; 12891 return DW_ERROR_UNKNOWN;
12913 } 12892 }
12914 12893
12915 /* 12894 /*
12916 * Create a new HTML window (widget) to be packed. 12895 * Create a new HTML window (widget) to be packed.
12917 * Not available under OS/2, eCS 12896 * Not available under OS/2, eCS
12918 * Parameters: 12897 * Parameters:
12919 * text: The default text to be in the entryfield widget. 12898 * text: The default text to be in the entryfield widget.
12920 * id: An ID to be used with dw_window_from_id() or 0L. 12899 * id: An ID to be used with dw_window_from_id() or 0L.
12921 */ 12900 */
12922 HWND API dw_html_new(unsigned long id) 12901 HWND API dw_html_new(unsigned long DW_UNUSED(id))
12923 { 12902 {
12924 id = id;
12925 dw_debug("HTML widget not available; OS/2 currently does not support it.\n"); 12903 dw_debug("HTML widget not available; OS/2 currently does not support it.\n");
12926 return 0; 12904 return 0;
12927 } 12905 }
12928 12906
12929 typedef struct _dwprint 12907 typedef struct _dwprint
13321 * it will create a unique ID in the form: org.dbsoft.dwindows.application 13299 * it will create a unique ID in the form: org.dbsoft.dwindows.application
13322 * or if the application name cannot be detected: org.dbsoft.dwindows.pid.# 13300 * or if the application name cannot be detected: org.dbsoft.dwindows.pid.#
13323 * The appname is only required on Windows. If NULL is passed the detected 13301 * The appname is only required on Windows. If NULL is passed the detected
13324 * application name will be used, but a prettier name may be desired. 13302 * application name will be used, but a prettier name may be desired.
13325 */ 13303 */
13326 int API dw_app_id_set(const char *appid, const char *appname) 13304 int API dw_app_id_set(const char * DW_UNUSED(appid), const char * DW_UNUSED(appname))
13327 { 13305 {
13328 return DW_ERROR_UNKNOWN; 13306 return DW_ERROR_UNKNOWN;
13329 } 13307 }
13330 13308
13331 /* 13309 /*