Start expand frame implementation
[dashstudio.git] / src / components / timeline / framestable.h
blobd638c058d27c343ac5daf2542edaf684ffca7f9c
1 /***************************************************************************
2 * Copyright (C) 2005 by David Cuadrado *
3 * krawek@gmail.com *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19 ***************************************************************************/
21 #ifndef COMPONENTSLAYERTABLE_H
22 #define COMPONENTSLAYERTABLE_H
24 #include <QTableWidget>
25 #include <QTableWidgetItem>
26 #include <QHash>
28 class QMenu;
30 namespace Dash {
31 namespace Component {
33 class FramesTable;
34 class FramesTableItemDelegate;
36 class FramesTableItem : public QTableWidgetItem
38 public:
39 enum Attributes
41 IsUsed = Qt::UserRole,
42 IsLocked,
43 IsVisible,
44 IsSound
47 FramesTableItem();
48 virtual ~FramesTableItem();
50 bool isUsed();
51 bool isLocked();
52 bool isVisible();
53 bool isSound();
56 class TLRuler;
58 /**
59 * @author David Cuadrado <krawek@gmail.com>
61 class FramesTable : public QTableWidget
63 Q_OBJECT;
65 friend class FramesTableItemDelegate;
67 public:
68 FramesTable(QWidget *parent = 0);
69 ~FramesTable();
71 bool isSoundLayer(int row);
73 public slots:
74 // Layers
76 void insertLayer(int layerPos, const QString &name);
77 void insertSoundLayer(int layerPos, const QString &name);
79 void removeCurrentLayer();
80 void removeLayer(int pos);
81 void moveLayer(int pos, int newPos);
83 int lastFrameByLayer(int layerPos);
85 // Frames
86 void addFrame(int layerPos, const QString &name);
87 void insertFrame(int layerPos, int framePos, const QString &name);
88 void setCurrentFrame(FramesTableItem *);
89 void setCurrentLayer(int layerPos);
90 void selectFrame(int index);
92 void setAttribute(int row, int col, FramesTableItem::Attributes att, bool value);
94 void removeFrame(int layerPos, int position);
95 void moveFrame(int layerPos, int from, int to);
97 void lockFrame(int layerPosition, int position, bool locked);
99 void setFrameVisibility(int layerPosition, int position, bool isVisible);
101 void setItemSize(int w, int h);
103 private:
104 void setup();
106 protected:
107 void fixSize();
108 void mousePressEvent ( QMouseEvent * event );
110 private slots:
111 void emitFrameSelected(int col);
112 void emitFrameSelected(QTableWidgetItem *curr, QTableWidgetItem *prev);
113 void onCellDoubleClicked(int row, int column);
114 void onMenuActionTriggered(QAction * action);
116 signals:
117 void frameSelected(int layerPos, int framePos);
118 void requestInsertFrame(int layerPos, int framePos);
119 void requestRemoveFrame(int layerPos, int framePos);
120 void requestChangeFrameVisibility(int layerPos, int framePos, bool isVisible);
121 void requestLockFrame(int layerPos, int framePos, bool locked);
122 void requestExpandFrame(int layerPos, int framePos, int size);
124 private:
125 struct Private;
126 Private *const d;
132 #endif