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@1270: #ifndef SV_PANESTACK_H Chris@1270: #define SV_PANESTACK_H Chris@127: Chris@127: #include Chris@127: Chris@323: #include Chris@323: Chris@908: #include "base/BaseTypes.h" Chris@908: Chris@127: class QWidget; Chris@127: class QLabel; Chris@127: class QStackedWidget; Chris@1447: class QVBoxLayout; Chris@127: class QSplitter; Chris@495: class QGridLayout; Chris@605: class QPushButton; 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@867: class AlignmentView; Chris@127: Chris@127: class PaneStack : public QFrame Chris@127: { Chris@127: Q_OBJECT Chris@127: Chris@127: public: Chris@1447: PaneStack(QWidget *parent, Chris@1447: 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@277: int getPaneIndex(Pane *pane); // so getPane(index)==pane; -1 if absent 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@1447: enum ResizeMode { Chris@1447: UserResizeable = 0, Chris@1447: AutoResizeOnly = 1 Chris@1447: }; Chris@1447: Chris@1447: ResizeMode getResizeMode() const { return m_resizeMode; } Chris@1447: void setResizeMode(ResizeMode); Chris@1447: Chris@1460: // Set whether the current-pane indicators and close buttons are Chris@1460: // shown. The default is true. Chris@1460: void setShowPaneAccessories(bool show); Chris@1460: Chris@1460: // Set whether a close button is shown on the first pane as well Chris@1460: // as others. (It may be reasonable to omit the close button from Chris@1460: // what is presumably the main pane in some applications.) The Chris@1460: // default is true. Chris@1460: void setShowCloseButtonOnFirstPane(bool); Chris@1460: Chris@235: void setPropertyStackMinWidth(int mw); Chris@235: Chris@867: void setShowAlignmentViews(bool show); Chris@867: Chris@320: void sizePanesEqually(); Chris@320: 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@363: void propertyStacksResized(int width); Chris@180: void propertyStacksResized(); Chris@189: void contextHelpChanged(const QString &); Chris@127: Chris@271: void paneAdded(Pane *pane); Chris@271: void paneAdded(); Chris@319: void paneHidden(Pane *pane); Chris@319: void paneHidden(); Chris@271: void paneAboutToBeDeleted(Pane *pane); Chris@271: void paneDeleted(); Chris@271: Chris@312: void dropAccepted(Pane *pane, QStringList uriList); Chris@312: void dropAccepted(Pane *pane, QString text); Chris@312: Chris@323: void paneDeleteButtonClicked(Pane *pane); Chris@323: Chris@908: void doubleClickSelectInvoked(sv_frame_t frame); Chris@716: 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@312: void paneDropAccepted(QStringList); Chris@312: void paneDropAccepted(QString); Chris@323: void paneDeleteButtonClicked(); Chris@500: void indicatorClicked(); Chris@127: Chris@127: protected: Chris@127: Pane *m_currentPane; Chris@127: Chris@127: struct PaneRec Chris@127: { Chris@1266: Pane *pane; Chris@1266: QWidget *propertyStack; Chris@867: QPushButton *xButton; Chris@1266: QLabel *currentIndicator; Chris@867: QFrame *frame; Chris@867: QGridLayout *layout; Chris@867: AlignmentView *alignmentView; Chris@127: }; Chris@127: Chris@127: std::vector m_panes; Chris@127: std::vector m_hiddenPanes; Chris@127: Chris@712: bool m_showAccessories; Chris@1460: bool m_showCloseButtonOnFirstPane; Chris@867: bool m_showAlignmentViews; Chris@712: Chris@1447: QSplitter *m_splitter; // constitutes the stack in UserResizeable mode Chris@1447: QWidget *m_autoResizeStack; // constitutes the stack in AutoResizeOnly mode Chris@1447: QVBoxLayout *m_autoResizeLayout; Chris@1447: 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@605: void showOrHidePaneAccessories(); Chris@605: Chris@867: void unlinkAlignmentViews(); Chris@867: void relinkAlignmentViews(); Chris@867: Chris@127: LayoutStyle m_layoutStyle; Chris@1447: ResizeMode m_resizeMode; Chris@127: }; Chris@127: Chris@127: #endif Chris@127: