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 #ifndef _KTOOLBARBUTTON_H 00024 #define _KTOOLBARBUTTON_H 00025 00026 #include <qpixmap.h> 00027 #include <qtoolbutton.h> 00028 #include <qintdict.h> 00029 #include <qstring.h> 00030 #include <kglobal.h> 00031 00032 class KToolBar; 00033 class KToolBarButtonPrivate; 00034 class KInstance; 00035 class QEvent; 00036 class QPopupMenu; 00037 class QPainter; 00038 00044 class KDEUI_EXPORT KToolBarButton : public QToolButton 00045 { 00046 Q_OBJECT 00047 00048 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: 00259 void clicked(int); 00266 void buttonClicked(int, Qt::ButtonState state); 00267 void doubleClicked(int); 00268 void pressed(int); 00269 void released(int); 00270 void toggled(int); 00271 void highlighted(int, bool); 00272 00273 public slots: 00279 void modeChange(); 00280 virtual void setTextLabel(const QString&, bool tipToo); 00281 00282 protected: 00283 void paletteChange(const QPalette &); 00284 void leaveEvent(QEvent *e); 00285 void enterEvent(QEvent *e); 00286 void drawButton(QPainter *p); 00287 bool eventFilter (QObject *o, QEvent *e); 00289 void mousePressEvent( QMouseEvent * ); 00291 void mouseReleaseEvent( QMouseEvent * ); 00292 void showMenu(); 00293 QSize sizeHint() const; 00294 QSize minimumSizeHint() const; 00295 QSize minimumSize() const; 00296 00298 bool isRaised() const; 00300 bool isActive() const; 00302 int iconTextMode() const; 00303 00304 protected slots: 00305 void slotClicked(); 00306 void slotPressed(); 00307 void slotReleased(); 00308 void slotToggled(); 00309 void slotDelayTimeout(); 00310 00311 protected: 00312 virtual void virtual_hook( int id, void* data ); 00313 private: 00314 KToolBarButtonPrivate *d; 00315 }; 00316 00322 class KDEUI_EXPORT KToolBarButtonList : public QIntDict<KToolBarButton> 00323 { 00324 public: 00325 KToolBarButtonList(); 00326 ~KToolBarButtonList() {} 00327 }; 00328 00329 #endif
KDE Logo
This file is part of the documentation for kdeui Library Version 3.4.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Thu Apr 14 00:10:17 2005 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003