
#ifndef __LOCATIONLIST_H
#define __LOCATIONLIST_H

#include <mapper/config.h>

#include <qlistview.h>
#include <listfilter.h>
#include <iwlocator/wlocation.h>

namespace iwear
{
    namespace sensor
    {
	namespace location
	{
class ListFilter;
class LocationListItem : public QListViewItem
{
private:
protected:
    const Location* location;
    /**
     * true per default, false if this item should not be displayed, e.g.
     * because it was filtered out...
     */
    bool display;
    /**
     * Is true if this location is a WLAN Location with some WLAN Info
     * associated to it...
     */
    bool wlanlocation;
public:
    LocationListItem( QListView* parent, const Location*, bool );
    virtual void paintCell( QPainter *p, const QColorGroup &cg,
					int column, int width, int alignment );
    const Location* get_location( void ) const { return location; }

    int compare ( QListViewItem * i, int col, bool ascending ) const;
};

class LocationDialog;
/**
 * This is a container with the location lists. It can have ListFilter
 */
class LocationList : public QListView
{
    Q_OBJECT
private:
protected:
    ListFilter* d_filter;
    void setup( void );

    vector<const Location*> locations;

    map<const Location*, LocationDialog*> locdmap;
protected slots:
    void location_info( QListViewItem* qlv, const QPoint&, int col );
public:
    LocationList( QWidget* parent );
    virtual ~LocationList( );

    void set_list( const map<uint32_t,Location*>& );
    void set_list( const map<uint32_t,WLocation*>& );

    void add_list( const map<uint32_t,Location*>& );
    void add_list( const map<uint32_t,WLocation*>& );

    void set_list( const vector<Location*>& );
    void update( void );
};

}
}
}
#endif
