comparison ios/dw.m @ 2472:206a0643add6

iOS: Move scrollbox functions into thread safety.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Thu, 15 Apr 2021 02:11:04 +0000
parents 4d1f370bf65e
children 457c91634881
comparison
equal deleted inserted replaced
2471:ed955edc7204 2472:206a0643add6
3510 * Returns the position of the scrollbar in the scrollbox 3510 * Returns the position of the scrollbar in the scrollbox
3511 * Parameters: 3511 * Parameters:
3512 * handle: Handle to the scrollbox to be queried. 3512 * handle: Handle to the scrollbox to be queried.
3513 * orient: The vertical or horizontal scrollbar. 3513 * orient: The vertical or horizontal scrollbar.
3514 */ 3514 */
3515 int API dw_scrollbox_get_pos(HWND handle, int orient) 3515 DW_FUNCTION_DEFINITION(dw_scrollbox_get_pos, int, HWND handle, int orient)
3516 DW_FUNCTION_ADD_PARAM2(handle, orient)
3517 DW_FUNCTION_RETURN(dw_scrollbox_get_pos, int)
3518 DW_FUNCTION_RESTORE_PARAM2(handle, HWND, orient, int)
3516 { 3519 {
3517 DWScrollBox *scrollbox = handle; 3520 DWScrollBox *scrollbox = handle;
3518 NSArray *subviews = [scrollbox subviews]; 3521 NSArray *subviews = [scrollbox subviews];
3519 UIView *view = [subviews firstObject]; 3522 UIView *view = [subviews firstObject];
3520 CGSize contentsize = [scrollbox contentSize]; 3523 CGSize contentsize = [scrollbox contentSize];
3533 } 3536 }
3534 if(val > range) 3537 if(val > range)
3535 { 3538 {
3536 val = range; 3539 val = range;
3537 } 3540 }
3538 return val; 3541 DW_FUNCTION_RETURN_THIS(val);
3539 } 3542 }
3540 3543
3541 /* 3544 /*
3542 * Gets the range for the scrollbar in the scrollbox. 3545 * Gets the range for the scrollbar in the scrollbox.
3543 * Parameters: 3546 * Parameters:
3544 * handle: Handle to the scrollbox to be queried. 3547 * handle: Handle to the scrollbox to be queried.
3545 * orient: The vertical or horizontal scrollbar. 3548 * orient: The vertical or horizontal scrollbar.
3546 */ 3549 */
3547 int API dw_scrollbox_get_range(HWND handle, int orient) 3550 DW_FUNCTION_DEFINITION(dw_scrollbox_get_range, int, HWND handle, int orient)
3551 DW_FUNCTION_ADD_PARAM2(handle, orient)
3552 DW_FUNCTION_RETURN(dw_scrollbox_get_range, int)
3553 DW_FUNCTION_RESTORE_PARAM2(handle, HWND, orient, int)
3548 { 3554 {
3549 DWScrollBox *scrollbox = handle; 3555 DWScrollBox *scrollbox = handle;
3550 NSArray *subviews = [scrollbox subviews]; 3556 NSArray *subviews = [scrollbox subviews];
3551 UIView *view = [subviews firstObject]; 3557 UIView *view = [subviews firstObject];
3552 int range = 0; 3558 int range = 0;
3556 } 3562 }
3557 else 3563 else
3558 { 3564 {
3559 range = [view bounds].size.width; 3565 range = [view bounds].size.width;
3560 } 3566 }
3561 return range; 3567 DW_FUNCTION_RETURN_THIS(range);
3562 } 3568 }
3563 3569
3564 /* Return the handle to the text object */ 3570 /* Return the handle to the text object */
3565 id _dw_text_handle(id object) 3571 id _dw_text_handle(id object)
3566 { 3572 {
3768 dw_messagebox(funcname, DW_MB_OK|DW_MB_ERROR, "Danger! Danger! Will Robinson; box and item are the same!"); 3774 dw_messagebox(funcname, DW_MB_OK|DW_MB_ERROR, "Danger! Danger! Will Robinson; box and item are the same!");
3769 return; 3775 return;
3770 } 3776 }
3771 3777
3772 /* Query the objects */ 3778 /* Query the objects */
3773 if([ object isKindOfClass:[ UIWindow class ] ]) 3779 if([object isKindOfClass:[UIWindow class]])
3774 { 3780 {
3775 UIWindow *window = box; 3781 UIWindow *window = box;
3776 NSArray *subviews = [window subviews]; 3782 NSArray *subviews = [window subviews];
3777 view = [subviews firstObject]; 3783 view = [subviews firstObject];
3778 } 3784 }
3779 else if([ object isMemberOfClass:[ DWScrollBox class ] ]) 3785 else if([object isMemberOfClass:[DWScrollBox class]])
3780 { 3786 {
3781 DWScrollBox *scrollbox = box; 3787 DWScrollBox *scrollbox = box;
3782 view = [scrollbox box]; 3788 view = [scrollbox box];
3783 } 3789 }
3784 3790