00001 /*************************************************************************** 00002 radiostation-listview.h - description 00003 ------------------- 00004 begin : Mi Mar 03 2004 00005 copyright : (C) 2003 by Martin Witte 00006 email : witte@kawo1.rwth-aachen.de 00007 ***************************************************************************/ 00008 00009 /*************************************************************************** 00010 * * 00011 * This program is free software; you can redistribute it and/or modify * 00012 * it under the terms of the GNU General Public License as published by * 00013 * the Free Software Foundation; either version 2 of the License, or * 00014 * (at your option) any later version. * 00015 * * 00016 ***************************************************************************/ 00017 00018 00019 #ifdef HAVE_CONFIG_H 00020 #include <config.h> 00021 #endif 00022 00023 #ifndef _KRADIO_RADIOSTATION_LISTVIEW_H_ 00024 #define _KRADIO_RADIOSTATION_LISTVIEW_H_ 00025 00026 #include <klistview.h> 00027 00028 class RadioStation; 00029 class StationList; 00030 00031 class RadioStationListView : public KListView 00032 { 00033 Q_OBJECT 00034 public: 00035 RadioStationListView(QWidget *parent=0, const char *name=0); 00036 virtual ~RadioStationListView(); 00037 00038 QListViewItem *getItemForIndex(int idx) const; 00039 int getIndexForItem(QListViewItem *) const; 00040 00041 void setStation(int idx, const RadioStation &, int nr = -1); 00042 void appendStation(const RadioStation &, int nr = -1); 00043 void setStations(const StationList &); 00044 00045 void removeStation(int idx); 00046 void takeItem(QListViewItem *item, int idx); 00047 void insertItem(QListViewItem *item, const QString &stationid, int idx); 00048 00049 void setCurrentStation(int idx); 00050 int currentStationIndex() const; 00051 00052 int count() const { return childCount(); } 00053 00054 void saveState (KConfig *) const; 00055 void restoreState (KConfig *); 00056 00057 00058 protected: 00059 00060 QDragObject *dragObject(); 00061 void dragEnterEvent(QDragEnterEvent* event); 00062 void dropEvent(QDropEvent* event); 00063 void contentsDragEnterEvent(QDragEnterEvent* event); 00064 void contentsDragMoveEvent(QDragMoveEvent* event); 00065 void contentsDropEvent(QDropEvent* event); 00066 00067 protected slots: 00068 00069 void slotStationActivation(QListViewItem *); 00070 void slotCurrentStationChanged(QListViewItem *); 00071 00072 signals: 00073 void sigStationActivated(int idx); 00074 void sigCurrentStationChanged(int idx); 00075 void sigStationsReceived(const QStringList &stationIDs); 00076 00077 protected: 00078 00079 QStringList m_StationIDs; 00080 00081 }; 00082 00083 #endif