kate Library API Documentation

katemainwindow.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_MAINWINDOW_H__
00022 #define __KATE_MAINWINDOW_H__
00023 
00024 #include "katemain.h"
00025 #include "../interfaces/mainwindow.h"
00026 #include "../interfaces/toolviewmanager.h"
00027 
00028 #include "kateviewmanager.h"
00029 
00030 #include "kateprojectmanager.h"
00031 
00032 #include <kate/view.h>
00033 #include <kate/document.h>
00034 
00035 #include <kparts/part.h>
00036 #include <kparts/dockmainwindow.h>
00037 #include <kmdimainfrm.h>
00038 
00039 #include <qguardedptr.h>
00040 
00041 #include <scriptmanager.h>
00042 #include <kaction.h>
00043 
00044 class GrepTool;
00045 
00046 class KFileItem;
00047 class KRecentFilesAction;
00048 class DCOPObject;
00049 
00050 class KateMainWindow : public KMdiMainFrm, virtual public KParts::PartBase
00051 {
00052   Q_OBJECT
00053 
00054   friend class KateConfigDialog;
00055   friend class KateApp;
00056   friend class KateViewManager;
00057   friend class KateView;
00058   friend class KateDocument;
00059 
00060   public:
00061     KateMainWindow ( KateDocManager *_docManager, KatePluginManager *_pluginManager,
00062                      KateProjectManager *projectMan, KMdi::MdiMode guiMode );
00063     ~KateMainWindow();
00064 
00065     Kate::MainWindow *mainWindow () { return m_mainWindow; }
00066     Kate::ToolViewManager *toolViewManager () { return m_toolViewManager; }
00067 
00068     Kate::Project *activeProject () { return m_project; }
00069 
00076      Kate::Project *createProject (const QString &type, const QString &name, const QString &filename);
00077 
00082     Kate::Project *openProject (const QString &filename);
00083 
00084     void activateProject (Kate::Project *project);
00085 
00088     KURL activeDocumentUrl();
00089 
00090     DCOPObject *dcopObject () { return m_dcop; }
00091 
00092     DCOPObject *m_dcop;
00093 
00094     // console
00095     KateConsole *console;
00096 
00097     // management items
00098     KateDocManager *m_docManager;
00099     KateViewManager *m_viewManager;
00100     KateProjectManager *m_projectManager;
00101 
00102     // should be protected, and kateviewmanager a friend class.
00103     KRecentFilesAction *fileOpenRecent;
00104 
00105     KateFileList *filelist;
00106     class KateProjectList *projectlist;
00107     class KateProjectViews *projectviews;
00108     KateFileSelector *fileselector;
00109 
00110   private:
00111     uint myID;
00112     bool syncKonsole;
00113     bool modNotification;
00114 
00115   public:
00116     bool notifyMod() const { return modNotification; }
00117     uint mainWindowNumber () const { return myID; }
00118 
00119   protected:
00120     KatePluginManager *m_pluginManager;
00121 
00122   private:
00123     QGuardedPtr<Kate::Project> m_project;
00124     uint m_projectNumber;
00125     QGuardedPtr<Kate::View> activeView;
00126 
00127     KAction *closeCurrentViewSpace;
00128 
00129     KAction *goNext;
00130     KAction *goPrev;
00131 
00132     KAction *saveProject;
00133     KAction *closeProject;
00134     KRecentFilesAction *recentProjects;
00135 
00136     KActionMenu* documentOpenWith;
00137 
00138     KAction *gotoLine;
00139     KAction* windowNext;
00140     KAction* windowPrev;
00141 
00142     QPopupMenu *documentMenu;
00143 
00144     KToggleAction* settingsShowFilelist;
00145     KToggleAction* settingsShowFileselector;
00146     KToggleAction* showFullScreenAction;
00147 
00148     KAction* settingsConfigure;
00149 
00150     KActionMenu *scriptMenu;
00151     KScriptManager* kscript;
00152 
00153   public slots:
00154     void newWindow ();
00155 
00156     void slotConfigure();
00157 
00158     void slotOpenWithMenuAction(int idx);
00159 
00160  private:
00161      GrepTool * greptool;
00162 
00163   public slots:
00164     void slotGrepToolItemSelected ( const QString &filename, int linenumber );
00165     void runScript( int menuItemId);
00166     void slotMail();
00167 
00168   public:
00169     void readProperties(KConfig *config);
00170     void saveProperties(KConfig *config);
00171     void saveGlobalProperties( KConfig* sessionConfig );
00172 
00173   private:
00174     void setupMainWindow();
00175     void setupActions();
00176     void setupScripts();
00177     bool queryClose();
00178 
00179     void readOptions(KConfig *);
00180     void saveOptions(KConfig *);
00181 
00182     void dragEnterEvent( QDragEnterEvent * );
00183     void dropEvent( QDropEvent * );
00184 
00185   private slots:
00186     void slotFileQuit();
00187     void slotEditToolbars();
00188     void slotDocumentChanged();
00189     void slotWindowActivated ();
00190     void documentMenuAboutToShow();
00191     void slotDropEvent(QDropEvent *);
00192     void editKeys();
00193     void mSlotFixOpenWithMenu();
00194     void slotGoNext();
00195     void slotGoPrev();
00196 
00197     void fileSelected(const KFileItem *file);
00198 
00199     void tipOfTheDay();
00200 
00201     /* to update the caption */
00202     void slotDocumentCreated (Kate::Document *doc);
00203     void updateCaption (Kate::Document *doc);
00204 
00205   public:
00206     void openURL (const QString &name=0L);
00207 
00208     static KMdi::MdiMode defaultMode;
00209 
00210   protected:
00211     bool eventFilter( QObject*, QEvent * );
00212     static uint uniqueID;
00213     Kate::MainWindow *m_mainWindow;
00214     Kate::ToolViewManager *m_toolViewManager;
00215 
00216   public:
00217     Kate::ViewManager *viewManager () {return m_viewManager->viewManager(); }
00218     KateViewManager *kateViewManager () { return m_viewManager; }
00219 
00220   public: //ToolViewManager stuff
00221     KMdiToolViewAccessor *addToolView(KDockWidget::DockPosition position, QWidget *widget, const QPixmap &icon, const QString &sname, const QString &tabToolTip = 0, const QString &tabCaption = 0);
00222     
00223     bool removeToolView(QWidget *);
00224     bool removeToolView(KMdiToolViewAccessor *);
00225 
00226     bool showToolView(QWidget *);
00227     bool showToolView(KMdiToolViewAccessor *);
00228     
00229     bool hideToolView(QWidget *);
00230     bool hideToolView(KMdiToolViewAccessor *);
00231 
00232   private slots:
00233     void pluginHelp ();
00234     void slotFullScreen(bool);
00235 
00236   // slots for the project GUI actions: new/open/save/close
00237   public slots:
00238     void slotProjectNew ();
00239     void slotProjectOpen ();
00240     void slotProjectSave ();
00241     void slotProjectClose ();
00242 
00243     // recent files
00244     void openConstURLProject (const KURL&);
00245 
00246   private slots:
00247     void projectDeleted (uint projectNumber);
00248 };
00249 
00250 #endif
00251 
00252 
KDE Logo
This file is part of the documentation for kate Library Version 3.2.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Fri Mar 5 04:41:10 2004 by doxygen 1.3.6-20040222 written by Dimitri van Heesch, © 1997-2003