Quantum GIS API Documentation  1.7.4
src/gui/qgslegendinterface.h
Go to the documentation of this file.
00001 /***************************************************************************
00002     qgslegendinterface.h
00003      --------------------------------------
00004     Date                 : 19-Nov-2009
00005     Copyright            : (C) 2009 by Andres Manz
00006     Email                : manz dot andres at gmail dot com
00007 ****************************************************************************/
00008 /***************************************************************************
00009  *                                                                         *
00010  *   This program is free software; you can redistribute it and/or modify  *
00011  *   it under the terms of the GNU General Public License as published by  *
00012  *   the Free Software Foundation; either version 2 of the License, or     *
00013  *   (at your option) any later version.                                   *
00014  *                                                                         *
00015  ***************************************************************************/
00016 /* $Id$ */
00017 
00018 #ifndef QGSLEGENDINTERFACE_H
00019 #define QGSLEGENDINTERFACE_H
00020 
00021 #include <QObject>
00022 #include <QPair>
00023 #include <QStringList>
00024 
00025 class QgsMapLayer;
00026 class QTreeWidgetItem;
00027 
00028 //Information about relationship between groups and layers
00029 //key: group name (or null strings for single layers without groups)
00030 //value: containter with layer ids contained in the group
00031 typedef QPair< QString, QList<QString> > GroupLayerInfo;
00032 
00039 class GUI_EXPORT QgsLegendInterface : public QObject
00040 {
00041     Q_OBJECT
00042 
00043   public:
00044 
00046     QgsLegendInterface();
00047 
00049     virtual ~QgsLegendInterface();
00050 
00052     virtual QStringList groups() = 0;
00053 
00055     virtual QList< GroupLayerInfo > groupLayerRelationship() { return QList< GroupLayerInfo >(); }
00056 
00059     virtual QList< QgsMapLayer * > layers() const = 0;
00060 
00063     virtual bool groupExists( int groupIndex ) = 0;
00064 
00067     virtual bool isGroupExpanded( int groupIndex ) = 0;
00068 
00071     virtual bool isGroupVisible( int groupIndex ) = 0;
00072 
00075     virtual bool isLayerVisible( QgsMapLayer * ml ) = 0;
00076 
00077   signals:
00079     void groupIndexChanged( int oldIndex, int newIndex );
00080 
00081   public slots:
00082 
00085     virtual int addGroup( QString name, bool expand = true, QTreeWidgetItem* parent = 0 ) = 0;
00086 
00089     virtual int addGroup( QString name, bool expand, int parentIndex ) = 0;
00090 
00092     virtual void removeGroup( int groupIndex ) = 0;
00093 
00095     virtual void moveLayer( QgsMapLayer * ml, int groupIndex ) = 0;
00096 
00099     virtual void setGroupExpanded( int groupIndex, bool expand ) = 0;
00100 
00103     virtual void setGroupVisible( int groupIndex, bool visible ) = 0;
00104 
00107     virtual void setLayerVisible( QgsMapLayer * ml, bool visible ) = 0;
00108 
00111     virtual void refreshLayerSymbology( QgsMapLayer *ml ) = 0;
00112 };
00113 
00114 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines