Split the autocorrect disabling stuff on Mac OS X into its own function and marked the TextArea TODO as a future plan.

This commit is contained in:
Pietro Gagliardi 2014-08-11 00:17:21 -04:00
parent 57cdc83280
commit 4bede4aa8d
4 changed files with 22 additions and 7 deletions

16
redo/common_darwin.m Normal file
View File

@ -0,0 +1,16 @@
// 11 august 2014
#include "objc_darwin.h"
#include <Cocoa/Cocoa.h>
void disableAutocorrect(id onwhat)
{
NSTextView *tv;
tv = (NSTextView *) onwhat;
[tv setEnabledTextCheckingTypes:0];
[tv setAutomaticDashSubstitutionEnabled:NO];
// don't worry about automatic data detection; it won't change stringValue (thanks pretty_function in irc.freenode.net/#macdev)
[tv setAutomaticSpellingCorrectionEnabled:NO];
[tv setAutomaticTextReplacementEnabled:NO];
}

View File

@ -21,6 +21,8 @@ Area
Repaint(rect image.Rectangle)
Tree
Mac OS X: make sure newScrollView() has the correct parameters for Table and Tree (and that Area has the appropriate ones from both + its own no border)
TextArea
Mac OS X: be sure to call disableAutocorrect()
so I don't forget, some TODOs:
windows

View File

@ -110,4 +110,7 @@ extern uintptr_t pressedMouseButtons(void);
extern uintptr_t keyCode(id);
extern void areaRepaintAll(id);
/* common_darwin.m */
extern void disableAutocorrect(id);
#endif

View File

@ -47,13 +47,7 @@ id newWindow(intptr_t width, intptr_t height)
// so we have to turn them off here
// thanks akempgen in irc.freenode.net/#macdev
// for some reason, this selector returns NSText but is documented to return NSTextView...
// TODO isolate into its own function when (if?) we add TextArea
tv = (NSTextView *) [w fieldEditor:YES forObject:nil];
[tv setEnabledTextCheckingTypes:0];
[tv setAutomaticDashSubstitutionEnabled:NO];
// don't worry about automatic data detection; it won't change stringValue (thanks pretty_function in irc.freenode.net/#macdev)
[tv setAutomaticSpellingCorrectionEnabled:NO];
[tv setAutomaticTextReplacementEnabled:NO];
disableAutocorrect((id) [w fieldEditor:YES forObject:nil]);
return w;
}