OpenTTD Source 20261123-master-g1c55c72fd0
OTTD_CocoaView Class Reference

Subclass of NSView to support mouse awareness and text input. More...

#include <cocoa_wnd.h>

Inheritance diagram for OTTD_CocoaView:

Instance Methods

(NSRect) - getRealRect:
(NSRect) - getVirtualRect:
(CGFloat) - getContentsScale
(NSPoint) - mousePositionFromEvent:
 Return the mouse location.
(instancetype) - initWithFrame: [implementation]
(BOOL) - acceptsFirstResponder [implementation]
 Allow to handle events.
(void) - setNeedsDisplayInRect: [implementation]
(void) - viewWillMoveToWindow: [implementation]
(void) - viewDidMoveToWindow [implementation]
(void) - mouseEntered: [implementation]
 Make OpenTTD aware that it has control over the mouse.
(void) - mouseExited: [implementation]
 Make OpenTTD aware that it has NO control over the mouse.
(void) - internalMouseMoveEvent: [implementation]
 Internal handler of mouse movement.
(void) - internalMouseButtonEvent [implementation]
 Internal handler of mouse buttons.
(BOOL) - emulateRightButton: [implementation]
 Check if right mouse button should be emulated when left button is pressed.
(void) - mouseMoved: [implementation]
 Handler of mouse movement.
(void) - mouseDragged: [implementation]
 Handler of mouse movement while left button is down.
(void) - mouseDown: [implementation]
 Handler of left mouse button pressing.
(void) - mouseUp: [implementation]
 Handler of left mouse button releasing.
(void) - rightMouseDragged: [implementation]
 Handler of mouse movement when right button is down.
(void) - rightMouseDown: [implementation]
 Handler of right mouse button pressing.
(void) - rightMouseUp: [implementation]
 Handler of right mouse button releasing.
(void) - otherMouseDown: [implementation]
 Handler of otther mouse button pressing.
(void) - otherMouseUp: [implementation]
 Handler of other mouse button releasing.
(void) - scrollWheel: [implementation]
 Handler of mouse wheel scrolling.
(void) - magnifyWithEvent: [implementation]
 Handler of magnification events.
(void) - endGestureWithEvent: [implementation]
 Handler of gesture to end magnification.
(BOOL) - internalHandleKeycode:unicode:pressed:modifiers: [implementation]
 Internal handler of keyboard keys.
(void) - keyDown: [implementation]
 Handler of keyboard key pressing.
(void) - keyUp: [implementation]
 Handler of keyboard key releasing.
(void) - flagsChanged: [implementation]
 Handler of modifiers.
(void) - insertText:replacementRange: [implementation]
 Insert the given text at the given range.
(void) - insertText: [implementation]
 Insert the given text at the caret.
(void) - setMarkedText:selectedRange:replacementRange: [implementation]
 Set a new marked text and reposition the caret.
(void) - setMarkedText:selectedRange: [implementation]
 Set a new marked text and reposition the caret.
(void) - unmarkText [implementation]
 Unmark the current marked text.
(NSRange) - selectedRange [implementation]
 Get the caret position.
(NSRange) - markedRange [implementation]
 Get the currently marked range.
(BOOL) - hasMarkedText [implementation]
 Is any text marked?
(NSAttributedString *) - attributedSubstringForProposedRange:actualRange: [implementation]
 Get a string corresponding to the given range.
(NSAttributedString *) - attributedSubstringFromRange: [implementation]
 Get a string corresponding to the given range.
(NSAttributedString *) - attributedString [implementation]
 Get the current edit box string.
(NSUInteger) - characterIndexForPoint: [implementation]
 Get the character that is rendered at the given point.
(NSRect) - firstRectForCharacterRange: [implementation]
 Get the bounding rect for the given range.
(NSRect) - firstRectForCharacterRange:actualRange: [implementation]
 Get the bounding rect for the given range.
(NSArray *) - validAttributesForMarkedText [implementation]
 Get all string attributes that we can process for marked text.
(void) - deleteBackward: [implementation]
 Delete single character left of the cursor.
(void) - deleteWordBackward: [implementation]
 Delete word left of the cursor.
(void) - deleteForward: [implementation]
 Delete single character right of the cursor.
(void) - deleteWordForward: [implementation]
 Delete word right of the cursor.
(void) - moveLeft: [implementation]
 Move cursor one character left.
(void) - moveWordLeft: [implementation]
 Move cursor one word left.
(void) - moveRight: [implementation]
 Move cursor one character right.
(void) - moveWordRight: [implementation]
 Move cursor one word right.
(void) - moveUp: [implementation]
 Move cursor one line up.
(void) - moveDown: [implementation]
 Move cursor one line down.
(void) - moveUpAndModifySelection: [implementation]
 MScroll one line up.
(void) - moveDownAndModifySelection: [implementation]
 Scroll one line down.
(void) - moveToBeginningOfLine: [implementation]
 Move cursor to the start of the line.
(void) - moveToEndOfLine: [implementation]
 Move cursor to the end of the line.
(void) - scrollPageUp: [implementation]
 Scroll one page up.
(void) - scrollPageDown: [implementation]
 Scroll one page down.
(void) - pageUpAndModifySelection: [implementation]
 Move cursor (and selection) one page up.
(void) - pageDownAndModifySelection: [implementation]
 Move cursor (and selection) one page down.
(void) - scrollToBeginningOfDocument: [implementation]
 Scroll to the beginning of the document.
(void) - scrollToEndOfDocument: [implementation]
 Scroll to the end of the document.
(void) - insertNewline: [implementation]
 Return was pressed.
(void) - cancelOperation: [implementation]
 Escape was pressed.
(void) - doCommandBySelector: [implementation]
 Invoke the selector if we implement it.

Detailed Description

Subclass of NSView to support mouse awareness and text input.

Definition at line 38 of file cocoa_wnd.h.

Method Documentation

◆ acceptsFirstResponder

- (BOOL) acceptsFirstResponder
implementation

Allow to handle events.

Returns
Always YES.

Definition at line 562 of file cocoa_wnd.mm.

References acceptsFirstResponder.

Referenced by acceptsFirstResponder.

◆ attributedString

- (NSAttributedString *) attributedString
implementation

Get the current edit box string.

Returns
The string from the edit box.

Definition at line 1177 of file cocoa_wnd.mm.

References _focused_window, attributedString, and EditBoxInGlobalFocus().

Referenced by attributedString.

◆ attributedSubstringForProposedRange:actualRange:

- (NSAttributedString *) attributedSubstringForProposedRange: (NSRange) theRange
actualRange: (NSRangePointer) actualRange 
implementation

Get a string corresponding to the given range.

Parameters
theRangeThe requested range of the string to return.
[out]actualRangeOptional output of range after validation.
Returns
The requested substring.

Definition at line 1149 of file cocoa_wnd.mm.

References _focused_window, and EditBoxInGlobalFocus().

Referenced by attributedSubstringFromRange:.

◆ attributedSubstringFromRange:

- (NSAttributedString *) attributedSubstringFromRange: (NSRange) theRange
implementation

Get a string corresponding to the given range.

Parameters
theRangeThe requested range of the string to return.
Returns
The requested substring.

Definition at line 1168 of file cocoa_wnd.mm.

References attributedSubstringForProposedRange:actualRange:.

◆ cancelOperation:

- (void) cancelOperation: (id) sender
implementation

Escape was pressed.

Parameters
senderWhere the event comes from.

Definition at line 1441 of file cocoa_wnd.mm.

References EditBoxInGlobalFocus(), and HandleKeypress().

◆ characterIndexForPoint:

- (NSUInteger) characterIndexForPoint: (NSPoint) thePoint
implementation

Get the character that is rendered at the given point.

Parameters
thePointThe point in screen coordinates to get the character index for.
Returns
A negative number to denote an error, otherwise the number of UTF-16 characters up to thePoint.

Definition at line 1190 of file cocoa_wnd.mm.

References _focused_window, CountUtf16Units(), EditBoxInGlobalFocus(), and Point.

◆ deleteBackward:

- (void) deleteBackward: (id) sender
implementation

Delete single character left of the cursor.

Parameters
senderWhere the event comes from.

Definition at line 1250 of file cocoa_wnd.mm.

References EditBoxInGlobalFocus(), and HandleKeypress().

◆ deleteForward:

- (void) deleteForward: (id) sender
implementation

Delete single character right of the cursor.

Parameters
senderWhere the event comes from.

Definition at line 1268 of file cocoa_wnd.mm.

References EditBoxInGlobalFocus(), and HandleKeypress().

◆ deleteWordBackward:

- (void) deleteWordBackward: (id) sender
implementation

Delete word left of the cursor.

Parameters
senderWhere the event comes from.

Definition at line 1259 of file cocoa_wnd.mm.

References EditBoxInGlobalFocus(), and HandleKeypress().

◆ deleteWordForward:

- (void) deleteWordForward: (id) sender
implementation

Delete word right of the cursor.

Parameters
senderWhere the event comes from.

Definition at line 1277 of file cocoa_wnd.mm.

References EditBoxInGlobalFocus(), and HandleKeypress().

◆ doCommandBySelector:

- (void) doCommandBySelector: (SEL) aSelector
implementation

Invoke the selector if we implement it.

Parameters
aSelectorThe selector to invoke.

Definition at line 1450 of file cocoa_wnd.mm.

◆ emulateRightButton:

- (BOOL) emulateRightButton: (NSEvent *) event
implementation

Check if right mouse button should be emulated when left button is pressed.

Parameters
eventInformation about occurred event.
Returns
True iff right button should be emulated instead of left one.

Definition at line 664 of file cocoa_wnd.mm.

References _settings_client.

◆ endGestureWithEvent:

- (void) endGestureWithEvent: (NSEvent *) event
implementation

Handler of gesture to end magnification.

Parameters
eventInformation about occurred event.

Definition at line 845 of file cocoa_wnd.mm.

◆ firstRectForCharacterRange:

- (NSRect) firstRectForCharacterRange: (NSRange) aRange
implementation

Get the bounding rect for the given range.

Parameters
aRangeThe start and end location of the string in UTF-16 characters.
Returns
The rectangle in screen coordinates for the given range.

Definition at line 1210 of file cocoa_wnd.mm.

References _focused_window, EditBoxInGlobalFocus(), and Utf8AdvanceByUtf16Units().

Referenced by firstRectForCharacterRange:actualRange:.

◆ firstRectForCharacterRange:actualRange:

- (NSRect) firstRectForCharacterRange: (NSRange) aRange
actualRange: (NSRangePointer) actualRange 
implementation

Get the bounding rect for the given range.

Parameters
aRangeThe start and end location of the string in UTF-16 characters.
[out]actualRangeOptional output of range after validation. Exists because the API requires it.
Returns
The rectangle in screen coordinates for the given range.

Definition at line 1232 of file cocoa_wnd.mm.

References firstRectForCharacterRange:.

◆ flagsChanged:

- (void) flagsChanged: (NSEvent *) event
implementation

Handler of modifiers.

Parameters
eventInformation about occurred event.

Definition at line 993 of file cocoa_wnd.mm.

References _current_mods, and internalHandleKeycode:unicode:pressed:modifiers:.

◆ getContentsScale

- (CGFloat) getContentsScale

Definition at line 553 of file cocoa_wnd.mm.

◆ getRealRect:

- (NSRect) getRealRect: (NSRect) rect

Definition at line 543 of file cocoa_wnd.mm.

◆ getVirtualRect:

- (NSRect) getVirtualRect: (NSRect) rect

Definition at line 548 of file cocoa_wnd.mm.

◆ hasMarkedText

- (BOOL) hasMarkedText
implementation

Is any text marked?

Returns
YES iff text is marked.

Definition at line 1136 of file cocoa_wnd.mm.

References _focused_window, EditBoxInGlobalFocus(), and hasMarkedText.

Referenced by hasMarkedText.

◆ initWithFrame:

- (instancetype) initWithFrame: (NSRect) frameRect
implementation

Definition at line 535 of file cocoa_wnd.mm.

◆ insertNewline:

- (void) insertNewline: (id) sender
implementation

Return was pressed.

Parameters
senderWhere the event comes from.

Definition at line 1432 of file cocoa_wnd.mm.

References EditBoxInGlobalFocus(), and HandleKeypress().

◆ insertText:

- (void) insertText: (id) aString
implementation

Insert the given text at the caret.

Parameters
aStringThe string to insert.

Definition at line 1046 of file cocoa_wnd.mm.

References insertText:replacementRange:.

◆ insertText:replacementRange:

- (void) insertText: (id) aString
replacementRange: (NSRange) replacementRange 
implementation

Insert the given text at the given range.

Parameters
aStringThe string to insert.
replacementRangeThe range of the original string to replace.

Definition at line 1023 of file cocoa_wnd.mm.

References _focused_window, EditBoxInGlobalFocus(), HandleTextInput(), and Utf8AdvanceByUtf16Units().

Referenced by insertText:.

◆ internalHandleKeycode:unicode:pressed:modifiers:

- (BOOL) internalHandleKeycode: (unsigned short) keycode
unicode: (char32_t) unicode
pressed: (BOOL) down
modifiers: (NSUInteger) modifiers 
implementation

Internal handler of keyboard keys.

Parameters
keycodeThe raw keycode of the key press.
unicodeThe unicode character of the key press.
downWhether pressing or releasing the key.
modifiersFlags to denote other (special) keys that might have been pressed.
Returns
Whether event should be interpreted.

Definition at line 860 of file cocoa_wnd.mm.

References _dirkeys, _settings_client, _tab_is_down, Debug, Down, Driver, EditBoxInGlobalFocus(), VideoDriver::GetInstance(), HandleKeypress(), IsInsideMM(), Left, Notice, Right, VideoDriver::ToggleFullscreen(), and Up.

Referenced by flagsChanged:, keyDown:, and keyUp:.

◆ internalMouseButtonEvent

- (void) internalMouseButtonEvent
implementation

Internal handler of mouse buttons.

Definition at line 650 of file cocoa_wnd.mm.

References HandleMouseEvents(), and internalMouseButtonEvent.

Referenced by internalMouseButtonEvent, mouseDown:, mouseUp:, otherMouseDown:, otherMouseUp:, rightMouseDown:, and rightMouseUp:.

◆ internalMouseMoveEvent:

- (void) internalMouseMoveEvent: (NSEvent *) event
implementation

Internal handler of mouse movement.

Parameters
eventInformation about occurred event.

Definition at line 635 of file cocoa_wnd.mm.

References HandleMouseEvents(), and mousePositionFromEvent:.

Referenced by mouseDragged:, mouseMoved:, and rightMouseDragged:.

◆ keyDown:

- (void) keyDown: (NSEvent *) event
implementation

Handler of keyboard key pressing.

Parameters
eventInformation about occurred event.

Definition at line 936 of file cocoa_wnd.mm.

References EditBoxInGlobalFocus(), internalHandleKeycode:unicode:pressed:modifiers:, and NSStringToUTF32().

◆ keyUp:

- (void) keyUp: (NSEvent *) event
implementation

Handler of keyboard key releasing.

Parameters
eventInformation about occurred event.

Definition at line 969 of file cocoa_wnd.mm.

References internalHandleKeycode:unicode:pressed:modifiers:, and NSStringToUTF32().

◆ magnifyWithEvent:

- (void) magnifyWithEvent: (NSEvent *) event
implementation

Handler of magnification events.

Parameters
eventInformation about occurred event.

Definition at line 824 of file cocoa_wnd.mm.

References HandleMouseEvents().

◆ markedRange

- (NSRange) markedRange
implementation

Get the currently marked range.

Returns
The currently marked range.

Definition at line 1116 of file cocoa_wnd.mm.

References _focused_window, CountUtf16Units(), EditBoxInGlobalFocus(), Textbuf::GetText(), markedRange, Textbuf::markend, and Textbuf::markpos.

Referenced by markedRange, and setMarkedText:selectedRange:replacementRange:.

◆ mouseDown:

- (void) mouseDown: (NSEvent *) event
implementation

Handler of left mouse button pressing.

Parameters
eventInformation about occurred event.

Definition at line 695 of file cocoa_wnd.mm.

References _input_pressed, internalMouseButtonEvent, Left, and rightMouseDown:.

◆ mouseDragged:

- (void) mouseDragged: (NSEvent *) event
implementation

Handler of mouse movement while left button is down.

Parameters
eventInformation about occurred event.

Definition at line 686 of file cocoa_wnd.mm.

References internalMouseMoveEvent:.

◆ mouseEntered:

- (void) mouseEntered: (NSEvent *) theEvent
implementation

Make OpenTTD aware that it has control over the mouse.

Parameters
theEventInformation about occurred event.

Definition at line 594 of file cocoa_wnd.mm.

References Bootstrap.

◆ mouseExited:

- (void) mouseExited: (NSEvent *) theEvent
implementation

Make OpenTTD aware that it has NO control over the mouse.

Parameters
theEventInformation about occurred event.

Definition at line 605 of file cocoa_wnd.mm.

References Bootstrap.

◆ mouseMoved:

- (void) mouseMoved: (NSEvent *) event
implementation

Handler of mouse movement.

Parameters
eventInformation about occurred event.

Definition at line 677 of file cocoa_wnd.mm.

References internalMouseMoveEvent:.

◆ mousePositionFromEvent:

- (NSPoint) mousePositionFromEvent: (NSEvent *) e

Return the mouse location.

Parameters
eInformation about occurred event.
Returns
Mouse location as NSPoint.

Definition at line 622 of file cocoa_wnd.mm.

Referenced by internalMouseMoveEvent:.

◆ mouseUp:

- (void) mouseUp: (NSEvent *) event
implementation

Handler of left mouse button releasing.

Parameters
eventInformation about occurred event.

Definition at line 710 of file cocoa_wnd.mm.

References _input_clicked, _input_pressed, internalMouseButtonEvent, Left, and rightMouseUp:.

◆ moveDown:

- (void) moveDown: (id) sender
implementation

Move cursor one line down.

Parameters
senderWhere the event comes from.

Definition at line 1331 of file cocoa_wnd.mm.

References EditBoxInGlobalFocus(), and HandleKeypress().

◆ moveDownAndModifySelection:

- (void) moveDownAndModifySelection: (id) sender
implementation

Scroll one line down.

Parameters
senderWhere the event comes from.

Definition at line 1349 of file cocoa_wnd.mm.

References EditBoxInGlobalFocus(), and HandleKeypress().

◆ moveLeft:

- (void) moveLeft: (id) sender
implementation

Move cursor one character left.

Parameters
senderWhere the event comes from.

Definition at line 1286 of file cocoa_wnd.mm.

References EditBoxInGlobalFocus(), and HandleKeypress().

◆ moveRight:

- (void) moveRight: (id) sender
implementation

Move cursor one character right.

Parameters
senderWhere the event comes from.

Definition at line 1304 of file cocoa_wnd.mm.

References EditBoxInGlobalFocus(), and HandleKeypress().

◆ moveToBeginningOfLine:

- (void) moveToBeginningOfLine: (id) sender
implementation

Move cursor to the start of the line.

Parameters
senderWhere the event comes from.

Definition at line 1358 of file cocoa_wnd.mm.

References EditBoxInGlobalFocus(), and HandleKeypress().

Referenced by scrollToBeginningOfDocument:.

◆ moveToEndOfLine:

- (void) moveToEndOfLine: (id) sender
implementation

Move cursor to the end of the line.

Parameters
senderWhere the event comes from.

Definition at line 1367 of file cocoa_wnd.mm.

References EditBoxInGlobalFocus(), and HandleKeypress().

Referenced by scrollToEndOfDocument:.

◆ moveUp:

- (void) moveUp: (id) sender
implementation

Move cursor one line up.

Parameters
senderWhere the event comes from.

Definition at line 1322 of file cocoa_wnd.mm.

References EditBoxInGlobalFocus(), and HandleKeypress().

◆ moveUpAndModifySelection:

- (void) moveUpAndModifySelection: (id) sender
implementation

MScroll one line up.

Parameters
senderWhere the event comes from.

Definition at line 1340 of file cocoa_wnd.mm.

References EditBoxInGlobalFocus(), and HandleKeypress().

◆ moveWordLeft:

- (void) moveWordLeft: (id) sender
implementation

Move cursor one word left.

Parameters
senderWhere the event comes from.

Definition at line 1295 of file cocoa_wnd.mm.

References EditBoxInGlobalFocus(), and HandleKeypress().

◆ moveWordRight:

- (void) moveWordRight: (id) sender
implementation

Move cursor one word right.

Parameters
senderWhere the event comes from.

Definition at line 1313 of file cocoa_wnd.mm.

References EditBoxInGlobalFocus(), and HandleKeypress().

◆ otherMouseDown:

- (void) otherMouseDown: (NSEvent *) event
implementation

Handler of otther mouse button pressing.

Parameters
eventInformation about occurred event.

Definition at line 756 of file cocoa_wnd.mm.

References _input_clicked, _input_pressed, internalMouseButtonEvent, Middle, X1, and X2.

◆ otherMouseUp:

- (void) otherMouseUp: (NSEvent *) event
implementation

Handler of other mouse button releasing.

Parameters
eventInformation about occurred event.

Definition at line 774 of file cocoa_wnd.mm.

References _input_pressed, internalMouseButtonEvent, Middle, X1, and X2.

◆ pageDownAndModifySelection:

- (void) pageDownAndModifySelection: (id) sender
implementation

Move cursor (and selection) one page down.

Parameters
senderWhere the event comes from.

Definition at line 1403 of file cocoa_wnd.mm.

References EditBoxInGlobalFocus(), and HandleKeypress().

◆ pageUpAndModifySelection:

- (void) pageUpAndModifySelection: (id) sender
implementation

Move cursor (and selection) one page up.

Parameters
senderWhere the event comes from.

Definition at line 1394 of file cocoa_wnd.mm.

References EditBoxInGlobalFocus(), and HandleKeypress().

◆ rightMouseDown:

- (void) rightMouseDown: (NSEvent *) event
implementation

Handler of right mouse button pressing.

Parameters
eventInformation about occurred event.

Definition at line 735 of file cocoa_wnd.mm.

References _input_clicked, _input_pressed, internalMouseButtonEvent, and Right.

Referenced by mouseDown:.

◆ rightMouseDragged:

- (void) rightMouseDragged: (NSEvent *) event
implementation

Handler of mouse movement when right button is down.

Parameters
eventInformation about occurred event.

Definition at line 726 of file cocoa_wnd.mm.

References internalMouseMoveEvent:.

◆ rightMouseUp:

- (void) rightMouseUp: (NSEvent *) event
implementation

Handler of right mouse button releasing.

Parameters
eventInformation about occurred event.

Definition at line 746 of file cocoa_wnd.mm.

References _input_pressed, internalMouseButtonEvent, and Right.

Referenced by mouseUp:.

◆ scrollPageDown:

- (void) scrollPageDown: (id) sender
implementation

Scroll one page down.

Parameters
senderWhere the event comes from.

Definition at line 1385 of file cocoa_wnd.mm.

References EditBoxInGlobalFocus(), and HandleKeypress().

◆ scrollPageUp:

- (void) scrollPageUp: (id) sender
implementation

Scroll one page up.

Parameters
senderWhere the event comes from.

Definition at line 1376 of file cocoa_wnd.mm.

References EditBoxInGlobalFocus(), and HandleKeypress().

◆ scrollToBeginningOfDocument:

- (void) scrollToBeginningOfDocument: (id) sender
implementation

Scroll to the beginning of the document.

Parameters
senderWhere the event comes from.

Definition at line 1412 of file cocoa_wnd.mm.

References moveToBeginningOfLine:.

◆ scrollToEndOfDocument:

- (void) scrollToEndOfDocument: (id) sender
implementation

Scroll to the end of the document.

Parameters
senderWhere the event comes from.

Definition at line 1422 of file cocoa_wnd.mm.

References moveToEndOfLine:.

◆ scrollWheel:

- (void) scrollWheel: (NSEvent *) event
implementation

Handler of mouse wheel scrolling.

Parameters
eventInformation about occurred event.

Definition at line 791 of file cocoa_wnd.mm.

References _settings_client.

◆ selectedRange

- (NSRange) selectedRange
implementation

Get the caret position.

Returns
The range with caret position.

Definition at line 1102 of file cocoa_wnd.mm.

References _focused_window, Textbuf::caretpos, CountUtf16Units(), EditBoxInGlobalFocus(), Textbuf::GetText(), and selectedRange.

Referenced by selectedRange.

◆ setMarkedText:selectedRange:

- (void) setMarkedText: (id) aString
selectedRange: (NSRange) selRange 
implementation

Set a new marked text and reposition the caret.

Parameters
aStringThe string to set the marked text for.
selRangeThe new selection range.

Definition at line 1087 of file cocoa_wnd.mm.

References setMarkedText:selectedRange:replacementRange:.

◆ setMarkedText:selectedRange:replacementRange:

- (void) setMarkedText: (id) aString
selectedRange: (NSRange) selRange
replacementRange: (NSRange) replacementRange 
implementation

Set a new marked text and reposition the caret.

Parameters
aStringThe string to set the marked text for.
selRangeThe new selection range.
replacementRangeThe range to replace, counted from the marked range.

Definition at line 1057 of file cocoa_wnd.mm.

References _focused_window, EditBoxInGlobalFocus(), HandleTextInput(), markedRange, and Utf8AdvanceByUtf16Units().

Referenced by setMarkedText:selectedRange:.

◆ setNeedsDisplayInRect:

- (void) setNeedsDisplayInRect: (NSRect) invalidRect
implementation

Definition at line 567 of file cocoa_wnd.mm.

◆ unmarkText

- (void) unmarkText
implementation

Unmark the current marked text.

Definition at line 1093 of file cocoa_wnd.mm.

References HandleTextInput(), and unmarkText.

Referenced by unmarkText.

◆ validAttributesForMarkedText

- (NSArray *) validAttributesForMarkedText
implementation

Get all string attributes that we can process for marked text.

Returns
The valid attributes, in this case an empty array.

Definition at line 1241 of file cocoa_wnd.mm.

References validAttributesForMarkedText.

Referenced by validAttributesForMarkedText.

◆ viewDidMoveToWindow

- (void) viewDidMoveToWindow
implementation

Definition at line 582 of file cocoa_wnd.mm.

◆ viewWillMoveToWindow:

- (void) viewWillMoveToWindow: (NSWindow *) win
implementation

Definition at line 575 of file cocoa_wnd.mm.


The documentation for this class was generated from the following files: