• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • kdeui
 

kdeui

klistview.h
00001 /* This file is part of the KDE libraries
00002    Copyright (C) 2000 Reginald Stadlbauer <reggie@kde.org>
00003    Copyright (C) 2000 Charles Samuels <charles@kde.org>
00004    Copyright (C) 2000 Peter Putzer <putzer@kde.org>
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 #ifndef KLISTVIEW_H
00021 #define KLISTVIEW_H
00022 
00023 #include <tqlistview.h>
00024 
00025 #include <tqptrlist.h>
00026 #include <kdelibs_export.h>
00027 
00028 class TQDragObject;
00029 class KConfig;
00030 class KLineEdit;
00053 class KDEUI_EXPORT KListView : public TQListView
00054 {
00055   friend class KListViewItem;
00056 
00057   Q_OBJECT
00058   TQ_OBJECT
00059   Q_ENUMS( SelectionModeExt )
00060   Q_PROPERTY( bool fullWidth READ fullWidth WRITE setFullWidth )
00061   Q_PROPERTY( bool itemsMovable READ itemsMovable WRITE setItemsMovable )
00062   Q_PROPERTY( bool itemsRenameable READ itemsRenameable WRITE setItemsRenameable )
00063   Q_PROPERTY( bool dragEnabled READ dragEnabled  WRITE  setDragEnabled )
00064   Q_PROPERTY( bool autoOpen READ autoOpen WRITE setAutoOpen )
00065   Q_PROPERTY( bool dropVisualizer READ dropVisualizer WRITE setDropVisualizer )
00066   Q_PROPERTY( int tooltipColumn READ tooltipColumn WRITE  setTooltipColumn )
00067   Q_PROPERTY( int dropVisualizerWidth READ dropVisualizerWidth WRITE  setDropVisualizerWidth )
00068   Q_PROPERTY( TQColor alternateBackground READ alternateBackground WRITE  setAlternateBackground )
00069   Q_PROPERTY( bool shadeSortColumn READ shadeSortColumn WRITE setShadeSortColumn )
00070 
00071   Q_OVERRIDE( SelectionModeExt selectionMode READ selectionModeExt WRITE setSelectionModeExt )
00072 
00073 public:
00105   enum SelectionModeExt {
00106     Single = TQListView::Single,
00107     Multi = TQListView::Multi,
00108     Extended = TQListView::Extended,
00109     NoSelection = TQListView::NoSelection,
00110     FileManager
00111   };
00112 
00119   KListView (TQWidget *parent = 0, const char *name = 0);
00120 
00124   virtual ~KListView();
00125 
00133   virtual void setAcceptDrops (bool);
00134 
00144   virtual bool isExecuteArea( const TQPoint& point );
00145 
00151   bool isExecuteArea( int x );
00152 
00158   TQPtrList<TQListViewItem> selectedItems() const;
00159 
00170   TQPtrList<TQListViewItem> selectedItems(bool includeHiddenItems) const; // ### BIC: KDE 4: use an implicitly shared class! (QValutList?) and merge with above, default to true
00171 
00178   void moveItem(TQListViewItem *item, TQListViewItem *parent, TQListViewItem *after);
00179 
00185   TQListViewItem *lastItem() const;
00186 
00192   TQListViewItem* lastChild () const;
00193 
00200   KLineEdit* renameLineEdit() const;
00201 
00208   bool itemsMovable() const;
00209 
00215   bool itemsRenameable() const;
00216 
00222   bool dragEnabled() const;
00223 
00229   bool autoOpen() const;
00230 
00236   bool isRenameable (int column) const;
00237 
00243   bool dropVisualizer() const;
00244 
00250   int tooltipColumn() const;
00251 
00258   bool createChildren() const KDE_DEPRECATED;
00259 
00265   bool dropHighlighter() const;
00266 
00273   int dropVisualizerWidth () const;
00274 
00281   SelectionModeExt selectionModeExt () const;
00282 
00288   int itemIndex( const TQListViewItem *item ) const;
00289 
00295   TQListViewItem* itemAtIndex(int index);
00296 
00301   void setFullWidth() KDE_DEPRECATED;
00302 
00308   void setFullWidth(bool fullWidth);
00309 
00315   bool fullWidth() const;
00316 
00322   virtual int addColumn(const TQString& label, int width = -1);
00326   virtual int addColumn(const TQIconSet& iconset, const TQString& label, int width = -1);
00332   virtual void removeColumn(int index);
00333 
00343   void setAlternateBackground(const TQColor &c);
00349   const TQColor &alternateBackground() const;
00350 
00358   void saveLayout(KConfig *config, const TQString &group) const;
00366   void restoreLayout(KConfig *config, const TQString &group);
00373   virtual void setSorting(int column, bool ascending = true);
00374 
00378   int columnSorted(void) const;
00379 
00383   bool ascendingSort(void) const;
00384 
00388   virtual void takeItem(TQListViewItem *i);
00389 
00396   void setShadeSortColumn(bool shadeSortColumn);
00397 
00404   bool shadeSortColumn(void) const;
00405 signals:
00406 
00416   void executed( TQListViewItem *item );
00417 
00429   void executed( TQListViewItem *item, const TQPoint &pos, int c );
00430 
00441   void dropped (TQDropEvent * e, TQListViewItem *after);
00442 
00455   void dropped (KListView* list, TQDropEvent* e, TQListViewItem* after);
00456 
00469   void dropped (KListView* list, TQDropEvent* e, TQListViewItem* parent, TQListViewItem* after);
00470 
00482   void dropped (TQDropEvent* e, TQListViewItem* parent, TQListViewItem* after);
00483 
00490   void moved();
00491 
00500   void aboutToMove();
00501 
00513   void moved (TQListViewItem *item, TQListViewItem *afterFirst, TQListViewItem *afterNow);
00514 
00515 
00521   void moved(TQPtrList<TQListViewItem> &items, TQPtrList<TQListViewItem> &afterFirst, TQPtrList<TQListViewItem> &afterNow);
00522 
00530   void itemRenamed(TQListViewItem* item, const TQString &str, int col);
00531 
00535   void itemRenamed(TQListViewItem* item);
00536 
00547   void menuShortCutPressed (KListView* list, TQListViewItem* item);
00548 
00557   void contextMenu (KListView* l, TQListViewItem* i, const TQPoint& p);
00558 
00559   void itemAdded(TQListViewItem *item);
00560   void itemRemoved(TQListViewItem *item);
00561 
00562 public slots:
00566   virtual void rename(TQListViewItem *item, int c);
00567 
00578   void setRenameable (int column, bool yesno=true);
00579 
00586   virtual void setItemsMovable(bool b);
00587 
00595   virtual void setItemsRenameable(bool b);
00596 
00601   virtual void setDragEnabled(bool b);
00602 
00606   virtual void setAutoOpen(bool b);
00607 
00613   virtual void setDropVisualizer(bool b);
00614 
00619   void setDropVisualizerWidth (int w);
00620 
00627   virtual void setTooltipColumn(int column);
00628 
00634   virtual void setDropHighlighter(bool b);
00635 
00642   virtual void setCreateChildren(bool b) KDE_DEPRECATED;
00643 
00649   void setSelectionModeExt (SelectionModeExt mode);
00650 
00655   void setTabOrderedRenaming(bool b);
00656 
00661   bool tabOrderedRenaming() const;
00662 
00669   virtual void selectAll( bool select );
00670 
00671 protected:
00680   inline bool below (const TQRect& rect, const TQPoint& p)
00681   {
00682     return (p.y() > (rect.top() + (rect.bottom() - rect.top())/2));
00683   }
00684 
00694   inline bool below (TQListViewItem* i, const TQPoint& p)
00695   {
00696     return below (itemRect(i), contentsToViewport(p));
00697   }
00698 
00703   virtual bool event( TQEvent * );
00704 
00709   void emitExecute( TQListViewItem *item, const TQPoint &pos, int c );
00710 
00718    virtual void focusInEvent(TQFocusEvent* fe);
00719 
00727   virtual void focusOutEvent( TQFocusEvent *fe );
00728 
00736   virtual void leaveEvent( TQEvent *e );
00737 
00741   virtual TQString tooltip(TQListViewItem* item, int column) const;
00742 
00746   virtual bool showTooltip(TQListViewItem *item, const TQPoint &pos, int column) const;
00747 
00755   virtual void contentsDragMoveEvent (TQDragMoveEvent *event);
00756 
00764   virtual void contentsMousePressEvent( TQMouseEvent *e );
00765 
00773   virtual void contentsMouseMoveEvent( TQMouseEvent *e );
00774 
00782   virtual void contentsMouseDoubleClickEvent ( TQMouseEvent *e );
00783 
00791   virtual void contentsDragLeaveEvent (TQDragLeaveEvent *event);
00792 
00800   virtual void contentsMouseReleaseEvent (TQMouseEvent*);
00801 
00809   virtual void contentsDropEvent (TQDropEvent*);
00810 
00818   virtual void contentsDragEnterEvent (TQDragEnterEvent *);
00819 
00825   virtual TQDragObject *dragObject();
00826 
00832   virtual bool acceptDrag (TQDropEvent* event) const;
00833 
00841   virtual TQRect drawDropVisualizer (TQPainter *p, TQListViewItem *parent, TQListViewItem *after);
00842 
00849   virtual TQRect drawItemHighlighter(TQPainter *painter, TQListViewItem *item);
00850 
00857   virtual void startDrag();
00858 
00866   virtual void keyPressEvent (TQKeyEvent*);
00867 
00875   virtual void viewportPaintEvent(TQPaintEvent*);
00876 
00881   void activateAutomaticSelection();
00886   void deactivateAutomaticSelection();
00892   bool automaticSelection() const;
00893 
00897   virtual void viewportResizeEvent(TQResizeEvent* e);
00898 
00906   void disableAutoSelection();
00907 
00913   void resetAutoSelection();
00914 
00920   void resetKeyboardSelectionOperation();
00921 
00928   void setActiveMultiSelectItem(TQListViewItem *item);
00929 
00934   // KDE 4: remove
00935   void doubleClicked( TQListViewItem *item, const TQPoint &pos, int c );
00936 
00937 protected slots:
00942   void slotSettingsChanged(int);
00943 
00944   void slotMouseButtonClicked( int btn, TQListViewItem *item, const TQPoint &pos, int c );
00945   void doneEditing(TQListViewItem *item, int row);
00946 
00950   void cleanDropVisualizer();
00951 
00955   void cleanItemHighlighter();
00956 
00960   void emitContextMenu (TQListViewItem*, const TQPoint&, int);
00961 
00965   void emitContextMenu (KListView*, TQListViewItem*);
00966 
00971   void slotOnItem( TQListViewItem *item );
00972 
00977   void slotOnViewport();
00978 
00983   void slotAutoSelect();
00984 
00985   void slotDragExpand();
00986 
00991   void slotHeaderChanged();
00992 
00993 protected:
00997   virtual void movableDropEvent (TQListViewItem* parent, TQListViewItem* afterme);
00998 
01005   virtual void findDrop(const TQPoint &pos, TQListViewItem *&parent, TQListViewItem *&after);
01006 
01010   void fileManagerKeyPressEvent (TQKeyEvent*);
01011 
01015   int depthToPixels( int depth );
01016 
01017 private:
01018   class Tooltip;
01019 protected:
01020   virtual void virtual_hook( int id, void* data );
01021 private:
01022   class KListViewPrivate;
01023   KListViewPrivate* const d;
01024   bool isExecuteArea( int x, TQListViewItem* item );
01025 };
01026 
01033 class KDEUI_EXPORT KListViewItem : public TQListViewItem
01034 {
01035   friend class KListView;
01036 public:
01043   KListViewItem(TQListView *parent);
01044   KListViewItem(TQListViewItem *parent);
01045   KListViewItem(TQListView *parent, TQListViewItem *after);
01046   KListViewItem(TQListViewItem *parent, TQListViewItem *after);
01047 
01048   KListViewItem(TQListView *parent,
01049     TQString, TQString = TQString::null,
01050     TQString = TQString::null, TQString = TQString::null,
01051     TQString = TQString::null, TQString = TQString::null,
01052     TQString = TQString::null, TQString = TQString::null);
01053 
01054   KListViewItem(TQListViewItem *parent,
01055     TQString, TQString = TQString::null,
01056     TQString = TQString::null, TQString = TQString::null,
01057     TQString = TQString::null, TQString = TQString::null,
01058     TQString = TQString::null, TQString = TQString::null);
01059 
01060   KListViewItem(TQListView *parent, TQListViewItem *after,
01061     TQString, TQString = TQString::null,
01062     TQString = TQString::null, TQString = TQString::null,
01063     TQString = TQString::null, TQString = TQString::null,
01064     TQString = TQString::null, TQString = TQString::null);
01065 
01066   KListViewItem(TQListViewItem *parent, TQListViewItem *after,
01067     TQString, TQString = TQString::null,
01068     TQString = TQString::null, TQString = TQString::null,
01069     TQString = TQString::null, TQString = TQString::null,
01070     TQString = TQString::null, TQString = TQString::null);
01071 
01072   virtual ~KListViewItem();
01073 
01074   virtual void insertItem(TQListViewItem *item);
01075   virtual void takeItem(TQListViewItem *item);
01079   bool isAlternate();
01083   const TQColor &backgroundColor() KDE_DEPRECATED;  // #### should be removed in 4.0; use below instead
01084 
01093   TQColor backgroundColor(int column);
01094 
01095   virtual void paintCell(TQPainter *p, const TQColorGroup &cg,
01096     int column, int width, int alignment);
01097 
01098 private:
01099   void init();
01100 
01101 private:
01102   uint m_odd : 1;
01103   uint m_known : 1;
01104   uint m_unused : 30;
01105 };
01106 
01107 #endif
01108 
01109 // vim: ts=2 sw=2 et

kdeui

Skip menu "kdeui"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdeui

Skip menu "kdeui"
  • arts
  • dcop
  • dnssd
  • interfaces
  •     interface
  •     library
  •   kspeech
  •   ktexteditor
  • kabc
  • kate
  • kcmshell
  • kdecore
  • kded
  • kdefx
  • kdeprint
  • kdesu
  • kdeui
  • kdoctools
  • khtml
  • kimgio
  • kinit
  • kio
  •   bookmarks
  •   httpfilter
  •   kfile
  •   kio
  •   kioexec
  •   kpasswdserver
  •   kssl
  • kioslave
  •   http
  • kjs
  • kmdi
  •   kmdi
  • knewstuff
  • kparts
  • krandr
  • kresources
  • kspell2
  • kunittest
  • kutils
  • kwallet
  • libkmid
  • libkscreensaver
Generated for kdeui by doxygen 1.7.6.1
This website is maintained by Timothy Pearson.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. |