kalarm

fontcolour.h
1 /*
2  * fontcolour.h - font and colour chooser widget
3  * Program: kalarm
4  * Copyright © 2001,2003,2008 by David Jarvie <djarvie@kde.org>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License along
17  * with this program; if not, write to the Free Software Foundation, Inc.,
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19  */
20 
21 #ifndef FONTCOLOUR_H
22 #define FONTCOLOUR_H
23 
24 #include <tdeversion.h>
25 #include <tqwidget.h>
26 #include <tqstringlist.h>
27 #include <tdefontdialog.h>
28 #include "colourlist.h"
29 
30 class ColourCombo;
31 class TQPushButton;
32 class CheckBox;
33 
34 
35 class FontColourChooser : public TQWidget
36 {
37  TQ_OBJECT
38 
39 public:
40  explicit FontColourChooser(TQWidget* parent = 0, const char* name = 0,
41  bool onlyFixed = false,
42  const TQStringList& fontList = TQStringList(),
43  const TQString& frameLabel = i18n("Requested font"),
44  bool editColours = false, bool fg = true, bool defaultFont = false,
45  int visibleListSize = 8);
46 
47  void setDefaultFont();
48  void setFont(const TQFont&, bool onlyFixed = false);
49  bool defaultFont() const;
50  TQFont font() const;
51  TQColor fgColour() const;
52  TQColor bgColour() const;
53  const ColourList& colours() const { return mColourList; }
54  void setFgColour(const TQColor&);
55  void setBgColour(const TQColor&);
56  void setColours(const ColourList&);
57  TQString sampleText() const;
58  void setSampleText(const TQString& text);
59  bool isReadOnly() const { return mReadOnly; }
60  void setReadOnly(bool);
61  virtual bool eventFilter(TQObject*, TQEvent*);
62 
63 private slots:
64  void setSampleColour();
65  void slotDefaultFontToggled(bool);
66  void slotAddColour();
67  void slotRemoveColour();
68 
69 private:
70  ColourCombo* mFgColourButton; // or null
71  ColourCombo* mBgColourButton;
72  TQPushButton* mRemoveColourButton;
73  TDEFontChooser* mFontChooser;
74  CheckBox* mDefaultFont; // or null
75  ColourList mColourList;
76  bool mReadOnly;
77 };
78 
79 #endif