Konsole
ViewSplitter.h
Go to the documentation of this file.00001 /* 00002 This file is part of the Konsole Terminal. 00003 00004 Copyright 2006-2008 Robert Knight <robertknight@gmail.com> 00005 00006 This program is free software; you can redistribute it and/or modify 00007 it under the terms of the GNU General Public License as published by 00008 the Free Software Foundation; either version 2 of the License, or 00009 (at your option) any later version. 00010 00011 This program is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 GNU General Public License for more details. 00015 00016 You should have received a copy of the GNU General Public License 00017 along with this program; if not, write to the Free Software 00018 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 00019 02110-1301 USA. 00020 */ 00021 00022 #ifndef VIEWSPLITTER_H 00023 #define VIEWSPLITTER_H 00024 00025 #include <QtCore/QList> 00026 #include <QtGui/QSplitter> 00027 00028 class QFocusEvent; 00029 00030 namespace Konsole 00031 { 00032 00033 class ViewContainer; 00034 00047 class ViewSplitter : public QSplitter 00048 { 00049 Q_OBJECT 00050 00051 public: 00052 ViewSplitter(QWidget* parent = 0); 00053 00069 void addContainer( ViewContainer* container , Qt::Orientation orientation ); 00070 00072 void removeContainer( ViewContainer* container ); 00073 00075 ViewSplitter* activeSplitter() ; 00076 00088 ViewContainer* activeContainer() const; 00089 00093 void setActiveContainer(ViewContainer* container); 00094 00098 QList<ViewContainer*> containers() const {return _containers;} 00099 00103 void activateNextContainer(); 00104 00114 void adjustContainerSize(ViewContainer* container , int percentage); 00115 00119 void activatePreviousContainer(); 00120 00136 void setRecursiveSplitting(bool recursive); 00137 00142 bool recursiveSplitting() const; 00143 00144 signals: 00146 void empty(ViewSplitter* splitter); 00147 00155 void allContainersEmpty(); 00156 00157 protected: 00158 //virtual void focusEvent(QFocusEvent* event); 00159 00160 private: 00161 // Adds container to splitter's internal list and 00162 // connects signals and slots 00163 void registerContainer( ViewContainer* container ); 00164 // Removes container from splitter's internal list and 00165 // removes signals and slots 00166 void unregisterContainer( ViewContainer* container ); 00167 00168 void updateSizes(); 00169 00170 private slots: 00171 // Called to indicate that a child ViewContainer has been deleted 00172 void containerDestroyed( ViewContainer* object ); 00173 00174 // Called to indicate that a child ViewContainer is empty 00175 void containerEmpty( ViewContainer* object ); 00176 00177 // Called to indicate that a child ViewSplitter is empty 00178 // (ie. all child widgets have been deleted) 00179 void childEmpty( ViewSplitter* splitter ); 00180 00181 private: 00182 QList<ViewContainer*> _containers; 00183 bool _recursiveSplitting; 00184 }; 00185 00186 } 00187 #endif //VIEWSPLITTER_H 00188