kdeui Library API Documentation

ktoolbarbutton.h

00001 /* This file is part of the KDE libraries
00002     Copyright (C) 1997, 1998 Stephan Kulow (coolo@kde.org)
00003               (C) 1997, 1998 Sven Radej (radej@kde.org)
00004               (C) 1997, 1998 Mark Donohoe (donohoe@kde.org)
00005               (C) 1997, 1998 Matthias Ettrich (ettrich@kde.org)
00006               (C) 2000 Kurt Granroth (granroth@kde.org)
00007 
00008     This library is free software; you can redistribute it and/or
00009     modify it under the terms of the GNU Library General Public
00010     License version 2 as published by the Free Software Foundation.
00011 
00012     This library is distributed in the hope that it will be useful,
00013     but WITHOUT ANY WARRANTY; without even the implied warranty of
00014     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015     Library General Public License for more details.
00016 
00017     You should have received a copy of the GNU Library General Public License
00018     along with this library; see the file COPYING.LIB.  If not, write to
00019     the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00020     Boston, MA 02111-1307, USA.
00021 */
00022 
00023 // $Id: ktoolbarbutton.h,v 1.34 2003/09/09 12:40:58 bhards Exp $
00024 #ifndef _KTOOLBARBUTTON_H
00025 #define _KTOOLBARBUTTON_H
00026 
00027 #include <qpixmap.h>
00028 #include <qtoolbutton.h>
00029 #include <qintdict.h>
00030 #include <qstring.h>
00031 #include <kglobal.h>
00032 
00033 class KToolBar;
00034 class KToolBarButtonPrivate;
00035 class KInstance;
00036 class QEvent;
00037 class QPopupMenu;
00038 class QPainter;
00039 
00045 class KToolBarButton : public QToolButton
00046 {
00047   Q_OBJECT
00048 
00049 public:
00061   KToolBarButton(const QString& icon, int id, QWidget *parent,
00062                  const char *name=0L, const QString &txt=QString::null,
00063                  KInstance *_instance = KGlobal::instance());
00064 
00076   KToolBarButton(const QPixmap& pixmap, int id, QWidget *parent,
00077                  const char *name=0L, const QString &txt=QString::null);
00078 
00085   KToolBarButton(QWidget *parent=0L, const char *name=0L);
00086 
00090   ~KToolBarButton();
00091 
00092 #ifndef KDE_NO_COMPAT
00093 
00102   // this one is from QButton, so #ifdef-ing it out doesn't break BC
00103   virtual void setPixmap(const QPixmap &pixmap) KDE_DEPRECATED;
00104 
00112   void setDefaultPixmap(const QPixmap& pixmap) KDE_DEPRECATED;
00113 
00121   void setDisabledPixmap(const QPixmap& pixmap) KDE_DEPRECATED;
00122 #endif
00123 
00130   virtual void setText(const QString &text);
00131 
00138   virtual void setIcon(const QString &icon);
00139 
00141   virtual void setIcon( const QPixmap &pixmap )
00142   { QToolButton::setIcon( pixmap ); }
00143 
00150   virtual void setIconSet( const QIconSet &iconset );
00151 
00152 #ifndef KDE_NO_COMPAT
00153 
00164   KDE_DEPRECATED void setIcon(const QString &icon, bool generate ) { Q_UNUSED(generate); setIcon( icon ); }
00165 
00173   void setDefaultIcon(const QString& icon) KDE_DEPRECATED;
00174 
00182   void setDisabledIcon(const QString& icon) KDE_DEPRECATED;
00183 #endif
00184 
00190   void on(bool flag = true);
00191 
00195   void toggle();
00196 
00204   void setToggle(bool toggle = true);
00205 
00209   QPopupMenu *popup();
00210 
00215   int id() const;
00216 
00225   void setPopup (QPopupMenu *p, bool unused = false);
00226 
00237   void setDelayedPopup(QPopupMenu *p, bool unused = false);
00238 
00244   void setRadio(bool f = true);
00245 
00253   void setNoStyle(bool no_style = true);
00254 
00255 signals:
00256   void clicked(int);
00257   void doubleClicked(int);
00258   void pressed(int);
00259   void released(int);
00260   void toggled(int);
00261   void highlighted(int, bool);
00262 
00263 public slots:
00269    void modeChange();
00270    virtual void setTextLabel(const QString&, bool tipToo);
00271 
00272 protected:
00273   void paletteChange(const QPalette &);
00274   void leaveEvent(QEvent *e);
00275   void enterEvent(QEvent *e);
00276   void drawButton(QPainter *p);
00277   bool eventFilter (QObject *o, QEvent *e);
00278   void showMenu();
00279   QSize sizeHint() const;
00280   QSize minimumSizeHint() const;
00281   QSize minimumSize() const;
00282 
00284   bool isRaised() const;
00286   bool isActive() const;
00288   int iconTextMode() const;
00289 
00290 protected slots:
00291   void slotClicked();
00292   void slotPressed();
00293   void slotReleased();
00294   void slotToggled();
00295   void slotDelayTimeout();
00296 
00297 protected:
00298   virtual void virtual_hook( int id, void* data );
00299 private:
00300   KToolBarButtonPrivate *d;
00301 };
00302 
00308 class KToolBarButtonList : public QIntDict<KToolBarButton>
00309 {
00310 public:
00311    KToolBarButtonList();
00312    ~KToolBarButtonList() {}
00313 };
00314 
00315 #endif
KDE Logo
This file is part of the documentation for kdeui Library Version 3.2.3.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Aug 4 05:24:01 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2003