KDevelop API Documentation

fileitemfactory.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2003 by Mario Scalas                                    *
00003  *   mario.scalas@libero.it                                                *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  ***************************************************************************/
00011 
00012 #ifndef FILEITEMFACTORY_H
00013 #define FILEITEMFACTORY_H
00014 
00015 #include <kfiletreeview.h>
00016 
00017 class FileTreeWidget;
00018 
00022 namespace filetreeview
00023 {
00027     class FileTreeViewItem : public KFileTreeViewItem
00028     {
00029         friend class FileTreeBranchItem;
00030     protected:
00031         FileTreeViewItem( KFileTreeViewItem* parent, KFileItem* item, KFileTreeBranch* branch, bool pf )
00032         : KFileTreeViewItem( parent, item, branch ), m_isProjectFile( pf )
00033         {
00034             hideOrShow();
00035         }
00036         FileTreeViewItem( KFileTreeView* parent, KFileItem* item, KFileTreeBranch* branch )
00037         : KFileTreeViewItem( parent, item, branch ), m_isProjectFile( false )
00038         {
00039             hideOrShow();
00040         }
00041         virtual ~FileTreeViewItem() {}
00042 
00043     public:
00044         virtual void paintCell( QPainter *p, const QColorGroup &cg, int column, int width, int alignment );
00045         FileTreeWidget* listView() const;
00046         void hideOrShow();
00047         bool isProjectFile() const { return m_isProjectFile; }
00048         bool setProjectFile( QString const &path, bool pf );
00049 
00050     protected:
00051         virtual int compare( QListViewItem *i, int col, bool ascending ) const;
00052 
00053     private:
00054         bool m_isProjectFile;
00055     };
00056 
00060     class FileTreeBranchItem : public KFileTreeBranch
00061     {
00062     protected:
00063         FileTreeBranchItem( KFileTreeView* view, const KURL& url, const QString& name, const QPixmap& pix )
00064         : KFileTreeBranch( view, url, name, pix, false,
00065             new FileTreeViewItem( view, new KFileItem( url, "inode/directory", S_IFDIR ), this ) )
00066         {
00067         }
00068         virtual ~FileTreeBranchItem()
00069         {
00070 //            if (root())
00071 //                delete root()->fileItem();
00072         }
00073 
00074     };
00075 
00079     class BranchItemFactory
00080     {
00081     public:
00082         virtual FileTreeBranchItem *makeBranchItem( KFileTreeView* view, const KURL& url, const QString& name, const QPixmap& pix ) = 0;
00083     };
00084 }
00085 
00086 #endif
KDE Logo
This file is part of the documentation for KDevelop Version 3.1.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Mar 23 00:03:57 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003