comparison ios/dw.m @ 2700:246f23670e3b

iOS: Fix dw_mle_set_word_wrap() and dw_checkbox_get(). The checkbox code is a recent breakage, from a method conflict. The MLE word wrap code isn't pretty, not sure this is the best way... but it works, so using it for the time being.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Tue, 16 Nov 2021 11:26:19 +0000
parents 0d5e99279c8b
children ae846e9f1ead
comparison
equal deleted inserted replaced
2699:0d5e99279c8b 2700:246f23670e3b
3191 else if([handle isMemberOfClass:[DWSplitBar class]]) 3191 else if([handle isMemberOfClass:[DWSplitBar class]])
3192 { 3192 {
3193 DWSplitBar *split = (DWSplitBar *)handle; 3193 DWSplitBar *split = (DWSplitBar *)handle;
3194 [split resize]; 3194 [split resize];
3195 } 3195 }
3196 else if([handle isMemberOfClass:[DWMLE class]])
3197 {
3198 DWMLE *mle = (DWMLE *)handle;
3199
3200 if([[mle textContainer] lineBreakMode] == NSLineBreakByClipping)
3201 [[mle textContainer] setSize:CGRectInfinite.size];
3202 }
3196 3203
3197 /* Advance the current position in the box */ 3204 /* Advance the current position in the box */
3198 if(thisbox->type == DW_HORZ) 3205 if(thisbox->type == DW_HORZ)
3199 currentx += width + (pad * 2); 3206 currentx += width + (pad * 2);
3200 if(thisbox->type == DW_VERT) 3207 if(thisbox->type == DW_VERT)
4660 DW_FUNCTION_RESTORE_PARAM1(handle, HWND) 4667 DW_FUNCTION_RESTORE_PARAM1(handle, HWND)
4661 { 4668 {
4662 DWButton *button = handle; 4669 DWButton *button = handle;
4663 int retval = FALSE; 4670 int retval = FALSE;
4664 4671
4665 if([button state]) 4672 if([button checkState])
4666 retval = TRUE; 4673 retval = TRUE;
4667 DW_FUNCTION_RETURN_THIS(retval); 4674 DW_FUNCTION_RETURN_THIS(retval);
4668 } 4675 }
4669 4676
4670 /* 4677 /*
5341 DW_FUNCTION_ADD_PARAM2(handle, state) 5348 DW_FUNCTION_ADD_PARAM2(handle, state)
5342 DW_FUNCTION_NO_RETURN(dw_mle_set_word_wrap) 5349 DW_FUNCTION_NO_RETURN(dw_mle_set_word_wrap)
5343 DW_FUNCTION_RESTORE_PARAM2(handle, HWND, state, int) 5350 DW_FUNCTION_RESTORE_PARAM2(handle, HWND, state, int)
5344 { 5351 {
5345 DWMLE *mle = handle; 5352 DWMLE *mle = handle;
5346 NSUInteger mask = state ? 0 :UIViewAutoresizingFlexibleWidth; 5353
5347
5348 [mle setAutoresizingMask:UIViewAutoresizingFlexibleHeight|mask];
5349 [[mle textContainer] setLineBreakMode:(state ? NSLineBreakByWordWrapping : NSLineBreakByClipping)]; 5354 [[mle textContainer] setLineBreakMode:(state ? NSLineBreakByWordWrapping : NSLineBreakByClipping)];
5355 [[mle textContainer] setWidthTracksTextView:(state ? YES : NO)];
5356 if(!state)
5357 [[mle textContainer] setSize:CGRectInfinite.size];
5358 else
5359 {
5360 CGSize size = [mle frame].size;
5361 [[mle textContainer] setSize:CGSizeMake(size.width, CGRectInfinite.size.height)];
5362 }
5350 DW_FUNCTION_RETURN_NOTHING; 5363 DW_FUNCTION_RETURN_NOTHING;
5351 } 5364 }
5352 5365
5353 /* 5366 /*
5354 * Sets the word auto complete state of an MLE box. 5367 * Sets the word auto complete state of an MLE box.