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., 51 Franklin Street, Fifth Floor, 00018 Boston, MA 02110-1301, 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 <tqtooltip.h> 00031 #include <tqcolor.h> 00032 #include <tqptrlist.h> 00033 00034 #define RTTI_KateFileListItem 1001 00035 00036 class KateMainWindow; 00037 00038 class KAction; 00039 class KSelectAction; 00040 00041 class KateFileListItem : public TQListViewItem 00042 { 00043 public: 00044 KateFileListItem( TQListView *lv, 00045 Kate::Document *doc ); 00046 ~KateFileListItem(); 00047 00048 inline uint documentNumber () { return m_docNumber; } 00049 inline Kate::Document * document() { return doc; } 00050 00051 int rtti() const { return RTTI_KateFileListItem; } 00052 00056 void setViewHistPos( int p ) { m_viewhistpos = p; } 00060 void setEditHistPos( int p ) { m_edithistpos = p; } 00061 00062 protected: 00063 virtual const TQPixmap *pixmap ( int column ) const; 00064 void paintCell( TQPainter *painter, const TQColorGroup & cg, int column, int width, int align ); 00068 int compare ( TQListViewItem * 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, TQWidget * 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 sortManual = 3 00095 }; 00096 00097 TQString tooltip( TQListViewItem *item, int ); 00098 00099 uint histCount() const { return m_viewHistory.count(); } 00100 uint editHistCount() const { return m_editHistory.count(); } 00101 TQColor editShade() const { return m_editShade; } 00102 TQColor viewShade() const { return m_viewShade; } 00103 bool shadingEnabled() { return m_enableBgShading; } 00104 00105 void readConfig( class KConfig *config, const TQString &group ); 00106 void writeConfig( class KConfig *config, const TQString &group ); 00107 00111 void takeItem( TQListViewItem * ); 00112 00113 public slots: 00114 void setSortType (int s); 00115 void moveFileUp(); 00116 void moveFileDown(); 00117 void slotNextDocument(); 00118 void slotPrevDocument(); 00119 00120 private slots: 00121 void slotDocumentCreated (Kate::Document *doc); 00122 void slotDocumentDeleted (uint documentNumber); 00123 void slotActivateView( TQListViewItem *item ); 00124 void slotModChanged (Kate::Document *doc); 00125 void slotModifiedOnDisc (Kate::Document *doc, bool b, unsigned char reason); 00126 void slotNameChanged (Kate::Document *doc); 00127 void slotViewChanged (); 00128 void slotMenu ( TQListViewItem *item, const TQPoint &p, int col ); 00129 00130 protected: 00131 virtual void keyPressEvent( TQKeyEvent *e ); 00136 virtual void contentsMousePressEvent( TQMouseEvent *e ); 00141 virtual void resizeEvent( TQResizeEvent *e ); 00142 00143 private: 00144 void setupActions (); 00145 void updateActions (); 00146 00147 private: 00148 KateMainWindow *m_main; 00149 KateViewManager *viewManager; 00150 00151 int m_sort; 00152 bool notify; 00153 00154 KAction* windowNext; 00155 KAction* windowPrev; 00156 KSelectAction* sortAction; 00157 KAction* listMoveFileUp; 00158 KAction* listMoveFileDown; 00159 00160 TQPtrList<KateFileListItem> m_viewHistory; 00161 TQPtrList<KateFileListItem> m_editHistory; 00162 00163 TQColor m_viewShade, m_editShade; 00164 bool m_enableBgShading; 00165 00166 TQListViewItem *m_clickedMenuItem; 00167 00168 class ToolTip *m_tooltip; 00169 }; 00170 00171 class KFLConfigPage : public Kate::ConfigPage { 00172 Q_OBJECT 00173 public: 00174 KFLConfigPage( TQWidget* parent=0, const char *name=0, KateFileList *fl=0 ); 00175 virtual ~KFLConfigPage() {}; 00176 00177 virtual void apply(); 00178 virtual void reload(); 00179 00180 public slots: 00181 void slotEnableChanged(); 00182 00183 private slots: 00184 void slotMyChanged(); 00185 00186 private: 00187 class TQCheckBox *cbEnableShading; 00188 class KColorButton *kcbViewShade, *kcbEditShade; 00189 class TQLabel *lEditShade, *lViewShade, *lSort; 00190 class TQComboBox *cmbSort; 00191 KateFileList *m_filelist; 00192 00193 bool m_changed; 00194 }; 00195 00196 00197 #endif 00198 // kate: space-indent on; indent-width 2; replace-tabs on;