kexi

objecttreeview.h
1/* This file is part of the KDE project
2 Copyright (C) 2004 Cedric Pasteur <cedric.pasteur@free.fr>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18*/
19
20#ifndef OBJECTTREEVIEW_H
21#define OBJECTTREEVIEW_H
22
23#include <tdelistview.h>
24
25namespace KFormDesigner {
26
27class ObjectTreeItem;
28class Form;
29
31class KFORMEDITOR_EXPORT ObjectTreeViewItem : public TDEListViewItem
32{
33 public:
34 ObjectTreeViewItem(ObjectTreeViewItem *parent, ObjectTreeItem *item);
35 ObjectTreeViewItem(TDEListView *list, ObjectTreeItem *item=0);
36 virtual ~ObjectTreeViewItem();
37
39 TQString name() const;
40
42 ObjectTreeItem* objectTree() const { return m_item; }
43
44 virtual void setOpen( bool o );
45
46 protected:
48 virtual void paintCell(TQPainter *p, const TQColorGroup & cg, int column, int width, int align);
49
51 virtual void paintBranches(TQPainter *p, const TQColorGroup &cg, int w, int y, int h);
52
54 virtual void setup();
55
56 private:
57 ObjectTreeItem *m_item;
58
59 friend class ObjectTreeView;
60};
61
67class KFORMEDITOR_EXPORT ObjectTreeView : public TDEListView
68{
69 TQ_OBJECT
70
71
72 public:
73 ObjectTreeView(TQWidget *parent=0, const char *name=0, bool tabStop = false);
74 virtual ~ObjectTreeView();
75
76 virtual TQSize sizeHint() const;
77
82 void setForm(Form *form);
83
85 TQString iconNameForClass(const TQCString &classname);
86
87 public slots:
90 void setSelectedWidget(TQWidget *w, bool add=false);
91
93 void addItem(ObjectTreeItem *item);
94
96 void removeItem(ObjectTreeItem *item);
97
99 void renameItem(const TQCString &oldname, const TQCString &newname);
100
101 protected slots:
104 void displayContextMenu(TDEListView *list, TQListViewItem *item, const TQPoint &p);
105
106 void slotColumnSizeChanged(int);
107
110
113
114 protected:
117
119 ObjectTreeViewItem* findItem(const TQString &name);
120
121 private:
122 Form *m_form;
123 ObjectTreeViewItem *m_topItem;
124
125 friend class TabStopDialog;
126};
127
128}
129
130#endif
A simple class representing a form.
Definition form.h:136
An item representing a widget Holds the properties of a widget (classname, name, parent,...
Definition objecttree.h:59
An item in ObjectTreeView associated with an ObjectTreeItem.
ObjectTreeItem * objectTree() const
A graphical view of Form's ObjectTree. This is a TDEListView which represents an item for each widget...
void displayContextMenu(TDEListView *list, TQListViewItem *item, const TQPoint &p)
TQString iconNameForClass(const TQCString &classname)
void setSelectedWidget(TQWidget *w, bool add=false)
void addItem(ObjectTreeItem *item)
void renameItem(const TQCString &oldname, const TQCString &newname)
ObjectTreeViewItem * findItem(const TQString &name)
void removeItem(ObjectTreeItem *item)
ObjectTreeViewItem * loadTree(ObjectTreeItem *item, ObjectTreeViewItem *parent)
Internal function to fill the list.