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