/** * Returns the number of lines. * * @return the number of lines in the widget * @exception SWTException * <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver * </ul> */ public int getLineCount() { checkWidget(); if (variant == TextUtils.LINE_EDIT) { return 1; } else { forceTextLayout(); return OS.QTextEdit_swt_getLineCount(topHandle); } }
void createHandle_pp(int index) { if (variant == 0) { variant = ((getStyle() & SWT.SINGLE) != 0 ? TextUtils.LINE_EDIT : TextUtils.TEXT_EDIT); } int alignment = OS.QT_ALIGNLEFT; if ((style & SWT.CENTER) != 0) { alignment = OS.QT_ALIGNHCENTER; } else if ((style & SWT.RIGHT) != 0) { alignment = OS.QT_ALIGNRIGHT; } if (variant == TextUtils.LINE_EDIT) { scrollAreaHandle = 0; topHandle = handle = OS.QLineEdit_new(); OS.QLineEdit_setAlignment(handle, alignment | OS.QT_ALIGNVCENTER); OS.QLineEdit_setMaxLength(handle, LIMIT); if ((style & SWT.PASSWORD) != 0) { OS.QLineEdit_setEchoMode(handle, OS.QLINEEDIT_ECHOMODE_PASSWORD); } } else { frameHandle = topHandle = scrollAreaHandle = OS.QTextEdit_new(); handle = OS.QAbstractScrollArea_viewPort(scrollAreaHandle); OS.QTextEdit_setAlignment(scrollAreaHandle, alignment); forceTextLayout(); } OS.QWidget_setGeometry(topHandle, 0, 0, 0, 0); state |= WidgetState.HANDLE; if ((style & SWT.READ_ONLY) != 0) { setEditable(false); } }