qwt_plot_dict.h 1.62 KB
Newer Older
pixhawk's avatar
pixhawk committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
 * Qwt Widget Library
 * Copyright (C) 1997   Josef Wilgen
 * Copyright (C) 2002   Uwe Rathmann
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the Qwt License, Version 1.0
 *****************************************************************************/

/*! \file !*/
#ifndef QWT_PLOT_DICT
#define QWT_PLOT_DICT

#include "qwt_global.h"
#include "qwt_plot_item.h"
#include <qlist.h>
Bryant's avatar
Bryant committed
17

pixhawk's avatar
pixhawk committed
18 19 20
/// \var typedef QList< QwtPlotItem *> QwtPlotItemList
/// \brief See QT 4.x assistant documentation for QList
typedef QList<QwtPlotItem *> QwtPlotItemList;
Bryant's avatar
Bryant committed
21
typedef QList<QwtPlotItem *>::ConstIterator QwtPlotItemIterator;
pixhawk's avatar
pixhawk committed
22 23 24 25 26 27 28

/*!
  \brief A dictionary for plot items

  QwtPlotDict organizes plot items in increasing z-order.
  If autoDelete() is enabled, all attached items will be deleted
  in the destructor of the dictionary.
Bryant's avatar
Bryant committed
29 30
  QwtPlotDict can be used to get access to all QwtPlotItem items - or all
  items of a specific type -  that are currently on the plot.
pixhawk's avatar
pixhawk committed
31 32 33 34 35 36 37

  \sa QwtPlotItem::attach(), QwtPlotItem::detach(), QwtPlotItem::z()
*/
class QWT_EXPORT QwtPlotDict
{
public:
    explicit QwtPlotDict();
Bryant's avatar
Bryant committed
38
    virtual ~QwtPlotDict();
pixhawk's avatar
pixhawk committed
39

Bryant's avatar
Bryant committed
40
    void setAutoDelete( bool );
pixhawk's avatar
pixhawk committed
41 42 43
    bool autoDelete() const;

    const QwtPlotItemList& itemList() const;
Bryant's avatar
Bryant committed
44
    QwtPlotItemList itemList( int rtti ) const;
pixhawk's avatar
pixhawk committed
45

Bryant's avatar
Bryant committed
46 47
    void detachItems( int rtti = QwtPlotItem::Rtti_PlotItem,
        bool autoDelete = true );
pixhawk's avatar
pixhawk committed
48

Bryant's avatar
Bryant committed
49 50 51
protected:
    void insertItem( QwtPlotItem * );
    void removeItem( QwtPlotItem * );
pixhawk's avatar
pixhawk committed
52

Bryant's avatar
Bryant committed
53
private:
pixhawk's avatar
pixhawk committed
54 55 56 57 58
    class PrivateData;
    PrivateData *d_data;
};

#endif