summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormichi_cc <michi_cc@openttd.org>2013-08-05 20:37:40 +0000
committermichi_cc <michi_cc@openttd.org>2013-08-05 20:37:40 +0000
commitc64e297e0c3f5f1f59a21d1ad3e12e6834e155d7 (patch)
treeb4179750bbd3ec711aa800407bcd17a4c2152e43 /src
parent643a294e68e1281e85c783ce53d0051ee2f31ea9 (diff)
downloadopenttd-c64e297e0c3f5f1f59a21d1ad3e12e6834e155d7.tar.xz
(svn r25688) -Codechange: [OSX] Make our view aware of text input by IMEs.
Diffstat (limited to 'src')
-rw-r--r--src/video/cocoa/cocoa_v.h2
-rw-r--r--src/video/cocoa/cocoa_v.mm63
2 files changed, 64 insertions, 1 deletions
diff --git a/src/video/cocoa/cocoa_v.h b/src/video/cocoa/cocoa_v.h
index e350f0a06..8a964f03b 100644
--- a/src/video/cocoa/cocoa_v.h
+++ b/src/video/cocoa/cocoa_v.h
@@ -232,7 +232,7 @@ uint QZ_ListModes(OTTD_Point *modes, uint max_modes, CGDirectDisplayID display_i
@end
/** Subclass of NSView to fix Quartz rendering and mouse awareness */
-@interface OTTD_CocoaView : NSView {
+@interface OTTD_CocoaView : NSView <NSTextInput> {
CocoaSubdriver *driver;
NSTrackingRectTag trackingtag;
}
diff --git a/src/video/cocoa/cocoa_v.mm b/src/video/cocoa/cocoa_v.mm
index 99f2c3fed..1a0ea1a60 100644
--- a/src/video/cocoa/cocoa_v.mm
+++ b/src/video/cocoa/cocoa_v.mm
@@ -799,6 +799,69 @@ void cocoaReleaseAutoreleasePool()
HandleTextInput([ s UTF8String ]);
}
+/** Set a new marked text and reposition the caret. */
+- (void)setMarkedText:(id)aString selectedRange:(NSRange)selRange
+{
+}
+
+/** Unmark the current marked text. */
+- (void)unmarkText
+{
+ HandleTextInput(NULL, true);
+}
+
+/** Get the caret position. */
+- (NSRange)selectedRange
+{
+ return NSMakeRange(NSNotFound, 0);
+}
+
+/** Get the currently marked range. */
+- (NSRange)markedRange
+{
+ return NSMakeRange(NSNotFound, 0);
+}
+
+/** Is any text marked? */
+- (BOOL)hasMarkedText
+{
+ return NO;
+}
+
+/** Get a string corresponding to the given range. */
+- (NSAttributedString *)attributedSubstringFromRange:(NSRange)theRange
+{
+ return nil;
+}
+
+/** Get the character that is rendered at the given point. */
+- (NSUInteger)characterIndexForPoint:(NSPoint)thePoint
+{
+ return NSNotFound;
+}
+
+/** Get the bounding rect for the given range. */
+- (NSRect)firstRectForCharacterRange:(NSRange)aRange
+{
+ return NSMakeRect(0, 0, 0, 0);
+}
+
+/** Get all string attributes that we can process for marked text. */
+- (NSArray*)validAttributesForMarkedText
+{
+ return [ NSArray array ];
+}
+
+/** Identifier for this text input instance. */
+#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5
+- (long)conversationIdentifier
+#else
+- (NSInteger)conversationIdentifier
+#endif
+{
+ return 0;
+}
+
/** Invoke the selector if we implement it. */
- (void)doCommandBySelector:(SEL)aSelector
{