Chris@127: Chris@127: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ Chris@127: Chris@127: /* Chris@127: Sonic Visualiser Chris@127: An audio file viewer and annotation editor. Chris@127: Centre for Digital Music, Queen Mary, University of London. Chris@182: This file copyright 2006 Chris Cannam and QMUL. Chris@127: Chris@127: This program is free software; you can redistribute it and/or Chris@127: modify it under the terms of the GNU General Public License as Chris@127: published by the Free Software Foundation; either version 2 of the Chris@127: License, or (at your option) any later version. See the file Chris@127: COPYING included with this distribution for more information. Chris@127: */ Chris@127: Chris@127: #ifndef _PANESTACK_H_ Chris@127: #define _PANESTACK_H_ Chris@127: Chris@127: #include Chris@127: Chris@127: class QWidget; Chris@127: class QLabel; Chris@127: class QStackedWidget; Chris@127: class QSplitter; Chris@127: class QHBoxLayout; Chris@127: class View; Chris@127: class Pane; Chris@127: class Layer; Chris@127: class ViewManager; Chris@127: class PropertyContainer; Chris@127: class PropertyStack; Chris@127: Chris@127: class PaneStack : public QFrame Chris@127: { Chris@127: Q_OBJECT Chris@127: Chris@127: public: Chris@127: PaneStack(QWidget *parent, ViewManager *viewManager); Chris@127: Chris@127: Pane *addPane(bool suppressPropertyBox = false); // I own the returned value Chris@127: void deletePane(Pane *pane); // Deletes the pane, but _not_ its layers Chris@127: Chris@127: int getPaneCount() const; // Returns only count of visible panes Chris@127: Pane *getPane(int n); // Of visible panes; I own the returned value Chris@127: Chris@127: void hidePane(Pane *pane); // Also removes pane from getPane/getPaneCount Chris@127: void showPane(Pane *pane); // Returns pane to getPane/getPaneCount Chris@127: Chris@127: int getHiddenPaneCount() const; Chris@127: Pane *getHiddenPane(int n); // I own the returned value Chris@127: Chris@127: void setCurrentPane(Pane *pane); Chris@127: void setCurrentLayer(Pane *pane, Layer *layer); Chris@127: Pane *getCurrentPane(); Chris@127: Chris@127: enum LayoutStyle { Chris@179: NoPropertyStacks = 0, Chris@127: SinglePropertyStackLayout = 1, Chris@127: PropertyStackPerPaneLayout = 2 Chris@127: }; Chris@127: Chris@127: LayoutStyle getLayoutStyle() const { return m_layoutStyle; } Chris@127: void setLayoutStyle(LayoutStyle style); Chris@127: Chris@235: void setPropertyStackMinWidth(int mw); Chris@235: Chris@127: signals: Chris@127: void currentPaneChanged(Pane *pane); Chris@127: void currentLayerChanged(Pane *pane, Layer *layer); Chris@127: void rightButtonMenuRequested(Pane *pane, QPoint position); Chris@180: void propertyStacksResized(); Chris@189: void contextHelpChanged(const QString &); Chris@127: Chris@271: void paneAdded(Pane *pane); Chris@271: void paneAdded(); Chris@271: void paneAboutToBeDeleted(Pane *pane); Chris@271: void paneDeleted(); Chris@271: Chris@127: public slots: Chris@127: void propertyContainerAdded(PropertyContainer *); Chris@127: void propertyContainerRemoved(PropertyContainer *); Chris@127: void propertyContainerSelected(View *client, PropertyContainer *); Chris@190: void viewSelected(View *v); Chris@127: void paneInteractedWith(); Chris@127: void rightButtonMenuRequested(QPoint); Chris@127: Chris@127: protected: Chris@127: Pane *m_currentPane; Chris@127: Chris@127: struct PaneRec Chris@127: { Chris@127: Pane *pane; Chris@127: QWidget *propertyStack; Chris@127: QLabel *currentIndicator; Chris@127: QFrame *frame; Chris@127: QHBoxLayout *layout; Chris@127: }; Chris@127: Chris@127: std::vector m_panes; Chris@127: std::vector m_hiddenPanes; Chris@127: Chris@127: QSplitter *m_splitter; Chris@127: QStackedWidget *m_propertyStackStack; Chris@127: Chris@127: ViewManager *m_viewManager; // I don't own this Chris@235: int m_propertyStackMinWidth; Chris@127: void sizePropertyStacks(); Chris@127: Chris@127: LayoutStyle m_layoutStyle; Chris@127: }; Chris@127: Chris@127: #endif Chris@127: