kalarm

fontcolourbutton.h
1/*
2 * fontcolourbutton.h - pushbutton widget to select a font and colour
3 * Program: kalarm
4 * Copyright © 2003,2007 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 FONTCOLOURBUTTON_H
22#define FONTCOLOURBUTTON_H
23
24#include <tqfont.h>
25#include <tqcolor.h>
26#include <tqframe.h>
27#include <kdialogbase.h>
28
29class TQLineEdit;
30class FontColourChooser;
31class PushButton;
32
33
34class FontColourButton : public TQFrame
35{
36 TQ_OBJECT
37
38 public:
39 FontColourButton(TQWidget* parent = 0, const char* name = 0);
40 void setDefaultFont();
41 void setFont(const TQFont&);
42 void setBgColour(const TQColor&);
43 void setFgColour(const TQColor&);
44 bool defaultFont() const { return mDefaultFont; }
45 TQFont font() const { return mFont; }
46 TQColor bgColour() const { return mBgColour; }
47 TQColor fgColour() const { return mFgColour; }
48 virtual void setReadOnly(bool ro) { mReadOnly = ro; }
49 virtual bool isReadOnly() const { return mReadOnly; }
50
51 signals:
52 void selected();
53
54 protected slots:
55 void slotButtonPressed();
56
57 private:
58 PushButton* mButton;
59 TQColor mBgColour, mFgColour;
60 TQFont mFont;
61 TQLineEdit* mSample;
62 bool mDefaultFont;
63 bool mReadOnly;
64};
65
66
67// Font and colour selection dialog displayed by the push button
68class FontColourDlg : public KDialogBase
69{
70 TQ_OBJECT
71
72 public:
73 FontColourDlg(const TQColor& bg, const TQColor& fg, const TQFont&, bool defaultFont,
74 const TQString& caption, TQWidget* parent = 0, const char* name = 0);
75 bool defaultFont() const { return mDefaultFont; }
76 TQFont font() const { return mFont; }
77 TQColor bgColour() const { return mBgColour; }
78 TQColor fgColour() const { return mFgColour; }
79 void setReadOnly(bool);
80 bool isReadOnly() const { return mReadOnly; }
81
82 protected slots:
83 virtual void slotOk();
84
85 private:
86 FontColourChooser* mChooser;
87 TQColor mBgColour, mFgColour;
88 TQFont mFont;
89 bool mDefaultFont;
90 bool mReadOnly;
91};
92
93#endif // FONTCOLOURBUTTON_H