homescreensrv_plat/hswidgetmodel_api/hswidget.h
author hgs
Fri, 09 Jul 2010 14:19:08 +0300
changeset 102 8b8b34fa9751
parent 85 7feec50967db
permissions -rw-r--r--
201027
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
85
7feec50967db 201003_02
hgs
parents:
diff changeset
     1
/*
7feec50967db 201003_02
hgs
parents:
diff changeset
     2
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
7feec50967db 201003_02
hgs
parents:
diff changeset
     3
* All rights reserved.
7feec50967db 201003_02
hgs
parents:
diff changeset
     4
* This component and the accompanying materials are made available
7feec50967db 201003_02
hgs
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
7feec50967db 201003_02
hgs
parents:
diff changeset
     6
* which accompanies this distribution, and is available
7feec50967db 201003_02
hgs
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
7feec50967db 201003_02
hgs
parents:
diff changeset
     8
*
7feec50967db 201003_02
hgs
parents:
diff changeset
     9
* Initial Contributors:
7feec50967db 201003_02
hgs
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
7feec50967db 201003_02
hgs
parents:
diff changeset
    11
*
7feec50967db 201003_02
hgs
parents:
diff changeset
    12
* Contributors:
7feec50967db 201003_02
hgs
parents:
diff changeset
    13
*
7feec50967db 201003_02
hgs
parents:
diff changeset
    14
* Description:  Base class for all homescreen widgets.
7feec50967db 201003_02
hgs
parents:
diff changeset
    15
*
7feec50967db 201003_02
hgs
parents:
diff changeset
    16
*/
7feec50967db 201003_02
hgs
parents:
diff changeset
    17
7feec50967db 201003_02
hgs
parents:
diff changeset
    18
7feec50967db 201003_02
hgs
parents:
diff changeset
    19
#ifndef HSWIDGET_H
7feec50967db 201003_02
hgs
parents:
diff changeset
    20
#define HSWIDGET_H
7feec50967db 201003_02
hgs
parents:
diff changeset
    21
7feec50967db 201003_02
hgs
parents:
diff changeset
    22
#include <hswidgetmodel_global.h>
7feec50967db 201003_02
hgs
parents:
diff changeset
    23
#include <hbwidget.h>
7feec50967db 201003_02
hgs
parents:
diff changeset
    24
7feec50967db 201003_02
hgs
parents:
diff changeset
    25
7feec50967db 201003_02
hgs
parents:
diff changeset
    26
class HsWidgetPrivate;
7feec50967db 201003_02
hgs
parents:
diff changeset
    27
class IHsWidgetPreferenceService;
7feec50967db 201003_02
hgs
parents:
diff changeset
    28
7feec50967db 201003_02
hgs
parents:
diff changeset
    29
class HSWIDGETMODEL_EXPORT HsWidget : public HbWidget
7feec50967db 201003_02
hgs
parents:
diff changeset
    30
{
7feec50967db 201003_02
hgs
parents:
diff changeset
    31
    Q_OBJECT
7feec50967db 201003_02
hgs
parents:
diff changeset
    32
7feec50967db 201003_02
hgs
parents:
diff changeset
    33
public:
7feec50967db 201003_02
hgs
parents:
diff changeset
    34
7feec50967db 201003_02
hgs
parents:
diff changeset
    35
    enum StartResult { StartResultRunning, StartResultFinished, StartResultFaulted };
7feec50967db 201003_02
hgs
parents:
diff changeset
    36
    enum StopResult { StopResultFinished, StopResultFinishing, StopResultFaulted, StopResultFaulting };
7feec50967db 201003_02
hgs
parents:
diff changeset
    37
    enum SuspendResult { SuspendResultSuspended, SuspendResultFaulted, SuspendResultFaulting };
7feec50967db 201003_02
hgs
parents:
diff changeset
    38
    enum ResumeResult { ResumeResultRunning, ResumeResultFaulted, ResumeResultFaulting };
7feec50967db 201003_02
hgs
parents:
diff changeset
    39
7feec50967db 201003_02
hgs
parents:
diff changeset
    40
7feec50967db 201003_02
hgs
parents:
diff changeset
    41
    HsWidget(QGraphicsItem *parent = 0, Qt::WindowFlags flags = 0);
7feec50967db 201003_02
hgs
parents:
diff changeset
    42
    virtual ~HsWidget();
7feec50967db 201003_02
hgs
parents:
diff changeset
    43
7feec50967db 201003_02
hgs
parents:
diff changeset
    44
    IHsWidgetPreferenceService *widgetPreferenceService() const;
7feec50967db 201003_02
hgs
parents:
diff changeset
    45
7feec50967db 201003_02
hgs
parents:
diff changeset
    46
    void start();
7feec50967db 201003_02
hgs
parents:
diff changeset
    47
    void stop();
7feec50967db 201003_02
hgs
parents:
diff changeset
    48
    void suspend();
7feec50967db 201003_02
hgs
parents:
diff changeset
    49
    void resume();
7feec50967db 201003_02
hgs
parents:
diff changeset
    50
7feec50967db 201003_02
hgs
parents:
diff changeset
    51
signals:
7feec50967db 201003_02
hgs
parents:
diff changeset
    52
7feec50967db 201003_02
hgs
parents:
diff changeset
    53
    void succeeded();
7feec50967db 201003_02
hgs
parents:
diff changeset
    54
    void stopped();
7feec50967db 201003_02
hgs
parents:
diff changeset
    55
    void faulted();
7feec50967db 201003_02
hgs
parents:
diff changeset
    56
7feec50967db 201003_02
hgs
parents:
diff changeset
    57
protected:
7feec50967db 201003_02
hgs
parents:
diff changeset
    58
7feec50967db 201003_02
hgs
parents:
diff changeset
    59
    
7feec50967db 201003_02
hgs
parents:
diff changeset
    60
    virtual StartResult onStart() = 0;
7feec50967db 201003_02
hgs
parents:
diff changeset
    61
    virtual StopResult onStop() = 0;
7feec50967db 201003_02
hgs
parents:
diff changeset
    62
    virtual SuspendResult onSuspend();
7feec50967db 201003_02
hgs
parents:
diff changeset
    63
    virtual ResumeResult onResume();
7feec50967db 201003_02
hgs
parents:
diff changeset
    64
7feec50967db 201003_02
hgs
parents:
diff changeset
    65
    void setFinished();
7feec50967db 201003_02
hgs
parents:
diff changeset
    66
    void setFaulted();
7feec50967db 201003_02
hgs
parents:
diff changeset
    67
    void setFaulting();
7feec50967db 201003_02
hgs
parents:
diff changeset
    68
7feec50967db 201003_02
hgs
parents:
diff changeset
    69
    /**
7feec50967db 201003_02
hgs
parents:
diff changeset
    70
     * @copydoc QGraphicsWidget::mouseDoubleClickEvent()
7feec50967db 201003_02
hgs
parents:
diff changeset
    71
     */
7feec50967db 201003_02
hgs
parents:
diff changeset
    72
    void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) { Q_UNUSED(event) }
7feec50967db 201003_02
hgs
parents:
diff changeset
    73
7feec50967db 201003_02
hgs
parents:
diff changeset
    74
    /**
7feec50967db 201003_02
hgs
parents:
diff changeset
    75
     * @copydoc QGraphicsWidget::mouseMoveEvent()
7feec50967db 201003_02
hgs
parents:
diff changeset
    76
     */
7feec50967db 201003_02
hgs
parents:
diff changeset
    77
    void mouseMoveEvent(QGraphicsSceneMouseEvent *event) { Q_UNUSED(event) }
7feec50967db 201003_02
hgs
parents:
diff changeset
    78
7feec50967db 201003_02
hgs
parents:
diff changeset
    79
    /**
7feec50967db 201003_02
hgs
parents:
diff changeset
    80
     * @copydoc QGraphicsWidget::mousePressEvent()
7feec50967db 201003_02
hgs
parents:
diff changeset
    81
     */
7feec50967db 201003_02
hgs
parents:
diff changeset
    82
    void mousePressEvent(QGraphicsSceneMouseEvent *event) { Q_UNUSED(event) }
7feec50967db 201003_02
hgs
parents:
diff changeset
    83
7feec50967db 201003_02
hgs
parents:
diff changeset
    84
    /**
7feec50967db 201003_02
hgs
parents:
diff changeset
    85
     * @copydoc QGraphicsWidget::mouseReleaseEvent()
7feec50967db 201003_02
hgs
parents:
diff changeset
    86
     */
7feec50967db 201003_02
hgs
parents:
diff changeset
    87
    void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) { Q_UNUSED(event) }
7feec50967db 201003_02
hgs
parents:
diff changeset
    88
7feec50967db 201003_02
hgs
parents:
diff changeset
    89
private:
7feec50967db 201003_02
hgs
parents:
diff changeset
    90
7feec50967db 201003_02
hgs
parents:
diff changeset
    91
    Q_DISABLE_COPY(HsWidget)
7feec50967db 201003_02
hgs
parents:
diff changeset
    92
7feec50967db 201003_02
hgs
parents:
diff changeset
    93
private:
7feec50967db 201003_02
hgs
parents:
diff changeset
    94
7feec50967db 201003_02
hgs
parents:
diff changeset
    95
    HsWidgetPrivate *mD;
7feec50967db 201003_02
hgs
parents:
diff changeset
    96
    friend class HsWidgetPrivate;
7feec50967db 201003_02
hgs
parents:
diff changeset
    97
7feec50967db 201003_02
hgs
parents:
diff changeset
    98
};
7feec50967db 201003_02
hgs
parents:
diff changeset
    99
7feec50967db 201003_02
hgs
parents:
diff changeset
   100
7feec50967db 201003_02
hgs
parents:
diff changeset
   101
7feec50967db 201003_02
hgs
parents:
diff changeset
   102
7feec50967db 201003_02
hgs
parents:
diff changeset
   103
#endif