~ubuntu-branches/debian/sid/kdevelop/sid

« back to all changes in this revision

Viewing changes to parts/replace/replaceitem.h

  • Committer: Bazaar Package Importer
  • Author(s): Jeremy Lainé
  • Date: 2006-05-23 18:39:42 UTC
  • Revision ID: james.westby@ubuntu.com-20060523183942-hucifbvh68k2bwz7
Tags: upstream-3.3.2
Import upstream version 3.3.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
 *   Copyright (C) 2003 by Jens Dagerbo                                    *
 
3
 *   jens.dagerbo@swipnet.se                                               *
 
4
 *                                                                         *
 
5
 *   This program is free software; you can redistribute it and/or modify  *
 
6
 *   it under the terms of the GNU General Public License as published by  *
 
7
 *   the Free Software Foundation; either version 2 of the License, or     *
 
8
 *   (at your option) any later version.                                   *
 
9
 *                                                                         *
 
10
 ***************************************************************************/
 
11
 
 
12
#ifndef __REPLACEITEM_H__
 
13
#define __REPLACEITEM_H__
 
14
 
 
15
 
 
16
#include <kdeversion.h>
 
17
#include <kdebug.h>
 
18
 
 
19
#include "replaceview.h"
 
20
 
 
21
class ReplaceItem : public QCheckListItem
 
22
{
 
23
public:
 
24
    // the file item
 
25
    ReplaceItem( ReplaceView * parent, ReplaceItem * after, QString file ) :
 
26
            QCheckListItem( parent,
 
27
#if KDE_VERSION > 305
 
28
                            after,
 
29
#endif
 
30
                            file, QCheckListItem::CheckBox ),
 
31
            _file( file ), _string( file ), _line( 0 ), _isfile( true ),
 
32
            _lineclicked( false ), _clicked( true )
 
33
    {
 
34
        setOpen( true );
 
35
        setOn( true );
 
36
    }
 
37
 
 
38
    // the line item
 
39
    ReplaceItem( ReplaceItem * parent, ReplaceItem * after, QString file, QString string, int line ) :
 
40
            QCheckListItem( parent,
 
41
#if KDE_VERSION > 305
 
42
                            after,
 
43
#endif
 
44
                            QString::number( line + 1 ) + ": " + string, QCheckListItem::CheckBox ),
 
45
            _file( file ), _string( string ), _line( line ), _isfile( false ),
 
46
            _lineclicked( false ), _clicked( true )
 
47
    {
 
48
        setOn( true );
 
49
    }
 
50
 
 
51
    QString const & file() const
 
52
    {
 
53
        return _file;
 
54
    }
 
55
 
 
56
    int line() const
 
57
    {
 
58
        return _line;
 
59
    }
 
60
 
 
61
    QString const & string() const
 
62
    {
 
63
        return _string;
 
64
    }
 
65
 
 
66
    bool isFile() const
 
67
    {
 
68
        return _isfile;
 
69
    }
 
70
 
 
71
    bool justClicked()
 
72
    {
 
73
        bool t = _clicked;
 
74
        _clicked = true;
 
75
        return t;
 
76
    }
 
77
 
 
78
    bool lineClicked()
 
79
    {
 
80
        return _lineclicked;
 
81
    }
 
82
 
 
83
    ReplaceItem * parent() const
 
84
    {
 
85
        return static_cast<ReplaceItem*>( QListViewItem::parent() );
 
86
    }
 
87
 
 
88
    ReplaceItem * firstChild() const
 
89
    {
 
90
        return static_cast<ReplaceItem*>( QListViewItem::firstChild() );
 
91
    }
 
92
 
 
93
    ReplaceItem * nextSibling() const
 
94
    {
 
95
        return static_cast<ReplaceItem*>( QListViewItem::nextSibling() );
 
96
    }
 
97
 
 
98
    void activate( int column, QPoint const & localPos );
 
99
    bool hasCheckedChildren() const;
 
100
    virtual void stateChange( bool state );
 
101
 
 
102
    static bool s_listview_done;
 
103
 
 
104
private:
 
105
#if KDE_VERSION > 305
 
106
    void paintCell( QPainter * p, const QColorGroup & cg, int column, int width, int align );
 
107
#endif    
 
108
    void setChecked( bool checked );
 
109
 
 
110
    QString _file;
 
111
    QString _string;
 
112
    int _line;
 
113
    bool const _isfile;
 
114
    bool _lineclicked;
 
115
    bool _clicked;
 
116
};
 
117
 
 
118
#endif
 
119