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 height() const;
00051     int width( const QFontMetrics &fm, const QListView* lv, int column ) const;
00052     int rtti() const { return RTTI_KateFileListItem; }
00053 
00057     void setViewHistPos( int p ) {  m_viewhistpos = p; }
00061     void setEditHistPos( int p ) { m_edithistpos = p; }
00062 
00063   protected:
00064     void paintCell( QPainter *painter, const QColorGroup & cg, int column, int width, int align );
00068     int compare ( QListViewItem * i, int col, bool ascending ) const;
00069 
00070   private:
00071     Kate::Document *doc;
00072     int m_viewhistpos; 
00073     int m_edithistpos; 
00074     uint m_docNumber;
00075 };
00076 
00077 class KateFileList : public KListView
00078 {
00079   Q_OBJECT
00080 
00081   friend class KFLConfigPage;
00082 
00083   public:
00084     KateFileList (KateMainWindow *main, KateViewManager *_viewManager, QWidget * parent = 0, const char * name = 0 );
00085     ~KateFileList ();
00086 
00087     int sortType () const { return m_sort; };
00088     void updateSort ();
00089 
00090     enum sorting {
00091       sortByID = 0,
00092       sortByName = 1,
00093       sortByURL = 2
00094     };
00095 
00096     QString tooltip( QListViewItem *item, int );
00097 
00098     uint histCount() const { return m_viewHistory.count(); }
00099     uint editHistCount() const { return m_editHistory.count(); }
00100     QColor editShade() const { return m_editShade; }
00101     QColor viewShade() const { return m_viewShade; }
00102     bool shadingEnabled() { return m_enableBgShading; }
00103 
00104     void readConfig( class KConfig *config, const QString &group );
00105     void writeConfig( class KConfig *config, const QString &group );
00106 
00110     void takeItem( QListViewItem * );
00111 
00112   public slots:
00113     void setSortType (int s);
00114     void slotNextDocument();
00115     void slotPrevDocument();
00116 
00117   private slots:
00118     void slotDocumentCreated (Kate::Document *doc);
00119     void slotDocumentDeleted (uint documentNumber);
00120     void slotActivateView( QListViewItem *item );
00121     void slotModChanged (Kate::Document *doc);
00122     void slotModifiedOnDisc (Kate::Document *doc, bool b, unsigned char reason);
00123     void slotNameChanged (Kate::Document *doc);
00124     void slotViewChanged ();
00125     void slotMenu ( QListViewItem *item, const QPoint &p, int col );
00126 
00127   protected:
00128     virtual void keyPressEvent( QKeyEvent *e );
00133     virtual void contentsMousePressEvent( QMouseEvent *e );
00138     virtual void resizeEvent( QResizeEvent *e );
00139 
00140   private:
00141     void setupActions ();
00142     void updateActions ();
00143 
00144   private:
00145     KateMainWindow *m_main;
00146     KateViewManager *viewManager;
00147 
00148     int m_sort;
00149     bool notify;
00150 
00151     KAction* windowNext;
00152     KAction* windowPrev;
00153 
00154     QPtrList<KateFileListItem> m_viewHistory;
00155     QPtrList<KateFileListItem> m_editHistory;
00156 
00157     QColor m_viewShade, m_editShade;
00158     bool m_enableBgShading;
00159 
00160     class ToolTip *m_tooltip;
00161 };
00162 
00163 class KFLConfigPage : public Kate::ConfigPage {
00164   Q_OBJECT
00165   public:
00166     KFLConfigPage( QWidget* parent=0, const char *name=0, KateFileList *fl=0 );
00167     virtual ~KFLConfigPage() {};
00168 
00169     virtual void apply();
00170     virtual void reload();
00171 
00172   public slots:
00173     void slotEnableChanged();
00174 
00175   private slots:
00176     void slotMyChanged();
00177 
00178   private:
00179     class QCheckBox *cbEnableShading;
00180     class KColorButton *kcbViewShade, *kcbEditShade;
00181     class QLabel *lEditShade, *lViewShade;
00182     KateFileList *m_filelist;
00183 
00184     bool m_changed;
00185 };
00186 
00187 
00188 #endif
00189 // 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.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Jun 14 01:19:50 2006 by doxygen 1.4.0 written by Dimitri van Heesch, © 1997-2003