kate Library API Documentation

kateviewmanager.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_VIEWMANAGER_H__
00022 #define __KATE_VIEWMANAGER_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 KateViewManager : public QWidget
00035 {
00036   Q_OBJECT
00037 
00038   friend class KateViewSpace;
00039   friend class KateVSStatusBar;
00040 
00041   public:
00042     KateViewManager (QWidget *parent=0, KateDocManager *docManager=0,KateMainWindow* mainWindow=0);
00043     ~KateViewManager ();
00044 
00045     Kate::ViewManager *viewManager () const { return m_viewManager; };
00046 
00047     inline QPtrList<Kate::View> &viewList () { return m_viewList; };
00048 
00049   public:
00050     /* This will save the splitter configuration */
00051     void saveViewConfiguration(KConfig *config,const QString& group);
00052 
00053     /* restore it */
00054     void restoreViewConfiguration (KConfig *config,const QString& group);
00055 
00056     uint openURL (const KURL &url, const QString& encoding, bool activate = true);
00057     
00058   public slots:
00059     void openURL (const KURL &url);
00060 
00061   private:
00062     bool useOpaqueResize;
00063   
00068     bool createView ( Kate::Document *doc =0L );
00069 
00070     bool deleteView ( Kate::View *view, bool delViewSpace = true);
00071 
00072     void moveViewtoSplit (Kate::View *view);
00073     void moveViewtoStack (Kate::View *view);
00074 
00075     /* Save the configuration of a single splitter.
00076      * If child splitters are found, it calls it self with those as the argument.
00077      * If a viewspace child is found, it is asked to save its filelist.
00078      */
00079     void saveSplitterConfig(KateSplitter* s, int idx=0, KConfig* config=0L, const QString& viewConfGrp="");
00080 
00084     void restoreSplitter ( KConfig* config, const QString &group, QWidget* parent , const QString& viewConfGrp);
00085 
00086     void removeViewSpace (KateViewSpace *viewspace);
00087 
00088     bool showFullPath;
00089 
00090   public:
00091     virtual Kate::View* activeView ();
00092     KateViewSpace* activeViewSpace ();
00093 
00094     uint viewCount ();
00095     uint viewSpaceCount ();
00096 
00097     bool isViewActivationBlocked(){return m_blockViewCreationAndActivation;};
00098 
00099   public:
00100     void closeViews(uint documentNumber);
00101     KateMainWindow *mainWindow();
00102 
00103   private slots:
00104     void activateView ( Kate::View *view );
00105     void activateSpace ( Kate::View* v );
00106     void slotViewChanged();
00107     void openNewIfEmpty();
00108 
00109   public slots:
00110     void deleteLastView ();
00111 
00112      /* Splits a KateViewSpace into two.
00113       * The operation is performed by creating a KateSplitter in the parent of the KateViewSpace to be split,
00114       * which is then moved to that splitter. Then a new KateViewSpace is created and added to the splitter,
00115       * and a KateView is created to populate the new viewspace. The new KateView is made the active one,
00116       * because createView() does that.
00117       * If no viewspace is provided, the result of activeViewSpace() is used.
00118       * The isHoriz, true pr default, decides the orientation of the splitting action.
00119       * If atTop is true, the new viewspace will be moved to the first position in the new splitter.
00120       * If a newViewUrl is provided, the new view will show the document in that URL if any, otherwise
00121       * the document of the current view in the viewspace to be split is used.
00122       */
00123     void splitViewSpace( KateViewSpace* vs=0L, bool isHoriz=true, bool atTop=false );
00124 
00125     bool getShowFullPath() const { return showFullPath; }
00126 
00127     void activateView ( uint documentNumber );
00128     void activateView ( int documentNumber ) { activateView((uint) documentNumber); };
00129 
00130     void slotDocumentCloseAll ();
00131     void slotDocumentSaveAll();
00132 
00133     void slotDocumentNew ();
00134     void slotDocumentOpen ();
00135     void slotDocumentClose ();
00137     void slotSplitViewSpaceHoriz () { splitViewSpace(); }
00139     void slotSplitViewSpaceVert () { splitViewSpace( 0L, false ); }
00140 
00141     void slotCloseCurrentViewSpace();
00142 
00143     void statusMsg ();
00144 
00145     void setActiveSpace ( KateViewSpace* vs );
00146     void setActiveView ( Kate::View* view );
00147 
00148     void setShowFullPath(bool enable);
00149 
00150     void activateNextView();
00151     void activatePrevView();
00152 
00153   signals:
00154     void statusChanged (Kate::View *, int, int, int, bool, int, const QString &);
00155     void statChanged ();
00156     void viewChanged ();
00157 
00158   private:
00159     Kate::ViewManager *m_viewManager;
00160     QPtrList<KateViewSpace> m_viewSpaceList;
00161     QPtrList<Kate::View> m_viewList;
00162 
00163     KateDocManager *m_docManager;
00164     QGridLayout *m_grid;
00165     bool m_blockViewCreationAndActivation;
00166 
00167     bool m_activeViewRunning;
00168     KateMainWindow *m_mainWindow;
00169 };
00170 
00171 #endif
KDE Logo
This file is part of the documentation for kate Library Version 3.3.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Thu Sep 8 02:43:14 2005 by doxygen 1.3.6 written by Dimitri van Heesch, © 1997-2003