1 /*******************************************************************************
2 * Copyright (c) 2000, 2019 IBM Corporation and others.
3 *
4 * This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License 2.0
6 * which accompanies this distribution, and is available at
7 * https://www.eclipse.org/legal/epl-2.0/
8 *
9 * SPDX-License-Identifier: EPL-2.0
10 *
11 * Contributors:
12 * IBM Corporation - initial API and implementation
13 *******************************************************************************/
14 package org.eclipse.swt.internal.cocoa;
15
16 public class NSTextView extends NSText {
17
NSTextView()18 public NSTextView() {
19 super();
20 }
21
NSTextView(long id)22 public NSTextView(long id) {
23 super(id);
24 }
25
NSTextView(id id)26 public NSTextView(id id) {
27 super(id);
28 }
29
characterIndexForInsertionAtPoint(NSPoint point)30 public long characterIndexForInsertionAtPoint(NSPoint point) {
31 return OS.objc_msgSend(this.id, OS.sel_characterIndexForInsertionAtPoint_, point);
32 }
33
defaultParagraphStyle()34 public NSParagraphStyle defaultParagraphStyle() {
35 long result = OS.objc_msgSend(this.id, OS.sel_defaultParagraphStyle);
36 return result != 0 ? new NSParagraphStyle(result) : null;
37 }
38
dragSelectionWithEvent(NSEvent event, NSSize mouseOffset, boolean slideBack)39 public boolean dragSelectionWithEvent(NSEvent event, NSSize mouseOffset, boolean slideBack) {
40 return OS.objc_msgSend_bool(this.id, OS.sel_dragSelectionWithEvent_offset_slideBack_, event != null ? event.id : 0, mouseOffset, slideBack);
41 }
42
drawViewBackgroundInRect(NSRect rect)43 public void drawViewBackgroundInRect(NSRect rect) {
44 OS.objc_msgSend(this.id, OS.sel_drawViewBackgroundInRect_, rect);
45 }
46
layoutManager()47 public NSLayoutManager layoutManager() {
48 long result = OS.objc_msgSend(this.id, OS.sel_layoutManager);
49 return result != 0 ? new NSLayoutManager(result) : null;
50 }
51
linkTextAttributes()52 public NSDictionary linkTextAttributes() {
53 long result = OS.objc_msgSend(this.id, OS.sel_linkTextAttributes);
54 return result != 0 ? new NSDictionary(result) : null;
55 }
56
markedTextAttributes()57 public NSDictionary markedTextAttributes() {
58 long result = OS.objc_msgSend(this.id, OS.sel_markedTextAttributes);
59 return result != 0 ? new NSDictionary(result) : null;
60 }
61
selectedTextAttributes()62 public NSDictionary selectedTextAttributes() {
63 long result = OS.objc_msgSend(this.id, OS.sel_selectedTextAttributes);
64 return result != 0 ? new NSDictionary(result) : null;
65 }
66
setAllowsUndo(boolean allowsUndo)67 public void setAllowsUndo(boolean allowsUndo) {
68 OS.objc_msgSend(this.id, OS.sel_setAllowsUndo_, allowsUndo);
69 }
70
setDefaultParagraphStyle(NSParagraphStyle defaultParagraphStyle)71 public void setDefaultParagraphStyle(NSParagraphStyle defaultParagraphStyle) {
72 OS.objc_msgSend(this.id, OS.sel_setDefaultParagraphStyle_, defaultParagraphStyle != null ? defaultParagraphStyle.id : 0);
73 }
74
setDisplaysLinkToolTips(boolean displaysLinkToolTips)75 public void setDisplaysLinkToolTips(boolean displaysLinkToolTips) {
76 OS.objc_msgSend(this.id, OS.sel_setDisplaysLinkToolTips_, displaysLinkToolTips);
77 }
78
setLinkTextAttributes(NSDictionary linkTextAttributes)79 public void setLinkTextAttributes(NSDictionary linkTextAttributes) {
80 OS.objc_msgSend(this.id, OS.sel_setLinkTextAttributes_, linkTextAttributes != null ? linkTextAttributes.id : 0);
81 }
82
setRichText(boolean richText)83 public void setRichText(boolean richText) {
84 OS.objc_msgSend(this.id, OS.sel_setRichText_, richText);
85 }
86
setSelectedTextAttributes(NSDictionary selectedTextAttributes)87 public void setSelectedTextAttributes(NSDictionary selectedTextAttributes) {
88 OS.objc_msgSend(this.id, OS.sel_setSelectedTextAttributes_, selectedTextAttributes != null ? selectedTextAttributes.id : 0);
89 }
90
setUsesFontPanel(boolean usesFontPanel)91 public void setUsesFontPanel(boolean usesFontPanel) {
92 OS.objc_msgSend(this.id, OS.sel_setUsesFontPanel_, usesFontPanel);
93 }
94
shouldChangeTextInRange(NSRange affectedCharRange, NSString replacementString)95 public boolean shouldChangeTextInRange(NSRange affectedCharRange, NSString replacementString) {
96 return OS.objc_msgSend_bool(this.id, OS.sel_shouldChangeTextInRange_replacementString_, affectedCharRange, replacementString != null ? replacementString.id : 0);
97 }
98
shouldDrawInsertionPoint()99 public boolean shouldDrawInsertionPoint() {
100 return OS.objc_msgSend_bool(this.id, OS.sel_shouldDrawInsertionPoint);
101 }
102
textContainer()103 public NSTextContainer textContainer() {
104 long result = OS.objc_msgSend(this.id, OS.sel_textContainer);
105 return result != 0 ? new NSTextContainer(result) : null;
106 }
107
textStorage()108 public NSTextStorage textStorage() {
109 long result = OS.objc_msgSend(this.id, OS.sel_textStorage);
110 return result != 0 ? new NSTextStorage(result) : null;
111 }
112
113 }
114