TracksView.h 2.21 KB
Newer Older
1
/*****************************************************************************
2
 * TracksView.h: QGraphicsView that contains the TracksScene
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
 *****************************************************************************
 * Copyright (C) 2008-2009 the VLMC team
 *
 * Authors: Ludovic Fauvet <etix@l0cal.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.
 *****************************************************************************/

23
24
#ifndef TRACKSVIEW_H
#define TRACKSVIEW_H
25

26
#include <QWidget>
27
#include <QGraphicsView>
28
#include <QGraphicsLineItem>
29
30
31
#include <QDragEnterEvent>
#include <QDropEvent>
#include <QDragMoveEvent>
32

33
class TracksView : public QGraphicsView
34
{
35
36
    Q_OBJECT

37
public:
38
    TracksView( QGraphicsScene* scene, QWidget* parent = 0 );
39
40
    void setDuration( int duration );
    int duration() { return m_projectDuration; }
41
    int tracksHeight() { return m_tracksHeight; }
42
    int tracksCount() { return m_tracksCount; }
43
    void setCursorPos( int pos );
44
45
46
47

protected:
    virtual void resizeEvent( QResizeEvent* event );
    virtual void drawBackground( QPainter* painter, const QRectF& rect );
48
49
    virtual void mouseMoveEvent( QMouseEvent* event );
    virtual void mousePressEvent( QMouseEvent* event );
50
51
52
    virtual void dragEnterEvent( QDragEnterEvent* event );
    virtual void dropEvent( QDropEvent* event );
    virtual void dragMoveEvent( QDragMoveEvent* event );
53
54
55
56
57
58

private:
    QGraphicsScene* m_scene;
    int m_tracksHeight;
    int m_tracksCount;
    int m_projectDuration;
59
60
61
    int m_cursorPos;
    QGraphicsLineItem* m_cursorLine;

62
63
};

64
#endif // TRACKSVIEW_H