[KLF Application][KLF Tools][KLF Backend][KLF Home]
KLatexFormula Project

src/klftools/klfdisplaylabel.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   file klfdisplaylabel.h
00003  *   This file is part of the KLatexFormula Project.
00004  *   Copyright (C) 2009 by Philippe Faist
00005  *   philippe.faist at bluewin.ch
00006  *                                                                         *
00007  *   This program is free software; you can redistribute it and/or modify  *
00008  *   it under the terms of the GNU General Public License as published by  *
00009  *   the Free Software Foundation; either version 2 of the License, or     *
00010  *   (at your option) any later version.                                   *
00011  *                                                                         *
00012  *   This program is distributed in the hope that it will be useful,       *
00013  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00014  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00015  *   GNU General Public License for more details.                          *
00016  *                                                                         *
00017  *   You should have received a copy of the GNU General Public License     *
00018  *   along with this program; if not, write to the                         *
00019  *   Free Software Foundation, Inc.,                                       *
00020  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00021  ***************************************************************************/
00022 /* $Id: klfdisplaylabel.h 483 2010-09-10 00:43:05Z philippe $ */
00023 
00024 #ifndef KLFDISPLAYLABEL_H
00025 #define KLFDISPLAYLABEL_H
00026 
00027 #include <QLabel>
00028 #include <QTemporaryFile>
00029 
00030 #include <klfdefs.h>
00031 
00034 class KLF_EXPORT KLFDisplayLabel : public QLabel
00035 {
00036   Q_OBJECT
00037 
00038   Q_PROPERTY(QSize labelFixedSize READ labelFixedSize WRITE setLabelFixedSize) ;
00039   Q_PROPERTY(bool enableToolTipPreview READ enableToolTipPreview WRITE setEnableToolTipPreview) ;
00040 
00041   Q_PROPERTY(QString bigPreviewText READ bigPreviewText) ;
00042   Q_PROPERTY(bool glowEffect READ glowEffect WRITE setGlowEffect) ;
00043   Q_PROPERTY(QColor glowEffectColor READ glowEffectColor WRITE setGlowEffectColor) ;
00044   Q_PROPERTY(int glowEffectRadius READ glowEffectRadius WRITE setGlowEffectRadius) ;
00045 public:
00046   KLFDisplayLabel(QWidget *parent);
00047   virtual ~KLFDisplayLabel();
00048 
00049   virtual QSize labelFixedSize() const { return pLabelFixedSize; }
00050   virtual bool enableToolTipPreview() const { return pEnableToolTipPreview; }
00051 
00052   virtual QString bigPreviewText() const { return _bigPreviewText; }
00053 
00054   inline bool glowEffect() const { return pGE; }
00055   inline QColor glowEffectColor() const { return pGEcolor; }
00056   inline int glowEffectRadius() const { return pGEradius; }
00057 
00058 signals:
00059   void labelDrag();
00060 
00061 public slots:
00062   virtual void setLabelFixedSize(const QSize& size);
00063   virtual void setEnableToolTipPreview(bool enable) { pEnableToolTipPreview = enable; }
00064 
00065   virtual void displayClear();
00066   virtual void display(QImage displayimg, QImage tooltipimage, bool labelenabled = true);
00067   virtual void displayError(bool labelenabled = false);
00068 
00070   void setGlowEffect(bool on) { pGE = on; }
00072   void setGlowEffectColor(const QColor& color) { pGEcolor = color; }
00074   void setGlowEffectRadius(int r) { pGEradius = r; }
00075 
00076 protected:
00077   virtual void mouseMoveEvent(QMouseEvent *e);
00078 
00079 private:
00080 
00081   QSize pLabelFixedSize;
00082   bool pEnableToolTipPreview;
00083   QTemporaryFile *mToolTipFile;
00084 
00085   QPalette pDefaultPalette;
00086   QPalette pErrorPalette;
00087 
00088   QString _bigPreviewText;
00089 
00090   bool pGE;
00091   QColor pGEcolor;
00092   int pGEradius;
00093 
00094   void set_error(bool error_on);
00095 };
00096 
00097 
00098 
00099 
00100 
00101 
00102 
00103 #endif

Generated by doxygen 1.7.3