• Skip to content
  • Skip to link menu
KDE 4.0 API Reference
  • KDE API Reference
  • kdeutils
  • Sitemap
  • Contact Us
 

kcalc

kcalc_button.h

Go to the documentation of this file.
00001 /*
00002     KCalc, a scientific calculator for the X window system using the
00003     Qt widget libraries, available at no cost at http://www.troll.no
00004 
00005     Copyright (C) 2004-2005 Klaus Niederkruger
00006                        kniederk@ulb.ac.be
00007 
00008     This program is free software; you can redistribute it and/or modify
00009     it under the terms of the GNU General Public License as published by
00010     the Free Software Foundation; either version 2 of the License, or
00011     (at your option) any later version.
00012 
00013     This program is distributed in the hope that it will be useful,
00014     but WITHOUT ANY WARRANTY; without even the implied warranty of
00015     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016     GNU General Public License for more details.
00017 
00018     You should have received a copy of the GNU General Public License
00019     along with this program; if not, write to the Free Software
00020     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00021 
00022 */
00023 
00024 #ifndef _KCALC_BUTTON_H
00025 #define _KCALC_BUTTON_H
00026 
00027 #include <QMap>
00028 #include <kpushbutton.h>
00029 
00030 // The class KCalcButton is an overridden KPushButton. It offers extra
00031 // functionality e.g. text can be richtext, and the button can be
00032 // told to display its shortcuts in the label, but the most important
00033 // thing is that the button may have several modes with corresponding
00034 // labels and tooltips. When one switches modes, the corresponding
00035 // label is displayed.
00036 
00037 
00038 enum ButtonModeFlags {ModeNormal = 0, ModeInverse = 1, ModeHyperbolic = 2};
00039 
00040 
00041 // Each kcalc button can be in one of several modes.
00042 // The following class describes label, tooltip etc. for each mode...
00043 class ButtonMode
00044 {
00045 public:
00046   ButtonMode(void) {}
00047   ButtonMode(const QString &label,
00048              const QString &tooltip,
00049              const KIcon &icon)
00050       : label(label), tooltip(tooltip), icon(icon) { }
00051 
00052   QString label;
00053   QString tooltip;
00054   KIcon icon;
00055 };
00056 
00057 
00058 class KCalcButton : public KPushButton
00059 {
00060 Q_OBJECT
00061 
00062 public:
00063  KCalcButton(QWidget *parent); 
00064  KCalcButton(const QString &label, QWidget *parent,
00065          const QString &tooltip = QString());
00066 
00067  void addMode(ButtonModeFlags mode, const QString &label,
00068           const QString &tooltip, const KIcon &icon = KIcon());
00069 
00070  virtual QSize sizeHint() const; // reimp
00071 
00072  void setText(const QString &text); // reimp
00073  void setToolTip(const QString &tip); // reimp
00074 
00075 public slots: 
00076   void slotSetMode(ButtonModeFlags mode, bool flag); 
00077   void slotSetAccelDisplayMode(bool flag);
00078 
00079 protected:
00080   virtual void paintEvent(QPaintEvent *e);
00081 
00082  private:
00083   bool _show_shortcut_mode;
00084   ButtonModeFlags _mode_flags;
00085   QMap<ButtonModeFlags, ButtonMode> _mode;
00086 };
00087 
00088 #endif  // _KCALC_BUTTON_H

kcalc

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

kdeutils

Skip menu "kdeutils"
  • ark
  • kcalc
  • kcharselect
  • kdelirc
  • kdessh
  • kdf
  • kfloppy
  • kgpg
  • kjots
  • klaptopdaemon
  • kmilo
  • ksim
  • ktimer
  • kwallet
  • superkaramba
Generated for kdeutils by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal