kwidgetlistbox.h00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef KWIDGETLISTBOX_H
00021 #define KWIDGETLISTBOX_H
00022
00023 #include <qtable.h>
00024
00029 typedef bool (*show_callback) (int index, QWidget* widget, void* data);
00030
00031 class KWidgetListbox : public QTable
00032 {
00033 Q_OBJECT
00034
00035 public:
00036 KWidgetListbox(QWidget *parent = 0, const char *name = 0);
00037 ~KWidgetListbox();
00038
00039 int insertItem(QWidget* item, int index = -1);
00040 void setSelected(QWidget* item);
00041 void setSelected(int index);
00042 void removeItem(QWidget* item);
00043 void removeItem(int index);
00044 void clear();
00045 int selected() const;
00046 QWidget* selectedItem() const;
00047 QWidget* item(int index) const;
00048 int index(QWidget* itm) const;
00049 uint count() const { return numRows(); };
00050
00051 void showItems(show_callback func = 0, void* data = 0);
00052
00053 void paintCell(QPainter* p, int row, int col, const QRect& cr,
00054 bool selected, const QColorGroup& cg);
00055 protected:
00056 void setItemColors(int index, bool even);
00057 void updateColors();
00058 bool even(int index);
00059 virtual void showEvent(QShowEvent* e);
00060
00061 protected slots:
00062 void selectionChanged(int row, int col);
00063
00064 signals:
00065 void selected(int index);
00066 };
00067
00068 #endif
|