kateviewspacecontainer.h
00001 /* This file is part of the KDE project 00002 Copyright (C) 2001 Christoph Cullmann <cullmann@kde.org> 00003 Copyright (C) 2001 Joseph Wenninger <jowenn@kde.org> 00004 Copyright (C) 2001 Anders Lund <anders.lund@lund.tdcadsl.dk> 00005 00006 This library is free software; you can redistribute it and/or 00007 modify it under the terms of the GNU Library General Public 00008 License version 2 as published by the Free Software Foundation. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Library General Public License for more details. 00014 00015 You should have received a copy of the GNU Library General Public License 00016 along with this library; see the file COPYING.LIB. If not, write to 00017 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00018 Boston, MA 02110-1301, USA. 00019 */ 00020 00021 #ifndef __KATE_VIEWSPACE_CONTAINER_H__ 00022 #define __KATE_VIEWSPACE_CONTAINER_H__ 00023 00024 #include "katemain.h" 00025 #include "../interfaces/viewmanager.h" 00026 00027 #include <kate/view.h> 00028 #include <kate/document.h> 00029 00030 #include "katemdi.h" 00031 00032 class KConfig; 00033 class KateMainWindow; 00034 00035 class KateViewSpaceContainer: public TQVBox 00036 { 00037 Q_OBJECT 00038 00039 friend class KateViewSpace; 00040 friend class KateVSStatusBar; 00041 00042 public: 00043 KateViewSpaceContainer (TQWidget *parent, KateViewManager *viewManager); 00044 00045 ~KateViewSpaceContainer (); 00046 00047 inline TQPtrList<Kate::View> &viewList () { return m_viewList; }; 00048 00049 public: 00050 /* This will save the splitter configuration */ 00051 void saveViewConfiguration(KConfig *config,const TQString& group); 00052 00053 /* restore it */ 00054 void restoreViewConfiguration (KConfig *config,const TQString& group); 00055 00056 private: 00061 bool createView ( Kate::Document *doc =0L ); 00062 00063 bool deleteView ( Kate::View *view, bool delViewSpace = true); 00064 00065 void moveViewtoSplit (Kate::View *view); 00066 void moveViewtoStack (Kate::View *view); 00067 00068 /* Save the configuration of a single splitter. 00069 * If child splitters are found, it calls it self with those as the argument. 00070 * If a viewspace child is found, it is asked to save its filelist. 00071 */ 00072 void saveSplitterConfig(KateMDI::Splitter* s, int idx=0, KConfig* config=0L, const TQString& viewConfGrp=""); 00073 00077 void restoreSplitter ( KConfig* config, const TQString &group, TQWidget* parent , const TQString& viewConfGrp); 00078 00079 void removeViewSpace (KateViewSpace *viewspace); 00080 00081 bool showFullPath; 00082 00083 public: 00084 Kate::View* activeView (); 00085 KateViewSpace* activeViewSpace (); 00086 00087 uint viewCount (); 00088 uint viewSpaceCount (); 00089 00090 bool isViewActivationBlocked(){return m_blockViewCreationAndActivation;}; 00091 00092 public: 00093 void closeViews(uint documentNumber); 00094 KateMainWindow *mainWindow(); 00095 friend class KateViewManager; 00096 00097 private slots: 00098 void activateView ( Kate::View *view ); 00099 void activateSpace ( Kate::View* v ); 00100 void slotViewChanged(); 00101 void reactivateActiveView(); 00102 void slotPendingDocumentNameChanged(); 00103 00104 void documentCreated (Kate::Document *doc); 00105 void documentDeleted (uint docNumber); 00106 00107 public slots: 00108 /* Splits a KateViewSpace into two. 00109 * The operation is performed by creating a KateMDI::Splitter in the parent of the KateViewSpace to be split, 00110 * which is then moved to that splitter. Then a new KateViewSpace is created and added to the splitter, 00111 * and a KateView is created to populate the new viewspace. The new KateView is made the active one, 00112 * because createView() does that. 00113 * If no viewspace is provided, the result of activeViewSpace() is used. 00114 * The isHoriz, true pr default, decides the orientation of the splitting action. 00115 * If atTop is true, the new viewspace will be moved to the first position in the new splitter. 00116 * If a newViewUrl is provided, the new view will show the document in that URL if any, otherwise 00117 * the document of the current view in the viewspace to be split is used. 00118 */ 00119 void splitViewSpace( KateViewSpace* vs=0L, bool isHoriz=true, bool atTop=false ); 00120 00121 bool getShowFullPath() const { return showFullPath; } 00122 00123 void activateView ( uint documentNumber ); 00124 void activateView ( int documentNumber ) { activateView((uint) documentNumber); }; 00125 00127 void slotSplitViewSpaceHoriz () { splitViewSpace(); } 00129 void slotSplitViewSpaceVert () { splitViewSpace( 0L, false ); } 00130 00131 void slotCloseCurrentViewSpace(); 00132 00133 void statusMsg (); 00134 00135 void setActiveSpace ( KateViewSpace* vs ); 00136 void setActiveView ( Kate::View* view ); 00137 00138 void setShowFullPath(bool enable); 00139 00140 void activateNextView(); 00141 void activatePrevView(); 00142 00143 signals: 00144 void statusChanged (Kate::View *, int, int, int, bool, int, const TQString &); 00145 void statChanged (); 00146 void viewChanged (); 00147 00148 private: 00149 KateViewManager *m_viewManager; 00150 TQPtrList<KateViewSpace> m_viewSpaceList; 00151 TQPtrList<Kate::View> m_viewList; 00152 00153 bool m_blockViewCreationAndActivation; 00154 00155 bool m_activeViewRunning; 00156 00157 bool m_pendingViewCreation; 00158 TQGuardedPtr<Kate::Document> m_pendingDocument; 00159 }; 00160 00161 #endif