SciFigs/LegendTable.h
Go to the documentation of this file.
00001 /***************************************************************************
00002 **
00003 **  This file is part of SciFigs.
00004 **
00005 **  This library is free software; you can redistribute it and/or
00006 **  modify it under the terms of the GNU Lesser General Public
00007 **  License as published by the Free Software Foundation; either
00008 **  version 2.1 of the License, or (at your option) any later version.
00009 **
00010 **  This file is distributed in the hope that it will be useful, but WITHOUT
00011 **  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 **  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
00013 **  License for more details.
00014 **
00015 **  You should have received a copy of the GNU Lesser General Public
00016 **  License along with this library; if not, write to the Free Software
00017 **  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00018 **
00019 **  See http://www.geopsy.org for more information.
00020 **
00021 **  Created : 2002-05-27
00022 **  Authors :
00023 **    Marc Wathelet
00024 **    Marc Wathelet (ULg, Liège, Belgium)
00025 **    Marc Wathelet (LGIT, Grenoble, France)
00026 **
00027 ***************************************************************************/
00028 
00029 #ifndef LEGENDTABLE_H
00030 #define LEGENDTABLE_H
00031 
00032 #include <QGpGuiTools.h>
00033 
00034 #include "Symbol.h"
00035 #include "Legend.h"
00036 #include "SciFigsDLLExport.h"
00037 
00038 namespace SciFigs {
00039 
00040 class SCIFIGS_EXPORT LegendTable : public QTableView
00041 {
00042   Q_OBJECT
00043 public:
00044   enum Column {ColumnNull,
00045                ColumnPenColor, ColumnPenWidth, ColumnPenStyle,
00046                ColumnSymbolType, ColumnSymbolSize,
00047                ColumnSymbolPenColor, ColumnSymbolPenWidth, ColumnSymbolPenStyle,
00048                ColumnSymbolBrushColor, ColumnSymbolBrushStyle,
00049                ColumnTextColor, ColumnText};
00050   enum PropertySection {All=0x3F, Text=0x01, Pen=0x02, SymbolAll=0x1C,
00051                         SymbolType=0x04, SymbolPen=0x08, SymbolBrush=0x10, TextColor=0x20, TextAll=0x21};
00052   Q_DECLARE_FLAGS(PropertySections, PropertySection)
00053 
00054   LegendTable(QWidget *parent=0);
00055 
00056   void setLegend(Legend * legend);
00057   void setPropertySections(PropertySections s=All);
00058 
00059   void setOneColor(bool oc);
00060   bool oneColor() const;
00061 
00062   void setReadOnlyText(bool ro);
00063   bool readOnlyText() const;
00064 
00065   void setConstant(bool c);
00066 
00067   static void initPenStyles(QComboBox * w);
00068   static Qt::PenStyle penStyle(int index);
00069   static int penItem(Qt::PenStyle p);
00070 
00071   static void initSymbolTypes(QComboBox * w);
00072   static Symbol::Type symbolType(int index);
00073   static int symbolItem(Symbol::Type t);
00074 
00075   static void initBrushStyles(QComboBox * w);
00076   static Qt::BrushStyle brushStyle(int index);
00077   static int brushItem(Qt::BrushStyle b);
00078 private slots:
00079   void applyAllSelected();
00080 signals:
00081   void changed();
00082 private:
00083   static QPixmap penStylePixmap(Qt::PenStyle s);
00084   static QPixmap brushStylePixmap(Qt::BrushStyle s);
00085   static QPixmap symbolTypePixmap(Symbol::Type t);
00086 
00087   QHash<int,Column> _columnIndexes;
00088 };
00089 
00090 } // namespace SciFigs
00091 
00092 Q_DECLARE_OPERATORS_FOR_FLAGS(SciFigs::LegendTable::PropertySections)
00093 
00094 #endif // LEGENDTABLE_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines