kexi
objecttreeview.h00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef OBJECTTREEVIEW_H
00021 #define OBJECTTREEVIEW_H
00022
00023 #include <klistview.h>
00024
00025 namespace KFormDesigner {
00026
00027 class ObjectTreeItem;
00028 class Form;
00029
00031 class KFORMEDITOR_EXPORT ObjectTreeViewItem : public KListViewItem
00032 {
00033 public:
00034 ObjectTreeViewItem(ObjectTreeViewItem *parent, ObjectTreeItem *item);
00035 ObjectTreeViewItem(KListView *list, ObjectTreeItem *item=0);
00036 virtual ~ObjectTreeViewItem();
00037
00039 QString name() const;
00040
00042 ObjectTreeItem* objectTree() const { return m_item; }
00043
00044 virtual void setOpen( bool o );
00045
00046 protected:
00048 virtual void paintCell(QPainter *p, const QColorGroup & cg, int column, int width, int align);
00049
00051 virtual void paintBranches(QPainter *p, const QColorGroup &cg, int w, int y, int h);
00052
00054 virtual void setup();
00055
00056 private:
00057 ObjectTreeItem *m_item;
00058
00059 friend class ObjectTreeView;
00060 };
00061
00066 class KFORMEDITOR_EXPORT ObjectTreeView : public KListView
00067 {
00068 Q_OBJECT
00069
00070 public:
00071 ObjectTreeView(QWidget *parent=0, const char *name=0, bool tabStop = false);
00072 virtual ~ObjectTreeView();
00073
00074 virtual QSize sizeHint() const;
00075
00079 void setForm(Form *form);
00080
00082 QString iconNameForClass(const QCString &classname);
00083
00084 public slots:
00086 void setSelectedWidget(QWidget *w, bool add=false);
00087
00089 void addItem(ObjectTreeItem *item);
00090
00092 void removeItem(ObjectTreeItem *item);
00093
00095 void renameItem(const QCString &oldname, const QCString &newname);
00096
00097 protected slots:
00099 void displayContextMenu(KListView *list, QListViewItem *item, const QPoint &p);
00100
00101 void slotColumnSizeChanged(int);
00102
00104 void slotSelectionChanged();
00105
00107 void slotBeforeFormDestroyed();
00108
00109 protected:
00111 ObjectTreeViewItem* loadTree(ObjectTreeItem *item, ObjectTreeViewItem *parent);
00112
00114 ObjectTreeViewItem* findItem(const QString &name);
00115
00116 private:
00117 Form *m_form;
00118 ObjectTreeViewItem *m_topItem;
00119
00120 friend class TabStopDialog;
00121 };
00122
00123 }
00124
00125 #endif
|