Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef COLORPALETTEWIDGET_H
00030 #define COLORPALETTEWIDGET_H
00031
00032 #include "GraphicObject.h"
00033 #include "Axis.h"
00034
00035 namespace SciFigs {
00036
00037 class PaletteProperties;
00038 class PaletteEditor;
00039 class ColorPaletteLayer;
00040
00041 class SCIFIGS_EXPORT ColorPaletteWidget : public GraphicObject
00042 {
00043 Q_OBJECT
00044
00045 Q_PROPERTY(QString numType READ dummyPropertyString WRITE setNumberType STORED false)
00046 Q_PROPERTY(int numPrec READ dummyPropertyInt WRITE setNumberPrecision STORED false)
00047 Q_PROPERTY(QString title READ dummyPropertyString WRITE setTitle STORED false)
00048 Q_PROPERTY(QString numberType READ dummyPropertyString WRITE setNumberType STORED false)
00049 Q_PROPERTY(int numberPrecision READ dummyPropertyInt WRITE setNumberPrecision STORED false)
00050 Q_PROPERTY(QString font READ dummyPropertyString WRITE setFontString STORED false)
00051 Q_PROPERTY(double lineWeight READ dummyPropertyDouble WRITE setLineWeight STORED false)
00052 Q_PROPERTY(double tickLength READ dummyPropertyDouble WRITE setTickSize STORED false)
00053 Q_PROPERTY(double tickLenght READ dummyPropertyDouble WRITE setTickSize STORED false)
00054 public:
00055 ColorPaletteWidget(QWidget *parent=0, Qt::WFlags f=0);
00056 ~ColorPaletteWidget();
00057
00058 ColorPaletteWidget& operator=(const ColorPaletteWidget& o);
00059
00060 virtual const QString& xml_tagName() const {return xmlColorPaletteWidgetTag;}
00061 static const QString xmlColorPaletteWidgetTag;
00062
00063 void setAxis(const Axis& a);
00064 const Axis& axis() const;
00065
00066 const ColorPalette& palette() const;
00067
00068 void setOrientation(Axis::Orientation o) {axis().setOrientation(o);}
00069 Axis::Orientation orientation() const {return axis().orientation();}
00070
00071 virtual int* scaleFonts(double factor);
00072 virtual void restoreScaleFonts(int* tmp);
00073
00074 virtual void addProperties(PropertyProxy * pp);
00075 virtual void removeProperties(PropertyProxy * pp);
00076 virtual void properties(PropertyWidget * w) const;
00077 virtual void setProperty(uint wid, int pid, QVariant val);
00078 public slots:
00079 virtual Q_SCRIPTABLE void update();
00080 virtual Q_SCRIPTABLE void deepUpdate();
00081 Q_SCRIPTABLE void setNumColor(int n);
00082 Q_SCRIPTABLE void defaultColors(int n);
00083 Q_SCRIPTABLE void defaultBW(int n);
00084 Q_SCRIPTABLE void defaultHSVColors(int sat, int value, int n=10, int transparency=255);
00085 Q_SCRIPTABLE void colorInterpole(int imin, int imax);
00086 Q_SCRIPTABLE void setVLinear(double min, double max);
00087 Q_SCRIPTABLE void setVLog(double min, double max);
00088 Q_SCRIPTABLE void load(QString fileName);
00089 Q_SCRIPTABLE void save(QString fileName);
00090 void setPalette(const ColorPalette& pal);
00091
00092 void setScaleType(Scale::Type t) {axis().setScaleType(t);}
00093 void setNumberType(QString t) {axis().setNumberType(Number::type(t.toAscii().data()[0]));}
00094 void setNumberPrecision(int p) {axis().setCurrentNumberPrecision(p);}
00095 void setTitle(QString s) {axis().setCurrentTitle(s);}
00096 void setFontString(QString fs) {axis().setFontString(fs);}
00097 void setLineWeight(double val) {axis().setLineWeight(val);}
00098 void setTickSize(double val) {axis().setTickSize(val);}
00099 protected:
00100 virtual bool eventFilter(QObject * obj, QEvent * e);
00101 virtual void resizeEvent(QResizeEvent * );
00102 private slots:
00103 void setOrientation();
00104 signals:
00105 void changed(ColorPalette pal);
00106 protected:
00107 virtual void print(QPainter& p, double dotpercm, int x0Sheet, int y0Sheet, bool mask);
00108 XMLMember xml_member(XML_MEMBER_ARGS);
00109 void xml_writeChildren(XML_WRITECHILDREN_ARGS) const;
00110 void xml_polishChild(XML_POLISHCHILD_ARGS);
00111 private:
00112 Axis& axis();
00113 QMouseEvent * convertMouseEvent(QObject * obj, QEvent * e);
00114
00115 ColorPaletteLayer * _paletteLayer;
00116 static uint _category, _tabPalette;
00117 };
00118
00119 }
00120
00121 #endif // COLORPALETTEWIDGET_H