bagetmodel/inc/baget.h
author hgs
Wed, 24 Mar 2010 03:15:43 +0200
changeset 89 1e87eb3b400f
parent 85 7feec50967db
permissions -rw-r--r--
201011
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 bagets.
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
#ifndef BAGET_H
7feec50967db 201003_02
hgs
parents:
diff changeset
    19
#define BAGET_H
7feec50967db 201003_02
hgs
parents:
diff changeset
    20
7feec50967db 201003_02
hgs
parents:
diff changeset
    21
#include <QGraphicsWidget>
7feec50967db 201003_02
hgs
parents:
diff changeset
    22
7feec50967db 201003_02
hgs
parents:
diff changeset
    23
#include "bagetmodel_global.h"
7feec50967db 201003_02
hgs
parents:
diff changeset
    24
7feec50967db 201003_02
hgs
parents:
diff changeset
    25
enum BagetState
7feec50967db 201003_02
hgs
parents:
diff changeset
    26
{
7feec50967db 201003_02
hgs
parents:
diff changeset
    27
    BagetStateConstructed = 0,
7feec50967db 201003_02
hgs
parents:
diff changeset
    28
    BagetStateRunning,
7feec50967db 201003_02
hgs
parents:
diff changeset
    29
    BagetStateSuspended,
7feec50967db 201003_02
hgs
parents:
diff changeset
    30
    BagetStateStopped
7feec50967db 201003_02
hgs
parents:
diff changeset
    31
};
7feec50967db 201003_02
hgs
parents:
diff changeset
    32
7feec50967db 201003_02
hgs
parents:
diff changeset
    33
class BagetPrivate;
7feec50967db 201003_02
hgs
parents:
diff changeset
    34
7feec50967db 201003_02
hgs
parents:
diff changeset
    35
class BAGETMODEL_EXPORT Baget : public QGraphicsWidget
7feec50967db 201003_02
hgs
parents:
diff changeset
    36
{
7feec50967db 201003_02
hgs
parents:
diff changeset
    37
    Q_OBJECT
7feec50967db 201003_02
hgs
parents:
diff changeset
    38
7feec50967db 201003_02
hgs
parents:
diff changeset
    39
public:
7feec50967db 201003_02
hgs
parents:
diff changeset
    40
7feec50967db 201003_02
hgs
parents:
diff changeset
    41
    Baget(QGraphicsItem *parent = 0, Qt::WindowFlags flags = 0);
7feec50967db 201003_02
hgs
parents:
diff changeset
    42
    virtual ~Baget();
7feec50967db 201003_02
hgs
parents:
diff changeset
    43
7feec50967db 201003_02
hgs
parents:
diff changeset
    44
    BagetState currentState();
7feec50967db 201003_02
hgs
parents:
diff changeset
    45
7feec50967db 201003_02
hgs
parents:
diff changeset
    46
public slots:
7feec50967db 201003_02
hgs
parents:
diff changeset
    47
7feec50967db 201003_02
hgs
parents:
diff changeset
    48
    void start();
7feec50967db 201003_02
hgs
parents:
diff changeset
    49
    void stop();
7feec50967db 201003_02
hgs
parents:
diff changeset
    50
    void resume();
7feec50967db 201003_02
hgs
parents:
diff changeset
    51
    void suspend();
7feec50967db 201003_02
hgs
parents:
diff changeset
    52
7feec50967db 201003_02
hgs
parents:
diff changeset
    53
signals:
7feec50967db 201003_02
hgs
parents:
diff changeset
    54
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
    virtual bool onStart() = 0;
7feec50967db 201003_02
hgs
parents:
diff changeset
    60
    virtual bool onStop() = 0;
7feec50967db 201003_02
hgs
parents:
diff changeset
    61
    virtual bool onResume();
7feec50967db 201003_02
hgs
parents:
diff changeset
    62
    virtual bool onSuspend();
7feec50967db 201003_02
hgs
parents:
diff changeset
    63
7feec50967db 201003_02
hgs
parents:
diff changeset
    64
private:
7feec50967db 201003_02
hgs
parents:
diff changeset
    65
7feec50967db 201003_02
hgs
parents:
diff changeset
    66
    Q_DISABLE_COPY(Baget)
7feec50967db 201003_02
hgs
parents:
diff changeset
    67
7feec50967db 201003_02
hgs
parents:
diff changeset
    68
private:
7feec50967db 201003_02
hgs
parents:
diff changeset
    69
7feec50967db 201003_02
hgs
parents:
diff changeset
    70
    BagetPrivate * const m_d;
7feec50967db 201003_02
hgs
parents:
diff changeset
    71
    friend class BagetPrivate;
7feec50967db 201003_02
hgs
parents:
diff changeset
    72
7feec50967db 201003_02
hgs
parents:
diff changeset
    73
};
7feec50967db 201003_02
hgs
parents:
diff changeset
    74
7feec50967db 201003_02
hgs
parents:
diff changeset
    75
#endif // BAGET_H