kcombiview.h
00001 /* -*- c++ -*- 00002 This file is part of the KDE libraries 00003 Copyright (C) 1998 Stephan Kulow <coolo@kde.org> 00004 1998 Daniel Grana <grana@ie.iwi.unibe.ch> 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 as published by the Free Software Foundation; either 00009 version 2 of the License, or (at your option) any later version. 00010 00011 This library is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 Library General Public License for more details. 00015 00016 You should have received a copy of the GNU Library General Public License 00017 along with this library; see the file COPYING.LIB. If not, write to 00018 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00019 Boston, MA 02111-1307, USA. 00020 */ 00021 00022 #ifndef _KCOMBIVIEW_H 00023 #define _KCOMBIVIEW_H 00024 00025 #include <qsplitter.h> 00026 #include <klocale.h> 00027 00028 #include <kfile.h> 00029 #include <kfileview.h> 00030 00031 class KFileIconView; 00032 class QIconViewItem; 00033 00053 class KCombiView : public QSplitter, 00054 public KFileView 00055 { 00056 Q_OBJECT 00057 00058 public: 00059 KCombiView( QWidget *parent, const char *name); 00060 virtual ~KCombiView(); 00061 00062 virtual QWidget *widget() { return this; } 00063 virtual void clearView(); 00064 00065 virtual void updateView( bool ); 00066 virtual void updateView(const KFileItem*); 00067 virtual void removeItem( const KFileItem * ); 00068 virtual void listingCompleted(); 00069 00074 void setRight(KFileView *view); 00075 00076 virtual void setSelectionMode( KFile::SelectionMode sm ); 00077 00078 virtual void setSelected(const KFileItem *, bool); 00079 virtual bool isSelected( const KFileItem * ) const; 00080 virtual void clearSelection(); 00081 virtual void selectAll(); 00082 virtual void invertSelection(); 00083 00084 virtual void setCurrentItem( const KFileItem * ); 00085 virtual KFileItem * currentFileItem() const; 00086 virtual KFileItem * firstFileItem() const; 00087 virtual KFileItem * nextItem( const KFileItem * ) const; 00088 virtual KFileItem * prevItem( const KFileItem * ) const; 00089 00090 virtual void insertItem( KFileItem *i ); 00091 virtual void clear(); 00092 00093 virtual void setSorting( QDir::SortSpec sort ); 00094 00095 virtual void readConfig( KConfig *, const QString& group = QString::null ); 00096 virtual void writeConfig( KConfig *, const QString& group = QString::null); 00097 00098 void ensureItemVisible( const KFileItem * ); 00099 00100 virtual KActionCollection * actionCollection() const; 00101 00102 protected: 00103 KFileIconView *left; 00104 KFileView *right; 00105 00106 protected slots: 00107 void slotSortingChanged( QDir::SortSpec ); 00108 00109 private: 00110 KFileView *focusView( KFileView *preferred ) const; 00111 00112 // in nextItem() and prevItem(), we have to switch views, when the first 00113 // view returns 0L. So we need to remember which view was used in the 00114 // previous call to next/prevItem(). Yes, it's a hack, but it works for 00115 // some cases at least. 00116 mutable KFileView *m_lastViewForNextItem; 00117 mutable KFileView *m_lastViewForPrevItem; 00118 00119 protected: 00120 virtual void virtual_hook( int id, void* data ); 00121 private: 00122 class KCombiViewPrivate; 00123 KCombiViewPrivate *d; 00124 00125 }; 00126 00127 #endif