summaryrefslogtreecommitdiffstats
path: root/quanta/treeviews/tagattributetree.h
blob: 1ecae329cb6b035ba1b64d2f6cbda35925d3adaa (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
/***************************************************************************
                             tagattributetree.h
                             -------------------
    copyright            : (C) 2003 by Andras Mantia <[email protected]>
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   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 TAGATTRIBUTETREE_H
#define TAGATTRIBUTETREE_H

//qt includes
#include <tqwidget.h>

//kde includes
#include <tdelistview.h>

//app includes

class TDEListView;
class TQListViewItem;
class ParentItem;
class Node;
class TQLabel;
class KPushButton;
class TQGridLayout;

class EditableTree : public TDEListView {
Q_OBJECT
  

public:
  EditableTree(TQWidget *parent = 0, const char *name = 0);
  virtual ~EditableTree();

  virtual void setCurrentItem( TQListViewItem *i);
  void setEditable(bool b) {m_editable = b;}
  bool isEditable() {return m_editable;}

public slots:
  virtual void editorContentChanged();
  virtual void focusInEvent(TQFocusEvent *);
  virtual void focusOutEvent(TQFocusEvent *);

protected:
  bool m_editable;

};

class DualEditableTree : public EditableTree
{
  Q_OBJECT
  
public:
  DualEditableTree(TQWidget *parent = 0, const char *name = 0);
  virtual ~DualEditableTree();

  virtual void setCurrentItem ( TQListViewItem *i);
  int currentColumn() {return curCol;}

protected:
  virtual bool eventFilter(TQObject *object, TQEvent *event);
  virtual void resizeEvent(TQResizeEvent *);

signals:
  void itemModified( TQListViewItem *);

public slots:
  virtual void editorContentChanged();

private slots:
  void itemClicked(TQListViewItem *i, const TQPoint &point, int col);

private:
  int curCol;
};

class TagAttributeTree : public EditableTree  {
   Q_OBJECT
  

public:
  TagAttributeTree(TQWidget *parent=0, const char *name=0);
  virtual ~TagAttributeTree();

  void setCurrentNode(Node *node);
  //virtual void setCurrentItem( TQListViewItem *i );
  Node *node() const {return m_node;}

public slots:
  void slotDelayedSetCurrentNode();
  void slotParentSelected(int index);
  virtual void editorContentChanged();

private slots:
  void slotCollapsed(TQListViewItem *item);
  void slotExpanded(TQListViewItem *item);

signals:
  void newNodeSelected(Node *node);

private:
  Node *m_node;
  Node *m_newNode;
  bool rebuildEnabled;
  ParentItem *m_parentItem;
};

//An enhanced TagAttributeTree with the tag name and buttons to delete the tag.
class EnhancedTagAttributeTree : public TQWidget
{
Q_OBJECT
  
public:
  EnhancedTagAttributeTree(TQWidget *parent = 0, const char *name = 0);
  virtual ~EnhancedTagAttributeTree();

  void setCurrentNode(Node *node);
  Node *node() const {return attrTree->node();}

signals:
  void newNodeSelected(Node *node);

private slots:
  void NodeSelected(Node *node);
  void deleteNode();
  void deleteSubTree();

private:
  void showCaption();

  TQLabel *nodeName;
  KPushButton* deleteAll;
  KPushButton* deleteTag;
  TagAttributeTree *attrTree;
  TQGridLayout *widgetLayout;
  Node *curNode;
};

#endif