OS.kTXNDoFontSubstitution, OS.kTXNWordWrapStateTag, OS.kTXNAutoScrollBehaviorTag,
void createHandle () {	if (OS.HIVIEW) {		int [] outControl = new int [1];		if ((style & SWT.MULTI) != 0 || ((style & SWT.BORDER) == 0)) {			if ((style & (SWT.H_SCROLL | SWT.V_SCROLL)) != 0) {				int options = 0;				if ((style & (SWT.H_SCROLL | SWT.V_SCROLL)) == (SWT.H_SCROLL | SWT.V_SCROLL)) options |= OS.kHIScrollViewOptionsAllowGrow;				if ((style & SWT.H_SCROLL) != 0) options |= OS.kHIScrollViewOptionsHorizScroll;				if ((style & SWT.V_SCROLL) != 0) options |= OS.kHIScrollViewOptionsVertScroll;				OS.HIScrollViewCreate (options, outControl);				if (outControl [0] == 0) error (SWT.ERROR_NO_HANDLES);				scrolledHandle = outControl [0];				OS.HIViewSetVisible (scrolledHandle, true);			}			int iFrameOptions = OS.kTXNDontDrawCaretWhenInactiveMask | OS.kTXNMonostyledTextMask;			if ((style & SWT.SINGLE) != 0) iFrameOptions |= OS.kTXNSingleLineOnlyMask;			if ((style & SWT.WRAP) != 0) iFrameOptions |= OS.kTXNAlwaysWrapAtViewEdgeMask;			OS.HITextViewCreate (null, 0, iFrameOptions, outControl);			if (outControl [0] == 0) error (SWT.ERROR_NO_HANDLES);			handle = outControl [0];			OS.HIViewSetVisible (handle, true);			txnObject = OS.HITextViewGetTXNObject (handle);						int ptr = OS.NewPtr (Rect.sizeof);			Rect rect = inset ();			OS.memcpy (ptr, rect, Rect.sizeof);			int [] tags = new int [] {				OS.kTXNDisableDragAndDropTag,				OS.kTXNIOPrivilegesTag,				OS.kTXNMarginsTag,				OS.kTXNJustificationTag,				OS.kTXNDoFontSubstitution,				OS.kTXNWordWrapStateTag,				OS.kTXNAutoScrollBehaviorTag,			};			int just = OS.kTXNFlushLeft;			if ((style & SWT.CENTER) != 0) just = OS.kTXNCenter;			if ((style & SWT.RIGHT) != 0) just = OS.kTXNFlushRight;			int [] datas = new int [] {				1,				(style & SWT.READ_ONLY) != 0 ? 1 : 0,				ptr,				just,				1,				(style & SWT.WRAP) != 0 ? 0 : 1,				0,			};			OS.TXNSetTXNObjectControls (txnObject, false, tags.length, tags, datas);			OS.DisposePtr (ptr);		} else {			int window = OS.GetControlOwner (parent.handle);			OS.CreateEditUnicodeTextControl (window, null, 0, (style & SWT.PASSWORD) != 0, null, outControl);			if (outControl [0] == 0) error (SWT.ERROR_NO_HANDLES);			handle = outControl [0];			OS.SetControlData (handle, OS.kControlEntireControl, OS.kControlEditTextSingleLineTag, 1, new byte [] {1});			if ((style & SWT.READ_ONLY) != 0) {				OS.SetControlData (handle, OS.kControlEntireControl, OS.kControlEditTextLockedTag, 1, new byte [] {1});			}			if ((style & (SWT.RIGHT | SWT.CENTER)) != 0) {				ControlFontStyleRec fontStyle = new ControlFontStyleRec ();				fontStyle.flags |= OS.kControlUseJustMask;				if ((style & SWT.CENTER) != 0) fontStyle.just = OS.teJustCenter;				if ((style & SWT.RIGHT) != 0) fontStyle.just = OS.teJustRight;				OS.SetControlFontStyle (handle, fontStyle);			}		}			} else {		int features = OS.kControlSupportsEmbedding | OS.kControlSupportsFocus | OS.kControlGetsFocusOnClick;		int [] outControl = new int [1];		int window = OS.GetControlOwner (parent.handle);		OS.CreateUserPaneControl (window, null, features, outControl);		if (outControl [0] == 0) error (SWT.ERROR_NO_HANDLES);		handle = outControl [0];				/*		* Feature in the Macintosh.  The TXNObject is not a control but creates scroll		* bar controls to scroll the text.  These are created in the root and are not		* children of the user pane that is used to represent the TNXObject.  The fix		* is to embed the scroll bars in the user pane.		*/		int [] theRoot = new int [1];		OS.GetRootControl (window, theRoot);		short [] oldCount = new short [1];		OS.CountSubControls (theRoot [0], oldCount);					/* Create the TXNObject */		int iFrameOptions = OS.kTXNDontDrawCaretWhenInactiveMask | OS.kTXNMonostyledTextMask;		if ((style & SWT.H_SCROLL) != 0) iFrameOptions |= OS.kTXNWantHScrollBarMask;		if ((style & SWT.V_SCROLL) != 0) iFrameOptions |= OS.kTXNWantVScrollBarMask;		if ((style & SWT.SINGLE) != 0) iFrameOptions |= OS.kTXNSingleLineOnlyMask;		if ((style & SWT.WRAP) != 0) iFrameOptions |= OS.kTXNAlwaysWrapAtViewEdgeMask;		int [] oTXNObject = new int [1], oTXNFrameID = new int[1];		OS.TXNNewObject (0, window, null, iFrameOptions, OS.kTXNTextEditStyleFrameType, OS.kTXNUnicodeTextFile, OS.kTXNSystemDefaultEncoding, oTXNObject, oTXNFrameID, 0);		if (oTXNObject [0] == 0) error (SWT.ERROR_NO_HANDLES);		txnObject = oTXNObject [0];		txnFrameID = oTXNFrameID [0];				/* Embed the scroll bars in the user pane */		short [] newCount = new short [1];		OS.CountSubControls (theRoot [0], newCount);		int [] scrollBar = new int [1];		for (int i=newCount [0]; i>oldCount [0]; --i) {			OS.GetIndexedSubControl (theRoot [0], (short) i, scrollBar);			OS.HIViewRemoveFromSuperview (scrollBar [0]);			OS.HIViewAddSubview (handle, scrollBar [0]);		}				/* Configure the TXNObject */		int ptr = OS.NewPtr (Rect.sizeof);		Rect rect = new Rect ();		if (hasBorder ()) {			OS.SetRect (rect, (short) 1, (short) 1, (short) 1, (short) 1);		}		OS.memcpy (ptr, rect, Rect.sizeof);		int [] tags = new int [] {			OS.kTXNDisableDragAndDropTag,			OS.kTXNIOPrivilegesTag,			OS.kTXNMarginsTag,			OS.kTXNJustificationTag,			OS.kTXNDoFontSubstitution,		};		int just = OS.kTXNFlushLeft;		if ((style & SWT.CENTER) != 0) just = OS.kTXNCenter;		if ((style & SWT.RIGHT) != 0) just = OS.kTXNFlushRight;		int [] datas = new int [] {			1,			(style & SWT.READ_ONLY) != 0 ? 1 : 0,			ptr,			just,			1,		};		OS.TXNSetTXNObjectControls (txnObject, false, tags.length, tags, datas);		OS.TXNSetFrameBounds (txnObject, 0, 0, 0, 0, txnFrameID);		OS.DisposePtr (ptr);			/*		* Bug in the Macintosh.  The caret height is too small until some text is set in the		* TXNObject.  The fix is to temporary change the text.		*/		char [] buffer = new char [] {' '};		OS.TXNSetData (txnObject, OS.kTXNUnicodeTextData, buffer, 2, OS.kTXNStartOffset, OS.kTXNEndOffset);		OS.TXNSetData (txnObject, OS.kTXNUnicodeTextData, buffer, 0, OS.kTXNStartOffset, OS.kTXNEndOffset);	}}