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

« back to all changes in this revision

Viewing changes to kdevdesigner/designer/workspace.h

  • Committer: Bazaar Package Importer
  • Author(s): Jeremy Lainé
  • Date: 2010-05-05 07:21:55 UTC
  • mfrom: (1.2.3 upstream) (5.1.2 squeeze)
  • Revision ID: james.westby@ubuntu.com-20100505072155-h78lx19pu04sbhtn
Tags: 4:4.0.0-2
* Upload to unstable (Closes: #579947, #481832).
* Acknowledge obsolete NMU fixes (Closes: #562410, #546961).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/**********************************************************************
2
 
** Copyright (C) 2000 Trolltech AS.  All rights reserved.
3
 
**
4
 
** This file is part of Qt Designer.
5
 
**
6
 
** This file may be distributed and/or modified under the terms of the
7
 
** GNU General Public License version 2 as published by the Free Software
8
 
** Foundation and appearing in the file LICENSE.GPL included in the
9
 
** packaging of this file.
10
 
**
11
 
** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
12
 
** licenses may use this file in accordance with the Qt Commercial License
13
 
** Agreement provided with the Software.
14
 
**
15
 
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
16
 
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
17
 
**
18
 
** See http://www.trolltech.com/gpl/ for GPL licensing information.
19
 
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
20
 
**   information about Qt Commercial License Agreements.
21
 
**
22
 
** Contact info@trolltech.com if any conditions of this licensing are
23
 
** not clear to you.
24
 
**
25
 
**********************************************************************/
26
 
 
27
 
#ifndef WORKSPACE_H
28
 
#define WORKSPACE_H
29
 
 
30
 
#include <qlistview.h>
31
 
 
32
 
class FormWindow;
33
 
class QResizeEvent;
34
 
class QCloseEvent;
35
 
class QDropEvent;
36
 
class QDragMoveEvent;
37
 
class QDragEnterEvent;
38
 
class MainWindow;
39
 
class Project;
40
 
class SourceFile;
41
 
class FormFile;
42
 
class QCompletionEdit;
43
 
class SourceEditor;
44
 
 
45
 
class WorkspaceItem : public QListViewItem
46
 
{
47
 
public:
48
 
    enum Type { ProjectType, FormFileType, FormSourceType, SourceFileType, ObjectType };
49
 
 
50
 
    WorkspaceItem( QListView *parent, Project* p );
51
 
    WorkspaceItem( QListViewItem *parent, SourceFile* sf );
52
 
    WorkspaceItem( QListViewItem *parent, FormFile* ff, Type t = FormFileType );
53
 
    WorkspaceItem( QListViewItem *parent, QObject *o, Project *p );
54
 
 
55
 
    void paintCell( QPainter *p, const QColorGroup &cg, int column, int width, int align );
56
 
 
57
 
    Type type() const { return t; }
58
 
 
59
 
    bool isModified() const;
60
 
 
61
 
    QString text( int ) const;
62
 
 
63
 
    void fillCompletionList( QStringList& completion );
64
 
    bool checkCompletion( const QString& completion );
65
 
 
66
 
    QString key( int, bool ) const; // column sorting key
67
 
 
68
 
    Project* project;
69
 
    SourceFile* sourceFile;
70
 
    FormFile* formFile;
71
 
    QObject *object;
72
 
 
73
 
    void setOpen( bool );
74
 
 
75
 
    void setAutoOpen( bool );
76
 
    bool isAutoOpen() const { return isOpen() && autoOpen; }
77
 
 
78
 
    bool useOddColor;
79
 
 
80
 
private:
81
 
    void init();
82
 
    bool autoOpen;
83
 
    QColor backgroundColor();
84
 
    Type t;
85
 
};
86
 
 
87
 
class Workspace : public QListView
88
 
{
89
 
    Q_OBJECT
90
 
 
91
 
public:
92
 
    Workspace( QWidget *parent , MainWindow *mw );
93
 
 
94
 
    void setCurrentProject( Project *pro );
95
 
 
96
 
    void contentsDropEvent( QDropEvent *e );
97
 
    void contentsDragEnterEvent( QDragEnterEvent *e );
98
 
    void contentsDragMoveEvent( QDragMoveEvent *e );
99
 
 
100
 
    void setBufferEdit( QCompletionEdit *edit );
101
 
 
102
 
public slots:
103
 
 
104
 
    void update();
105
 
    void update( FormFile* );
106
 
 
107
 
    void activeFormChanged( FormWindow *fw );
108
 
    void activeEditorChanged( SourceEditor *se );
109
 
 
110
 
protected:
111
 
    void closeEvent( QCloseEvent *e );
112
 
    bool eventFilter( QObject *, QEvent * );
113
 
 
114
 
 
115
 
private slots:
116
 
    void itemClicked( int, QListViewItem *i, const QPoint& pos  );
117
 
    void itemDoubleClicked( QListViewItem *i );
118
 
    void rmbClicked( QListViewItem *i, const QPoint& pos  );
119
 
    void bufferChosen( const QString &buffer );
120
 
 
121
 
    void projectDestroyed( QObject* );
122
 
 
123
 
    void sourceFileAdded( SourceFile* );
124
 
    void sourceFileRemoved( SourceFile* );
125
 
 
126
 
    void formFileAdded( FormFile* );
127
 
    void formFileRemoved( FormFile* );
128
 
 
129
 
    void objectAdded( QObject* );
130
 
    void objectRemoved( QObject * );
131
 
 
132
 
private:
133
 
    WorkspaceItem *findItem( FormFile *ff );
134
 
    WorkspaceItem *findItem( SourceFile *sf );
135
 
    WorkspaceItem *findItem( QObject *o );
136
 
 
137
 
    void closeAutoOpenItems();
138
 
 
139
 
private:
140
 
    MainWindow *mainWindow;
141
 
    Project *project;
142
 
    WorkspaceItem *projectItem;
143
 
    QCompletionEdit *bufferEdit;
144
 
    bool blockNewForms;
145
 
    void updateBufferEdit();
146
 
    bool completionDirty;
147
 
    void updateColors();
148
 
 
149
 
};
150
 
 
151
 
#endif