comparison view/PaneStack.h @ 127:89c625dda204

* Reorganising code base. This revision will not compile.
author Chris Cannam
date Mon, 31 Jul 2006 11:44:37 +0000
parents
children 6a0d54f3f21a
comparison
equal deleted inserted replaced
126:0e95c127bb53 127:89c625dda204
1
2 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
3
4 /*
5 Sonic Visualiser
6 An audio file viewer and annotation editor.
7 Centre for Digital Music, Queen Mary, University of London.
8 This file copyright 2006 Chris Cannam.
9
10 This program is free software; you can redistribute it and/or
11 modify it under the terms of the GNU General Public License as
12 published by the Free Software Foundation; either version 2 of the
13 License, or (at your option) any later version. See the file
14 COPYING included with this distribution for more information.
15 */
16
17 #ifndef _PANESTACK_H_
18 #define _PANESTACK_H_
19
20 #include <QFrame>
21
22 class QWidget;
23 class QLabel;
24 class QStackedWidget;
25 class QSplitter;
26 class QHBoxLayout;
27 class View;
28 class Pane;
29 class Layer;
30 class ViewManager;
31 class PropertyContainer;
32 class PropertyStack;
33
34 class PaneStack : public QFrame
35 {
36 Q_OBJECT
37
38 public:
39 PaneStack(QWidget *parent, ViewManager *viewManager);
40
41 Pane *addPane(bool suppressPropertyBox = false); // I own the returned value
42 void deletePane(Pane *pane); // Deletes the pane, but _not_ its layers
43
44 int getPaneCount() const; // Returns only count of visible panes
45 Pane *getPane(int n); // Of visible panes; I own the returned value
46
47 void hidePane(Pane *pane); // Also removes pane from getPane/getPaneCount
48 void showPane(Pane *pane); // Returns pane to getPane/getPaneCount
49
50 int getHiddenPaneCount() const;
51 Pane *getHiddenPane(int n); // I own the returned value
52
53 void setCurrentPane(Pane *pane);
54 void setCurrentLayer(Pane *pane, Layer *layer);
55 Pane *getCurrentPane();
56
57 enum LayoutStyle {
58 SinglePropertyStackLayout = 1,
59 PropertyStackPerPaneLayout = 2
60 };
61
62 LayoutStyle getLayoutStyle() const { return m_layoutStyle; }
63 void setLayoutStyle(LayoutStyle style);
64
65 signals:
66 void currentPaneChanged(Pane *pane);
67 void currentLayerChanged(Pane *pane, Layer *layer);
68 void rightButtonMenuRequested(Pane *pane, QPoint position);
69
70 public slots:
71 void propertyContainerAdded(PropertyContainer *);
72 void propertyContainerRemoved(PropertyContainer *);
73 void propertyContainerSelected(View *client, PropertyContainer *);
74 void paneInteractedWith();
75 void rightButtonMenuRequested(QPoint);
76
77 protected:
78 Pane *m_currentPane;
79
80 struct PaneRec
81 {
82 Pane *pane;
83 QWidget *propertyStack;
84 QLabel *currentIndicator;
85 QFrame *frame;
86 QHBoxLayout *layout;
87 };
88
89 std::vector<PaneRec> m_panes;
90 std::vector<PaneRec> m_hiddenPanes;
91
92 QSplitter *m_splitter;
93 QStackedWidget *m_propertyStackStack;
94
95 ViewManager *m_viewManager; // I don't own this
96 void sizePropertyStacks();
97
98 LayoutStyle m_layoutStyle;
99 };
100
101 #endif
102