telutils/dialpad/inc/dialpadkeypad.h
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Fri, 17 Sep 2010 08:33:29 +0300
changeset 50 2313cb430f28
parent 39 cee7e9e0906c
permissions -rw-r--r--
Revision: 201035 Kit: 201037

/*!
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description: Number grid and dial key.
*
*/

#ifndef DIALPADKEYPAD_H
#define DIALPADKEYPAD_H

#include <hbwidget.h>

class DialpadInputField;
class DialpadButton;
class DialpadNumericButtonGrid;
class QSignalMapper;

class DialpadKeypad : public HbWidget
{
    Q_OBJECT

public:
    explicit DialpadKeypad(
        const HbMainWindow& mainWindow,
        DialpadInputField& inputField,
        QGraphicsItem* parent=0);

    ~DialpadKeypad();

public:
    bool isCallButtonEnabled() const;

    void setCallButtonEnabled(bool enabled);

    void resetButtons();

protected slots:
    void handleKeyClicked(int key);
    void sendKeyPressEvent(const QKeyEvent& event);
    void sendKeyReleaseEvent(const QKeyEvent& event);
    void sendLongPressEvent(const QKeyEvent& event);
    void handleKeyChangeEvent(const QKeyEvent& releaseEvent,
                              const QKeyEvent& pressEvent);

protected:
    void postKeyEvent(QEvent::Type type, int key);
    void sendKeyEventToEditor(QEvent::Type type, int key);

protected:
    void setGeometry(const QRectF &rect);

private:
    const HbMainWindow& mMainWindow;
    DialpadInputField& mInputField;
    QSignalMapper* mKeyClickedSignalMapper;
    int mPressedNumericKey;
    DialpadButton* mCallButton;
    DialpadNumericButtonGrid* mNumericButtonGrid;
};

#endif // DIALPADKEYPAD_H