kalarm

fontcolour.h

00001 /*
00002  *  fontcolour.h  -  font and colour chooser widget
00003  *  Program:  kalarm
00004  *  Copyright (c) 2001, 2003 by David Jarvie <software@astrojar.org.uk>
00005  *
00006  *  This program is free software; you can redistribute it and/or modify
00007  *  it under the terms of the GNU General Public License as published by
00008  *  the Free Software Foundation; either version 2 of the License, or
00009  *  (at your option) any later version.
00010  *
00011  *  This program is distributed in the hope that it will be useful,
00012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00014  *  GNU General Public License for more details.
00015  *
00016  *  You should have received a copy of the GNU General Public License along
00017  *  with this program; if not, write to the Free Software Foundation, Inc.,
00018  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00019  */
00020 
00021 #ifndef FONTCOLOUR_H
00022 #define FONTCOLOUR_H
00023 
00024 #include <kdeversion.h>
00025 #include <qwidget.h>
00026 #include <qstringlist.h>
00027 #include <kfontdialog.h>
00028 #include "colourlist.h"
00029 
00030 class ColourCombo;
00031 class QPushButton;
00032 class CheckBox;
00033 
00034 
00035 class FontColourChooser : public QWidget
00036 {
00037     Q_OBJECT
00038 public:
00039     FontColourChooser(QWidget* parent = 0, const char* name = 0,
00040            bool onlyFixed = false,
00041            const QStringList& fontList = QStringList(),
00042            const QString& frameLabel = i18n("Requested font"),
00043            bool editColours = false, bool fg = true, bool defaultFont = false,
00044            int visibleListSize = 8);
00045 
00046     void              setDefaultFont();
00047     void              setFont(const QFont&, bool onlyFixed = false);
00048     bool              defaultFont() const;
00049     QFont             font() const;
00050     QColor            fgColour() const;
00051     QColor            bgColour() const;
00052     const ColourList& colours() const   { return mColourList; }
00053     void              setFgColour(const QColor&);
00054     void              setBgColour(const QColor&);
00055     void              setColours(const ColourList&);
00056     QString           sampleText() const;
00057     void              setSampleText(const QString& text);
00058     bool              isReadOnly() const     { return mReadOnly; }
00059     void              setReadOnly(bool);
00060 
00061 private slots:
00062     void              setSampleColour();
00063     void              slotDefaultFontToggled(bool);
00064     void              slotAddColour();
00065     void              slotRemoveColour();
00066 
00067 private:
00068     ColourCombo*     mFgColourButton;       // or null
00069     ColourCombo*     mBgColourButton;
00070     QPushButton*     mRemoveColourButton;
00071     KFontChooser*    mFontChooser;
00072     CheckBox*        mDefaultFont;          // or null
00073     ColourList       mColourList;
00074     bool             mReadOnly;
00075 };
00076 
00077 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys