|
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_INPUT_BUTTON_H |
|
27 #define HB_INPUT_BUTTON_H |
|
28 |
|
29 #include <QObject> |
|
30 #include <QPoint> |
|
31 #include <QSize> |
|
32 #include <QString> |
|
33 |
|
34 #include <hbicon.h> |
|
35 #include <hbinputdef.h> |
|
36 |
|
37 class HbInputButtonPrivate; |
|
38 |
|
39 const QString HbInputButtonIconDelete("qtg_mono_backspace1"); |
|
40 const QString HbInputButtonIconDelete2("qtg_mono_backspace2"); |
|
41 const QString HbInputButtonIconShift("qtg_mono_shift"); |
|
42 const QString HbInputButtonIconSymbol("qtg_mono_sym_qwerty"); |
|
43 const QString HbInputButtonIconSymbol2("qtg_mono_sym_itut"); |
|
44 const QString HbInputButtonIconEnter("qtg_mono_enter"); |
|
45 const QString HbInputButtonIconSpace("qtg_mono_space_vkb"); |
|
46 const QString HbInputButtonIconSpace2("qtg_mono_space_itut"); |
|
47 const QString HbInputButtonIconAlphabet("qtg_mono_alpha_mode"); |
|
48 const QString HbInputButtonIconPageChange("qtg_mono_special_characters_qwerty"); |
|
49 const QString HbInputButtonIconPageChange2("qtg_mono_special_characters_itut"); |
|
50 const QString HbInputButtonIconSmiley("qtg_mono_smiley"); |
|
51 |
|
52 class HB_INPUT_EXPORT HbInputButton : public QObject |
|
53 { |
|
54 Q_OBJECT |
|
55 |
|
56 Q_ENUMS(HbInputButtonType ButtonType) |
|
57 Q_ENUMS(HbInputButtonState ButtonState) |
|
58 Q_PROPERTY(HbInputButton::HbInputButtonType buttonType READ type WRITE setType) |
|
59 Q_PROPERTY(HbInputButton::HbInputButtonState buttonState READ state WRITE setState) |
|
60 Q_PROPERTY(QPoint position READ position WRITE setPosition) |
|
61 Q_PROPERTY(QSize size READ size WRITE setSize) |
|
62 Q_PROPERTY(int keyCode READ keyCode WRITE setKeyCode) |
|
63 Q_PROPERTY(bool autoRepeat READ autoRepeat WRITE setAutoRepeat) |
|
64 Q_PROPERTY(QList<QString> texts READ texts WRITE setTexts) |
|
65 Q_PROPERTY(QString mappedCharacters READ mappedCharacters WRITE setMappedCharacters) |
|
66 Q_PROPERTY(QList<HbIcon> icons READ icons WRITE setIcons) |
|
67 Q_PROPERTY(QRectF boundingRect READ boundingRect WRITE setBoundingRect) |
|
68 |
|
69 public: |
|
70 enum HbInputButtonKeyCode { |
|
71 ButtonKeyCodeDelete = Qt::Key_Delete, |
|
72 ButtonKeyCodeSpace = Qt::Key_Space, |
|
73 ButtonKeyCodeAsterisk = Qt::Key_Asterisk, |
|
74 ButtonKeyCodeShift = Qt::Key_Shift, |
|
75 ButtonKeyCodeControl = Qt::Key_Control, |
|
76 ButtonKeyCodeEnter = Qt::Key_Enter, |
|
77 ButtonKeyCodeCharacter = Qt::Key_unknown + 1, |
|
78 ButtonKeyCodeSymbol, |
|
79 ButtonKeyCodeAlphabet, |
|
80 ButtonKeyCodeSmiley, |
|
81 ButtonKeyCodePageChange, |
|
82 ButtonKeyCodeSettings, |
|
83 ButtonKeyCodeCustom |
|
84 }; |
|
85 |
|
86 enum HbInputButtonType { |
|
87 ButtonTypeNormal, |
|
88 ButtonTypeFunction, |
|
89 ButtonTypeLabel, |
|
90 ButtonTypeCount |
|
91 }; |
|
92 |
|
93 enum HbInputButtonState { |
|
94 ButtonStateReleased, |
|
95 ButtonStatePressed, |
|
96 ButtonStateLatched, |
|
97 ButtonStateDisabled, |
|
98 ButtonStateCount |
|
99 }; |
|
100 |
|
101 enum HbInputButtonTextIndex { |
|
102 ButtonTextIndexPrimary, |
|
103 ButtonTextIndexSecondaryFirstRow, |
|
104 ButtonTextIndexSecondarySecondRow, |
|
105 ButtonTextIndexCount |
|
106 }; |
|
107 |
|
108 enum HbInputButtonIconIndex { |
|
109 ButtonIconIndexPrimary, |
|
110 ButtonIconIndexSecondaryFirstRow, |
|
111 ButtonIconIndexSecondarySecondRow, |
|
112 ButtonIconIndexCount |
|
113 }; |
|
114 |
|
115 HbInputButton(); |
|
116 HbInputButton(int keyCode, const QPoint &position, const QSize &size = QSize(1, 1)); |
|
117 |
|
118 ~HbInputButton(); |
|
119 |
|
120 void setType(HbInputButtonType type); |
|
121 HbInputButtonType type() const; |
|
122 |
|
123 void setState(HbInputButtonState state); |
|
124 HbInputButtonState state() const; |
|
125 |
|
126 void setPosition(const QPoint &position); |
|
127 QPoint position() const; |
|
128 |
|
129 void setSize(const QSize &size); |
|
130 QSize size() const; |
|
131 |
|
132 void setKeyCode(int keyCode); |
|
133 int keyCode() const; |
|
134 |
|
135 void setAutoRepeat(bool autoRepeat); |
|
136 bool autoRepeat() const; |
|
137 |
|
138 void setText(const QString &text, HbInputButtonTextIndex index); |
|
139 void setTexts(const QList<QString> &texts); |
|
140 QString text(HbInputButtonTextIndex index) const; |
|
141 QList<QString> texts() const; |
|
142 |
|
143 void setMappedCharacters(const QString &mappedCharacters); |
|
144 QString mappedCharacters() const; |
|
145 |
|
146 void setIcon(const HbIcon &icon, HbInputButtonIconIndex index); |
|
147 void setIcons(const QList<HbIcon> &icons); |
|
148 HbIcon icon(HbInputButtonIconIndex index) const; |
|
149 QList<HbIcon> icons() const; |
|
150 |
|
151 void setBoundingRect(const QRectF &rect); |
|
152 QRectF boundingRect() const; |
|
153 |
|
154 protected: |
|
155 HbInputButtonPrivate * const d_ptr; |
|
156 |
|
157 private: |
|
158 Q_DECLARE_PRIVATE_D(d_ptr, HbInputButton) |
|
159 Q_DISABLE_COPY(HbInputButton) |
|
160 }; |
|
161 |
|
162 #endif // HB_INPUT_BUTTON_H |
|
163 |
|
164 // End of file |