view widgets/MultiPaneLayerContainer.cpp @ 107:c3ac34b2e45b

correct bugs after DAN review
author lbajardsilogic
date Thu, 13 Sep 2007 12:42:44 +0000
parents c70c6b99d871
children fa034c6ae8bf
line wrap: on
line source
/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*-  vi:set ts=8 sts=4 sw=4: */

/*   
Sound Access
EASAIER client application.
Silogic 2007. Benoit Rigolleau.

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.  See the file
COPYING included with this distribution for more information.
*/

#include "MultiPaneLayerContainer.h" 

MultiPaneLayerContainer::MultiPaneLayerContainer(QWidget *parent): QWidget(parent){
	m_map = new QMap<Pane*,PropertyStack*>();
	m_layout = new QVBoxLayout;
	this->setLayout(m_layout);
}

MultiPaneLayerContainer::~MultiPaneLayerContainer(){
	
}

void MultiPaneLayerContainer::addPane(Pane *pane){
	PropertyStack *propertyStack = new PropertyStack(0, pane);
	connect(propertyStack, SIGNAL(removeSelectedItem()), this, SIGNAL(removeSelectedItem())); 
	connect(propertyStack, SIGNAL(propertyContainerSelected(View *, PropertyContainer *)), this, SIGNAL(propertyContainerSelected(View *, PropertyContainer *))); 
	m_map->insert(pane,propertyStack);
	m_layout->addWidget(propertyStack);
	m_layout->setMargin(0);
	m_layout->setSpacing(0);
}

void MultiPaneLayerContainer::removePane(Pane *pane){
	m_layout->removeWidget(m_map->value(pane));
	delete m_map->value(pane);
	m_map->remove(pane);

}


//////////////////SLOTS ///////////////////////

void MultiPaneLayerContainer::currentPaneChanged(Pane *pane){

	QMap<Pane*,PropertyStack*>::Iterator it;

	for (it = m_map->begin(); it != m_map->end(); ++it ) {
		m_map->value(it.key())->setVisible(false);
    }
	if(m_map->contains(pane)){
		m_map->value(pane)->setVisible(true);
	}
}

void MultiPaneLayerContainer::paneAdded(Pane *pane){
	addPane(pane);
}

void MultiPaneLayerContainer::paneRemoved(Pane *pane){
	removePane(pane);
}