2011-04-27 12:13:26 +00:00
|
|
|
// Commit: 27e4302b7f45f22180693d26747f419177c81e27
|
|
|
|
/****************************************************************************
|
|
|
|
**
|
2012-01-05 04:29:18 +00:00
|
|
|
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
2011-04-27 12:13:26 +00:00
|
|
|
** All rights reserved.
|
|
|
|
** Contact: Nokia Corporation (qt-info@nokia.com)
|
|
|
|
**
|
|
|
|
** This file is part of the QtDeclarative module of the Qt Toolkit.
|
|
|
|
**
|
|
|
|
** $QT_BEGIN_LICENSE:LGPL$
|
|
|
|
** GNU Lesser General Public License Usage
|
2011-07-07 12:52:03 +00:00
|
|
|
** This file may be used under the terms of the GNU Lesser General Public
|
|
|
|
** License version 2.1 as published by the Free Software Foundation and
|
|
|
|
** appearing in the file LICENSE.LGPL included in the packaging of this
|
|
|
|
** file. Please review the following information to ensure the GNU Lesser
|
|
|
|
** General Public License version 2.1 requirements will be met:
|
|
|
|
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
2011-04-27 12:13:26 +00:00
|
|
|
**
|
|
|
|
** In addition, as a special exception, Nokia gives you certain additional
|
2011-07-07 12:52:03 +00:00
|
|
|
** rights. These rights are described in the Nokia Qt LGPL Exception
|
2011-04-27 12:13:26 +00:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
**
|
2011-07-07 12:52:03 +00:00
|
|
|
** GNU General Public License Usage
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU General
|
|
|
|
** Public License version 3.0 as published by the Free Software Foundation
|
|
|
|
** and appearing in the file LICENSE.GPL included in the packaging of this
|
|
|
|
** file. Please review the following information to ensure the GNU General
|
|
|
|
** Public License version 3.0 requirements will be met:
|
|
|
|
** http://www.gnu.org/copyleft/gpl.html.
|
2011-04-27 12:13:26 +00:00
|
|
|
**
|
2011-07-07 12:52:03 +00:00
|
|
|
** Other Usage
|
|
|
|
** Alternatively, this file may be used in accordance with the terms and
|
|
|
|
** conditions contained in a signed written agreement between you and Nokia.
|
2011-04-27 12:13:26 +00:00
|
|
|
**
|
|
|
|
**
|
|
|
|
**
|
|
|
|
**
|
|
|
|
**
|
|
|
|
** $QT_END_LICENSE$
|
|
|
|
**
|
|
|
|
****************************************************************************/
|
|
|
|
|
2011-10-14 08:51:42 +00:00
|
|
|
#ifndef QQUICKTEXTEDIT_P_P_H
|
|
|
|
#define QQUICKTEXTEDIT_P_P_H
|
2011-04-27 12:13:26 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// W A R N I N G
|
|
|
|
// -------------
|
|
|
|
//
|
|
|
|
// This file is not part of the Qt API. It exists purely as an
|
|
|
|
// implementation detail. This header file may change from version to
|
|
|
|
// version without notice, or even be removed.
|
|
|
|
//
|
|
|
|
// We mean it.
|
|
|
|
//
|
|
|
|
|
2011-10-14 08:51:42 +00:00
|
|
|
#include "qquicktextedit_p.h"
|
|
|
|
#include "qquickimplicitsizeitem_p_p.h"
|
2011-04-27 12:13:26 +00:00
|
|
|
|
|
|
|
#include <QtDeclarative/qdeclarative.h>
|
2011-08-30 11:17:00 +00:00
|
|
|
#include <QtGui/qpixmap.h>
|
2011-04-27 12:13:26 +00:00
|
|
|
|
|
|
|
QT_BEGIN_NAMESPACE
|
|
|
|
class QTextLayout;
|
2011-12-05 01:36:55 +00:00
|
|
|
class QQuickTextDocumentWithImageResources;
|
2011-11-10 04:58:17 +00:00
|
|
|
class QQuickTextControl;
|
2011-10-14 08:51:42 +00:00
|
|
|
class QQuickTextEditPrivate : public QQuickImplicitSizeItemPrivate
|
2011-04-27 12:13:26 +00:00
|
|
|
{
|
2011-10-14 08:51:42 +00:00
|
|
|
Q_DECLARE_PUBLIC(QQuickTextEdit)
|
2011-04-27 12:13:26 +00:00
|
|
|
|
|
|
|
public:
|
2011-10-14 08:51:42 +00:00
|
|
|
QQuickTextEditPrivate()
|
|
|
|
: color("black"), hAlign(QQuickTextEdit::AlignLeft), vAlign(QQuickTextEdit::AlignTop),
|
2011-06-01 07:45:55 +00:00
|
|
|
documentDirty(true), dirty(false), richText(false), cursorVisible(false), focusOnPress(true),
|
2011-09-28 13:56:36 +00:00
|
|
|
persistentSelection(true), requireImplicitWidth(false), selectByMouse(false), canPaste(false),
|
2011-12-20 07:21:55 +00:00
|
|
|
canPasteValid(false), hAlignImplicit(true), rightToLeftText(false), useImageFallback(false),
|
2012-01-11 01:00:36 +00:00
|
|
|
textCached(false),
|
2011-04-27 12:13:26 +00:00
|
|
|
textMargin(0.0), lastSelectionStart(0), lastSelectionEnd(0), cursorComponent(0), cursor(0),
|
2011-12-13 03:56:42 +00:00
|
|
|
format(QQuickTextEdit::PlainText), document(0), wrapMode(QQuickTextEdit::NoWrap),
|
2011-10-14 08:51:42 +00:00
|
|
|
mouseSelectionMode(QQuickTextEdit::SelectCharacters),
|
2011-09-16 11:47:08 +00:00
|
|
|
lineCount(0), yoff(0), nodeType(NodeIsNull), texture(0)
|
2011-04-27 12:13:26 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void init();
|
|
|
|
|
|
|
|
void updateDefaultTextOption();
|
|
|
|
void relayoutDocument();
|
|
|
|
bool determineHorizontalAlignment();
|
2011-10-14 08:51:42 +00:00
|
|
|
bool setHAlign(QQuickTextEdit::HAlignment, bool forceAlign = false);
|
2011-04-27 12:13:26 +00:00
|
|
|
void mirrorChange();
|
|
|
|
qreal getImplicitWidth() const;
|
|
|
|
|
|
|
|
QString text;
|
|
|
|
QFont font;
|
|
|
|
QFont sourceFont;
|
|
|
|
QColor color;
|
|
|
|
QColor selectionColor;
|
|
|
|
QColor selectedTextColor;
|
|
|
|
QString style;
|
|
|
|
QColor styleColor;
|
2011-10-14 08:51:42 +00:00
|
|
|
QQuickTextEdit::HAlignment hAlign;
|
|
|
|
QQuickTextEdit::VAlignment vAlign;
|
2011-04-27 12:13:26 +00:00
|
|
|
|
2011-06-01 07:45:55 +00:00
|
|
|
bool documentDirty : 1;
|
2011-04-27 12:13:26 +00:00
|
|
|
bool dirty : 1;
|
|
|
|
bool richText : 1;
|
|
|
|
bool cursorVisible : 1;
|
|
|
|
bool focusOnPress : 1;
|
|
|
|
bool persistentSelection : 1;
|
|
|
|
bool requireImplicitWidth:1;
|
|
|
|
bool selectByMouse:1;
|
|
|
|
bool canPaste:1;
|
2011-12-20 07:21:55 +00:00
|
|
|
bool canPasteValid:1;
|
2011-04-27 12:13:26 +00:00
|
|
|
bool hAlignImplicit:1;
|
|
|
|
bool rightToLeftText:1;
|
2011-09-19 14:46:38 +00:00
|
|
|
bool useImageFallback:1;
|
2012-01-11 01:00:36 +00:00
|
|
|
bool textCached:1;
|
2011-04-27 12:13:26 +00:00
|
|
|
|
|
|
|
qreal textMargin;
|
|
|
|
int lastSelectionStart;
|
|
|
|
int lastSelectionEnd;
|
|
|
|
QDeclarativeComponent* cursorComponent;
|
2011-10-14 08:51:42 +00:00
|
|
|
QQuickItem* cursor;
|
|
|
|
QQuickTextEdit::TextFormat format;
|
2011-12-05 01:36:55 +00:00
|
|
|
QQuickTextDocumentWithImageResources *document;
|
2011-11-10 04:58:17 +00:00
|
|
|
QQuickTextControl *control;
|
2011-10-14 08:51:42 +00:00
|
|
|
QQuickTextEdit::WrapMode wrapMode;
|
|
|
|
QQuickTextEdit::SelectionMode mouseSelectionMode;
|
2011-04-27 12:13:26 +00:00
|
|
|
int lineCount;
|
|
|
|
int yoff;
|
|
|
|
QSize paintedSize;
|
2011-06-01 07:45:55 +00:00
|
|
|
|
|
|
|
enum NodeType {
|
|
|
|
NodeIsNull,
|
|
|
|
NodeIsTexture,
|
|
|
|
NodeIsText
|
|
|
|
};
|
|
|
|
NodeType nodeType;
|
|
|
|
QSGTexture *texture;
|
|
|
|
QPixmap pixmapCache;
|
2011-04-27 12:13:26 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
QT_END_NAMESPACE
|
|
|
|
|
2011-10-14 08:51:42 +00:00
|
|
|
#endif // QQUICKTEXTEDIT_P_P_H
|