superkaramba
kwidgetlistbox.h
00001
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 <tqtable.h>
00024
00029 typedef bool (*show_callback) (int index, TQWidget* widget, void* data);
00030
00031 class KWidgetListbox : public TQTable
00032 {
00033 Q_OBJECT
00034
00035
00036 public:
00037 KWidgetListbox(TQWidget *parent = 0, const char *name = 0);
00038 ~KWidgetListbox();
00039
00040 int insertItem(TQWidget* item, int index = -1);
00041 void setSelected(TQWidget* item);
00042 void setSelected(int index);
00043 void removeItem(TQWidget* item);
00044 void removeItem(int index);
00045 void clear();
00046 int selected() const;
00047 TQWidget* selectedItem() const;
00048 TQWidget* item(int index) const;
00049 int index(TQWidget* itm) const;
00050 uint count() const { return numRows(); };
00051
00052 void showItems(show_callback func = 0, void* data = 0);
00053
00054 void paintCell(TQPainter* p, int row, int col, const TQRect& cr,
00055 bool selected, const TQColorGroup& cg);
00056 protected:
00057 void setItemColors(int index, bool even);
00058 void updateColors();
00059 bool even(int index);
00060 virtual void showEvent(TQShowEvent* e);
00061
00062 protected slots:
00063 void selectionChanged(int row, int col);
00064
00065 signals:
00066 void selected(int index);
00067 };
00068
00069 #endif