/***********************************************************************
**
**   waypointlistview.h
**
**   This file is part of Cumulus.
**
************************************************************************
**
**   Copyright (c):  2004 by André Somers, Eckhard Völlm 
**
**   This file is distributed under the terms of the General Public
**   Licence. See the file COPYING for more information.
**
**   $Id: reachpointlistview.h,v 1.6 2004/04/27 21:47:08 axel Exp $
**
***********************************************************************/

#ifndef REACHPOINTLISTVIEW_H
#define REACHPOINTLISTVIEW_H

#include <qwidget.h>
#include "qlistview.h"
#include "wp.h"
#include <qlayout.h>
#include <qpixmap.h>


/**This widget provides a list of waypoints and a means to select one.
  *@author André Somers
  */
class CumulusApp;

#define NUMBER_LIST_ENTRIES 40 
class ReachpointListView : public QWidget  {
    Q_OBJECT
public:
    ReachpointListView(CumulusApp *parent=0, const char *name=0);
    ~ReachpointListView();

    /** Returns a pointer to the currently highlighted waypoint. */
    wayPoint * getSelectedWaypoint();
private:
    QListView* list;
    CumulusApp * par;
    QBoxLayout * buttonrow;
    wayPoint    selectedWp;
    bool       _outlandShow;
    QPushButton *cmdShowOl;
    QPushButton *cmdHideOl;
    QPixmap     _arrows;
    bool        _newList;
    
protected:
    void showEvent(QShowEvent *);

private: // Private methods

public slots: // Public slots
    /** This signal is called to indicate that a selection has been made. */
    void slot_Select();
    /** This slot is called if the info button has been clicked, or the user pressed 'i' */
    void slot_Info();
    /** Called when the listview should be closed without selection */
    void slot_Close ();
    /** This slot is called if the Show Outland button has been clicked */
    void slot_ShowOl ();
    /** This slot is called if the Hide Outland button has been clicked */
    void slot_HideOl ();
    /** Signalled if the list of reachable points has changed */
    void slot_newList ();
    /** Retreives the waypoints from the mapcontents, and fills the list. */
    void fillRpList();

signals: // Signals
    /** This signal is emitted if a new waypoint is selected. */
    void newWaypoint(wayPoint*);

    /** This signal is send if the selection is done, and the screen can be closed. */
    void done();

    /** Emitted if the user clicks the Info button. */
    void info(wayPoint *);
};

#endif
