kate Library API Documentation

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., 59 Temple Place - Suite 330,
00018    Boston, MA 02111-1307, 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 class KateSplitter;
00031 class KConfig;
00032 class KateMainWindow;
00033 
00034 class KateViewSpaceContainer: public QWidget
00035 {
00036   Q_OBJECT
00037 
00038   friend class KateViewSpace;
00039   friend class KateVSStatusBar;
00040 
00041   public:
00042     KateViewSpaceContainer (QWidget *parent, KateViewManager *viewManager);
00043 
00044     ~KateViewSpaceContainer ();
00045 
00046     inline QPtrList<Kate::View> &viewList () { return m_viewList; };
00047 
00048   public:
00049     /* This will save the splitter configuration */
00050     void saveViewConfiguration(KConfig *config,const QString& group);
00051 
00052     /* restore it */
00053     void restoreViewConfiguration (KConfig *config,const QString& group);
00054 
00055   private:
00060     bool createView ( Kate::Document *doc =0L );
00061 
00062     bool deleteView ( Kate::View *view, bool delViewSpace = true);
00063 
00064     void moveViewtoSplit (Kate::View *view);
00065     void moveViewtoStack (Kate::View *view);
00066 
00067     /* Save the configuration of a single splitter.
00068      * If child splitters are found, it calls it self with those as the argument.
00069      * If a viewspace child is found, it is asked to save its filelist.
00070      */
00071     void saveSplitterConfig(KateSplitter* s, int idx=0, KConfig* config=0L, const QString& viewConfGrp="");
00072 
00076     void restoreSplitter ( KConfig* config, const QString &group, QWidget* parent , const QString& viewConfGrp);
00077 
00078     void removeViewSpace (KateViewSpace *viewspace);
00079 
00080     bool showFullPath;
00081 
00082   public:
00083     Kate::View* activeView ();
00084     KateViewSpace* activeViewSpace ();
00085 
00086     uint viewCount ();
00087     uint viewSpaceCount ();
00088 
00089     bool isViewActivationBlocked(){return m_blockViewCreationAndActivation;};
00090 
00091   public:
00092     void closeViews(uint documentNumber);
00093     KateMainWindow *mainWindow();
00094   friend class KateViewManager;
00095 
00096   private slots:
00097     void activateView ( Kate::View *view );
00098     void activateSpace ( Kate::View* v );
00099     void slotViewChanged();
00100     void reactivateActiveView();
00101     void slotPendingDocumentNameChanged();
00102 
00103     void documentCreated (Kate::Document *doc);
00104     void documentDeleted (uint docNumber);
00105 
00106   public slots:
00107      /* Splits a KateViewSpace into two.
00108       * The operation is performed by creating a KateSplitter in the parent of the KateViewSpace to be split,
00109       * which is then moved to that splitter. Then a new KateViewSpace is created and added to the splitter,
00110       * and a KateView is created to populate the new viewspace. The new KateView is made the active one,
00111       * because createView() does that.
00112       * If no viewspace is provided, the result of activeViewSpace() is used.
00113       * The isHoriz, true pr default, decides the orientation of the splitting action.
00114       * If atTop is true, the new viewspace will be moved to the first position in the new splitter.
00115       * If a newViewUrl is provided, the new view will show the document in that URL if any, otherwise
00116       * the document of the current view in the viewspace to be split is used.
00117       */
00118     void splitViewSpace( KateViewSpace* vs=0L, bool isHoriz=true, bool atTop=false );
00119 
00120     bool getShowFullPath() const { return showFullPath; }
00121 
00122     void activateView ( uint documentNumber );
00123     void activateView ( int documentNumber ) { activateView((uint) documentNumber); };
00124 
00126     void slotSplitViewSpaceHoriz () { splitViewSpace(); }
00128     void slotSplitViewSpaceVert () { splitViewSpace( 0L, false ); }
00129 
00130     void slotCloseCurrentViewSpace();
00131 
00132     void statusMsg ();
00133 
00134     void setActiveSpace ( KateViewSpace* vs );
00135     void setActiveView ( Kate::View* view );
00136 
00137     void setShowFullPath(bool enable);
00138 
00139     void activateNextView();
00140     void activatePrevView();
00141 
00142   signals:
00143     void statusChanged (Kate::View *, int, int, int, bool, int, const QString &);
00144     void statChanged ();
00145     void viewChanged ();
00146 
00147   private:
00148     KateViewManager *m_viewManager;
00149     QPtrList<KateViewSpace> m_viewSpaceList;
00150     QPtrList<Kate::View> m_viewList;
00151 
00152     QGridLayout *m_grid;
00153     bool m_blockViewCreationAndActivation;
00154 
00155     bool m_activeViewRunning;
00156 
00157     bool m_pendingViewCreation;
00158     QGuardedPtr<Kate::Document> m_pendingDocument;
00159 };
00160 
00161 #endif
KDE Logo
This file is part of the documentation for kate Library Version 3.4.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Apr 6 02:40:58 2005 by doxygen 1.4.0 written by Dimitri van Heesch, © 1997-2003