|
OpenTTD Source 20260208-master-g43af8e94d0
|
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.
Definition at line 572 of file cocoa_wnd.mm.
References acceptsFirstResponder.
Referenced by acceptsFirstResponder.
|
implementation |
Get the current edit box string.
Definition at line 1112 of file cocoa_wnd.mm.
References attributedString, and EditBoxInGlobalFocus().
Referenced by attributedString.
|
implementation |
Get a string corresponding to the given range.
Definition at line 1091 of file cocoa_wnd.mm.
References EditBoxInGlobalFocus().
Referenced by attributedSubstringFromRange:.
|
implementation |
Get a string corresponding to the given range.
Definition at line 1106 of file cocoa_wnd.mm.
References attributedSubstringForProposedRange:actualRange:.
|
implementation |
Escape was pressed.
| sender | Where the event comes from. |
Definition at line 1360 of file cocoa_wnd.mm.
References EditBoxInGlobalFocus(), and HandleKeypress().
|
implementation |
Get the character that is rendered at the given point.
Definition at line 1121 of file cocoa_wnd.mm.
References CountUtf16Units(), EditBoxInGlobalFocus(), and Point.
|
implementation |
Update mouse cursor to use for this view.
Definition at line 586 of file cocoa_wnd.mm.
|
implementation |
Delete single character left of the cursor.
| sender | Where the event comes from. |
Definition at line 1169 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 1187 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 1178 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 1196 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 1369 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 671 of file cocoa_wnd.mm.
References _settings_client.
|
implementation |
Handler of gesture to end magnification.
| event | Information about occurred event. |
Definition at line 817 of file cocoa_wnd.mm.
|
implementation |
Get the bounding rect for the given range.
Definition at line 1137 of file cocoa_wnd.mm.
References EditBoxInGlobalFocus(), and Utf8AdvanceByUtf16Units().
Referenced by firstRectForCharacterRange:actualRange:.
|
implementation |
Get the bounding rect for the given range.
Definition at line 1154 of file cocoa_wnd.mm.
References firstRectForCharacterRange:.
|
implementation |
Handler of modifiers.
| event | Information about occurred event. |
Definition at line 965 of file cocoa_wnd.mm.
References _current_mods, and internalHandleKeycode:unicode:pressed:modifiers:.
| - (CGFloat) getContentsScale |
Definition at line 564 of file cocoa_wnd.mm.
| - (NSRect) getRealRect: | (NSRect) | rect |
Definition at line 554 of file cocoa_wnd.mm.
| - (NSRect) getVirtualRect: | (NSRect) | rect |
Definition at line 559 of file cocoa_wnd.mm.
|
implementation |
Is any text marked?
Definition at line 1083 of file cocoa_wnd.mm.
References EditBoxInGlobalFocus(), and hasMarkedText.
Referenced by hasMarkedText.
|
implementation |
Definition at line 546 of file cocoa_wnd.mm.
|
implementation |
Return was pressed.
| sender | Where the event comes from. |
Definition at line 1351 of file cocoa_wnd.mm.
References EditBoxInGlobalFocus(), and HandleKeypress().
|
implementation |
Insert the given text at the caret.
Definition at line 1011 of file cocoa_wnd.mm.
References insertText:replacementRange:.
|
implementation |
Insert the given text at the given range.
Definition at line 991 of file cocoa_wnd.mm.
References 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 832 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 657 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 642 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 908 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 941 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 796 of file cocoa_wnd.mm.
References HandleMouseEvents().
|
implementation |
Get the currently marked range.
Definition at line 1066 of file cocoa_wnd.mm.
References 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 702 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 693 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 610 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 618 of file cocoa_wnd.mm.
|
implementation |
Handler of mouse movement.
| event | Information about occurred event. |
Definition at line 684 of file cocoa_wnd.mm.
References internalMouseMoveEvent:.
| - (NSPoint) mousePositionFromEvent: | (NSEvent *) | e |
Return the mouse location.
| e | Information about occurred event. |
Definition at line 629 of file cocoa_wnd.mm.
Referenced by internalMouseMoveEvent:.
|
implementation |
Handler of left mouse button releasing.
| event | Information about occurred event. |
Definition at line 717 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 1250 of file cocoa_wnd.mm.
References EditBoxInGlobalFocus(), and HandleKeypress().
|
implementation |
Scroll one line down.
| sender | Where the event comes from. |
Definition at line 1268 of file cocoa_wnd.mm.
References EditBoxInGlobalFocus(), and HandleKeypress().
|
implementation |
Move cursor one character left.
| sender | Where the event comes from. |
Definition at line 1205 of file cocoa_wnd.mm.
References EditBoxInGlobalFocus(), and HandleKeypress().
|
implementation |
Move cursor one character right.
| sender | Where the event comes from. |
Definition at line 1223 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 1277 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 1286 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 1241 of file cocoa_wnd.mm.
References EditBoxInGlobalFocus(), and HandleKeypress().
|
implementation |
MScroll one line up.
| sender | Where the event comes from. |
Definition at line 1259 of file cocoa_wnd.mm.
References EditBoxInGlobalFocus(), and HandleKeypress().
|
implementation |
Move cursor one word left.
| sender | Where the event comes from. |
Definition at line 1214 of file cocoa_wnd.mm.
References EditBoxInGlobalFocus(), and HandleKeypress().
|
implementation |
Move cursor one word right.
| sender | Where the event comes from. |
Definition at line 1232 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 1322 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 1313 of file cocoa_wnd.mm.
References EditBoxInGlobalFocus(), and HandleKeypress().
|
implementation |
Handler of right mouse button pressing.
| event | Information about occurred event. |
Definition at line 742 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 733 of file cocoa_wnd.mm.
References internalMouseMoveEvent:.
|
implementation |
Handler of right mouse button releasing.
| event | Information about occurred event. |
Definition at line 753 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 1304 of file cocoa_wnd.mm.
References EditBoxInGlobalFocus(), and HandleKeypress().
|
implementation |
Scroll one page up.
| sender | Where the event comes from. |
Definition at line 1295 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 1331 of file cocoa_wnd.mm.
References moveToBeginningOfLine:.
|
implementation |
Scroll to the end of the document.
| sender | Where the event comes from. |
Definition at line 1341 of file cocoa_wnd.mm.
References moveToEndOfLine:.
|
implementation |
Handler of mouse wheel scrolling.
| event | Information about occurred event. |
Definition at line 763 of file cocoa_wnd.mm.
References _settings_client.
|
implementation |
Get the caret position.
Definition at line 1055 of file cocoa_wnd.mm.
References Textbuf::caretpos, CountUtf16Units(), EditBoxInGlobalFocus(), Textbuf::GetText(), and selectedRange.
Referenced by selectedRange.
|
implementation |
Set a new marked text and reposition the caret.
Definition at line 1043 of file cocoa_wnd.mm.
References setMarkedText:selectedRange:replacementRange:.
|
implementation |
Set a new marked text and reposition the caret.
Definition at line 1017 of file cocoa_wnd.mm.
References EditBoxInGlobalFocus(), HandleTextInput(), markedRange, and Utf8AdvanceByUtf16Units().
Referenced by setMarkedText:selectedRange:.
|
implementation |
Definition at line 577 of file cocoa_wnd.mm.
|
implementation |
Unmark the current marked text.
Definition at line 1049 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 1160 of file cocoa_wnd.mm.
References validAttributesForMarkedText.
Referenced by validAttributesForMarkedText.
|
implementation |
Definition at line 598 of file cocoa_wnd.mm.
|
implementation |
Definition at line 591 of file cocoa_wnd.mm.