GraphicsEffectItem.h 3.8 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
/*****************************************************************************
 * GraphicsEffectItem.h: Represent an effect in the timeline.
 *****************************************************************************
 * Copyright (C) 2008-2010 VideoLAN
 *
 * Authors: Hugo Beauzée-Luyssen <beauze.h@gmail.com>
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
 *****************************************************************************/

#ifndef GRAPHICSEFFECTITEM_H
#define GRAPHICSEFFECTITEM_H

#include "AbstractGraphicsItem.h"
#include "EffectsEngine.h"

29
class   EffectUser;
30
class   AbstractGraphicsMediaItem;
31

32 33 34 35
class   QUuid;

class GraphicsEffectItem : public AbstractGraphicsItem
{
36 37
    Q_OBJECT

38 39 40
    public:
        enum { Type = UserType + 3 };
        GraphicsEffectItem( Effect *effect );
41
        GraphicsEffectItem( EffectHelper *helper );
42 43 44 45 46 47 48 49

        virtual const QUuid&        uuid() const;
        virtual int                 type() const;
        virtual bool                expandable() const;
        virtual bool                moveable() const;
        virtual void                paint( QPainter *painter, const QStyleOptionGraphicsItem *option,
                                           QWidget *widget );
        virtual Workflow::TrackType trackType() const;
50
        EffectHelper*               effectHelper();
51 52
        virtual qint64              begin() const;
        virtual qint64              end() const;
53 54
        virtual qint64              maxBegin() const;
        virtual qint64              maxEnd() const;
55
        virtual Workflow::Helper    *helper();
56
        virtual void                triggerMove( EffectUser *target, qint64 startPos );
57
        virtual void                triggerResize( EffectUser *tw, Workflow::Helper *helper,
58
                                           qint64 newBegin, qint64 newEnd, qint64 pos );
59
        virtual qint64              itemHeight() const;
60 61
        virtual qint32              zSelected() const;
        virtual qint32              zNotSelected() const;
62
        void                        setContainer( AbstractGraphicsMediaItem *item );
63
        const AbstractGraphicsMediaItem  *container() const;
64 65
        virtual void                setStartPos( qint64 position );

66 67
    protected:
        virtual bool                hasResizeBoundaries() const;
68
        virtual void                contextMenuEvent( QGraphicsSceneContextMenuEvent *event );
69 70 71 72 73 74 75 76 77 78 79 80
        /**
         * \brief Paint the item's rectangle.
         * \param painter Pointer to a QPainter.
         * \param option Painting options.
         */
        void                paintRect( QPainter* painter, const QStyleOptionGraphicsItem* option );
        /**
         * \brief Paint the item's title.
         * \param painter Pointer to a QPainter.
         * \param option Painting options.
         */
        void                paintTitle( QPainter* painter, const QStyleOptionGraphicsItem* option );
81 82
    private slots:
        void                containerMoved( qint64 pos );
83 84 85

    private:
        Effect                      *m_effect;
86
        EffectHelper                *m_effectHelper;
87
        AbstractGraphicsMediaItem   *m_container;
88 89 90
};

#endif // GRAPHICSEFFECTITEM_H