1 /**************************************************************************** |
|
2 ** |
|
3 ** Copyright (C) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). |
|
4 ** All rights reserved. |
|
5 ** Contact: Nokia Corporation (developer.feedback@nokia.com) |
|
6 ** |
|
7 ** This file is part of the HbInput module of the UI Extensions for Mobile. |
|
8 ** |
|
9 ** GNU Lesser General Public License Usage |
|
10 ** This file may be used under the terms of the GNU Lesser General Public |
|
11 ** License version 2.1 as published by the Free Software Foundation and |
|
12 ** appearing in the file LICENSE.LGPL included in the packaging of this file. |
|
13 ** Please review the following information to ensure the GNU Lesser General |
|
14 ** Public License version 2.1 requirements will be met: |
|
15 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
16 ** |
|
17 ** In addition, as a special exception, Nokia gives you certain additional |
|
18 ** rights. These rights are described in the Nokia Qt LGPL Exception |
|
19 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
20 ** |
|
21 ** If you have questions regarding the use of this file, please contact |
|
22 ** Nokia at developer.feedback@nokia.com. |
|
23 ** |
|
24 ****************************************************************************/ |
|
25 |
|
26 #ifndef HB_TOUCH_KEYPAD_BUTTON_H |
|
27 #define HB_TOUCH_KEYPAD_BUTTON_H |
|
28 |
|
29 #include <hbinputdef.h> // For HB_INPUT_EXPORT |
|
30 #include <hbpushbutton.h> |
|
31 |
|
32 class HbInputVkbWidget; |
|
33 class HbTouchKeypadButtonPrivate; |
|
34 class HbStyleOptionLabel; |
|
35 class HbFrameItem; |
|
36 |
|
37 class HB_INPUT_EXPORT HbTouchKeypadButton : public HbPushButton |
|
38 { |
|
39 Q_OBJECT |
|
40 Q_PROPERTY(int keyCode READ keyCode WRITE setKeyCode) |
|
41 |
|
42 public: |
|
43 enum HbTouchButtonType { |
|
44 HbTouchButtonNormal, |
|
45 HbTouchButtonFunction, |
|
46 HbTouchButtonNormalInActive, |
|
47 HbTouchButtonFnInActive |
|
48 }; |
|
49 |
|
50 enum HbTouchButtonState { |
|
51 HbTouchButtonReleased, |
|
52 HbTouchButtonPressed, |
|
53 HbTouchButtonLatched |
|
54 }; |
|
55 |
|
56 public: |
|
57 HbTouchKeypadButton(HbInputVkbWidget* owner, const QString &text, QGraphicsWidget *parent = 0); |
|
58 HbTouchKeypadButton(HbInputVkbWidget* owner, const HbIcon &icon, const QString &text, QGraphicsItem *parent = 0 ); |
|
59 virtual ~HbTouchKeypadButton(); |
|
60 |
|
61 int keyCode() const; |
|
62 void setKeyCode(int code); |
|
63 virtual void setText(const QString &text); |
|
64 virtual void setAdditionalText(const QString &additionalText); |
|
65 bool isFaded(); |
|
66 void setFade(bool fade); |
|
67 void setButtonType(HbTouchButtonType buttonType); |
|
68 int getButtonType(); |
|
69 HbFrameItem * getFrameIcon(); |
|
70 void setBackgroundAttributes(HbTouchButtonState buttonState); |
|
71 int type() const; |
|
72 void setFrameIcon(const QString& frameIconFileName); |
|
73 void setAsStickyButton(bool isSticky); |
|
74 bool isStickyButton() const; |
|
75 void setLatch(bool enable); |
|
76 bool isLatched() const; |
|
77 void setInitialSize(const QSizeF& initialSize); |
|
78 |
|
79 signals: |
|
80 void enteredInNonStickyRegion(); |
|
81 |
|
82 protected: |
|
83 void mousePressEvent(QGraphicsSceneMouseEvent *event); |
|
84 void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); |
|
85 void resizeEvent(QGraphicsSceneResizeEvent *event); |
|
86 void mouseMoveEvent(QGraphicsSceneMouseEvent *event); |
|
87 void gestureEvent(QGestureEvent *event); |
|
88 void setBackground(const QString& backgroundFrameFilename); |
|
89 virtual void changeEvent( QEvent *event ); |
|
90 virtual void updatePrimitives(); |
|
91 QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const; |
|
92 QVariant itemChange( GraphicsItemChange change, const QVariant & value ); |
|
93 |
|
94 protected: |
|
95 HbTouchKeypadButtonPrivate * const d_ptr; |
|
96 |
|
97 private: |
|
98 Q_DECLARE_PRIVATE_D(d_ptr, HbTouchKeypadButton) |
|
99 Q_DISABLE_COPY(HbTouchKeypadButton) |
|
100 }; |
|
101 |
|
102 #endif // HB_TOUCH_KEYPAD_BUTTON_H |
|
103 |
|
104 // End of file |
|
105 |
|