summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--redo/common_darwin.m16
-rw-r--r--redo/future2
-rw-r--r--redo/objc_darwin.h3
-rw-r--r--redo/window_darwin.m8
4 files changed, 22 insertions, 7 deletions
diff --git a/redo/common_darwin.m b/redo/common_darwin.m
new file mode 100644
index 0000000..3043f21
--- /dev/null
+++ b/redo/common_darwin.m
@@ -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];
+}
diff --git a/redo/future b/redo/future
index e73fd2b..01bbc95 100644
--- a/redo/future
+++ b/redo/future
@@ -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
diff --git a/redo/objc_darwin.h b/redo/objc_darwin.h
index 14164f0..b95cc07 100644
--- a/redo/objc_darwin.h
+++ b/redo/objc_darwin.h
@@ -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
diff --git a/redo/window_darwin.m b/redo/window_darwin.m
index 7cb97d6..b58c2b8 100644
--- a/redo/window_darwin.m
+++ b/redo/window_darwin.m
@@ -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;
}