telutils/dialpad/inc/dialpadkeypad.h
changeset 39 cee7e9e0906c
parent 31 a2467631ae02
child 46 2fa1fa551b0b
equal deleted inserted replaced
32:1f002146abb4 39:cee7e9e0906c
    16 */
    16 */
    17 
    17 
    18 #ifndef DIALPADKEYPAD_H
    18 #ifndef DIALPADKEYPAD_H
    19 #define DIALPADKEYPAD_H
    19 #define DIALPADKEYPAD_H
    20 
    20 
       
    21 #include <QTextLayout>
       
    22 #include <QColor>
    21 #include <hbinputbuttongroup.h>
    23 #include <hbinputbuttongroup.h>
    22 
    24 
    23 class DialpadInputField;
    25 class DialpadInputField;
    24 class DialpadButton;
    26 class DialpadButton;
       
    27 class DialpadNumericButton;
    25 class QSignalMapper;
    28 class QSignalMapper;
    26 class QGraphicsGridLayout;
    29 class QGraphicsGridLayout;
    27 
    30 
    28 class DialpadKeypad : public HbInputButtonGroup
    31 class DialpadKeypad : public HbInputButtonGroup
    29 {
    32 {
    51     void sendKeyPressEvent(const QKeyEvent& event);
    54     void sendKeyPressEvent(const QKeyEvent& event);
    52     void sendKeyReleaseEvent(const QKeyEvent& event);
    55     void sendKeyReleaseEvent(const QKeyEvent& event);
    53     void sendLongPressEvent(const QKeyEvent& event);
    56     void sendLongPressEvent(const QKeyEvent& event);
    54     void handleKeyChangeEvent(const QKeyEvent& releaseEvent,
    57     void handleKeyChangeEvent(const QKeyEvent& releaseEvent,
    55                               const QKeyEvent& pressEvent);
    58                               const QKeyEvent& pressEvent);
       
    59     void cancelButtonPress();
       
    60 
       
    61 protected:
       
    62     void postKeyEvent(QEvent::Type type, int key);
       
    63     void sendKeyEventToEditor(QEvent::Type type, int key);
       
    64 
       
    65     inline DialpadNumericButton* button(int i) const;
       
    66     void updateButtonLabels();
       
    67     void updateColorArray();
       
    68     void updateIconColor();
       
    69     void updateTextLayouts(const QSizeF &size);
       
    70     void resolveTextContent(QList<QString> &content);
       
    71     void createTextLayouts(const QSizeF &size,
       
    72                            const QList<QString> &content);
       
    73     void layoutTextLines(const QSizeF &size,
       
    74                          QTextLayout &textLayout,
       
    75                          int state,
       
    76                          int type);
       
    77 
       
    78 protected:
       
    79     void paint(QPainter* painter,
       
    80                const QStyleOptionGraphicsItem* option,
       
    81                QWidget* widget);
       
    82     void setGeometry(const QRectF &rect);
       
    83     void changeEvent(QEvent *event);
    56 
    84 
    57 private:
    85 private:
    58     void postKeyEvent(QEvent::Type type, int key);
    86     enum ButtonState {
    59     void sendKeyEventToEditor(QEvent::Type type, int key);
    87         Normal = 0,
       
    88         Pressed,
       
    89         StateCount
       
    90     };
       
    91 
       
    92     enum TextType {
       
    93         PrimaryText = 0,
       
    94         SecondaryText,
       
    95         TextTypeCount
       
    96     };
    60 
    97 
    61 private:
    98 private:
    62     const HbMainWindow& mMainWindow;
    99     const HbMainWindow& mMainWindow;
    63     DialpadInputField& mInputField;
   100     DialpadInputField& mInputField;
    64     QSignalMapper* mKeyClickedSignalMapper;
   101     QSignalMapper* mKeyClickedSignalMapper;
    65     QMap<int,QChar> mGeneratedChar;
   102     QMap<int,QChar> mGeneratedChar;
    66     int mPressedNumericKey;
   103     int mPressedNumericKey;
    67     DialpadButton* mCallButton;
   104     DialpadButton* mCallButton;
       
   105     QList<QColor> mColors;
       
   106     QList<QTextLayout*> mTextLayouts;
       
   107     qreal mUnit;
       
   108     qreal mMaxPrimaryLineWidth;
    68 };
   109 };
    69 
   110 
    70 #endif // DIALPADKEYPAD_H
   111 #endif // DIALPADKEYPAD_H