kate Library API Documentation

katefilelist.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_FILELIST_H__
00022 #define __KATE_FILELIST_H__
00023 
00024 #include "katemain.h"
00025 
00026 #include <kate/document.h>
00027 
00028 #include <klistview.h>
00029 
00030 #include <qtooltip.h>
00031 #include <qcolor.h>
00032 #include <qptrlist.h>
00033 
00034 #define RTTI_KateFileListItem 1001
00035 
00036 class KateMainWindow;
00037 
00038 class KAction;
00039 
00040 class KateFileListItem : public QListViewItem
00041 {
00042   public:
00043     KateFileListItem( QListView *lv,
00044               Kate::Document *doc );
00045     ~KateFileListItem();
00046 
00047     inline uint documentNumber () { return m_docNumber; }
00048     inline Kate::Document * document() { return doc; }
00049 
00050     int rtti() const { return RTTI_KateFileListItem; }
00051 
00055     void setViewHistPos( int p ) {  m_viewhistpos = p; }
00059     void setEditHistPos( int p ) { m_edithistpos = p; }
00060 
00061   protected:
00062     virtual const QPixmap *pixmap ( int column ) const;
00063     void paintCell( QPainter *painter, const QColorGroup & cg, int column, int width, int align );
00067     int compare ( QListViewItem * i, int col, bool ascending ) const;
00068 
00069   private:
00070     Kate::Document *doc;
00071     int m_viewhistpos; 
00072     int m_edithistpos; 
00073     uint m_docNumber;
00074 };
00075 
00076 class KateFileList : public KListView
00077 {
00078   Q_OBJECT
00079 
00080   friend class KFLConfigPage;
00081 
00082   public:
00083     KateFileList (KateMainWindow *main, KateViewManager *_viewManager, QWidget * parent = 0, const char * name = 0 );
00084     ~KateFileList ();
00085 
00086     int sortType () const { return m_sort; };
00087     void updateSort ();
00088 
00089     enum sorting {
00090       sortByID = 0,
00091       sortByName = 1,
00092       sortByURL = 2
00093     };
00094 
00095     QString tooltip( QListViewItem *item, int );
00096 
00097     uint histCount() const { return m_viewHistory.count(); }
00098     uint editHistCount() const { return m_editHistory.count(); }
00099     QColor editShade() const { return m_editShade; }
00100     QColor viewShade() const { return m_viewShade; }
00101     bool shadingEnabled() { return m_enableBgShading; }
00102 
00103     void readConfig( class KConfig *config, const QString &group );
00104     void writeConfig( class KConfig *config, const QString &group );
00105 
00109     void takeItem( QListViewItem * );
00110 
00111   public slots:
00112     void setSortType (int s);
00113     void slotNextDocument();
00114     void slotPrevDocument();
00115 
00116   private slots:
00117     void slotDocumentCreated (Kate::Document *doc);
00118     void slotDocumentDeleted (uint documentNumber);
00119     void slotActivateView( QListViewItem *item );
00120     void slotModChanged (Kate::Document *doc);
00121     void slotModifiedOnDisc (Kate::Document *doc, bool b, unsigned char reason);
00122     void slotNameChanged (Kate::Document *doc);
00123     void slotViewChanged ();
00124     void slotMenu ( QListViewItem *item, const QPoint &p, int col );
00125 
00126   protected:
00127     virtual void keyPressEvent( QKeyEvent *e );
00132     virtual void contentsMousePressEvent( QMouseEvent *e );
00137     virtual void resizeEvent( QResizeEvent *e );
00138 
00139   private:
00140     void setupActions ();
00141     void updateActions ();
00142 
00143   private:
00144     KateMainWindow *m_main;
00145     KateViewManager *viewManager;
00146 
00147     int m_sort;
00148     bool notify;
00149 
00150     KAction* windowNext;
00151     KAction* windowPrev;
00152 
00153     QPtrList<KateFileListItem> m_viewHistory;
00154     QPtrList<KateFileListItem> m_editHistory;
00155 
00156     QColor m_viewShade, m_editShade;
00157     bool m_enableBgShading;
00158 
00159     class ToolTip *m_tooltip;
00160 };
00161 
00162 class KFLConfigPage : public Kate::ConfigPage {
00163   Q_OBJECT
00164   public:
00165     KFLConfigPage( QWidget* parent=0, const char *name=0, KateFileList *fl=0 );
00166     virtual ~KFLConfigPage() {};
00167 
00168     virtual void apply();
00169     virtual void reload();
00170 
00171   public slots:
00172     void slotEnableChanged();
00173 
00174   private slots:
00175     void slotMyChanged();
00176 
00177   private:
00178     class QCheckBox *cbEnableShading;
00179     class KColorButton *kcbViewShade, *kcbEditShade;
00180     class QLabel *lEditShade, *lViewShade;
00181     KateFileList *m_filelist;
00182 
00183     bool m_changed;
00184 };
00185 
00186 
00187 #endif
00188 // kate: space-indent on; indent-width 2; replace-tabs on;
KDE Logo
This file is part of the documentation for kate Library Version 3.4.3.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Jun 14 01:53:50 2006 by doxygen 1.4.4 written by Dimitri van Heesch, © 1997-2003