summaryrefslogtreecommitdiffstats
path: root/quanta/treeviews/tagattributeitems.h
blob: 81f5cb436743e721d4f5669bc80ae1687c297fa2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
/***************************************************************************
                             tagattributeitems.h
                             -------------------
    copyright            : (C) 2003 by Andras Mantia <amantia@kde.org>
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; version 2 of the License.               *
 *                                                                         *
 ***************************************************************************/

#ifndef TAGATTRIBUTEITEM_H
#define TAGATTRIBUTEITEM_H

#include <tqptrlist.h>

class KColorCombo;
class KURLRequester;
class KListView;
class KListViewItem;
class TQListViewItem;
class TQLineEdit;
class TQComboBox;

class Attribute;
class EditableTree;
class TagAttributeTree;
class Node;
class StyleEditor;

class TopLevelItem : public KListViewItem
{

public:
    TopLevelItem(KListView *parent, const TQString& title);
    TopLevelItem(KListView *parent, TQListViewItem* after, const TQString& title);

    virtual ~TopLevelItem();

protected:

    void paintCell( TQPainter *p, const TQColorGroup &cg,
                    int column, int width, int align );
};

class ParentItem : public KListViewItem
{

public:
    ParentItem(TagAttributeTree *listView, TQListViewItem *parent);

    virtual ~ParentItem();
    Node *node(int index);
    void addNode(Node *node);
    void showList(bool show);

protected:

    void paintCell( TQPainter *p, const TQColorGroup &cg,
                    int column, int width, int align );

private:
    TQPtrList<Node> m_nodeList;
    TQComboBox *comboBox;
    TagAttributeTree *m_listView;
};

class AttributeItem : public KListViewItem
{
public:
    AttributeItem(TQListViewItem* parent, const TQString& title, const TQString& title2);
    AttributeItem(EditableTree *listView, TQListViewItem* parent, const TQString& title, const TQString& title2);
    AttributeItem(EditableTree *listView, const TQString& title, const TQString& title2);
    AttributeItem(EditableTree *listView, const TQString& title, const TQString& title2, TQListViewItem* after);

    virtual ~AttributeItem();
    virtual void replaceCurrentEditor();
    virtual void showEditor(int column = 1);
    virtual void hideEditor(int column = 1);
    virtual void placeEditor(TQWidget *w, int column = 1);
    virtual TQString editorText(int column = 1);

    //I'm not sane... lin is the right editor, lin2 is the left one.
    TQLineEdit *lin, *lin2;

protected:

    void paintCell( TQPainter *p, const TQColorGroup &cg,
                    int column, int width, int align );

    EditableTree *m_listView;
};

class AttributeNameSpaceItem:public AttributeItem
{
public:
    AttributeNameSpaceItem(TQListViewItem* parent, const TQString& title, const TQString& title2): AttributeItem(parent, title, title2){};
    AttributeNameSpaceItem(EditableTree *listView, TQListViewItem* parent, const TQString& title, const TQString& title2):AttributeItem(listView, parent, title, title2){};
    virtual ~AttributeNameSpaceItem(){};

};

class AttributeBoolItem : public AttributeItem
{
public:
    AttributeBoolItem(TagAttributeTree *listView, TQListViewItem* parent, const TQString& title, const TQString& title2);

    virtual ~AttributeBoolItem();
    virtual void showEditor(int column = 1);
    virtual void hideEditor(int column = 1);
    virtual TQString editorText(int column = 1);

private:
    TQComboBox* combo;
};

class AttributeUrlItem : public AttributeItem
{
public:
    AttributeUrlItem(TagAttributeTree *listView, TQListViewItem* parent, const TQString& title, const TQString& title2);

    virtual ~AttributeUrlItem();
    virtual void showEditor(int column = 1);
    virtual void hideEditor(int column = 1);
    virtual TQString editorText(int column = 1);

private:
    KURLRequester* urlRequester;
};

class AttributeListItem : public AttributeItem
{
public:
    AttributeListItem(EditableTree *listView, TQListViewItem* parent, const TQString& title, const TQString& title2, Attribute *attr = 0L);

    virtual ~AttributeListItem();
    virtual void showEditor(int column = 1);
    virtual void hideEditor(int column = 1);
    virtual TQString editorText(int column = 1);

private:
    TQComboBox* combo;
};

class AttributeColorItem : public AttributeItem
{
public:
    AttributeColorItem(EditableTree *listView, TQListViewItem* parent, const TQString& title, const TQString& title2);

    virtual ~AttributeColorItem();
    virtual void showEditor(int column = 1);
    virtual void hideEditor(int column = 1);
    virtual TQString editorText(int column = 1);

private:
    KColorCombo* combo;
};

class AttributeStyleItem : public AttributeItem
{
public:
    AttributeStyleItem(EditableTree *listView, TQListViewItem* parent, const TQString& title, const TQString& title2);

    virtual ~AttributeStyleItem();
    virtual void showEditor(int column = 1);
    virtual void hideEditor(int column = 1);
    virtual TQString editorText(int column = 1);

private:

    StyleEditor *m_se;
};


#endif