diff options
author | Timothy Pearson <[email protected]> | 2011-11-08 12:31:36 -0600 |
---|---|---|
committer | Timothy Pearson <[email protected]> | 2011-11-08 12:31:36 -0600 |
commit | d796c9dd933ab96ec83b9a634feedd5d32e1ba3f (patch) | |
tree | 6e3dcca4f77e20ec8966c666aac7c35bd4704053 /examples/dirview/dirview.h | |
download | tqt3-d796c9dd933ab96ec83b9a634feedd5d32e1ba3f.tar.gz tqt3-d796c9dd933ab96ec83b9a634feedd5d32e1ba3f.zip |
Test conversion to TQt3 from Qt3 8c6fc1f8e35fd264dd01c582ca5e7549b32ab731
Diffstat (limited to 'examples/dirview/dirview.h')
-rw-r--r-- | examples/dirview/dirview.h | 110 |
1 files changed, 110 insertions, 0 deletions
diff --git a/examples/dirview/dirview.h b/examples/dirview/dirview.h new file mode 100644 index 000000000..b4e49b5a2 --- /dev/null +++ b/examples/dirview/dirview.h @@ -0,0 +1,110 @@ +/**************************************************************************** +** +** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. +** +** This file is part of an example program for TQt. This example +** program may be used, distributed and modified without limitation. +** +*****************************************************************************/ + +#ifndef DIRVIEW_H +#define DIRVIEW_H + +#include <qlistview.h> +#include <qstring.h> +#include <qfile.h> +#include <qfileinfo.h> +#include <qtimer.h> + +class TQWidget; +class TQDragEnterEvent; +class TQDragMoveEvent; +class TQDragLeaveEvent; +class TQDropEvent; + +class FileItem : public TQListViewItem +{ +public: + FileItem( TQListViewItem *parent, const TQString &s1, const TQString &s2 ) + : TQListViewItem( parent, s1, s2 ), pix( 0 ) {} + + const TQPixmap *pixmap( int i ) const; +#if !defined(Q_NO_USING_KEYWORD) + using TQListViewItem::setPixmap; +#endif + void setPixmap( TQPixmap *p ); + +private: + TQPixmap *pix; + +}; + +class Directory : public TQListViewItem +{ +public: + Directory( TQListView * parent, const TQString& filename ); + Directory( Directory * parent, const TQString& filename, const TQString &col2 ) + : TQListViewItem( parent, filename, col2 ), pix( 0 ) {} + Directory( Directory * parent, const TQString& filename ); + + TQString text( int column ) const; + + TQString fullName(); + + void setOpen( bool ); + void setup(); + + const TQPixmap *pixmap( int i ) const; +#if !defined(Q_NO_USING_KEYWORD) + using TQListViewItem::setPixmap; +#endif + void setPixmap( TQPixmap *p ); + +private: + TQFile f; + Directory * p; + bool readable; + bool showDirsOnly; + TQPixmap *pix; + +}; + +class DirectoryView : public TQListView +{ + Q_OBJECT + +public: + DirectoryView( TQWidget *parent = 0, const char *name = 0, bool sdo = FALSE ); + bool showDirsOnly() { return dirsOnly; } + +public slots: + void setDir( const TQString & ); + +signals: + void folderSelected( const TQString & ); + +protected slots: + void slotFolderSelected( TQListViewItem * ); + void openFolder(); + +protected: + void contentsDragEnterEvent( TQDragEnterEvent *e ); + void contentsDragMoveEvent( TQDragMoveEvent *e ); + void contentsDragLeaveEvent( TQDragLeaveEvent *e ); + void contentsDropEvent( TQDropEvent *e ); + void contentsMouseMoveEvent( TQMouseEvent *e ); + void contentsMousePressEvent( TQMouseEvent *e ); + void contentsMouseReleaseEvent( TQMouseEvent *e ); + +private: + TQString fullPath(TQListViewItem* item); + bool dirsOnly; + TQListViewItem *oldCurrent; + TQListViewItem *dropItem; + TQTimer* autoopen_timer; + TQPoint presspos; + bool mousePressed; + +}; + +#endif |