KDevelop API Documentation

replaceitem.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2003 by Jens Dagerbo                                    *
00003  *   jens.dagerbo@swipnet.se                                               *
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 __REPLACEITEM_H__
00013 #define __REPLACEITEM_H__
00014 
00015 
00016 #include <kdeversion.h>
00017 #include <kdebug.h>
00018 
00019 #include "replaceview.h"
00020 
00021 class ReplaceItem : public QCheckListItem
00022 {
00023 public:
00024     // the file item
00025     ReplaceItem( ReplaceView * parent, ReplaceItem * after, QString file ) :
00026             QCheckListItem( parent,
00027 #if KDE_VERSION > 305
00028                             after,
00029 #endif
00030                             file, QCheckListItem::CheckBox ),
00031             _file( file ), _string( file ), _line( 0 ), _isfile( true ),
00032             _lineclicked( false ), _clicked( true )
00033     {
00034         setOpen( true );
00035         setOn( true );
00036     }
00037 
00038     // the line item
00039     ReplaceItem( ReplaceItem * parent, ReplaceItem * after, QString file, QString string, int line ) :
00040             QCheckListItem( parent,
00041 #if KDE_VERSION > 305
00042                             after,
00043 #endif
00044                             QString::number( line + 1 ) + ": " + string, QCheckListItem::CheckBox ),
00045             _file( file ), _string( string ), _line( line ), _isfile( false ),
00046             _lineclicked( false ), _clicked( true )
00047     {
00048         setOn( true );
00049     }
00050 
00051     QString const & file() const
00052     {
00053         return _file;
00054     }
00055 
00056     int line() const
00057     {
00058         return _line;
00059     }
00060 
00061     QString const & string() const
00062     {
00063         return _string;
00064     }
00065 
00066     bool isFile() const
00067     {
00068         return _isfile;
00069     }
00070 
00071     bool justClicked()
00072     {
00073         bool t = _clicked;
00074         _clicked = true;
00075         return t;
00076     }
00077 
00078     bool lineClicked()
00079     {
00080         return _lineclicked;
00081     }
00082 
00083     ReplaceItem * parent() const
00084     {
00085         return static_cast<ReplaceItem*>( QListViewItem::parent() );
00086     }
00087 
00088     ReplaceItem * firstChild() const
00089     {
00090         return static_cast<ReplaceItem*>( QListViewItem::firstChild() );
00091     }
00092 
00093     ReplaceItem * nextSibling() const
00094     {
00095         return static_cast<ReplaceItem*>( QListViewItem::nextSibling() );
00096     }
00097 
00098     void activate( int column, QPoint const & localPos );
00099     bool hasCheckedChildren() const;
00100     virtual void stateChange( bool state );
00101 
00102     static bool s_listview_done;
00103 
00104 private:
00105 #if KDE_VERSION > 305
00106     void paintCell( QPainter * p, const QColorGroup & cg, int column, int width, int align );
00107 #endif    
00108     void setChecked( bool checked );
00109 
00110     QString _file;
00111     QString _string;
00112     int _line;
00113     bool const _isfile;
00114     bool _lineclicked;
00115     bool _clicked;
00116 };
00117 
00118 #endif
00119 
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:58 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003