Mercurial > dwindows
comparison ios/dw.m @ 2699:0d5e99279c8b
iOS: MLE work: Implement dw_mle_set_auto_complete() DW_MLE_COMPLETE_TEXT now
enables and disabled iOS Auto Correct on the MLE.
Attempt to get dw_mle_set_word_wrap() working, but it still doesn't seem to
be working. Also added thread protection to another MLE function.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Mon, 15 Nov 2021 21:12:32 +0000 |
parents | 5c43d1ee9736 |
children | 246f23670e3b |
comparison
equal
deleted
inserted
replaced
2698:5c43d1ee9736 | 2699:0d5e99279c8b |
---|---|
5147 DWMLE *mle = [[[DWMLE alloc] initWithFrame:frame textContainer:tc] retain]; | 5147 DWMLE *mle = [[[DWMLE alloc] initWithFrame:frame textContainer:tc] retain]; |
5148 CGSize size = [mle intrinsicContentSize]; | 5148 CGSize size = [mle intrinsicContentSize]; |
5149 | 5149 |
5150 size.width = size.height; | 5150 size.width = size.height; |
5151 [mle setAutoresizingMask:UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleWidth]; | 5151 [mle setAutoresizingMask:UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleWidth]; |
5152 [mle setScrollEnabled:YES]; | |
5152 [mle setTag:cid]; | 5153 [mle setTag:cid]; |
5153 [mle autorelease]; | 5154 [mle autorelease]; |
5154 DW_FUNCTION_RETURN_THIS(mle); | 5155 DW_FUNCTION_RETURN_THIS(mle); |
5155 } | 5156 } |
5156 | 5157 |
5318 * Sets the editablity of an MLE box. | 5319 * Sets the editablity of an MLE box. |
5319 * Parameters: | 5320 * Parameters: |
5320 * handle: Handle to the MLE. | 5321 * handle: Handle to the MLE. |
5321 * state: TRUE if it can be edited, FALSE for readonly. | 5322 * state: TRUE if it can be edited, FALSE for readonly. |
5322 */ | 5323 */ |
5323 void API dw_mle_set_editable(HWND handle, int state) | 5324 DW_FUNCTION_DEFINITION(dw_mle_set_editable, void, HWND handle, int state) |
5325 DW_FUNCTION_ADD_PARAM2(handle, state) | |
5326 DW_FUNCTION_NO_RETURN(dw_mle_set_editable) | |
5327 DW_FUNCTION_RESTORE_PARAM2(handle, HWND, state, int) | |
5324 { | 5328 { |
5325 DWMLE *mle = handle; | 5329 DWMLE *mle = handle; |
5326 if(state) | 5330 [mle setEditable:(state ? YES : NO)]; |
5327 { | 5331 DW_FUNCTION_RETURN_NOTHING; |
5328 [mle setEditable:YES]; | |
5329 } | |
5330 else | |
5331 { | |
5332 [mle setEditable:NO]; | |
5333 } | |
5334 } | 5332 } |
5335 | 5333 |
5336 /* | 5334 /* |
5337 * Sets the word wrap state of an MLE box. | 5335 * Sets the word wrap state of an MLE box. |
5338 * Parameters: | 5336 * Parameters: |
5339 * handle: Handle to the MLE. | 5337 * handle: Handle to the MLE. |
5340 * state: TRUE if it wraps, FALSE if it doesn't. | 5338 * state: TRUE if it wraps, FALSE if it doesn't. |
5341 */ | 5339 */ |
5342 void API dw_mle_set_word_wrap(HWND handle, int state) | 5340 DW_FUNCTION_DEFINITION(dw_mle_set_word_wrap, void, HWND handle, int state) |
5343 { | 5341 DW_FUNCTION_ADD_PARAM2(handle, state) |
5344 /* TODO: Figure out how to do this in iOS */ | 5342 DW_FUNCTION_NO_RETURN(dw_mle_set_word_wrap) |
5343 DW_FUNCTION_RESTORE_PARAM2(handle, HWND, state, int) | |
5344 { | |
5345 DWMLE *mle = handle; | |
5346 NSUInteger mask = state ? 0 :UIViewAutoresizingFlexibleWidth; | |
5347 | |
5348 [mle setAutoresizingMask:UIViewAutoresizingFlexibleHeight|mask]; | |
5349 [[mle textContainer] setLineBreakMode:(state ? NSLineBreakByWordWrapping : NSLineBreakByClipping)]; | |
5350 DW_FUNCTION_RETURN_NOTHING; | |
5345 } | 5351 } |
5346 | 5352 |
5347 /* | 5353 /* |
5348 * Sets the word auto complete state of an MLE box. | 5354 * Sets the word auto complete state of an MLE box. |
5349 * Parameters: | 5355 * Parameters: |
5350 * handle: Handle to the MLE. | 5356 * handle: Handle to the MLE. |
5351 * state: Bitwise combination of DW_MLE_COMPLETE_TEXT/DASH/QUOTE | 5357 * state: Bitwise combination of DW_MLE_COMPLETE_TEXT/DASH/QUOTE |
5352 */ | 5358 */ |
5353 void API dw_mle_set_auto_complete(HWND handle, int state) | 5359 DW_FUNCTION_DEFINITION(dw_mle_set_auto_complete, void, HWND handle, int state) |
5354 { | 5360 DW_FUNCTION_ADD_PARAM2(handle, state) |
5355 /* TODO: Figure out how to do this in iOS */ | 5361 DW_FUNCTION_NO_RETURN(dw_mle_set_auto_complete) |
5362 DW_FUNCTION_RESTORE_PARAM2(handle, HWND, state, int) | |
5363 { | |
5364 DWMLE *mle = handle; | |
5365 NSInteger autocorrect = (state & DW_MLE_COMPLETE_TEXT) ? UITextAutocorrectionTypeYes : UITextAutocorrectionTypeNo; | |
5366 [mle setAutocorrectionType:autocorrect]; | |
5367 DW_FUNCTION_RETURN_NOTHING; | |
5356 } | 5368 } |
5357 | 5369 |
5358 /* | 5370 /* |
5359 * Sets the current cursor position of an MLE box. | 5371 * Sets the current cursor position of an MLE box. |
5360 * Parameters: | 5372 * Parameters: |