PaneStack.h

Go to the documentation of this file.
00001 
00002 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*-  vi:set ts=8 sts=4 sw=4: */
00003 
00004 /*
00005     Sonic Visualiser
00006     An audio file viewer and annotation editor.
00007     Centre for Digital Music, Queen Mary, University of London.
00008     This file copyright 2006 Chris Cannam and QMUL.
00009     
00010     This program is free software; you can redistribute it and/or
00011     modify it under the terms of the GNU General Public License as
00012     published by the Free Software Foundation; either version 2 of the
00013     License, or (at your option) any later version.  See the file
00014     COPYING included with this distribution for more information.
00015 */
00016 
00017 #ifndef _PANESTACK_H_
00018 #define _PANESTACK_H_
00019 
00020 #include <QFrame>
00021 
00022 #include <map>
00023 
00024 class QWidget;
00025 class QLabel;
00026 class QStackedWidget;
00027 class QSplitter;
00028 class QHBoxLayout;
00029 class View;
00030 class Pane;
00031 class Layer;
00032 class ViewManager;
00033 class PropertyContainer;
00034 class PropertyStack;
00035 
00036 class PaneStack : public QFrame
00037 {
00038     Q_OBJECT
00039 
00040 public:
00041     PaneStack(QWidget *parent, ViewManager *viewManager);
00042 
00043     Pane *addPane(bool suppressPropertyBox = false); // I own the returned value
00044     void deletePane(Pane *pane); // Deletes the pane, but _not_ its layers
00045 
00046     int getPaneCount() const; // Returns only count of visible panes
00047     Pane *getPane(int n); // Of visible panes; I own the returned value
00048     int getPaneIndex(Pane *pane); // so getPane(index)==pane; -1 if absent
00049 
00050     void hidePane(Pane *pane); // Also removes pane from getPane/getPaneCount
00051     void showPane(Pane *pane); // Returns pane to getPane/getPaneCount
00052 
00053     int getHiddenPaneCount() const;
00054     Pane *getHiddenPane(int n); // I own the returned value
00055 
00056     void setCurrentPane(Pane *pane);
00057     void setCurrentLayer(Pane *pane, Layer *layer);
00058     Pane *getCurrentPane();
00059 
00060     enum LayoutStyle {
00061         NoPropertyStacks = 0,
00062         SinglePropertyStackLayout = 1,
00063         PropertyStackPerPaneLayout = 2
00064     };
00065 
00066     LayoutStyle getLayoutStyle() const { return m_layoutStyle; }
00067     void setLayoutStyle(LayoutStyle style);
00068 
00069     void setPropertyStackMinWidth(int mw);
00070 
00071     void sizePanesEqually();
00072 
00073 signals:
00074     void currentPaneChanged(Pane *pane);
00075     void currentLayerChanged(Pane *pane, Layer *layer);
00076     void rightButtonMenuRequested(Pane *pane, QPoint position);
00077     void propertyStacksResized(int width);
00078     void propertyStacksResized();
00079     void contextHelpChanged(const QString &);
00080 
00081     void paneAdded(Pane *pane);
00082     void paneAdded();
00083     void paneHidden(Pane *pane);
00084     void paneHidden();
00085     void paneAboutToBeDeleted(Pane *pane);
00086     void paneDeleted();
00087 
00088     void dropAccepted(Pane *pane, QStringList uriList);
00089     void dropAccepted(Pane *pane, QString text);
00090 
00091     void paneDeleteButtonClicked(Pane *pane);
00092 
00093 public slots:
00094     void propertyContainerAdded(PropertyContainer *);
00095     void propertyContainerRemoved(PropertyContainer *);
00096     void propertyContainerSelected(View *client, PropertyContainer *);
00097     void viewSelected(View *v);
00098     void paneInteractedWith();
00099     void rightButtonMenuRequested(QPoint);
00100     void paneDropAccepted(QStringList);
00101     void paneDropAccepted(QString);
00102     void paneDeleteButtonClicked();
00103 
00104 protected:
00105     Pane *m_currentPane;
00106 
00107     struct PaneRec
00108     {
00109         Pane        *pane;
00110         QWidget     *propertyStack;
00111         QLabel      *currentIndicator;
00112         QFrame      *frame;
00113         QHBoxLayout *layout;
00114     };
00115 
00116     std::vector<PaneRec> m_panes;
00117     std::vector<PaneRec> m_hiddenPanes;
00118 
00119     std::map<QWidget *, Pane *> m_xButtonMap;
00120 
00121     QSplitter *m_splitter;
00122     QStackedWidget *m_propertyStackStack;
00123 
00124     ViewManager *m_viewManager; // I don't own this
00125     int m_propertyStackMinWidth;
00126     void sizePropertyStacks();
00127 
00128     LayoutStyle m_layoutStyle;
00129 };
00130 
00131 #endif
00132 

Generated on Wed Feb 20 15:45:27 2008 for SonicVisualiser by  doxygen 1.5.1