00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __moduletreeview_h__
00021 #define __moduletreeview_h__
00022
00023 #include <tqpalette.h>
00024 #include <tqptrlist.h>
00025 #include <tqlistview.h>
00026 #include <klistview.h>
00027 #include <tqdict.h>
00028
00029
00030 class ConfigModule;
00031 class ConfigModuleList;
00032 class TQPainter;
00033
00034 class ModuleTreeItem : public QListViewItem
00035 {
00036
00037 public:
00038 ModuleTreeItem(TQListViewItem *parent, ConfigModule *module = 0);
00039 ModuleTreeItem(TQListViewItem *parent, const TQString& text);
00040 ModuleTreeItem(TQListView *parent, ConfigModule *module = 0);
00041 ModuleTreeItem(TQListView *parent, const TQString& text);
00042
00043 void setTag(const TQString& tag) { _tag = tag; }
00044 void setCaption(const TQString& caption) { _caption = caption; }
00045 void setModule(ConfigModule *m) { _module = m; }
00046 TQString tag() const { return _tag; };
00047 TQString caption() const { return _caption; };
00048 TQString icon() const { return _icon; };
00049 ConfigModule *module() { return _module; };
00050 void regChildIconWidth(int width);
00051 int maxChildIconWidth() { return _maxChildIconWidth; }
00052
00053 void setPixmap(int column, const TQPixmap& pm);
00054 void setGroup(const TQString &path);
00055
00056 protected:
00057 void paintCell( TQPainter * p, const TQColorGroup & cg, int column, int width, int align );
00058
00059 private:
00060 ConfigModule *_module;
00061 TQString _tag;
00062 TQString _caption;
00063 int _maxChildIconWidth;
00064 TQString _icon;
00065 };
00066
00067 class ModuleTreeView : public KListView
00068 {
00069 Q_OBJECT
00070
00071 public:
00072 ModuleTreeView(ConfigModuleList *list, TQWidget * parent = 0, const char * name = 0);
00073
00074 void makeSelected(ConfigModule* module);
00075 void makeVisible(ConfigModule *module);
00076 void fill();
00077 TQSize sizeHint() const;
00078
00079 signals:
00080 void moduleSelected(ConfigModule*);
00081 void categorySelected(TQListViewItem*);
00082
00083 protected slots:
00084 void slotItemSelected(TQListViewItem*);
00085
00086 protected:
00087 void updateItem(ModuleTreeItem *item, ConfigModule* module);
00088 void keyPressEvent(TQKeyEvent *);
00089 void fill(ModuleTreeItem *parent, const TQString &parentPath);
00090
00091 private:
00092 ConfigModuleList *_modules;
00093 };
00094
00095 #endif