~saviq/ubuntu/saucy/qtdeclarative-opensource-src/add-qtquick-delegate-range

« back to all changes in this revision

Viewing changes to src/quick/items/qquicktextedit_p_p.h

  • Committer: Package Import Robot
  • Author(s): Timo Jyrinki
  • Date: 2013-02-05 14:17:19 UTC
  • Revision ID: package-import@ubuntu.com-20130205141719-qqeyml8wslpyez52
Tags: upstream-5.0.1
ImportĀ upstreamĀ versionĀ 5.0.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/****************************************************************************
 
2
**
 
3
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
 
4
** Contact: http://www.qt-project.org/legal
 
5
**
 
6
** This file is part of the QtQml module of the Qt Toolkit.
 
7
**
 
8
** $QT_BEGIN_LICENSE:LGPL$
 
9
** Commercial License Usage
 
10
** Licensees holding valid commercial Qt licenses may use this file in
 
11
** accordance with the commercial license agreement provided with the
 
12
** Software or, alternatively, in accordance with the terms contained in
 
13
** a written agreement between you and Digia.  For licensing terms and
 
14
** conditions see http://qt.digia.com/licensing.  For further information
 
15
** use the contact form at http://qt.digia.com/contact-us.
 
16
**
 
17
** GNU Lesser General Public License Usage
 
18
** Alternatively, this file may be used under the terms of the GNU Lesser
 
19
** General Public License version 2.1 as published by the Free Software
 
20
** Foundation and appearing in the file LICENSE.LGPL included in the
 
21
** packaging of this file.  Please review the following information to
 
22
** ensure the GNU Lesser General Public License version 2.1 requirements
 
23
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
 
24
**
 
25
** In addition, as a special exception, Digia gives you certain additional
 
26
** rights.  These rights are described in the Digia Qt LGPL Exception
 
27
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
 
28
**
 
29
** GNU General Public License Usage
 
30
** Alternatively, this file may be used under the terms of the GNU
 
31
** General Public License version 3.0 as published by the Free Software
 
32
** Foundation and appearing in the file LICENSE.GPL included in the
 
33
** packaging of this file.  Please review the following information to
 
34
** ensure the GNU General Public License version 3.0 requirements will be
 
35
** met: http://www.gnu.org/copyleft/gpl.html.
 
36
**
 
37
**
 
38
** $QT_END_LICENSE$
 
39
**
 
40
****************************************************************************/
 
41
 
 
42
#ifndef QQUICKTEXTEDIT_P_P_H
 
43
#define QQUICKTEXTEDIT_P_P_H
 
44
 
 
45
//
 
46
//  W A R N I N G
 
47
//  -------------
 
48
//
 
49
// This file is not part of the Qt API.  It exists purely as an
 
50
// implementation detail.  This header file may change from version to
 
51
// version without notice, or even be removed.
 
52
//
 
53
// We mean it.
 
54
//
 
55
 
 
56
#include "qquicktextedit_p.h"
 
57
#include "qquickimplicitsizeitem_p_p.h"
 
58
#include "qquicktextcontrol_p.h"
 
59
 
 
60
#include <QtQml/qqml.h>
 
61
 
 
62
QT_BEGIN_NAMESPACE
 
63
class QTextLayout;
 
64
class QQuickTextDocumentWithImageResources;
 
65
class QQuickTextControl;
 
66
class QQuickTextEditPrivate : public QQuickImplicitSizeItemPrivate
 
67
{
 
68
public:
 
69
    Q_DECLARE_PUBLIC(QQuickTextEdit)
 
70
 
 
71
    typedef QQuickTextEdit Public;
 
72
 
 
73
    QQuickTextEditPrivate()
 
74
        : color(QRgb(0xFF000000)), selectionColor(QRgb(0xFF000080)), selectedTextColor(QRgb(0xFFFFFFFF))
 
75
        , textMargin(0.0), xoff(0), yoff(0), font(sourceFont), cursorComponent(0), cursorItem(0), document(0), control(0)
 
76
        , lastSelectionStart(0), lastSelectionEnd(0), lineCount(0)
 
77
        , hAlign(QQuickTextEdit::AlignLeft), vAlign(QQuickTextEdit::AlignTop)
 
78
        , format(QQuickTextEdit::PlainText), wrapMode(QQuickTextEdit::NoWrap)
 
79
        , renderType(QQuickTextEdit::QtRendering)
 
80
        , contentDirection(Qt::LayoutDirectionAuto)
 
81
        , mouseSelectionMode(QQuickTextEdit::SelectCharacters)
 
82
#ifndef QT_NO_IM
 
83
        , inputMethodHints(Qt::ImhNone)
 
84
#endif
 
85
        , updateType(UpdatePaintNode)
 
86
        , documentDirty(true), dirty(false), richText(false), cursorVisible(false), cursorPending(false)
 
87
        , focusOnPress(true), persistentSelection(false), requireImplicitWidth(false)
 
88
        , selectByMouse(false), canPaste(false), canPasteValid(false), hAlignImplicit(true)
 
89
        , textCached(true), inLayout(false)
 
90
    {
 
91
    }
 
92
 
 
93
    static QQuickTextEditPrivate *get(QQuickTextEdit *item) {
 
94
        return static_cast<QQuickTextEditPrivate *>(QObjectPrivate::get(item)); }
 
95
 
 
96
    void init();
 
97
 
 
98
    void updateDefaultTextOption();
 
99
    void relayoutDocument();
 
100
    bool determineHorizontalAlignment();
 
101
    bool setHAlign(QQuickTextEdit::HAlignment, bool forceAlign = false);
 
102
    void mirrorChange();
 
103
    qreal getImplicitWidth() const;
 
104
    Qt::LayoutDirection textDirection(const QString &text) const;
 
105
 
 
106
    void setNativeCursorEnabled(bool enabled) { control->setCursorWidth(enabled ? 1 : 0); }
 
107
 
 
108
    QColor color;
 
109
    QColor selectionColor;
 
110
    QColor selectedTextColor;
 
111
 
 
112
    QSizeF contentSize;
 
113
 
 
114
    qreal textMargin;
 
115
    qreal xoff;
 
116
    qreal yoff;
 
117
 
 
118
    QString text;
 
119
    QUrl baseUrl;
 
120
    QFont sourceFont;
 
121
    QFont font;
 
122
 
 
123
    QQmlComponent* cursorComponent;
 
124
    QQuickItem* cursorItem;
 
125
    QQuickTextDocumentWithImageResources *document;
 
126
    QQuickTextControl *control;
 
127
 
 
128
    int lastSelectionStart;
 
129
    int lastSelectionEnd;
 
130
    int lineCount;
 
131
 
 
132
    enum UpdateType {
 
133
        UpdateNone,
 
134
        UpdateOnlyPreprocess,
 
135
        UpdatePaintNode
 
136
    };
 
137
 
 
138
    QQuickTextEdit::HAlignment hAlign;
 
139
    QQuickTextEdit::VAlignment vAlign;
 
140
    QQuickTextEdit::TextFormat format;
 
141
    QQuickTextEdit::WrapMode wrapMode;
 
142
    QQuickTextEdit::RenderType renderType;
 
143
    Qt::LayoutDirection contentDirection;
 
144
    QQuickTextEdit::SelectionMode mouseSelectionMode;
 
145
#ifndef QT_NO_IM
 
146
    Qt::InputMethodHints inputMethodHints;
 
147
#endif
 
148
    UpdateType updateType;
 
149
 
 
150
    bool documentDirty : 1;
 
151
    bool dirty : 1;
 
152
    bool richText : 1;
 
153
    bool cursorVisible : 1;
 
154
    bool cursorPending : 1;
 
155
    bool focusOnPress : 1;
 
156
    bool persistentSelection : 1;
 
157
    bool requireImplicitWidth:1;
 
158
    bool selectByMouse:1;
 
159
    bool canPaste:1;
 
160
    bool canPasteValid:1;
 
161
    bool hAlignImplicit:1;
 
162
    bool textCached:1;
 
163
    bool inLayout:1;
 
164
};
 
165
 
 
166
QT_END_NAMESPACE
 
167
 
 
168
#endif // QQUICKTEXTEDIT_P_P_H