changeset 712:833cd1b8014f tonioni

Make it possible to globally hide pane accessories (close button & current-indicator)
author Chris Cannam
date Fri, 10 Jan 2014 09:04:06 +0000
parents 084fd76deb89
children 6d79ad93fef0
files view/PaneStack.cpp view/PaneStack.h
diffstat 2 files changed, 15 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/view/PaneStack.cpp	Thu Jan 09 16:41:55 2014 +0000
+++ b/view/PaneStack.cpp	Fri Jan 10 09:04:06 2014 +0000
@@ -39,6 +39,7 @@
 PaneStack::PaneStack(QWidget *parent, ViewManager *viewManager) :
     QFrame(parent),
     m_currentPane(0),
+    m_showAccessories(true),
     m_splitter(new QSplitter),
     m_propertyStackStack(new QStackedWidget),
     m_viewManager(viewManager),
@@ -60,6 +61,12 @@
     setLayout(layout);
 }
 
+void
+PaneStack::setShowPaneAccessories(bool show)
+{
+    m_showAccessories = show;
+}
+
 Pane *
 PaneStack::addPane(bool suppressPropertyBox)
 {
@@ -79,6 +86,7 @@
     xButton->setIcon(IconLoader().load("cross"));
     xButton->setFixedSize(QSize(16, 16));
     xButton->setFlat(true);
+    xButton->setVisible(m_showAccessories);
     layout->addWidget(xButton, 0, 0);
     connect(xButton, SIGNAL(clicked()), this, SLOT(paneDeleteButtonClicked()));
 
@@ -88,6 +96,7 @@
     layout->setRowStretch(1, 20);
     currentIndicator->setMinimumWidth(8);
     currentIndicator->setScaledContents(true);
+    currentIndicator->setVisible(m_showAccessories);
 
     long initialCentreFrame = -1;
     for (int i = 0; i < m_panes.size(); ++i) {
@@ -288,8 +297,8 @@
     bool multi = (getPaneCount() > 1);
     for (std::vector<PaneRec>::iterator i = m_panes.begin();
          i != m_panes.end(); ++i) {
-        i->xButton->setVisible(multi);
-        i->currentIndicator->setVisible(multi);
+        i->xButton->setVisible(multi && m_showAccessories);
+        i->currentIndicator->setVisible(multi && m_showAccessories);
     }
 }
 
--- a/view/PaneStack.h	Thu Jan 09 16:41:55 2014 +0000
+++ b/view/PaneStack.h	Fri Jan 10 09:04:06 2014 +0000
@@ -68,6 +68,8 @@
     void setLayoutStyle(LayoutStyle style);
 
     void setPropertyStackMinWidth(int mw);
+    
+    void setShowPaneAccessories(bool show); // current indicator, close button
 
     void sizePanesEqually();
 
@@ -119,6 +121,8 @@
     std::vector<PaneRec> m_panes;
     std::vector<PaneRec> m_hiddenPanes;
 
+    bool m_showAccessories;
+
     QSplitter *m_splitter;
     QStackedWidget *m_propertyStackStack;