Enablers for using QGlyphRun in SceneGraph
[profile/ivi/qtbase.git] / src / gui / widgets / qlinecontrol_p.h
index 6918b83..d4c4154 100644 (file)
@@ -7,29 +7,29 @@
 ** This file is part of the QtGui module of the Qt Toolkit.
 **
 ** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
 ** GNU Lesser General Public License Usage
-** Alternatively, 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.
+** 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.
 **
 ** In addition, as a special exception, Nokia gives you certain additional
-** rights.  These rights are described in the Nokia Qt LGPL Exception
+** rights. These rights are described in the Nokia Qt LGPL Exception
 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
 **
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
+** 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.
 **
+** 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.
 **
 **
 **
 #include "QtGui/qtextlayout.h"
 #include "QtGui/qstyleoption.h"
 #include "QtCore/qpointer.h"
-#include "QtGui/qlineedit.h"
 #include "QtGui/qclipboard.h"
 #include "QtCore/qpoint.h"
 #include "QtGui/qcompleter.h"
+#include "QtGui/qaccessible.h"
+#include "QtCore/qthread.h"
+
+#include "qplatformdefs.h"
 
 QT_BEGIN_HEADER
 
@@ -85,6 +88,13 @@ public:
         m_ascent(0), m_maxLength(32767), m_lastCursorPos(-1),
         m_tripleClickTimer(0), m_maskData(0), m_modifiedState(0), m_undoState(0),
         m_selstart(0), m_selend(0), m_passwordEchoEditing(false)
+#ifdef QT_GUI_PASSWORD_ECHO_DELAY
+        , m_passwordEchoTimer(0)
+#endif
+#if defined(Q_WS_MAC)
+        , m_threadChecks(false)
+        , m_textLayoutThread(0)
+ #endif
     {
         init(txt);
     }
@@ -222,6 +232,7 @@ public:
     uint echoMode() const { return m_echoMode; }
     void setEchoMode(uint mode)
     {
+        cancelPasswordEchoTimer();
         m_echoMode = mode;
         m_passwordEchoEditing = false;
         updateDisplayText();
@@ -271,7 +282,13 @@ public:
     QString preeditAreaText() const { return m_textLayout.preeditAreaText(); }
 
     void updatePasswordEchoEditing(bool editing);
-    bool passwordEchoEditing() const { return m_passwordEchoEditing; }
+    bool passwordEchoEditing() const {
+#ifdef QT_GUI_PASSWORD_ECHO_DELAY
+        if (m_passwordEchoTimer != 0)
+            return true;
+#endif
+        return m_passwordEchoEditing ;
+    }
 
     QChar passwordCharacter() const { return m_passwordCharacter; }
     void setPasswordCharacter(const QChar &character) { m_passwordCharacter = character; updateDisplayText(); }
@@ -302,6 +319,8 @@ public:
     void setCursorBlinkPeriod(int msec);
     void resetCursorBlinkTimer();
 
+    bool cursorBlinkStatus() const { return m_blinkStatus; }
+
     QString cancelText() const { return m_cancelText; }
     void setCancelText(const QString &text) { m_cancelText = text; }
 
@@ -318,6 +337,27 @@ public:
 
     bool processEvent(QEvent *ev);
 
+    QTextLayout *textLayout() const
+    {
+#if defined(Q_WS_MAC)
+        if (m_threadChecks && QThread::currentThread() != m_textLayoutThread)
+            redoTextLayout();
+#endif
+        return &m_textLayout;
+    }
+
+#if defined(Q_WS_MAC)
+    void setThreadChecks(bool threadChecks)
+    {
+        m_threadChecks = threadChecks;
+    }
+
+    bool threadChecks() const
+    {
+        return m_threadChecks;
+    }
+#endif
+
 private:
     void init(const QString &txt);
     void removeSelectedText();
@@ -414,11 +454,29 @@ private:
     QString stripString(const QString &str) const;
     int findInMask(int pos, bool forward, bool findSeparator, QChar searchChar = QChar()) const;
 
-    // complex text layout
-    QTextLayout m_textLayout;
+    // complex text layout (must be mutable so it can be reshaped at will)
+    mutable QTextLayout m_textLayout;
 
     bool m_passwordEchoEditing;
     QChar m_passwordCharacter;
+#ifdef QT_GUI_PASSWORD_ECHO_DELAY
+    int m_passwordEchoTimer;
+#endif
+    void cancelPasswordEchoTimer()
+    {
+#ifdef QT_GUI_PASSWORD_ECHO_DELAY
+        if (m_passwordEchoTimer != 0) {
+            killTimer(m_passwordEchoTimer);
+            m_passwordEchoTimer = 0;
+        }
+#endif
+    }
+
+    int redoTextLayout() const;
+#if defined(Q_WS_MAC)
+    bool m_threadChecks;
+    mutable QThread *m_textLayoutThread;
+#endif
 
 Q_SIGNALS:
     void cursorPositionChanged(int, int);