home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / kate / documentmanager.h < prev    next >
Encoding:
C/C++ Source or Header  |  2007-01-15  |  3.2 KB  |  112 lines

  1. /* This file is part of the KDE project
  2.    Copyright (C) 2001 Christoph Cullmann <cullmann@kde.org>
  3.  
  4.    This library is free software; you can redistribute it and/or
  5.    modify it under the terms of the GNU Library General Public
  6.    License version 2 as published by the Free Software Foundation.
  7.  
  8.    This library is distributed in the hope that it will be useful,
  9.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  10.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  11.    Library General Public License for more details.
  12.  
  13.    You should have received a copy of the GNU Library General Public License
  14.    along with this library; see the file COPYING.LIB.  If not, write to
  15.    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  16.    Boston, MA 02110-1301, USA.
  17. */
  18.  
  19. #ifndef _KATE_DOCMANAGER_INCLUDE_
  20. #define _KATE_DOCMANAGER_INCLUDE_
  21.  
  22. #include <qobject.h>
  23. #include <kurl.h>
  24.  
  25. namespace Kate
  26. {
  27. /** This interface provides access to the Kate Document Manager.
  28. */
  29. class KDE_EXPORT DocumentManager : public QObject
  30. {
  31.   friend class PrivateDocumentManager;
  32.  
  33.   Q_OBJECT
  34.  
  35.   public:
  36.     DocumentManager ( void *documentManager  );
  37.     virtual ~DocumentManager ();
  38.  
  39.   public:
  40.     /** Returns a pointer to the document indexed by n in the managers internal list.
  41.     */
  42.     class Document *document (uint n = 0);
  43.     /** Returns a pointer to the currently active document or NULL if no document is open.
  44.     */
  45.     class Document *activeDocument ();
  46.     /** Returns a pointer to the document with the given ID or NULL if no such document exists.
  47.     */
  48.     class Document *documentWithID (uint id);
  49.  
  50.     /** Returns the ID of the document located at url if such a document is known by the manager.
  51.      */
  52.     int findDocument (const KURL &url);
  53.     /** Returns true if the document located at url is open, otherwise false.
  54.      */
  55.     bool isOpen (const KURL &url);
  56.  
  57.     /** returns the number of documents managed by this manager.
  58.     */
  59.     uint documents ();
  60.  
  61.     /** open a document and return a pointer to the document, if you specify a pointer != 0 to the id parameter
  62.      * you will get the document id returned too
  63.      */
  64.     class Document *openURL(const KURL&url,const QString &encoding=QString::null,uint *id =0);
  65.     /** close a document by pointer
  66.      */
  67.     bool closeDocument(class Document *document);
  68.     /** close a document identified by the index
  69.      */
  70.     bool closeDocument(uint n = 0);
  71.     /** close a document identified by the ID
  72.      */
  73.     bool closeDocumentWithID(uint id);
  74.     /** close all documents
  75.      */
  76.     bool closeAllDocuments();
  77.  
  78.   #undef signals
  79.   #define signals public
  80.   signals:
  81.   #undef signals
  82.   #define signals protected
  83.  
  84.     /**
  85.      * emitted if the current doc changes (there need not to be a active document)
  86.      */
  87.     void documentChanged ();
  88.     
  89.     /**
  90.      * this document has now been created
  91.      */
  92.     void documentCreated (Kate::Document *document);
  93.     
  94.     /**
  95.      * the document with this number was deleted
  96.      */
  97.     void documentDeleted (uint documentNumber);
  98.  
  99.   private:
  100.     class PrivateDocumentManager *d;
  101. };
  102.  
  103. /**
  104.  * Returns the document manager object
  105.  * @return DocumentManager document manager object
  106.  */
  107. KDE_EXPORT DocumentManager *documentManager ();
  108.  
  109. }
  110.  
  111. #endif
  112.