comparison win/dw.c @ 510:710f82598210

Change function names to be inline with Mark Hessling's Rexx/DW.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Tue, 09 Mar 2004 03:27:39 +0000
parents a9cfbc5ad01e
children 80dbd5a1f403
comparison
equal deleted inserted replaced
509:a9cfbc5ad01e 510:710f82598210
1724 { 1724 {
1725 NMHDR FAR *tem=(NMHDR FAR *)mp2; 1725 NMHDR FAR *tem=(NMHDR FAR *)mp2;
1726 if(tmp->window == tem->hwndFrom && tem->code == tmp->message) 1726 if(tmp->window == tem->hwndFrom && tem->code == tmp->message)
1727 { 1727 {
1728 int (*switchpagefunc)(HWND, unsigned long, void *) = tmp->signalfunction; 1728 int (*switchpagefunc)(HWND, unsigned long, void *) = tmp->signalfunction;
1729 unsigned long num=dw_notebook_page_query(tem->hwndFrom); 1729 unsigned long num=dw_notebook_page_get(tem->hwndFrom);
1730 result = switchpagefunc(tem->hwndFrom, num, tmp->data); 1730 result = switchpagefunc(tem->hwndFrom, num, tmp->data);
1731 tmp = NULL; 1731 tmp = NULL;
1732 } 1732 }
1733 } 1733 }
1734 else if(tmp->message == LVN_COLUMNCLICK) 1734 else if(tmp->message == LVN_COLUMNCLICK)
3743 * Changes the appearance of the mouse pointer. 3743 * Changes the appearance of the mouse pointer.
3744 * Parameters: 3744 * Parameters:
3745 * handle: Handle to widget for which to change. 3745 * handle: Handle to widget for which to change.
3746 * cursortype: ID of the pointer you want. 3746 * cursortype: ID of the pointer you want.
3747 */ 3747 */
3748 void API dw_window_pointer(HWND handle, int pointertype) 3748 void API dw_window_set_pointer(HWND handle, int pointertype)
3749 { 3749 {
3750 /* 3750 /*
3751 if(pointertype == DW_POINTER_ARROW) 3751 if(pointertype == DW_POINTER_ARROW)
3752 SetClassLong( handle, GCL_HCURSOR, LoadCursor( NULL, IDC_ARROW)); 3752 SetClassLong( handle, GCL_HCURSOR, LoadCursor( NULL, IDC_ARROW));
3753 else if(pointertype == DW_POINTER_CLOCK) 3753 else if(pointertype == DW_POINTER_CLOCK)
5009 * Parameters: 5009 * Parameters:
5010 * handle: Window (widget) handle. 5010 * handle: Window (widget) handle.
5011 * width: New width in pixels. 5011 * width: New width in pixels.
5012 * height: New height in pixels. 5012 * height: New height in pixels.
5013 */ 5013 */
5014 void API dw_window_set_usize(HWND handle, ULONG width, ULONG height) 5014 void API dw_window_set_size(HWND handle, ULONG width, ULONG height)
5015 { 5015 {
5016 SetWindowPos(handle, (HWND)NULL, 0, 0, width, height, SWP_SHOWWINDOW | SWP_NOZORDER | SWP_NOMOVE); 5016 SetWindowPos(handle, (HWND)NULL, 0, 0, width, height, SWP_SHOWWINDOW | SWP_NOZORDER | SWP_NOMOVE);
5017 } 5017 }
5018 5018
5019 /* 5019 /*
5277 dw_box_pack_start(tmpbox, page, 0, 0, TRUE, TRUE, 0); 5277 dw_box_pack_start(tmpbox, page, 0, 0, TRUE, TRUE, 0);
5278 SubclassWindow(tmpbox, _wndproc); 5278 SubclassWindow(tmpbox, _wndproc);
5279 if(array[pageid]->hwnd) 5279 if(array[pageid]->hwnd)
5280 dw_window_destroy(array[pageid]->hwnd); 5280 dw_window_destroy(array[pageid]->hwnd);
5281 array[pageid]->hwnd = tmpbox; 5281 array[pageid]->hwnd = tmpbox;
5282 if(pageidx == dw_notebook_page_query(handle)) 5282 if(pageidx == dw_notebook_page_get(handle))
5283 { 5283 {
5284 SetParent(tmpbox, handle); 5284 SetParent(tmpbox, handle);
5285 _resize_notebook_page(handle, pageid); 5285 _resize_notebook_page(handle, pageid);
5286 } 5286 }
5287 } 5287 }
5339 /* 5339 /*
5340 * Queries the currently visible page ID. 5340 * Queries the currently visible page ID.
5341 * Parameters: 5341 * Parameters:
5342 * handle: Handle to the notebook widget. 5342 * handle: Handle to the notebook widget.
5343 */ 5343 */
5344 unsigned long API dw_notebook_page_query(HWND handle) 5344 unsigned long API dw_notebook_page_get(HWND handle)
5345 { 5345 {
5346 NotebookPage **array = (NotebookPage **)dw_window_get_data(handle, "_dw_array"); 5346 NotebookPage **array = (NotebookPage **)dw_window_get_data(handle, "_dw_array");
5347 int physid = TabCtrl_GetCurSel(handle); 5347 int physid = TabCtrl_GetCurSel(handle);
5348 5348
5349 if(physid > -1 && physid < 256 && array && array[physid]) 5349 if(physid > -1 && physid < 256 && array && array[physid])
5466 * handle: Handle to the listbox to be queried. 5466 * handle: Handle to the listbox to be queried.
5467 * index: Index into the list to be queried. 5467 * index: Index into the list to be queried.
5468 * buffer: Buffer where text will be copied. 5468 * buffer: Buffer where text will be copied.
5469 * length: Length of the buffer (including NULL). 5469 * length: Length of the buffer (including NULL).
5470 */ 5470 */
5471 void API dw_listbox_query_text(HWND handle, unsigned int index, char *buffer, unsigned int length) 5471 void API dw_listbox_get_text(HWND handle, unsigned int index, char *buffer, unsigned int length)
5472 { 5472 {
5473 char tmpbuf[100]; 5473 char tmpbuf[100];
5474 int len; 5474 int len;
5475 5475
5476 if(!buffer || !length) 5476 if(!buffer || !length)
5716 * Parameters: 5716 * Parameters:
5717 * handle: Handle to the MLE to be queried. 5717 * handle: Handle to the MLE to be queried.
5718 * bytes: A pointer to a variable to return the total bytes. 5718 * bytes: A pointer to a variable to return the total bytes.
5719 * lines: A pointer to a variable to return the number of lines. 5719 * lines: A pointer to a variable to return the number of lines.
5720 */ 5720 */
5721 void API dw_mle_query(HWND handle, unsigned long *bytes, unsigned long *lines) 5721 void API dw_mle_get_size(HWND handle, unsigned long *bytes, unsigned long *lines)
5722 { 5722 {
5723 if(bytes) 5723 if(bytes)
5724 *bytes = GetWindowTextLength(handle); 5724 *bytes = GetWindowTextLength(handle);
5725 if(lines) 5725 if(lines)
5726 *lines = (unsigned long)SendMessage(handle, EM_GETLINECOUNT, 0, 0); 5726 *lines = (unsigned long)SendMessage(handle, EM_GETLINECOUNT, 0, 0);
5764 * Sets the visible line of an MLE box. 5764 * Sets the visible line of an MLE box.
5765 * Parameters: 5765 * Parameters:
5766 * handle: Handle to the MLE. 5766 * handle: Handle to the MLE.
5767 * line: Line to be visible. 5767 * line: Line to be visible.
5768 */ 5768 */
5769 void API dw_mle_set_visible(HWND handle, int line) 5769 void API dw_mle_set_cursor_visible(HWND handle, int line)
5770 { 5770 {
5771 int point = (int)SendMessage(handle, EM_LINEINDEX, (WPARAM)line, 0); 5771 int point = (int)SendMessage(handle, EM_LINEINDEX, (WPARAM)line, 0);
5772 dw_mle_set(handle, point); 5772 dw_mle_set_cursor(handle, point);
5773 } 5773 }
5774 5774
5775 /* 5775 /*
5776 * Sets the editablity of an MLE box. 5776 * Sets the editablity of an MLE box.
5777 * Parameters: 5777 * Parameters:
5778 * handle: Handle to the MLE. 5778 * handle: Handle to the MLE.
5779 * state: TRUE if it can be edited, FALSE for readonly. 5779 * state: TRUE if it can be edited, FALSE for readonly.
5780 */ 5780 */
5781 void API dw_mle_set_editable(HWND handle, int state) 5781 void API dw_mle_set_cursor_editable(HWND handle, int state)
5782 { 5782 {
5783 SendMessage(handle, EM_SETREADONLY, (WPARAM)(state ? FALSE : TRUE), 0); 5783 SendMessage(handle, EM_SETREADONLY, (WPARAM)(state ? FALSE : TRUE), 0);
5784 } 5784 }
5785 5785
5786 /* 5786 /*
5787 * Sets the word wrap state of an MLE box. 5787 * Sets the word wrap state of an MLE box.
5788 * Parameters: 5788 * Parameters:
5789 * handle: Handle to the MLE. 5789 * handle: Handle to the MLE.
5790 * state: TRUE if it wraps, FALSE if it doesn't. 5790 * state: TRUE if it wraps, FALSE if it doesn't.
5791 */ 5791 */
5792 void API dw_mle_set_word_wrap(HWND handle, int state) 5792 void API dw_mle_set_cursor_word_wrap(HWND handle, int state)
5793 { 5793 {
5794 /* If ES_AUTOHSCROLL is not set and there is not 5794 /* If ES_AUTOHSCROLL is not set and there is not
5795 * horizontal scrollbar it word wraps. 5795 * horizontal scrollbar it word wraps.
5796 */ 5796 */
5797 if(state) 5797 if(state)
5804 * Sets the current cursor position of an MLE box. 5804 * Sets the current cursor position of an MLE box.
5805 * Parameters: 5805 * Parameters:
5806 * handle: Handle to the MLE to be positioned. 5806 * handle: Handle to the MLE to be positioned.
5807 * point: Point to position cursor. 5807 * point: Point to position cursor.
5808 */ 5808 */
5809 void API dw_mle_set(HWND handle, int point) 5809 void API dw_mle_set_cursor(HWND handle, int point)
5810 { 5810 {
5811 SendMessage(handle, EM_SETSEL, 0, MAKELONG(point,point)); 5811 SendMessage(handle, EM_SETSEL, 0, MAKELONG(point,point));
5812 SendMessage(handle, EM_SCROLLCARET, 0, 0); 5812 SendMessage(handle, EM_SCROLLCARET, 0, 0);
5813 } 5813 }
5814 5814
5879 /* 5879 /*
5880 * Returns the range of the percent bar. 5880 * Returns the range of the percent bar.
5881 * Parameters: 5881 * Parameters:
5882 * handle: Handle to the percent bar to be queried. 5882 * handle: Handle to the percent bar to be queried.
5883 */ 5883 */
5884 unsigned int API dw_percent_query_range(HWND handle) 5884 unsigned int API dw_percent_get_range(HWND handle)
5885 { 5885 {
5886 return (unsigned int)SendMessage(handle, PBM_GETRANGE, (WPARAM)FALSE, 0); 5886 return (unsigned int)SendMessage(handle, PBM_GETRANGE, (WPARAM)FALSE, 0);
5887 } 5887 }
5888 5888
5889 /* 5889 /*
5900 /* 5900 /*
5901 * Returns the position of the slider. 5901 * Returns the position of the slider.
5902 * Parameters: 5902 * Parameters:
5903 * handle: Handle to the slider to be queried. 5903 * handle: Handle to the slider to be queried.
5904 */ 5904 */
5905 unsigned int API dw_slider_query_pos(HWND handle) 5905 unsigned int API dw_slider_get_pos(HWND handle)
5906 { 5906 {
5907 int max = (int)SendMessage(handle, TBM_GETRANGEMAX, 0, 0); 5907 int max = (int)SendMessage(handle, TBM_GETRANGEMAX, 0, 0);
5908 ULONG currentstyle = GetWindowLong(handle, GWL_STYLE); 5908 ULONG currentstyle = GetWindowLong(handle, GWL_STYLE);
5909 5909
5910 if(currentstyle & TBS_VERT) 5910 if(currentstyle & TBS_VERT)
5932 /* 5932 /*
5933 * Returns the position of the scrollbar. 5933 * Returns the position of the scrollbar.
5934 * Parameters: 5934 * Parameters:
5935 * handle: Handle to the scrollbar to be queried. 5935 * handle: Handle to the scrollbar to be queried.
5936 */ 5936 */
5937 unsigned int API dw_scrollbar_query_pos(HWND handle) 5937 unsigned int API dw_scrollbar_get_pos(HWND handle)
5938 { 5938 {
5939 return (unsigned int)SendMessage(handle, SBM_GETPOS, 0, 0); 5939 return (unsigned int)SendMessage(handle, SBM_GETPOS, 0, 0);
5940 } 5940 }
5941 5941
5942 /* 5942 /*
6022 /* 6022 /*
6023 * Returns the current value of the spinbutton. 6023 * Returns the current value of the spinbutton.
6024 * Parameters: 6024 * Parameters:
6025 * handle: Handle to the spinbutton to be queried. 6025 * handle: Handle to the spinbutton to be queried.
6026 */ 6026 */
6027 long API dw_spinbutton_query(HWND handle) 6027 long API dw_spinbutton_get_pos(HWND handle)
6028 { 6028 {
6029 if(IS_IE5PLUS) 6029 if(IS_IE5PLUS)
6030 return (long)SendMessage(handle, UDM_GETPOS32, 0, 0); 6030 return (long)SendMessage(handle, UDM_GETPOS32, 0, 0);
6031 else 6031 else
6032 return (long)SendMessage(handle, UDM_GETPOS, 0, 0); 6032 return (long)SendMessage(handle, UDM_GETPOS, 0, 0);
6035 /* 6035 /*
6036 * Returns the state of the checkbox. 6036 * Returns the state of the checkbox.
6037 * Parameters: 6037 * Parameters:
6038 * handle: Handle to the checkbox to be queried. 6038 * handle: Handle to the checkbox to be queried.
6039 */ 6039 */
6040 int API dw_checkbox_query(HWND handle) 6040 int API dw_checkbox_get(HWND handle)
6041 { 6041 {
6042 if(SendMessage(handle, BM_GETCHECK, 0, 0) == BST_CHECKED) 6042 if(SendMessage(handle, BM_GETCHECK, 0, 0) == BST_CHECKED)
6043 return (in_checkbox_handler ? FALSE : TRUE); 6043 return (in_checkbox_handler ? FALSE : TRUE);
6044 return (in_checkbox_handler ? TRUE : FALSE); 6044 return (in_checkbox_handler ? TRUE : FALSE);
6045 } 6045 }
6155 * handle: Handle to the tree containing the item. 6155 * handle: Handle to the tree containing the item.
6156 * item: Handle of the item to be modified. 6156 * item: Handle of the item to be modified.
6157 * title: The text title of the entry. 6157 * title: The text title of the entry.
6158 * icon: Handle to coresponding icon. 6158 * icon: Handle to coresponding icon.
6159 */ 6159 */
6160 void API dw_tree_set(HWND handle, HTREEITEM item, char *title, unsigned long icon) 6160 void API dw_tree_item_change(HWND handle, HTREEITEM item, char *title, unsigned long icon)
6161 { 6161 {
6162 TVITEM tvi; 6162 TVITEM tvi;
6163 void **ptrs; 6163 void **ptrs;
6164 6164
6165 tvi.mask = TVIF_HANDLE; 6165 tvi.mask = TVIF_HANDLE;
6186 * Parameters: 6186 * Parameters:
6187 * handle: Handle to the tree containing the item. 6187 * handle: Handle to the tree containing the item.
6188 * item: Handle of the item to be modified. 6188 * item: Handle of the item to be modified.
6189 * itemdata: User defined data to be associated with item. 6189 * itemdata: User defined data to be associated with item.
6190 */ 6190 */
6191 void API dw_tree_set_data(HWND handle, HTREEITEM item, void *itemdata) 6191 void API dw_tree_item_change_data(HWND handle, HTREEITEM item, void *itemdata)
6192 { 6192 {
6193 TVITEM tvi; 6193 TVITEM tvi;
6194 void **ptrs; 6194 void **ptrs;
6195 6195
6196 tvi.mask = TVIF_HANDLE; 6196 tvi.mask = TVIF_HANDLE;
6207 * Gets the item data of a tree item. 6207 * Gets the item data of a tree item.
6208 * Parameters: 6208 * Parameters:
6209 * handle: Handle to the tree containing the item. 6209 * handle: Handle to the tree containing the item.
6210 * item: Handle of the item to be modified. 6210 * item: Handle of the item to be modified.
6211 */ 6211 */
6212 void * API dw_tree_get_data(HWND handle, HTREEITEM item) 6212 void * API dw_tree_item_get_data(HWND handle, HTREEITEM item)
6213 { 6213 {
6214 TVITEM tvi; 6214 TVITEM tvi;
6215 void **ptrs; 6215 void **ptrs;
6216 6216
6217 tvi.mask = TVIF_HANDLE; 6217 tvi.mask = TVIF_HANDLE;
6266 TreeView_SelectItem(handle, item); 6266 TreeView_SelectItem(handle, item);
6267 dw_window_set_data(handle, "_dw_select_item", (void *)0); 6267 dw_window_set_data(handle, "_dw_select_item", (void *)0);
6268 } 6268 }
6269 6269
6270 /* Delete all tree subitems */ 6270 /* Delete all tree subitems */
6271 void _dw_tree_delete_recursive(HWND handle, HTREEITEM node) 6271 void _dw_tree_item_delete_recursive(HWND handle, HTREEITEM node)
6272 { 6272 {
6273 HTREEITEM hti; 6273 HTREEITEM hti;
6274 6274
6275 hti = TreeView_GetChild(handle, node); 6275 hti = TreeView_GetChild(handle, node);
6276 6276
6277 while(hti) 6277 while(hti)
6278 { 6278 {
6279 HTREEITEM lastitem = hti; 6279 HTREEITEM lastitem = hti;
6280 6280
6281 hti = TreeView_GetNextSibling(handle, hti); 6281 hti = TreeView_GetNextSibling(handle, hti);
6282 dw_tree_delete(handle, lastitem); 6282 dw_tree_item_delete(handle, lastitem);
6283 } 6283 }
6284 } 6284 }
6285 6285
6286 /* 6286 /*
6287 * Removes all nodes from a tree. 6287 * Removes all nodes from a tree.
6295 dw_window_set_data(handle, "_dw_select_item", (void *)1); 6295 dw_window_set_data(handle, "_dw_select_item", (void *)1);
6296 while(hti) 6296 while(hti)
6297 { 6297 {
6298 HTREEITEM lastitem = hti; 6298 HTREEITEM lastitem = hti;
6299 6299
6300 _dw_tree_delete_recursive(handle, hti); 6300 _dw_tree_item_delete_recursive(handle, hti);
6301 hti = TreeView_GetNextSibling(handle, hti); 6301 hti = TreeView_GetNextSibling(handle, hti);
6302 dw_tree_delete(handle, lastitem); 6302 dw_tree_item_delete(handle, lastitem);
6303 } 6303 }
6304 dw_window_set_data(handle, "_dw_select_item", (void *)0); 6304 dw_window_set_data(handle, "_dw_select_item", (void *)0);
6305 } 6305 }
6306 6306
6307 /* 6307 /*
6308 * Expands a node on a tree. 6308 * Expands a node on a tree.
6309 * Parameters: 6309 * Parameters:
6310 * handle: Handle to the tree window (widget). 6310 * handle: Handle to the tree window (widget).
6311 * item: Handle to node to be expanded. 6311 * item: Handle to node to be expanded.
6312 */ 6312 */
6313 void API dw_tree_expand(HWND handle, HTREEITEM item) 6313 void API dw_tree_item_expand(HWND handle, HTREEITEM item)
6314 { 6314 {
6315 TreeView_Expand(handle, item, TVE_EXPAND); 6315 TreeView_Expand(handle, item, TVE_EXPAND);
6316 } 6316 }
6317 6317
6318 /* 6318 /*
6319 * Collapses a node on a tree. 6319 * Collapses a node on a tree.
6320 * Parameters: 6320 * Parameters:
6321 * handle: Handle to the tree window (widget). 6321 * handle: Handle to the tree window (widget).
6322 * item: Handle to node to be collapsed. 6322 * item: Handle to node to be collapsed.
6323 */ 6323 */
6324 void API dw_tree_collapse(HWND handle, HTREEITEM item) 6324 void API dw_tree_item_collapse(HWND handle, HTREEITEM item)
6325 { 6325 {
6326 TreeView_Expand(handle, item, TVE_COLLAPSE); 6326 TreeView_Expand(handle, item, TVE_COLLAPSE);
6327 } 6327 }
6328 6328
6329 /* 6329 /*
6330 * Removes a node from a tree. 6330 * Removes a node from a tree.
6331 * Parameters: 6331 * Parameters:
6332 * handle: Handle to the window (widget) to be cleared. 6332 * handle: Handle to the window (widget) to be cleared.
6333 * item: Handle to node to be deleted. 6333 * item: Handle to node to be deleted.
6334 */ 6334 */
6335 void API dw_tree_delete(HWND handle, HTREEITEM item) 6335 void API dw_tree_item_delete(HWND handle, HTREEITEM item)
6336 { 6336 {
6337 TVITEM tvi; 6337 TVITEM tvi;
6338 void **ptrs; 6338 void **ptrs;
6339 6339
6340 if(item == TVI_ROOT || !item) 6340 if(item == TVI_ROOT || !item)
6344 tvi.hItem = item; 6344 tvi.hItem = item;
6345 6345
6346 if(TreeView_GetItem(handle, &tvi)) 6346 if(TreeView_GetItem(handle, &tvi))
6347 ptrs = (void **)tvi.lParam; 6347 ptrs = (void **)tvi.lParam;
6348 6348
6349 _dw_tree_delete_recursive(handle, item); 6349 _dw_tree_item_delete_recursive(handle, item);
6350 TreeView_DeleteItem(handle, item); 6350 TreeView_DeleteItem(handle, item);
6351 if(ptrs) 6351 if(ptrs)
6352 free(ptrs); 6352 free(ptrs);
6353 } 6353 }
6354 6354