telutils/dialpad/inc/dialpadkeypad.h
changeset 39 cee7e9e0906c
parent 31 a2467631ae02
child 46 2fa1fa551b0b
--- a/telutils/dialpad/inc/dialpadkeypad.h	Tue Jul 06 14:53:02 2010 +0300
+++ b/telutils/dialpad/inc/dialpadkeypad.h	Wed Aug 18 10:19:22 2010 +0300
@@ -18,10 +18,13 @@
 #ifndef DIALPADKEYPAD_H
 #define DIALPADKEYPAD_H
 
+#include <QTextLayout>
+#include <QColor>
 #include <hbinputbuttongroup.h>
 
 class DialpadInputField;
 class DialpadButton;
+class DialpadNumericButton;
 class QSignalMapper;
 class QGraphicsGridLayout;
 
@@ -53,10 +56,44 @@
     void sendLongPressEvent(const QKeyEvent& event);
     void handleKeyChangeEvent(const QKeyEvent& releaseEvent,
                               const QKeyEvent& pressEvent);
+    void cancelButtonPress();
+
+protected:
+    void postKeyEvent(QEvent::Type type, int key);
+    void sendKeyEventToEditor(QEvent::Type type, int key);
+
+    inline DialpadNumericButton* button(int i) const;
+    void updateButtonLabels();
+    void updateColorArray();
+    void updateIconColor();
+    void updateTextLayouts(const QSizeF &size);
+    void resolveTextContent(QList<QString> &content);
+    void createTextLayouts(const QSizeF &size,
+                           const QList<QString> &content);
+    void layoutTextLines(const QSizeF &size,
+                         QTextLayout &textLayout,
+                         int state,
+                         int type);
+
+protected:
+    void paint(QPainter* painter,
+               const QStyleOptionGraphicsItem* option,
+               QWidget* widget);
+    void setGeometry(const QRectF &rect);
+    void changeEvent(QEvent *event);
 
 private:
-    void postKeyEvent(QEvent::Type type, int key);
-    void sendKeyEventToEditor(QEvent::Type type, int key);
+    enum ButtonState {
+        Normal = 0,
+        Pressed,
+        StateCount
+    };
+
+    enum TextType {
+        PrimaryText = 0,
+        SecondaryText,
+        TextTypeCount
+    };
 
 private:
     const HbMainWindow& mMainWindow;
@@ -65,6 +102,10 @@
     QMap<int,QChar> mGeneratedChar;
     int mPressedNumericKey;
     DialpadButton* mCallButton;
+    QList<QColor> mColors;
+    QList<QTextLayout*> mTextLayouts;
+    qreal mUnit;
+    qreal mMaxPrimaryLineWidth;
 };
 
 #endif // DIALPADKEYPAD_H