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