home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / kcombiview.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-10-10  |  4.1 KB  |  134 lines

  1. /*  -*- c++ -*-
  2.     This file is part of the KDE libraries
  3.     Copyright (C) 1998 Stephan Kulow <coolo@kde.org>
  4.                   1998 Daniel Grana <grana@ie.iwi.unibe.ch>
  5.  
  6.     This library is free software; you can redistribute it and/or
  7.     modify it under the terms of the GNU Library General Public
  8.     License as published by the Free Software Foundation; either
  9.     version 2 of the License, or (at your option) any later version.
  10.  
  11.     This library is distributed in the hope that it will be useful,
  12.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14.     Library General Public License for more details.
  15.  
  16.     You should have received a copy of the GNU Library General Public License
  17.     along with this library; see the file COPYING.LIB.  If not, write to
  18.     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  19.     Boston, MA 02110-1301, USA.
  20. */
  21.  
  22. #ifndef _KCOMBIVIEW_H
  23. #define _KCOMBIVIEW_H
  24.  
  25. #include <qsplitter.h>
  26. #include <klocale.h>
  27.  
  28. #include <kfile.h>
  29. #include <kfileview.h>
  30.  
  31. class KFileIconView;
  32. class QEvent;
  33. class QIconViewItem;
  34.  
  35. /**
  36.  * This view is designed to combine two KFileViews into one widget, to show
  37.  * directories on the left side and files on the right side.
  38.  *
  39.  * Methods like selectedItems() to query status _only_ work on the right side,
  40.  * i.e. on the files.
  41.  *
  42.  * After creating the KCombiView, you need to supply the view shown in the
  43.  * right, (see setRight()). Available KFileView implementations are
  44.  * KFileIconView and KFileDetailView.
  45.  *
  46.  * Most of the below methods are just implementations of the baseclass
  47.  * KFileView, so look there for documentation.
  48.  *
  49.  * @see KFileView
  50.  * @see KFileIconView
  51.  * @see KFileDetailView
  52.  * @see KDirOperator
  53.  */
  54. class KIO_EXPORT KCombiView : public QSplitter,
  55.            public KFileView
  56. {
  57.     Q_OBJECT
  58.  
  59. public:
  60.     KCombiView( QWidget *parent, const char *name);
  61.     virtual ~KCombiView();
  62.  
  63.     virtual QWidget *widget() { return this; }
  64.     virtual void clearView();
  65.  
  66.     virtual void updateView( bool );
  67.     virtual void updateView(const KFileItem*);
  68.     virtual void removeItem( const KFileItem * );
  69.     virtual void listingCompleted();
  70.  
  71.     /**
  72.      * Sets the view to be shown in the right. You need to call this before
  73.      * doing anything else with this widget.
  74.      */
  75.     void setRight(KFileView *view);
  76.  
  77.     virtual void setSelectionMode( KFile::SelectionMode sm );
  78.  
  79.     virtual void setSelected(const KFileItem *, bool);
  80.     virtual bool isSelected( const KFileItem * ) const;
  81.     virtual void clearSelection();
  82.     virtual void selectAll();
  83.     virtual void invertSelection();
  84.  
  85.     virtual void setCurrentItem( const KFileItem * );
  86.     virtual KFileItem * currentFileItem() const;
  87.     virtual KFileItem * firstFileItem() const;
  88.     virtual KFileItem * nextItem( const KFileItem * ) const;
  89.     virtual KFileItem * prevItem( const KFileItem * ) const;
  90.  
  91.     virtual void insertItem( KFileItem *i );
  92.     virtual void clear();
  93.  
  94.     virtual void setSorting( QDir::SortSpec sort );
  95.  
  96.     virtual void readConfig( KConfig *, const QString& group = QString::null );
  97.     virtual void writeConfig( KConfig *, const QString& group = QString::null);
  98.  
  99.     void ensureItemVisible( const KFileItem * );
  100.  
  101.     virtual KActionCollection * actionCollection() const;
  102.  
  103.     virtual void setAcceptDrops(bool b);
  104.  
  105. protected:
  106.     KFileIconView *left;
  107.     KFileView *right;
  108.  
  109. protected slots:
  110.     void slotSortingChanged( QDir::SortSpec );
  111.  
  112. private:
  113.     KFileView *focusView( KFileView *preferred ) const;
  114.  
  115.     // in nextItem() and prevItem(), we have to switch views, when the first
  116.     // view returns 0L. So we need to remember which view was used in the
  117.     // previous call to next/prevItem(). Yes, it's a hack, but it works for
  118.     // some cases at least.
  119.     mutable KFileView *m_lastViewForNextItem;
  120.     mutable KFileView *m_lastViewForPrevItem;
  121.  
  122. protected:
  123.     virtual bool eventFilter( QObject *o, QEvent *e );
  124.     void setDropOptions_impl(int options);
  125.  
  126.     virtual void virtual_hook( int id, void* data );
  127. private:
  128.     class KCombiViewPrivate;
  129.     KCombiViewPrivate *d;
  130.  
  131. };
  132.  
  133. #endif
  134.