tdetoolbarbutton.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., 51 Franklin Street, Fifth Floor, 00020 Boston, MA 02110-1301, USA. 00021 */ 00022 00023 #ifndef _TDETOOLBARBUTTON_H 00024 #define _TDETOOLBARBUTTON_H 00025 00026 #include <tqpixmap.h> 00027 #include <tqtoolbutton.h> 00028 #include <tqintdict.h> 00029 #include <tqstring.h> 00030 #include <tdeglobal.h> 00031 00032 class TDEToolBar; 00033 class TDEToolBarButtonPrivate; 00034 class TDEInstance; 00035 class TQEvent; 00036 class TQPopupMenu; 00037 class TQPainter; 00038 00044 class TDEUI_EXPORT TDEToolBarButton : public TQToolButton 00045 { 00046 Q_OBJECT 00047 00048 00049 public: 00062 TDEToolBarButton(const TQString& icon, int id, TQWidget *parent, 00063 const char *name=0L, const TQString &txt=TQString::null, 00064 TDEInstance *_instance = TDEGlobal::instance()); 00065 00077 TDEToolBarButton(const TQPixmap& pixmap, int id, TQWidget *parent, 00078 const char *name=0L, const TQString &txt=TQString::null); 00079 00086 TDEToolBarButton(TQWidget *parent=0L, const char *name=0L); 00087 00091 ~TDEToolBarButton(); 00092 00093 #ifndef KDE_NO_COMPAT 00094 00103 // this one is from TQButton, so #ifdef-ing it out doesn't break BC 00104 virtual void setPixmap(const TQPixmap &pixmap) KDE_DEPRECATED; 00105 00113 void setDefaultPixmap(const TQPixmap& pixmap) KDE_DEPRECATED; 00114 00122 void setDisabledPixmap(const TQPixmap& pixmap) KDE_DEPRECATED; 00123 #endif 00124 00131 virtual void setText(const TQString &text); 00132 00139 virtual void setIcon(const TQString &icon); 00140 00142 virtual void setIcon( const TQPixmap &pixmap ) 00143 { TQToolButton::setIcon( pixmap ); } 00144 00151 virtual void setIconSet( const TQIconSet &iconset ); 00152 00153 #ifndef KDE_NO_COMPAT 00154 00165 KDE_DEPRECATED void setIcon(const TQString &icon, bool generate ) { Q_UNUSED(generate); setIcon( icon ); } 00166 00174 void setDefaultIcon(const TQString& icon) KDE_DEPRECATED; 00175 00183 void setDisabledIcon(const TQString& icon) KDE_DEPRECATED; 00184 #endif 00185 00191 void on(bool flag = true); 00192 00196 void toggle(); 00197 00205 void setToggle(bool toggle = true); 00206 00210 TQPopupMenu *popup(); 00211 00216 int id() const; 00217 00226 void setPopup (TQPopupMenu *p, bool unused = false); 00227 00238 void setDelayedPopup(TQPopupMenu *p, bool unused = false); 00239 00245 void setRadio(bool f = true); 00246 00254 void setNoStyle(bool no_style = true); 00255 00256 signals: 00260 void clicked(int); 00267 void buttonClicked(int, TQt::ButtonState state); 00268 void doubleClicked(int); 00269 void pressed(int); 00270 void released(int); 00271 void toggled(int); 00272 void highlighted(int, bool); 00273 00274 public slots: 00280 void modeChange(); 00281 virtual void setTextLabel(const TQString&, bool tipToo); 00282 00283 protected: 00284 bool event(TQEvent *e); 00285 void paletteChange(const TQPalette &); 00286 void leaveEvent(TQEvent *e); 00287 void enterEvent(TQEvent *e); 00288 void drawButton(TQPainter *p); 00289 bool eventFilter (TQObject *o, TQEvent *e); 00291 void mousePressEvent( TQMouseEvent * ); 00293 void mouseReleaseEvent( TQMouseEvent * ); 00294 void showMenu(); 00295 TQSize sizeHint() const; 00296 TQSize minimumSizeHint() const; 00297 TQSize minimumSize() const; 00298 00300 bool isRaised() const; 00302 bool isActive() const; 00304 int iconTextMode() const; 00305 00306 protected slots: 00307 void slotClicked(); 00308 void slotPressed(); 00309 void slotReleased(); 00310 void slotToggled(); 00311 void slotDelayTimeout(); 00312 00313 protected: 00314 virtual void virtual_hook( int id, void* data ); 00315 private: 00316 TDEToolBarButtonPrivate *d; 00317 }; 00318 00324 class TDEUI_EXPORT TDEToolBarButtonList : public TQIntDict<TDEToolBarButton> 00325 { 00326 public: 00327 TDEToolBarButtonList(); 00328 ~TDEToolBarButtonList() {} 00329 }; 00330 00331 #endif