KDEUI
kpushbutton.h
Go to the documentation of this file.
00001 /* This file is part of the KDE libraries 00002 Copyright (C) 2000 Carsten Pfeiffer <pfeiffer@kde.org> 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License as published by the Free Software Foundation; either 00007 version 2 of the License, or (at your option) any later version. 00008 00009 This library is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 Library General Public License for more details. 00013 00014 You should have received a copy of the GNU Library General Public License 00015 along with this library; see the file COPYING.LIB. If not, write to 00016 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00017 Boston, MA 02110-1301, USA. 00018 */ 00019 00020 #ifndef KPUSHBUTTON_H 00021 #define KPUSHBUTTON_H 00022 00023 #include <QtGui/QPushButton> 00024 00025 #include <kstandardguiitem.h> 00026 00027 class QDrag; 00028 class QMenu; 00029 class KIcon; 00030 00031 namespace KAuth { 00032 class Action; 00033 } 00034 00046 class KDEUI_EXPORT KPushButton : public QPushButton 00047 { 00048 Q_OBJECT 00049 Q_PROPERTY(bool isDragEnabled READ isDragEnabled WRITE setDragEnabled) 00050 00051 public: 00052 00056 explicit KPushButton( QWidget *parent = 0 ); 00057 00061 explicit KPushButton( const QString &text, QWidget *parent = 0 ); 00062 00066 KPushButton( const KIcon &icon, const QString &text, QWidget *parent = 0 ); 00067 00072 explicit KPushButton( const KGuiItem &item, QWidget *parent = 0 ); 00073 00077 ~KPushButton(); 00078 00082 void setDragEnabled( bool enable ); 00083 00087 bool isDragEnabled() const; 00088 00092 void setGuiItem( const KGuiItem& item ); 00093 00097 void setGuiItem( KStandardGuiItem::StandardItem item ); 00098 00102 KStandardGuiItem::StandardItem guiItem() const; 00103 00108 void setIcon( const KIcon &icon ); 00109 00115 #ifndef KDE_NO_DEPRECATED 00116 KDE_DEPRECATED void setIcon( const QIcon &pix ); 00117 #endif 00118 00122 void setText( const QString &text ); 00123 00128 void setDelayedMenu(QMenu *delayed_menu); 00129 00134 QMenu *delayedMenu(); 00135 00140 virtual QSize sizeHint() const; 00141 00147 KAuth::Action *authAction() const; 00148 00159 void setAuthAction(KAuth::Action *action); 00160 00168 void setAuthAction(const QString &actionName); 00169 00170 protected: 00177 virtual QDrag * dragObject(); 00178 00182 virtual void mousePressEvent( QMouseEvent * ); 00186 virtual void mouseMoveEvent( QMouseEvent * ); 00187 00192 virtual void paintEvent( QPaintEvent * ); 00193 00197 virtual void startDrag(); 00198 00199 Q_SIGNALS: 00215 void authorized(KAuth::Action *action); 00216 00217 private: 00222 void init( const KGuiItem &item ); 00223 00224 private: 00225 class KPushButtonPrivate; 00226 KPushButtonPrivate * const d; 00227 00228 Q_PRIVATE_SLOT(d, void slotSettingsChanged( int )) 00229 Q_PRIVATE_SLOT(d, void slotPressedInternal()) 00230 Q_PRIVATE_SLOT(d, void slotClickedInternal()) 00231 Q_PRIVATE_SLOT(d, void slotDelayedMenuTimeout()) 00232 Q_PRIVATE_SLOT(d, void authStatusChanged(int)) 00233 }; 00234 00235 #endif // KPUSHBUTTON_H
KDE 4.6 API Reference