annotate widgets/PaneStack.h @ 112:43b1ca9647e1

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