~ubuntu-branches/ubuntu/karmic/kdevelop/karmic

« back to all changes in this revision

Viewing changes to parts/replace/replaceitem.h

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Thomas
  • Date: 2009-05-25 19:34:26 UTC
  • mfrom: (1.1.11 upstream) (2.3.1 experimental)
  • Revision ID: james.westby@ubuntu.com-20090525193426-hdntv90rvflyew8g
Tags: 4:3.9.93-1ubuntu1
* Merge from Debian experimental, remaining changes:
  - Conflict/replace -kde4 packages

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
 
                            after,
28
 
                            file, QCheckListItem::CheckBox ),
29
 
            _file( file ), _string( file ), _line( 0 ), _isfile( true ),
30
 
            _lineclicked( false ), _clicked( true )
31
 
    {
32
 
        setOpen( true );
33
 
        setOn( true );
34
 
    }
35
 
 
36
 
    // the line item
37
 
    ReplaceItem( ReplaceItem * parent, ReplaceItem * after, QString file, QString string, int line ) :
38
 
            QCheckListItem( parent,
39
 
                            after,
40
 
                            QString::number( line + 1 ) + ": " + string, QCheckListItem::CheckBox ),
41
 
            _file( file ), _string( string ), _line( line ), _isfile( false ),
42
 
            _lineclicked( false ), _clicked( true )
43
 
    {
44
 
        setOn( true );
45
 
    }
46
 
 
47
 
    QString const & file() const
48
 
    {
49
 
        return _file;
50
 
    }
51
 
 
52
 
    int line() const
53
 
    {
54
 
        return _line;
55
 
    }
56
 
 
57
 
    QString const & string() const
58
 
    {
59
 
        return _string;
60
 
    }
61
 
 
62
 
    bool isFile() const
63
 
    {
64
 
        return _isfile;
65
 
    }
66
 
 
67
 
    bool justClicked()
68
 
    {
69
 
        bool t = _clicked;
70
 
        _clicked = true;
71
 
        return t;
72
 
    }
73
 
 
74
 
    bool lineClicked()
75
 
    {
76
 
        return _lineclicked;
77
 
    }
78
 
 
79
 
    ReplaceItem * parent() const
80
 
    {
81
 
        return static_cast<ReplaceItem*>( QListViewItem::parent() );
82
 
    }
83
 
 
84
 
    ReplaceItem * firstChild() const
85
 
    {
86
 
        return static_cast<ReplaceItem*>( QListViewItem::firstChild() );
87
 
    }
88
 
 
89
 
    ReplaceItem * nextSibling() const
90
 
    {
91
 
        return static_cast<ReplaceItem*>( QListViewItem::nextSibling() );
92
 
    }
93
 
 
94
 
    void activate( int column, QPoint const & localPos );
95
 
    bool hasCheckedChildren() const;
96
 
    virtual void stateChange( bool state );
97
 
 
98
 
    static bool s_listview_done;
99
 
 
100
 
private:
101
 
    void paintCell( QPainter * p, const QColorGroup & cg, int column, int width, int align );
102
 
    void setChecked( bool checked );
103
 
 
104
 
    QString _file;
105
 
    QString _string;
106
 
    int _line;
107
 
    bool const _isfile;
108
 
    bool _lineclicked;
109
 
    bool _clicked;
110
 
};
111
 
 
112
 
#endif
113