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
00067 class KFORMEDITOR_EXPORT ObjectTreeView : public KListView
00068 {
00069 Q_OBJECT
00070
00071 public:
00072 ObjectTreeView(QWidget *parent=0, const char *name=0, bool tabStop = false);
00073 virtual ~ObjectTreeView();
00074
00075 virtual QSize sizeHint() const;
00076
00081 void setForm(Form *form);
00082
00084 QString iconNameForClass(const QCString &classname);
00085
00086 public slots:
00089 void setSelectedWidget(QWidget *w, bool add=false);
00090
00092 void addItem(ObjectTreeItem *item);
00093
00095 void removeItem(ObjectTreeItem *item);
00096
00098 void renameItem(const QCString &oldname, const QCString &newname);
00099
00100 protected slots:
00103 void displayContextMenu(KListView *list, QListViewItem *item, const QPoint &p);
00104
00105 void slotColumnSizeChanged(int);
00106
00108 void slotSelectionChanged();
00109
00111 void slotBeforeFormDestroyed();
00112
00113 protected:
00115 ObjectTreeViewItem* loadTree(ObjectTreeItem *item, ObjectTreeViewItem *parent);
00116
00118 ObjectTreeViewItem* findItem(const QString &name);
00119
00120 private:
00121 Form *m_form;
00122 ObjectTreeViewItem *m_topItem;
00123
00124 friend class TabStopDialog;
00125 };
00126
00127 }
00128
00129 #endif
|