messagingapp/msgui/conversationview/inc/msgconversationviewitem.h
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Mon, 03 May 2010 12:29:07 +0300
changeset 25 84d9eb65b26f
parent 23 238255e8b033
child 27 e4592d119491
child 37 518b245aa84c
permissions -rw-r--r--
Revision: 201015 Kit: 201018

/*
 * 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:Message chat View decorator item prototype
 *
 */

#ifndef MSG_CONVERSATION_VIEW_ITEM_H
#define MSG_CONVERSATION_VIEW_ITEM_H

// INCLUDES
#include <HbListViewItem>

//Forward Declarations
class MsgConversationWidget;
class HbTextItem;
class HbIconItem;

/**
 * This class represents the item decorator of 
 * the conversation view.  
 */
class MsgConversationViewItem : public HbListViewItem
{
Q_OBJECT

    Q_PROPERTY(bool isIncoming READ isIncoming WRITE setIncoming)

public:
    /**
     * Constructor
     * @param parent, reference of QGraphicsItem
     * default set to 0
     */
    MsgConversationViewItem(QGraphicsItem* parent = 0);
    
    /**
     * Destructor
     */
    virtual ~MsgConversationViewItem();

    /**
     * Factory method to the items
     */
    virtual MsgConversationViewItem* createItem();

    /**
     * Overridden method to draw the custom item in the list view
     */
    void updateChildItems();

    /**
     * Checks if point in question is within bubble frame or not.
     * @param point, point to be checked.
     * @return returns true is point is within bubble frame geometry.
     */
    bool containsPoint(const QPointF& point);

    /**
     * Specify if this widget's message is incoming
     * @param incoming
     */
    void setIncoming(bool incoming = true);

    /**
     * Get to find if this is incoming message
     * @return bool
     */
    bool isIncoming();

private:

    /**
     * Set the Icon that displays the message state.
     */
    void setMessageStateIcon(int messageState);

    /**
     * Set the Icon that displays the message notification state.
     */
    void setNotificationStateIcon(int notificationState);

protected:

    /**
     * Reimplemented from HbAbstractViewItem.
     * This function is called whenever item press state changes.
     * @see HbAbstractViewItem::pressStateChanged
     */
    virtual void pressStateChanged (bool pressed, bool animate);

private:

    /**
     * Info about received or outgoing message.
     * true if received message else false.
     */
    bool mIncoming;

    /*
     * The chat custom control to show the conversation item
     * Owned
     */
    MsgConversationWidget *mConversation;

    /**
     * Graphics Item to hold message sending state.
     * Owned
     */
    HbIconItem *mMessageStateIconItem;
};

#endif // MSG_CONVERSATION_VIEW_ITEM_H
// EOF