kalarm

fontcolour.h

00001 /*
00002  *  fontcolour.h  -  font and colour chooser widget
00003  *  Program:  kalarm
00004  *  Copyright © 2001,2003,2008 by David Jarvie <djarvie@kde.org>
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 <tdeversion.h>
00025 #include <tqwidget.h>
00026 #include <tqstringlist.h>
00027 #include <tdefontdialog.h>
00028 #include "colourlist.h"
00029 
00030 class ColourCombo;
00031 class TQPushButton;
00032 class CheckBox;
00033 
00034 
00035 class FontColourChooser : public TQWidget
00036 {
00037     Q_OBJECT
00038   
00039 public:
00040     explicit FontColourChooser(TQWidget* parent = 0, const char* name = 0,
00041            bool onlyFixed = false,
00042            const TQStringList& fontList = TQStringList(),
00043            const TQString& frameLabel = i18n("Requested font"),
00044            bool editColours = false, bool fg = true, bool defaultFont = false,
00045            int visibleListSize = 8);
00046 
00047     void              setDefaultFont();
00048     void              setFont(const TQFont&, bool onlyFixed = false);
00049     bool              defaultFont() const;
00050     TQFont             font() const;
00051     TQColor            fgColour() const;
00052     TQColor            bgColour() const;
00053     const ColourList& colours() const   { return mColourList; }
00054     void              setFgColour(const TQColor&);
00055     void              setBgColour(const TQColor&);
00056     void              setColours(const ColourList&);
00057     TQString           sampleText() const;
00058     void              setSampleText(const TQString& text);
00059     bool              isReadOnly() const     { return mReadOnly; }
00060     void              setReadOnly(bool);
00061     virtual bool      eventFilter(TQObject*, TQEvent*);
00062 
00063 private slots:
00064     void              setSampleColour();
00065     void              slotDefaultFontToggled(bool);
00066     void              slotAddColour();
00067     void              slotRemoveColour();
00068 
00069 private:
00070     ColourCombo*     mFgColourButton;       // or null
00071     ColourCombo*     mBgColourButton;
00072     TQPushButton*     mRemoveColourButton;
00073     TDEFontChooser*    mFontChooser;
00074     CheckBox*        mDefaultFont;          // or null
00075     ColourList       mColourList;
00076     bool             mReadOnly;
00077 };
00078 
00079 #endif