|
OpenTTD Source 20260414-master-g8a7bc482ad
|
Subclass of NSView to support mouse awareness and text input. More...
#include <cocoa_wnd.h>
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) | - cursorUpdate: [implementation] |
| Update mouse cursor to use for this view. | |
| (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) | - 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. | |
Subclass of NSView to support mouse awareness and text input.
Definition at line 43 of file cocoa_wnd.h.
|
implementation |
Allow to handle events.
YES. Definition at line 587 of file cocoa_wnd.mm.
References acceptsFirstResponder.
Referenced by acceptsFirstResponder.
|
implementation |
Get the current edit box string.
Definition at line 1167 of file cocoa_wnd.mm.
References _focused_window, attributedString, and EditBoxInGlobalFocus().
Referenced by attributedString.
|
implementation |
Get a string corresponding to the given range.
| theRange | The requested range of the string to return. | |
| [out] | actualRange | Optional output of range after validation. |
Definition at line 1139 of file cocoa_wnd.mm.
References _focused_window, and EditBoxInGlobalFocus().
Referenced by attributedSubstringFromRange:.
|
implementation |
Get a string corresponding to the given range.
| theRange | The requested range of the string to return. |
Definition at line 1158 of file cocoa_wnd.mm.
References attributedSubstringForProposedRange:actualRange:.
|
implementation |
Escape was pressed.
| sender | Where the event comes from. |
Definition at line 1431 of file cocoa_wnd.mm.
References EditBoxInGlobalFocus(), and HandleKeypress().
|
implementation |
Get the character that is rendered at the given point.
| thePoint | The point in screen coordinates to get the character index for. |
thePoint. Definition at line 1180 of file cocoa_wnd.mm.
References _focused_window, CountUtf16Units(), EditBoxInGlobalFocus(), and Point.
|
implementation |
Update mouse cursor to use for this view.
| event | Event from the operating system. Exists because the API requires it. |
Definition at line 604 of file cocoa_wnd.mm.
|
implementation |
Delete single character left of the cursor.
| sender | Where the event comes from. |
Definition at line 1240 of file cocoa_wnd.mm.
References EditBoxInGlobalFocus(), and HandleKeypress().
|
implementation |
Delete single character right of the cursor.
| sender | Where the event comes from. |
Definition at line 1258 of file cocoa_wnd.mm.
References EditBoxInGlobalFocus(), and HandleKeypress().
|
implementation |
Delete word left of the cursor.
| sender | Where the event comes from. |
Definition at line 1249 of file cocoa_wnd.mm.
References EditBoxInGlobalFocus(), and HandleKeypress().
|
implementation |
Delete word right of the cursor.
| sender | Where the event comes from. |
Definition at line 1267 of file cocoa_wnd.mm.
References EditBoxInGlobalFocus(), and HandleKeypress().
|
implementation |
Invoke the selector if we implement it.
| aSelector | The selector to invoke. |
Definition at line 1440 of file cocoa_wnd.mm.
|
implementation |
Check if right mouse button should be emulated when left button is pressed.
| event | Information about occurred event. |
Definition at line 689 of file cocoa_wnd.mm.
References _settings_client.
|
implementation |
Handler of gesture to end magnification.
| event | Information about occurred event. |
Definition at line 835 of file cocoa_wnd.mm.
|
implementation |
Get the bounding rect for the given range.
| aRange | The start and end location of the string in UTF-16 characters. |
Definition at line 1200 of file cocoa_wnd.mm.
References _focused_window, EditBoxInGlobalFocus(), and Utf8AdvanceByUtf16Units().
Referenced by firstRectForCharacterRange:actualRange:.
|
implementation |
Get the bounding rect for the given range.
| aRange | The start and end location of the string in UTF-16 characters. | |
| [out] | actualRange | Optional output of range after validation. Exists because the API requires it. |
Definition at line 1222 of file cocoa_wnd.mm.
References firstRectForCharacterRange:.
|
implementation |
Handler of modifiers.
| event | Information about occurred event. |
Definition at line 983 of file cocoa_wnd.mm.
References _current_mods, and internalHandleKeycode:unicode:pressed:modifiers:.
| - (CGFloat) getContentsScale |
Definition at line 578 of file cocoa_wnd.mm.
| - (NSRect) getRealRect: | (NSRect) | rect |
Definition at line 568 of file cocoa_wnd.mm.
| - (NSRect) getVirtualRect: | (NSRect) | rect |
Definition at line 573 of file cocoa_wnd.mm.
|
implementation |
Is any text marked?
YES iff text is marked. Definition at line 1126 of file cocoa_wnd.mm.
References _focused_window, EditBoxInGlobalFocus(), and hasMarkedText.
Referenced by hasMarkedText.
|
implementation |
Definition at line 560 of file cocoa_wnd.mm.
|
implementation |
Return was pressed.
| sender | Where the event comes from. |
Definition at line 1422 of file cocoa_wnd.mm.
References EditBoxInGlobalFocus(), and HandleKeypress().
|
implementation |
Insert the given text at the caret.
| aString | The string to insert. |
Definition at line 1036 of file cocoa_wnd.mm.
References insertText:replacementRange:.
|
implementation |
Insert the given text at the given range.
| aString | The string to insert. |
| replacementRange | The range of the original string to replace. |
Definition at line 1013 of file cocoa_wnd.mm.
References _focused_window, EditBoxInGlobalFocus(), HandleTextInput(), and Utf8AdvanceByUtf16Units().
Referenced by insertText:.
|
implementation |
Internal handler of keyboard keys.
| keycode | The raw keycode of the key press. |
| unicode | The unicode character of the key press. |
| down | Whether pressing or releasing the key. |
| modifiers | Flags to denote other (special) keys that might have been pressed. |
Definition at line 850 of file cocoa_wnd.mm.
References _dirkeys, _settings_client, _tab_is_down, Debug, EditBoxInGlobalFocus(), VideoDriver::GetInstance(), HandleKeypress(), IsInsideMM(), SB(), and VideoDriver::ToggleFullscreen().
Referenced by flagsChanged:, keyDown:, and keyUp:.
|
implementation |
Internal handler of mouse buttons.
Definition at line 675 of file cocoa_wnd.mm.
References HandleMouseEvents(), and internalMouseButtonEvent.
Referenced by internalMouseButtonEvent, mouseDown:, mouseUp:, rightMouseDown:, and rightMouseUp:.
|
implementation |
Internal handler of mouse movement.
| event | Information about occurred event. |
Definition at line 660 of file cocoa_wnd.mm.
References HandleMouseEvents(), and mousePositionFromEvent:.
Referenced by mouseDragged:, mouseMoved:, and rightMouseDragged:.
|
implementation |
Handler of keyboard key pressing.
| event | Information about occurred event. |
Definition at line 926 of file cocoa_wnd.mm.
References EditBoxInGlobalFocus(), internalHandleKeycode:unicode:pressed:modifiers:, and NSStringToUTF32().
|
implementation |
Handler of keyboard key releasing.
| event | Information about occurred event. |
Definition at line 959 of file cocoa_wnd.mm.
References internalHandleKeycode:unicode:pressed:modifiers:, and NSStringToUTF32().
|
implementation |
Handler of magnification events.
| event | Information about occurred event. |
Definition at line 814 of file cocoa_wnd.mm.
References HandleMouseEvents().
|
implementation |
Get the currently marked range.
Definition at line 1106 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:.
|
implementation |
Handler of left mouse button pressing.
| event | Information about occurred event. |
Definition at line 720 of file cocoa_wnd.mm.
References _left_button_down, internalMouseButtonEvent, and rightMouseDown:.
|
implementation |
Handler of mouse movement while left button is down.
| event | Information about occurred event. |
Definition at line 711 of file cocoa_wnd.mm.
References internalMouseMoveEvent:.
|
implementation |
Make OpenTTD aware that it has control over the mouse.
| theEvent | Information about occurred event. |
Definition at line 628 of file cocoa_wnd.mm.
|
implementation |
Make OpenTTD aware that it has NO control over the mouse.
| theEvent | Information about occurred event. |
Definition at line 636 of file cocoa_wnd.mm.
|
implementation |
Handler of mouse movement.
| event | Information about occurred event. |
Definition at line 702 of file cocoa_wnd.mm.
References internalMouseMoveEvent:.
| - (NSPoint) mousePositionFromEvent: | (NSEvent *) | e |
Return the mouse location.
| e | Information about occurred event. |
Definition at line 647 of file cocoa_wnd.mm.
Referenced by internalMouseMoveEvent:.
|
implementation |
Handler of left mouse button releasing.
| event | Information about occurred event. |
Definition at line 735 of file cocoa_wnd.mm.
References _left_button_clicked, _left_button_down, internalMouseButtonEvent, and rightMouseUp:.
|
implementation |
Move cursor one line down.
| sender | Where the event comes from. |
Definition at line 1321 of file cocoa_wnd.mm.
References EditBoxInGlobalFocus(), and HandleKeypress().
|
implementation |
Scroll one line down.
| sender | Where the event comes from. |
Definition at line 1339 of file cocoa_wnd.mm.
References EditBoxInGlobalFocus(), and HandleKeypress().
|
implementation |
Move cursor one character left.
| sender | Where the event comes from. |
Definition at line 1276 of file cocoa_wnd.mm.
References EditBoxInGlobalFocus(), and HandleKeypress().
|
implementation |
Move cursor one character right.
| sender | Where the event comes from. |
Definition at line 1294 of file cocoa_wnd.mm.
References EditBoxInGlobalFocus(), and HandleKeypress().
|
implementation |
Move cursor to the start of the line.
| sender | Where the event comes from. |
Definition at line 1348 of file cocoa_wnd.mm.
References EditBoxInGlobalFocus(), and HandleKeypress().
Referenced by scrollToBeginningOfDocument:.
|
implementation |
Move cursor to the end of the line.
| sender | Where the event comes from. |
Definition at line 1357 of file cocoa_wnd.mm.
References EditBoxInGlobalFocus(), and HandleKeypress().
Referenced by scrollToEndOfDocument:.
|
implementation |
Move cursor one line up.
| sender | Where the event comes from. |
Definition at line 1312 of file cocoa_wnd.mm.
References EditBoxInGlobalFocus(), and HandleKeypress().
|
implementation |
MScroll one line up.
| sender | Where the event comes from. |
Definition at line 1330 of file cocoa_wnd.mm.
References EditBoxInGlobalFocus(), and HandleKeypress().
|
implementation |
Move cursor one word left.
| sender | Where the event comes from. |
Definition at line 1285 of file cocoa_wnd.mm.
References EditBoxInGlobalFocus(), and HandleKeypress().
|
implementation |
Move cursor one word right.
| sender | Where the event comes from. |
Definition at line 1303 of file cocoa_wnd.mm.
References EditBoxInGlobalFocus(), and HandleKeypress().
|
implementation |
Move cursor (and selection) one page down.
| sender | Where the event comes from. |
Definition at line 1393 of file cocoa_wnd.mm.
References EditBoxInGlobalFocus(), and HandleKeypress().
|
implementation |
Move cursor (and selection) one page up.
| sender | Where the event comes from. |
Definition at line 1384 of file cocoa_wnd.mm.
References EditBoxInGlobalFocus(), and HandleKeypress().
|
implementation |
Handler of right mouse button pressing.
| event | Information about occurred event. |
Definition at line 760 of file cocoa_wnd.mm.
References _right_button_clicked, _right_button_down, and internalMouseButtonEvent.
Referenced by mouseDown:.
|
implementation |
Handler of mouse movement when right button is down.
| event | Information about occurred event. |
Definition at line 751 of file cocoa_wnd.mm.
References internalMouseMoveEvent:.
|
implementation |
Handler of right mouse button releasing.
| event | Information about occurred event. |
Definition at line 771 of file cocoa_wnd.mm.
References _right_button_down, and internalMouseButtonEvent.
Referenced by mouseUp:.
|
implementation |
Scroll one page down.
| sender | Where the event comes from. |
Definition at line 1375 of file cocoa_wnd.mm.
References EditBoxInGlobalFocus(), and HandleKeypress().
|
implementation |
Scroll one page up.
| sender | Where the event comes from. |
Definition at line 1366 of file cocoa_wnd.mm.
References EditBoxInGlobalFocus(), and HandleKeypress().
|
implementation |
Scroll to the beginning of the document.
| sender | Where the event comes from. |
Definition at line 1402 of file cocoa_wnd.mm.
References moveToBeginningOfLine:.
|
implementation |
Scroll to the end of the document.
| sender | Where the event comes from. |
Definition at line 1412 of file cocoa_wnd.mm.
References moveToEndOfLine:.
|
implementation |
Handler of mouse wheel scrolling.
| event | Information about occurred event. |
Definition at line 781 of file cocoa_wnd.mm.
References _settings_client.
|
implementation |
Get the caret position.
Definition at line 1092 of file cocoa_wnd.mm.
References _focused_window, Textbuf::caretpos, CountUtf16Units(), EditBoxInGlobalFocus(), Textbuf::GetText(), and selectedRange.
Referenced by selectedRange.
|
implementation |
Set a new marked text and reposition the caret.
| aString | The string to set the marked text for. |
| selRange | The new selection range. |
Definition at line 1077 of file cocoa_wnd.mm.
References setMarkedText:selectedRange:replacementRange:.
|
implementation |
Set a new marked text and reposition the caret.
| aString | The string to set the marked text for. |
| selRange | The new selection range. |
| replacementRange | The range to replace, counted from the marked range. |
Definition at line 1047 of file cocoa_wnd.mm.
References _focused_window, EditBoxInGlobalFocus(), HandleTextInput(), markedRange, and Utf8AdvanceByUtf16Units().
Referenced by setMarkedText:selectedRange:.
|
implementation |
Definition at line 592 of file cocoa_wnd.mm.
|
implementation |
Unmark the current marked text.
Definition at line 1083 of file cocoa_wnd.mm.
References HandleTextInput(), and unmarkText.
Referenced by unmarkText.
|
implementation |
Get all string attributes that we can process for marked text.
Definition at line 1231 of file cocoa_wnd.mm.
References validAttributesForMarkedText.
Referenced by validAttributesForMarkedText.
|
implementation |
Definition at line 616 of file cocoa_wnd.mm.
|
implementation |
Definition at line 609 of file cocoa_wnd.mm.