File indexing completed on 2024-05-12 16:34:57

0001 /* This file is part of the KDE libraries
0002     Copyright (C) 1999 Reginald Stadlbauer <reggie@kde.org>
0003               (C) 1999 Simon Hausmann <hausmann@kde.org>
0004               (C) 2000 Nicolas Hadacek <haadcek@kde.org>
0005               (C) 2000 Kurt Granroth <granroth@kde.org>
0006               (C) 2000 Michael Koch <koch@kde.org>
0007               (C) 2001 Holger Freyther <freyther@kde.org>
0008               (C) 2002 Ellis Whitehead <ellis@kde.org>
0009               (C) 2003 Andras Mantia <amantia@kde.org>
0010               (C) 2005-2006 Hamish Rodda <rodda@kde.org>
0011               (C) 2014 Dan Leinir Turthra Jensen
0012 
0013     This library is free software; you can redistribute it and/or
0014     modify it under the terms of the GNU Library General Public
0015     License version 2 as published by the Free Software Foundation.
0016 
0017     This library is distributed in the hope that it will be useful,
0018     but WITHOUT ANY WARRANTY; without even the implied warranty of
0019     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0020     Library General Public License for more details.
0021 
0022     You should have received a copy of the GNU Library General Public License
0023     along with this library; see the file COPYING.LIB.  If not, write to
0024     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0025     Boston, MA 02110-1301, USA.
0026 */
0027 
0028 // This is a minorly modified version of the KFontAction class. It exists
0029 // entirely because there's a hang bug on windows at the moment.
0030 
0031 #ifndef KOFONTACTION_H
0032 #define KOFONTACTION_H
0033 
0034 #include <kselectaction.h>
0035 
0036 class QIcon;
0037 
0038 /**
0039  * An action to select a font family.
0040  * On a toolbar this will show a combobox with all the fonts on the system.
0041  */
0042 class KoFontFamilyAction : public KSelectAction
0043 {
0044     Q_OBJECT
0045     Q_PROPERTY( QString font READ font WRITE setFont )
0046 
0047 public:
0048     KoFontFamilyAction(uint fontListCriteria, QObject *parent);
0049     explicit KoFontFamilyAction(QObject *parent);
0050     KoFontFamilyAction(const QString& text, QObject *parent);
0051     KoFontFamilyAction(const QIcon &icon, const QString &text, QObject *parent);
0052     ~KoFontFamilyAction() override;
0053 
0054     QString font() const;
0055 
0056     void setFont( const QString &family );
0057 
0058     QWidget* createWidget(QWidget* parent) override;
0059 
0060 private:
0061     class KoFontFamilyActionPrivate;
0062     KoFontFamilyActionPrivate * const d;
0063 
0064     Q_PRIVATE_SLOT( d, void _ko_slotFontChanged(const QFont&) )
0065 };
0066 
0067 #endif