• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepim API Reference
  • KDE Home
  • Contact Us
 

kalarm

  • sources
  • kde-4.14
  • kdepim
  • kalarm
fontcolourbutton.h
Go to the documentation of this file.
1 /*
2  * fontcolourbutton.h - pushbutton widget to select a font and colour
3  * Program: kalarm
4  * Copyright © 2003-2009 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 "pushbutton.h"
25 #include <kdialog.h>
26 #include <QFont>
27 #include <QColor>
28 
29 class FontColourChooser;
30 
31 
32 class FontColourButton : public PushButton
33 {
34  Q_OBJECT
35  public:
36  explicit FontColourButton(QWidget* parent = 0);
37  void setDefaultFont();
38  void setFont(const QFont&);
39  void setBgColour(const QColor& c) { mBgColour = c; }
40  void setFgColour(const QColor& c) { mFgColour = c; }
41  bool defaultFont() const { return mDefaultFont; }
42  QFont font() const { return mFont; }
43  QColor bgColour() const { return mBgColour; }
44  QColor fgColour() const { return mFgColour; }
45  virtual void setReadOnly(bool ro, bool noHighlight = false)
46  { mReadOnly = ro; PushButton::setReadOnly(ro, noHighlight); }
47  virtual bool isReadOnly() const { return mReadOnly; }
48 
49  signals:
51  void selected(const QColor& fg, const QColor& bg);
52 
53  protected slots:
54  void slotButtonPressed();
55 
56  private:
57  QColor mBgColour, mFgColour;
58  QFont mFont;
59  bool mDefaultFont;
60  bool mReadOnly;
61 };
62 
63 
64 // Font and colour selection dialog displayed by the push button
65 class FontColourDlg : public KDialog
66 {
67  Q_OBJECT
68  public:
69  FontColourDlg(const QColor& bg, const QColor& fg, const QFont&, bool defaultFont,
70  const QString& caption, QWidget* parent = 0);
71  bool defaultFont() const { return mDefaultFont; }
72  QFont font() const { return mFont; }
73  QColor bgColour() const { return mBgColour; }
74  QColor fgColour() const { return mFgColour; }
75  void setReadOnly(bool);
76  bool isReadOnly() const { return mReadOnly; }
77 
78  protected slots:
79  virtual void slotOk();
80 
81  private:
82  FontColourChooser* mChooser;
83  QColor mBgColour, mFgColour;
84  QFont mFont;
85  bool mDefaultFont;
86  bool mReadOnly;
87 };
88 
89 #endif // FONTCOLOURBUTTON_H
90 
91 // vim: et sw=4:
FontColourButton::setFgColour
void setFgColour(const QColor &c)
Definition: fontcolourbutton.h:40
FontColourButton::bgColour
QColor bgColour() const
Definition: fontcolourbutton.h:43
FontColourButton::defaultFont
bool defaultFont() const
Definition: fontcolourbutton.h:41
QWidget
FontColourButton::FontColourButton
FontColourButton(QWidget *parent=0)
Definition: fontcolourbutton.cpp:41
FontColourChooser
Definition: fontcolour.h:33
FontColourButton::fgColour
QColor fgColour() const
Definition: fontcolourbutton.h:44
FontColourButton::slotButtonPressed
void slotButtonPressed()
Definition: fontcolourbutton.cpp:65
FontColourDlg::slotOk
virtual void slotOk()
Definition: fontcolourbutton.cpp:116
QFont
PushButton::setReadOnly
virtual void setReadOnly(bool readOnly, bool noHighlight=false)
FontColourButton::setDefaultFont
void setDefaultFont()
Definition: fontcolourbutton.cpp:50
KDialog
FontColourButton::font
QFont font() const
Definition: fontcolourbutton.h:42
FontColourDlg
Definition: fontcolourbutton.h:65
PushButton
pushbutton.h
FontColourDlg::isReadOnly
bool isReadOnly() const
Definition: fontcolourbutton.h:76
FontColourButton::setBgColour
void setBgColour(const QColor &c)
Definition: fontcolourbutton.h:39
FontColourDlg::FontColourDlg
FontColourDlg(const QColor &bg, const QColor &fg, const QFont &, bool defaultFont, const QString &caption, QWidget *parent=0)
Definition: fontcolourbutton.cpp:89
QString
QColor
FontColourButton::setFont
void setFont(const QFont &)
Definition: fontcolourbutton.cpp:55
FontColourDlg::fgColour
QColor fgColour() const
Definition: fontcolourbutton.h:74
FontColourDlg::font
QFont font() const
Definition: fontcolourbutton.h:72
FontColourButton
Definition: fontcolourbutton.h:32
FontColourDlg::setReadOnly
void setReadOnly(bool)
Definition: fontcolourbutton.cpp:130
FontColourButton::selected
void selected(const QColor &fg, const QColor &bg)
Signal emitted whenever a font or colour has been selected.
FontColourButton::setReadOnly
virtual void setReadOnly(bool ro, bool noHighlight=false)
Definition: fontcolourbutton.h:45
FontColourButton::isReadOnly
virtual bool isReadOnly() const
Definition: fontcolourbutton.h:47
FontColourDlg::defaultFont
bool defaultFont() const
Definition: fontcolourbutton.h:71
FontColourDlg::bgColour
QColor bgColour() const
Definition: fontcolourbutton.h:73
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:34:51 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kalarm

Skip menu "kalarm"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdepim API Reference

Skip menu "kdepim API Reference"
  • akonadi_next
  • akregator
  • blogilo
  • calendarsupport
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt2
  • kjots
  • kleopatra
  • kmail
  • knode
  • knotes
  • kontact
  • korgac
  • korganizer
  • ktimetracker
  • libkdepim
  • libkleo
  • libkpgp
  • mailcommon
  • messagelist
  • messageviewer
  • pimprint

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal