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 <tqwidget.h>
25 #include <tqstringlist.h>
26 #include <tdefontdialog.h>
27 #include "colourlist.h"
28 
29 class ColourCombo;
30 class TQPushButton;
31 class CheckBox;
32 
33 
34 class FontColourChooser : public TQWidget
35 {
36  TQ_OBJECT
37 
38 public:
39  explicit FontColourChooser(TQWidget* parent = 0, const char* name = 0,
40  bool onlyFixed = false,
41  const TQStringList& fontList = TQStringList(),
42  const TQString& frameLabel = i18n("Requested font"),
43  bool editColours = false, bool fg = true, bool defaultFont = false,
44  int visibleListSize = 8);
45 
46  void setDefaultFont();
47  void setFont(const TQFont&, bool onlyFixed = false);
48  bool defaultFont() const;
49  TQFont font() const;
50  TQColor fgColour() const;
51  TQColor bgColour() const;
52  const ColourList& colours() const { return mColourList; }
53  void setFgColour(const TQColor&);
54  void setBgColour(const TQColor&);
55  void setColours(const ColourList&);
56  TQString sampleText() const;
57  void setSampleText(const TQString& text);
58  bool isReadOnly() const { return mReadOnly; }
59  void setReadOnly(bool);
60  virtual bool eventFilter(TQObject*, TQEvent*);
61 
62 private slots:
63  void setSampleColour();
64  void slotDefaultFontToggled(bool);
65  void slotAddColour();
66  void slotRemoveColour();
67 
68 private:
69  ColourCombo* mFgColourButton; // or null
70  ColourCombo* mBgColourButton;
71  TQPushButton* mRemoveColourButton;
72  TDEFontChooser* mFontChooser;
73  CheckBox* mDefaultFont; // or null
74  ColourList mColourList;
75  bool mReadOnly;
76 };
77 
78 #endif