src/hbinput/inputwidgets/hbinputbutton.cpp
changeset 6 c3690ec91ef8
parent 2 06ff229162e9
child 7 923ff622b8b9
equal deleted inserted replaced
5:627c4a0fd0e7 6:c3690ec91ef8
    49     QList<HbIcon> mIcons;
    49     QList<HbIcon> mIcons;
    50     QRectF mBoundingRect;
    50     QRectF mBoundingRect;
    51 };
    51 };
    52 
    52 
    53 HbInputButtonPrivate::HbInputButtonPrivate()
    53 HbInputButtonPrivate::HbInputButtonPrivate()
    54  : mType(HbInputButton::ButtonTypeNormal), mState(HbInputButton::ButtonStateReleased),
    54     : mType(HbInputButton::ButtonTypeNormal), mState(HbInputButton::ButtonStateReleased),
    55    mPosition(0, 0), mSize(1, 1), mKeyCode(-1), mAutoRepeat(false)
    55       mPosition(0, 0), mSize(1, 1), mKeyCode(-1), mAutoRepeat(false)
    56 {
    56 {
    57     for (int i = 0; i < HbInputButton::ButtonTextIndexCount; ++i) {
    57     for (int i = 0; i < HbInputButton::ButtonTextIndexCount; ++i) {
    58         mTexts.append("");
    58         mTexts.append("");
    59     }
    59     }
    60 
    60 
    62         mIcons.append(HbIcon());
    62         mIcons.append(HbIcon());
    63     }
    63     }
    64 }
    64 }
    65 
    65 
    66 HbInputButtonPrivate::HbInputButtonPrivate(int keyCode, const QPoint &position, const QSize &size)
    66 HbInputButtonPrivate::HbInputButtonPrivate(int keyCode, const QPoint &position, const QSize &size)
    67  : mType(HbInputButton::ButtonTypeNormal), mState(HbInputButton::ButtonStateReleased),
    67     : mType(HbInputButton::ButtonTypeNormal), mState(HbInputButton::ButtonStateReleased),
    68    mPosition(position), mSize(size), mKeyCode(keyCode), mAutoRepeat(false)
    68       mPosition(position), mSize(size), mKeyCode(keyCode), mAutoRepeat(false)
    69 {
    69 {
    70     for (int i = 0; i < HbInputButton::ButtonTextIndexCount; ++i) {
    70     for (int i = 0; i < HbInputButton::ButtonTextIndexCount; ++i) {
    71         mTexts.append("");
    71         mTexts.append("");
    72     }
    72     }
    73 
    73 
    92         mAutoRepeat = true;
    92         mAutoRepeat = true;
    93     }
    93     }
    94 }
    94 }
    95 
    95 
    96 HbInputButtonPrivate::HbInputButtonPrivate(HbInputButton::HbInputButtonType type, HbInputButton::HbInputButtonState state,
    96 HbInputButtonPrivate::HbInputButtonPrivate(HbInputButton::HbInputButtonType type, HbInputButton::HbInputButtonState state,
    97                                            const QPoint &position, const QSize &size, int keyCode, bool autoRepeat,
    97         const QPoint &position, const QSize &size, int keyCode, bool autoRepeat,
    98                                            const QList<QString> &texts, const QString &mappedCharacters, const QList<HbIcon> &icons)
    98         const QList<QString> &texts, const QString &mappedCharacters, const QList<HbIcon> &icons)
    99  : mType(type), mState(state), mPosition(position), mSize(size), mKeyCode(keyCode), mAutoRepeat(autoRepeat),
    99     : mType(type), mState(state), mPosition(position), mSize(size), mKeyCode(keyCode), mAutoRepeat(autoRepeat),
   100    mMappedCharacters(mappedCharacters)
   100       mMappedCharacters(mappedCharacters)
   101 {
   101 {
   102     for (int i = 0; i < HbInputButton::ButtonTextIndexCount; ++i) {
   102     for (int i = 0; i < HbInputButton::ButtonTextIndexCount; ++i) {
   103         if (i < texts.count()) {
   103         if (i < texts.count()) {
   104             mTexts.append(texts.at(i));
   104             mTexts.append(texts.at(i));
   105         } else {
   105         } else {
   148 
   148 
   149 /*!
   149 /*!
   150 Constructor
   150 Constructor
   151 */
   151 */
   152 HbInputButton::HbInputButton()
   152 HbInputButton::HbInputButton()
   153  : d_ptr(new HbInputButtonPrivate)
   153     : d_ptr(new HbInputButtonPrivate)
   154 {
   154 {
   155 }
   155 }
   156 
   156 
   157 /*!
   157 /*!
   158 Constructor
   158 Constructor
   161 integer value.
   161 integer value.
   162 position is button's position in grid cell units.
   162 position is button's position in grid cell units.
   163 size is button's size in grid cell units.
   163 size is button's size in grid cell units.
   164 */
   164 */
   165 HbInputButton::HbInputButton(int keyCode, const QPoint &position, const QSize &size)
   165 HbInputButton::HbInputButton(int keyCode, const QPoint &position, const QSize &size)
   166  : d_ptr(new HbInputButtonPrivate(keyCode, position, size))
   166     : d_ptr(new HbInputButtonPrivate(keyCode, position, size))
   167 {
   167 {
   168 }
   168 }
   169 
   169 
   170 /*!
   170 /*!
   171 Destructor
   171 Destructor
   355 
   355 
   356     for (int i = 0; i < ButtonTextIndexCount; ++i) {
   356     for (int i = 0; i < ButtonTextIndexCount; ++i) {
   357         if (i < texts.count()) {
   357         if (i < texts.count()) {
   358             d->mTexts.replace(i, texts.at(i));
   358             d->mTexts.replace(i, texts.at(i));
   359         } else {
   359         } else {
   360             d->mTexts.replace(i, QString());
   360             d->mTexts[i].clear();
   361         }
   361         }
   362     }
   362     }
   363 }
   363 }
   364 
   364 
   365 /*!
   365 /*!
   432     }
   432     }
   433 }
   433 }
   434 
   434 
   435 /*!
   435 /*!
   436 Updates all button icons.
   436 Updates all button icons.
   437 Button can have three different icons. Icon position 
   437 Button can have three different icons. Icon position
   438 will depend of other buttons icons and texts. If list contains
   438 will depend of other buttons icons and texts. If list contains
   439 more icons, then the rest will be ignored. Icon with same index
   439 more icons, then the rest will be ignored. Icon with same index
   440 than text will override the text.
   440 than text will override the text.
   441 
   441 
   442 \sa icon
   442 \sa icon