File indexing completed on 2024-05-12 05:14:45

0001 /*
0002  *  fontcolour.h  -  font and colour chooser widget
0003  *  Program:  kalarm
0004  *  SPDX-FileCopyrightText: 2001-2022 David Jarvie <djarvie@kde.org>
0005  *
0006  *  SPDX-License-Identifier: GPL-2.0-or-later
0007  */
0008 
0009 #pragma once
0010 
0011 #include <KLocalizedString>
0012 #include <QWidget>
0013 #include <QStringList>
0014 
0015 class KFontChooser;
0016 class CheckBox;
0017 class ColourButton;
0018 
0019 
0020 class FontColourChooser : public QWidget
0021 {
0022     Q_OBJECT
0023 public:
0024     explicit FontColourChooser(QWidget* parent = nullptr,
0025            const QStringList& fontList = QStringList(),
0026            const QString& frameLabel = i18n("Requested font"),
0027            bool fg = true, bool defaultFont = false, int visibleListSize = 8);
0028 
0029     void          setFont(const QFont&, bool defaultFont = false, bool onlyFixed = false);
0030     bool          defaultFont() const;
0031     QFont         font() const;
0032     QColor        fgColour() const;
0033     QColor        bgColour() const;
0034     void          setFgColour(const QColor&);
0035     void          setBgColour(const QColor&);
0036     QString       sampleText() const;
0037     void          setSampleText(const QString& text);
0038     bool          isReadOnly() const     { return mReadOnly; }
0039     void          setReadOnly(bool);
0040     bool          eventFilter(QObject*, QEvent*) override;
0041 
0042 private Q_SLOTS:
0043     void          setSampleColour();
0044     void          slotDefaultFontToggled(bool);
0045 
0046 private:
0047     ColourButton* mFgColourButton {nullptr};
0048     ColourButton* mBgColourButton;
0049     KFontChooser* mFontChooser;
0050     CheckBox*     mDefaultFont {nullptr};
0051     bool          mReadOnly {false};
0052 };
0053 
0054 // vim: et sw=4: