Tulip  4.6.0
Better Visualization Through Research
library/tulip-gui/include/tulip/TulipFont.h
00001 /*
00002  *
00003  * This file is part of Tulip (www.tulip-software.org)
00004  *
00005  * Authors: David Auber and the Tulip development Team
00006  * from LaBRI, University of Bordeaux
00007  *
00008  * Tulip is free software; you can redistribute it and/or modify
00009  * it under the terms of the GNU Lesser General Public License
00010  * as published by the Free Software Foundation, either version 3
00011  * of the License, or (at your option) any later version.
00012  *
00013  * Tulip is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00016  * See the GNU General Public License for more details.
00017  *
00018  */
00019 ///@cond DOXYGEN_HIDDEN
00020 
00021 
00022 #ifndef TULIPFONT_H
00023 #define TULIPFONT_H
00024 
00025 #include <QObject>
00026 #include <QMap>
00027 
00028 #include <tulip/tulipconf.h>
00029 
00030 namespace tlp {
00031 
00032 class TLP_QT_SCOPE TulipFont : public QObject {
00033   static QMap<QString,int> FONT_IDS;
00034   static int fontId(const QString&);
00035 
00036   Q_OBJECT
00037   Q_PROPERTY(bool bold READ isBold WRITE setBold)
00038   bool _bold;
00039   Q_PROPERTY(bool italic READ isItalic WRITE setItalic)
00040   bool _italic;
00041   Q_PROPERTY(QString fontName READ fontName WRITE setFontName)
00042   QString _fontName;
00043   Q_PROPERTY(QString fontFile READ fontFile)
00044   QString _fontFile;
00045   Q_PROPERTY(bool exists READ exists)
00046   Q_PROPERTY(int fontId READ fontId)
00047   Q_PROPERTY(QString fontFamily READ fontFamily)
00048 
00049   void refreshFontFile();
00050 public:
00051 
00052   static QString tulipFontsDirectory();
00053   static QStringList installedFontNames();
00054   static TulipFont fromFile(const QString&);
00055 
00056   explicit TulipFont(QObject *parent = NULL);
00057   explicit TulipFont(const QString fontName, QObject *parent = NULL);
00058   TulipFont(const TulipFont&);
00059 
00060   TulipFont& operator=(const TulipFont&);
00061   bool isBold() const;
00062   bool isItalic() const;
00063   QString fontName() const;
00064   QString fontFile() const;
00065   bool exists() const;
00066   int fontId() const;
00067   QString fontFamily() const;
00068 
00069 public slots:
00070   void setItalic(bool);
00071   void setBold(bool);
00072   void setFontName(const QString&);
00073 };
00074 
00075 }
00076 
00077 #endif // TULIPFONT_H
00078 ///@endcond
 All Classes Files Functions Variables Enumerations Enumerator Properties