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.26 2002/09/28 15:16:22 tjansen 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);
00104 
00112   void setDefaultPixmap(const QPixmap& pixmap);
00113 
00121   void setDisabledPixmap(const QPixmap& pixmap);
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   void setIcon(const QString &icon, bool /*generate*/ ) { setIcon( icon ); }
00165 
00173   void setDefaultIcon(const QString& icon);
00174 
00182   void setDisabledIcon(const QString& icon);
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 
00223   void setPopup (QPopupMenu *p, bool toggle = false);
00224 
00239   void setDelayedPopup(QPopupMenu *p, bool toggle = false);
00240 
00246   void setRadio(bool f = true);
00247 
00255   void setNoStyle(bool no_style = true);
00256 
00257 signals:
00258   void clicked(int);
00259   void doubleClicked(int);
00260   void pressed(int);
00261   void released(int);
00262   void toggled(int);
00263   void highlighted(int, bool);
00264 
00265 public slots:
00271    void modeChange();
00272    virtual void setTextLabel(const QString&, bool tipToo);
00273 
00274 protected:
00275   void paletteChange(const QPalette &);
00276   void leaveEvent(QEvent *e);
00277   void enterEvent(QEvent *e);
00278   void drawButton(QPainter *p);
00279   bool eventFilter (QObject *o, QEvent *e);
00280   void showMenu();
00281   QSize sizeHint() const;
00282   QSize minimumSizeHint() const;
00283   QSize minimumSize() const;
00284 
00286   bool isRaised() const;
00288   bool isActive() const;
00290   int iconTextMode() const;
00291 
00292 protected slots:
00293   void slotClicked();
00294   void slotPressed();
00295   void slotReleased();
00296   void slotToggled();
00297   void slotDelayTimeout();
00298 
00299 protected:
00300   virtual void virtual_hook( int id, void* data );
00301 private:
00302   KToolBarButtonPrivate *d;
00303 };
00304 
00310 class KToolBarButtonList : public QIntDict<KToolBarButton>
00311 {
00312 public:
00313    KToolBarButtonList();
00314    ~KToolBarButtonList() {}
00315 };
00316 
00317 #endif
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.4.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Sun Feb 27 22:15:05 2005 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001