| # kdeui Library API Documentation
Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Source Files

# kaction.h

    00001 /* This file is part of the KDE libraries
    00002     Copyright (C) 1999 Reginald Stadlbauer <reggie@kde.org>
    00003               (C) 1999 Simon Hausmann <hausmann@kde.org>
    00004               (C) 2000 Nicolas Hadacek <haadcek@kde.org>
    00005               (C) 2000 Kurt Granroth <granroth@kde.org>
    00006               (C) 2000 Michael Koch <koch@kde.org>
    00007               (C) 2001 Holger Freyther <freyther@kde.org>
    00008               (C) 2002 Ellis Whitehead <ellis@kde.org>
    00009
    00010     This library is free software; you can redistribute it and/or
    00011     modify it under the terms of the GNU Library General Public
    00012     License version 2 as published by the Free Software Foundation.
    00013
    00014     This library is distributed in the hope that it will be useful,
    00015     but WITHOUT ANY WARRANTY; without even the implied warranty of
    00016     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00017     Library General Public License for more details.
    00018
    00019     You should have received a copy of the GNU Library General Public License
    00020     along with this library; see the file COPYING.LIB.  If not, write to
    00021     the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    00022     Boston, MA 02111-1307, USA.
    00023 */
    00024 //$Id: kaction.h,v 1.167.2.1 2002/12/09 23:28:37 faure Exp $
    00025
    00026 #ifndef __kaction_h__
    00027 #define __kaction_h__
    00028
    00029 #include <qkeysequence.h>
    00030 #include <qobject.h>
    00031 #include <qvaluelist.h>
    00032 #include <qguardedptr.h>
    00033 #include <kguiitem.h>
    00034 #include <kshortcut.h>
    00035 #include <kstdaction.h>
    00036 #include <kicontheme.h>
    00037
    00038 class QMenuBar;
    00039 class QPopupMenu;
    00040 class QComboBox;
    00041 class QPoint;
    00042 class QIconSet;
    00043 class QString;
    00044 class KToolBar;
    00045
    00046 class KAccel;
    00047 class KAccelActions;
    00048 class KConfig;
    00049 class KConfigBase;
    00050 class KURL;
    00051 class KInstance;
    00052 class KToolBar;
    00053 class KActionCollection;
    00054 class KPopupMenu;
    00055 class KMainWindow;
    00056
    00191 class KAction : public QObject
    00192 {
    00193   friend class KActionCollection;
    00194   Q_OBJECT
    00195   Q_PROPERTY( int containerCount READ containerCount )
    00196   Q_PROPERTY( QString plainText READ plainText )
    00197   Q_PROPERTY( QString text READ text WRITE setText )
    00198   Q_PROPERTY( QString shortcut READ shortcutText WRITE setShortcutText )
    00199   Q_PROPERTY( bool enabled READ isEnabled WRITE setEnabled )
    00200   Q_PROPERTY( QString group READ group WRITE setGroup )
    00201   Q_PROPERTY( QString whatsThis READ whatsThis WRITE setWhatsThis )
    00202   Q_PROPERTY( QString toolTip READ toolTip WRITE setToolTip )
    00203   Q_PROPERTY( QString icon READ icon WRITE setIcon )
    00204 public:
    00225     KAction( const QString& text, const KShortcut& cut,
    00226              const QObject* receiver, const char* slot,
    00227              KActionCollection* parent, const char* name );
    00228
    00248     KAction( const QString& text, const QIconSet& pix, const KShortcut& cut,
    00249              const QObject* receiver, const char* slot,
    00250              KActionCollection* parent, const char* name );
    00251
    00272     KAction( const QString& text, const QString& pix, const KShortcut& cut,
    00273              const QObject* receiver, const char* slot,
    00274              KActionCollection* parent, const char* name );
    00275
    00282     KAction( const KGuiItem& item, const KShortcut& cut,
    00283              const QObject* receiver, const char* slot,
    00284              KActionCollection* parent, const char* name );
    00285
    00289         KAction( const QString& text, const KShortcut& cut = KShortcut(), QObject* parent = 0, const char* name = 0 );
    00293         KAction( const QString& text, const KShortcut& cut,
    00294                 const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 );
    00298         KAction( const QString& text, const QIconSet& pix, const KShortcut& cut = KShortcut(),
    00299                 QObject* parent = 0, const char* name = 0 );
    00303         KAction( const QString& text, const QString& pix, const KShortcut& cut = KShortcut(),
    00304                 QObject* parent = 0, const char* name = 0 );
    00308         KAction( const QString& text, const QIconSet& pix, const KShortcut& cut,
    00309                 const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 );
    00313         KAction( const QString& text, const QString& pix, const KShortcut& cut,
    00314                 const QObject* receiver, const char* slot, QObject* parent,
    00315                 const char* name = 0 );
    00319         KAction( QObject* parent = 0, const char* name = 0 );
    00320
    00324     virtual ~KAction();
    00325
    00337     virtual int plug( QWidget *w, int index = -1 );
    00338
    00349     virtual void plugAccel(KAccel *accel, bool configurable = true);
    00350
    00363     virtual void unplug( QWidget *w );
    00364
    00369     virtual void unplugAccel();
    00370
    00375     virtual bool isPlugged() const;
    00376
    00380     bool isPlugged( const QWidget *container ) const;
    00381
    00386     virtual bool isPlugged( const QWidget *container, int id ) const;
    00387
    00392     virtual bool isPlugged( const QWidget *container, const QWidget *_representative ) const;
    00393
    00394     QWidget* container( int index ) const;
    00395     int itemId( int index ) const;
    00396     QWidget* representative( int index ) const;
    00397     int containerCount() const;
    00399     uint kaccelCount() const;
    00400
    00401     virtual bool hasIcon() const;
    00402 #ifndef KDE_NO_COMPAT
    00403     bool hasIconSet() const { return hasIcon(); }
    00404 #endif
    00405     virtual QString plainText() const;
    00406
    00410     virtual QString text() const;
    00411
    00415     virtual const KShortcut& shortcut() const;
    00419     virtual const KShortcut& shortcutDefault() const;
    00420
    00421     // These two methods are for Q_PROPERTY
    00422     QString shortcutText() const;
    00423     void setShortcutText( const QString& );
    00424
    00428     virtual bool isEnabled() const;
    00429
    00433     virtual bool isShortcutConfigurable() const;
    00434
    00435     virtual QString group() const;
    00436
    00440     virtual QString whatsThis() const;
    00441
    00445     virtual QString toolTip() const;
    00446
    00451     virtual QIconSet iconSet( KIcon::Group group, int size=0 ) const;
    00452 #ifndef KDE_NO_COMPAT
    00453     QIconSet iconSet() const { return iconSet( KIcon::Small ); }
    00454 #endif
    00455
    00456     virtual QString icon() const;
    00457
    00458     KActionCollection *parentCollection() const;
    00459
    00464     static int getToolButtonID();
    00465
    00466
    00467     void unplugAll();
    00468
    00469 public slots:
    00474     virtual void setText(const QString &text);
    00475
    00479     virtual bool setShortcut( const KShortcut& );
    00480
    00481     virtual void setGroup( const QString& );
    00482
    00490     virtual void setWhatsThis( const QString& text );
    00491
    00498     virtual void setToolTip( const QString& );
    00499
    00504     virtual void setIconSet( const QIconSet &iconSet );
    00505
    00506     virtual void setIcon( const QString& icon );
    00507
    00512     virtual void setEnabled(bool enable);
    00513
    00517     virtual void setShortcutConfigurable( bool );
    00518
    00523     virtual void activate();
    00524
    00525 protected slots:
    00526     virtual void slotDestroyed();
    00527     virtual void slotKeycodeChanged();
    00528     virtual void slotActivated();
    00529
    00530 protected:
    00531     KToolBar* toolBar( int index ) const;
    00532     QPopupMenu* popupMenu( int index ) const;
    00533     void removeContainer( int index );
    00534     int findContainer( const QWidget* widget ) const;
    00535     void plugMainWindowAccel( QWidget *w );
    00536
    00537     void addContainer( QWidget* parent, int id );
    00538     void addContainer( QWidget* parent, QWidget* representative );
    00539
    00540     virtual void updateShortcut( int i );
    00541     virtual void updateShortcut( QPopupMenu* menu, int id );
    00542     virtual void updateGroup( int id );
    00543     virtual void updateText(int i );
    00544     virtual void updateEnabled(int i);
    00545     virtual void updateIconSet(int i);
    00546     virtual void updateIcon( int i);
    00547     virtual void updateToolTip( int id );
    00548     virtual void updateWhatsThis( int i );
    00549
    00550     KActionCollection *m_parentCollection;
    00551     QString whatsThisWithIcon() const;
    00552
    00553 signals:
    00554     void activated();
    00555     void enabled( bool );
    00556
    00557 private:
    00558     void initPrivate( const QString& text, const KShortcut& cut,
    00559                   const QObject* receiver, const char* slot );
    00560     KAccel* kaccelCurrent();
    00561     bool initShortcut( const KShortcut& );
    00562     void plugShortcut();
    00563     bool updateKAccelShortcut( KAccel* kaccel );
    00564     void insertKAccel( KAccel* );
    00566     void removeKAccel( KAccel* );
    00567
    00568 #ifndef KDE_NO_COMPAT
    00569 public:
    00574     int accel() const;
    00575
    00576     QString statusText() const
    00577         { return toolTip(); }
    00578
    00583     void setAccel( int key );
    00584
    00588     void setStatusText( const QString &text )
    00589          { setToolTip( text ); }
    00590
    00594     int menuId( int i ) { return itemId( i ); }
    00595 #endif // !KDE_NO_COMPAT
    00596
    00597 protected:
    00598     virtual void virtual_hook( int id, void* data );
    00599 private:
    00600     class KActionPrivate;
    00601     KActionPrivate *d;
    00602 };
    00603
    00611 class KToggleAction : public KAction
    00612 {
    00613     Q_OBJECT
    00614     Q_PROPERTY( bool checked READ isChecked WRITE setChecked )
    00615     Q_PROPERTY( QString exclusiveGroup READ exclusiveGroup WRITE setExclusiveGroup )
    00616 public:
    00617
    00628     KToggleAction( const QString& text, const KShortcut& cut = KShortcut(), QObject* parent = 0, const char* name = 0 );
    00629
    00638     KToggleAction( const QString& text, const KShortcut& cut,
    00639                    const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 );
    00640
    00648     KToggleAction( const QString& text, const QIconSet& pix, const KShortcut& cut = KShortcut(),
    00649              QObject* parent = 0, const char* name = 0 );
    00650
    00658     KToggleAction( const QString& text, const QString& pix, const KShortcut& cut = KShortcut(),
    00659                    QObject* parent = 0, const char* name = 0 );
    00660
    00670     KToggleAction( const QString& text, const QIconSet& pix, const KShortcut& cut,
    00671                    const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 );
    00672
    00682     KToggleAction( const QString& text, const QString& pix, const KShortcut& cut,
    00683                    const QObject* receiver, const char* slot,
    00684                    QObject* parent, const char* name = 0 );
    00685
    00690     KToggleAction( QObject* parent = 0, const char* name = 0 );
    00691
    00695     virtual ~KToggleAction();
    00696
    00708     virtual int plug( QWidget* widget, int index = -1 );
    00709
    00713     bool isChecked() const;
    00714
    00719     QString exclusiveGroup() const;
    00720
    00727     virtual void setExclusiveGroup( const QString& name );
    00728
    00729 public slots:
    00733     virtual void setChecked( bool );
    00734
    00735 protected slots:
    00736     virtual void slotActivated();
    00737
    00738 protected:
    00739     virtual void updateChecked( int id );
    00740
    00741 signals:
    00742     void toggled( bool );
    00743
    00744 protected:
    00745     virtual void virtual_hook( int id, void* data );
    00746 private:
    00747     class KToggleActionPrivate;
    00748     KToggleActionPrivate *d;
    00749 };
    00750
    00755 class KRadioAction : public KToggleAction
    00756 {
    00757   Q_OBJECT
    00758 public:
    00769     KRadioAction( const QString& text, const KShortcut& cut = KShortcut(), QObject* parent = 0, const char* name = 0 );
    00770
    00779     KRadioAction( const QString& text, const KShortcut& cut,
    00780                   const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 );
    00781
    00789     KRadioAction( const QString& text, const QIconSet& pix, const KShortcut& cut = KShortcut(),
    00790                   QObject* parent = 0, const char* name = 0 );
    00791
    00799     KRadioAction( const QString& text, const QString& pix, const KShortcut& cut = KShortcut(),
    00800                   QObject* parent = 0, const char* name = 0 );
    00801
    00811     KRadioAction( const QString& text, const QIconSet& pix, const KShortcut& cut,
    00812                   const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 );
    00813
    00823     KRadioAction( const QString& text, const QString& pix, const KShortcut& cut,
    00824                   const QObject* receiver, const char* slot,
    00825                   QObject* parent, const char* name = 0 );
    00826
    00831     KRadioAction( QObject* parent = 0, const char* name = 0 );
    00832
    00833 protected:
    00834     virtual void slotActivated();
    00835
    00836 protected:
    00837     virtual void virtual_hook( int id, void* data );
    00838 private:
    00839     class KRadioActionPrivate;
    00840     KRadioActionPrivate *d;
    00841 };
    00842
    00854 class KSelectAction : public KAction
    00855 {
    00856     Q_OBJECT
    00857     Q_PROPERTY( int currentItem READ currentItem WRITE setCurrentItem )
    00858     Q_PROPERTY( QStringList items READ items WRITE setItems )
    00859     Q_PROPERTY( bool editable READ isEditable WRITE setEditable )
    00860     Q_PROPERTY( int comboWidth READ comboWidth WRITE setComboWidth )
    00861     Q_PROPERTY( QString currentText READ currentText )
    00862     Q_PROPERTY( bool menuAccelsEnabled READ menuAccelsEnabled WRITE setMenuAccelsEnabled )
    00863 public:
    00864
    00875     KSelectAction( const QString& text, const KShortcut& cut = KShortcut(), QObject* parent = 0, const char* name = 0 );
    00876
    00885     KSelectAction( const QString& text, const KShortcut& cut,
    00886                    const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 );
    00887
    00895     KSelectAction( const QString& text, const QIconSet& pix, const KShortcut& cut = KShortcut(),
    00896              QObject* parent = 0, const char* name = 0 );
    00897
    00905     KSelectAction( const QString& text, const QString& pix, const KShortcut& cut = KShortcut(),
    00906                    QObject* parent = 0, const char* name = 0 );
    00907
    00917     KSelectAction( const QString& text, const QIconSet& pix, const KShortcut& cut,
    00918                    const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 );
    00919
    00929     KSelectAction( const QString& text, const QString& pix, const KShortcut& cut,
    00930                    const QObject* receiver, const char* slot,
    00931                    QObject* parent, const char* name = 0 );
    00932
    00937     KSelectAction( QObject* parent = 0, const char* name = 0 );
    00938
    00942     virtual ~KSelectAction();
    00943
    00955     virtual int plug( QWidget* widget, int index = -1 );
    00956
    00961     virtual bool isEditable() const;
    00962
    00967     virtual QStringList items() const;
    00968
    00969     virtual void changeItem( int index, const QString& text );
    00970
    00971     virtual QString currentText() const;
    00972
    00973     virtual int currentItem() const;
    00974
    00979     virtual int comboWidth() const;
    00980
    00981     QPopupMenu* popupMenu() const;
    00982
    00987     void setRemoveAmpersandsInCombo( bool b );
    00989     bool removeAmpersandsInCombo() const;
    00990
    00997     void setMenuAccelsEnabled( bool b );
    00999     bool menuAccelsEnabled() const;
    01000
    01001 public slots:
    01007     virtual void setCurrentItem( int index );
    01008
    01013     virtual void setItems( const QStringList &lst );
    01014
    01018     virtual void clear();
    01019
    01024     virtual void setEditable( bool );
    01025
    01031     virtual void setComboWidth( int width );
    01032
    01033 protected:
    01034     virtual void changeItem( int id, int index, const QString& text );
    01035
    01042     QStringList comboItems() const;
    01043
    01044 protected slots:
    01045     virtual void slotActivated( int id );
    01046     virtual void slotActivated( const QString &text );
    01047     virtual void slotActivated();
    01048
    01049 signals:
    01050     void activated( int index );
    01051     void activated( const QString& text );
    01052
    01053 protected:
    01054     virtual void updateCurrentItem( int id );
    01055
    01056     virtual void updateComboWidth( int id );
    01057
    01058     virtual void updateItems( int id );
    01059
    01060     virtual void updateClear( int id );
    01061
    01062 protected:
    01063     virtual void virtual_hook( int id, void* data );
    01064 private:
    01065     class KSelectActionPrivate;
    01066     KSelectActionPrivate *d;
    01067
    01068 };
    01069
    01071
    01074 class KListAction : public KSelectAction
    01075 {
    01076     Q_OBJECT
    01077 public:
    01088     KListAction( const QString& text, const KShortcut& cut = KShortcut(), QObject* parent = 0,
    01089                   const char* name = 0 );
    01090
    01099     KListAction( const QString& text, const KShortcut& cut, const QObject* receiver,
    01100                   const char* slot, QObject* parent, const char* name = 0 );
    01101
    01109     KListAction( const QString& text, const QIconSet& pix, const KShortcut& cut = KShortcut(),
    01110                       QObject* parent = 0, const char* name = 0 );
    01111
    01119     KListAction( const QString& text, const QString& pix, const KShortcut& cut = KShortcut(),
    01120                       QObject* parent = 0, const char* name = 0 );
    01121
    01131     KListAction( const QString& text, const QIconSet& pix, const KShortcut& cut,
    01132                           const QObject* receiver, const char* slot, QObject* parent,
    01133                   const char* name = 0 );
    01134
    01144     KListAction( const QString& text, const QString& pix, const KShortcut& cut,
    01145                  const QObject* receiver, const char* slot, QObject* parent,
    01146                  const char* name = 0 );
    01147
    01152     KListAction( QObject* parent = 0, const char* name = 0 );
    01153
    01157     virtual ~KListAction();
    01158
    01159
    01160     virtual QString currentText() const;
    01161     virtual int currentItem() const;
    01162
    01163
    01164 public slots:
    01170     virtual void setCurrentItem( int index );
    01171
    01172 protected:
    01173     virtual void virtual_hook( int id, void* data );
    01174 private:
    01175     class KListActionPrivate;
    01176     KListActionPrivate *d;
    01177 };
    01178
    01188 class KRecentFilesAction : public KListAction  // TODO public KSelectAction
    01189 {
    01190   Q_OBJECT
    01191   Q_PROPERTY( uint maxItems READ maxItems WRITE setMaxItems )
    01192 public:
    01200   KRecentFilesAction( const QString& text, const KShortcut& cut,
    01201                       QObject* parent, const char* name = 0,
    01202                       uint maxItems = 10 );
    01203
    01214   KRecentFilesAction( const QString& text, const KShortcut& cut,
    01215                       const QObject* receiver, const char* slot,
    01216                       QObject* parent, const char* name = 0,
    01217                       uint maxItems = 10 );
    01218
    01227   KRecentFilesAction( const QString& text, const QIconSet& pix, const KShortcut& cut,
    01228                       QObject* parent, const char* name = 0,
    01229                       uint maxItems = 10 );
    01230
    01239   KRecentFilesAction( const QString& text, const QString& pix, const KShortcut& cut,
    01240                       QObject* parent, const char* name = 0,
    01241                       uint maxItems = 10 );
    01242
    01254   KRecentFilesAction( const QString& text, const QIconSet& pix, const KShortcut& cut,
    01255                       const QObject* receiver, const char* slot,
    01256                       QObject* parent, const char* name = 0,
    01257                       uint maxItems = 10 );
    01258
    01270   KRecentFilesAction( const QString& text, const QString& pix, const KShortcut& cut,
    01271                       const QObject* receiver, const char* slot,
    01272                       QObject* parent, const char* name = 0,
    01273                       uint maxItems = 10 );
    01274
    01280   KRecentFilesAction( QObject* parent = 0, const char* name = 0,
    01281                       uint maxItems = 10 );
    01282
    01286   virtual ~KRecentFilesAction();
    01287
    01291   uint maxItems() const;
    01292
    01293 public slots:
    01302   void setMaxItems( uint maxItems );
    01303
    01311   void loadEntries( KConfig* config, QString groupname=QString::null );
    01312
    01320   void saveEntries( KConfig* config, QString groupname=QString::null );
    01321
    01322 public slots:
    01328   void addURL( const KURL& url );
    01329
    01335   void removeURL( const KURL& url );
    01336
    01340   void clearURLList();
    01341
    01342 signals:
    01343
    01349   void urlSelected( const KURL& url );
    01350
    01351 protected slots:
    01355   void itemSelected( const QString& string );
    01356
    01357 protected:
    01358   virtual void virtual_hook( int id, void* data );
    01359 private:
    01360   void init();
    01361
    01362   class KRecentFilesActionPrivate;
    01363   KRecentFilesActionPrivate *d;
    01364 };
    01365
    01366 class KFontAction : public KSelectAction
    01367 {
    01368     Q_OBJECT
    01369     Q_PROPERTY( QString font READ font WRITE setFont )
    01370 public:
    01371     KFontAction( const QString& text, const KShortcut& cut = KShortcut(), QObject* parent = 0,
    01372                  const char* name = 0 );
    01373     KFontAction( const QString& text, const KShortcut& cut,
    01374                  const QObject* receiver, const char* slot, QObject* parent,
    01375                  const char* name = 0 );
    01376     KFontAction( const QString& text, const QIconSet& pix, const KShortcut& cut = KShortcut(),
    01377                  QObject* parent = 0, const char* name = 0 );
    01378     KFontAction( const QString& text, const QString& pix, const KShortcut& cut = KShortcut(),
    01379                  QObject* parent = 0, const char* name = 0 );
    01380     KFontAction( const QString& text, const QIconSet& pix, const KShortcut& cut,
    01381                  const QObject* receiver, const char* slot, QObject* parent,
    01382                  const char* name = 0 );
    01383     KFontAction( const QString& text, const QString& pix, const KShortcut& cut,
    01384                  const QObject* receiver, const char* slot, QObject* parent,
    01385                  const char* name = 0 );
    01386
    01387     KFontAction( QObject* parent = 0, const char* name = 0 );
    01388     ~KFontAction();
    01389
    01390     QString font() const {
    01391         return currentText();
    01392     }
    01393
    01394     int plug( QWidget*, int index = -1 );
    01395
    01396 public slots:
    01397     void setFont( const QString &family );
    01398
    01399 protected:
    01400     virtual void virtual_hook( int id, void* data );
    01401 private:
    01402     class KFontActionPrivate;
    01403     KFontActionPrivate *d;
    01404 };
    01405
    01406 class KFontSizeAction : public KSelectAction
    01407 {
    01408     Q_OBJECT
    01409     Q_PROPERTY( int fontSize READ fontSize WRITE setFontSize )
    01410 public:
    01411     KFontSizeAction( const QString& text, const KShortcut& cut = KShortcut(), QObject* parent = 0,
    01412                      const char* name = 0 );
    01413     KFontSizeAction( const QString& text, const KShortcut& cut, const QObject* receiver,
    01414                      const char* slot, QObject* parent, const char* name = 0 );
    01415     KFontSizeAction( const QString& text, const QIconSet& pix, const KShortcut& cut = KShortcut(),
    01416                      QObject* parent = 0, const char* name = 0 );
    01417     KFontSizeAction( const QString& text, const QString& pix, const KShortcut& cut = KShortcut(),
    01418                      QObject* parent = 0, const char* name = 0 );
    01419     KFontSizeAction( const QString& text, const QIconSet& pix, const KShortcut& cut,
    01420                      const QObject* receiver, const char* slot,
    01421                      QObject* parent, const char* name = 0 );
    01422     KFontSizeAction( const QString& text, const QString& pix, const KShortcut& cut,
    01423                      const QObject* receiver, const char* slot,
    01424                      QObject* parent, const char* name = 0 );
    01425     KFontSizeAction( QObject* parent = 0, const char* name = 0 );
    01426
    01427     virtual ~KFontSizeAction();
    01428
    01429     virtual int fontSize() const;
    01430
    01431 public slots:
    01432     virtual void setFontSize( int size );
    01433
    01434 protected slots:
    01435     virtual void slotActivated( int );
    01436     virtual void slotActivated( const QString& );
    01437     virtual void slotActivated() { KAction::slotActivated(); }
    01438
    01439 signals:
    01440     void fontSizeChanged( int );
    01441
    01442 private:
    01443     void init();
    01444
    01445
    01446 protected:
    01447     virtual void virtual_hook( int id, void* data );
    01448 private:
    01449     class KFontSizeActionPrivate;
    01450     KFontSizeActionPrivate *d;
    01451 };
    01452
    01453
    01464 class KActionMenu : public KAction
    01465 {
    01466   Q_OBJECT
    01467   Q_PROPERTY( bool delayed READ delayed WRITE setDelayed )
    01468   Q_PROPERTY( bool stickyMenu READ stickyMenu WRITE setStickyMenu )
    01469
    01470 public:
    01471     KActionMenu( const QString& text, QObject* parent = 0,
    01472                  const char* name = 0 );
    01473     KActionMenu( const QString& text, const QIconSet& icon,
    01474                  QObject* parent = 0, const char* name = 0 );
    01475     KActionMenu( const QString& text, const QString& icon,
    01476                  QObject* parent = 0, const char* name = 0 );
    01477     KActionMenu( QObject* parent = 0, const char* name = 0 );
    01478     virtual ~KActionMenu();
    01479
    01480     virtual void insert( KAction*, int index = -1 );
    01481     virtual void remove( KAction* );
    01482
    01483     KPopupMenu* popupMenu() const;
    01484     void popup( const QPoint& global );
    01485
    01490     bool delayed() const;
    01504     void setDelayed(bool _delayed);
    01505
    01510     bool stickyMenu() const;
    01519     void setStickyMenu(bool sticky);
    01520
    01521     virtual int plug( QWidget* widget, int index = -1 );
    01522
    01523 protected:
    01524     virtual void virtual_hook( int id, void* data );
    01525 private:
    01526     class KActionMenuPrivate;
    01527     KActionMenuPrivate *d;
    01528 };
    01529
    01537 class KToolBarPopupAction : public KAction
    01538 {
    01539   Q_OBJECT
    01540   Q_PROPERTY( bool delayed READ delayed WRITE setDelayed )
    01541   Q_PROPERTY( bool stickyMenu READ stickyMenu WRITE setStickyMenu )
    01542
    01543 public:
    01544     //Not all constructors - because we need an icon, since this action only makes
    01545     // sense when being plugged at least in a toolbar.
    01556     KToolBarPopupAction( const QString& text, const QString& icon, const KShortcut& cut = KShortcut(),
    01557                          QObject* parent = 0, const char* name = 0 );
    01558
    01574     KToolBarPopupAction( const QString& text, const QString& icon, const KShortcut& cut,
    01575                          const QObject* receiver, const char* slot,
    01576                          QObject* parent = 0, const char* name = 0 );
    01577
    01593     KToolBarPopupAction( const KGuiItem& item, const KShortcut& cut,
    01594                          const QObject* receiver, const char* slot,
    01595                          KActionCollection* parent, const char* name );
    01596
    01597     virtual ~KToolBarPopupAction();
    01598
    01599     virtual int plug( QWidget *widget, int index = -1 );
    01600
    01606     KPopupMenu *popupMenu() const;
    01607
    01612     bool delayed() const;
    01618     void setDelayed(bool delayed);
    01623     bool stickyMenu() const;
    01633     void setStickyMenu(bool sticky);
    01634
    01635 private:
    01636     KPopupMenu *m_popup;
    01637     bool m_delayed:1;
    01638     bool m_stickyMenu:1;
    01639 protected:
    01640     virtual void virtual_hook( int id, void* data );
    01641 private:
    01642     class KToolBarPopupActionPrivate;
    01643     KToolBarPopupActionPrivate *d;
    01644 };
    01645
    01659 class KToggleToolBarAction : public KToggleAction
    01660 {
    01661     Q_OBJECT
    01662 public:
    01669     KToggleToolBarAction( const char* toolBarName, const QString& text,
    01670                           KActionCollection* parent, const char* name );
    01671     KToggleToolBarAction( KToolBar *toolBar, const QString &text,
    01672                           KActionCollection *parent, const char *name );
    01673     virtual ~KToggleToolBarAction();
    01674
    01675     virtual int plug( QWidget*, int index = -1 );
    01676
    01677     KToolBar *toolBar() { return m_toolBar; }
    01678
    01679 public slots:
    01680     virtual void setChecked( bool );
    01681
    01682 private:
    01683     QCString               m_toolBarName;
    01684     QGuardedPtr<KToolBar>  m_toolBar;
    01685 protected:
    01686     virtual void virtual_hook( int id, void* data );
    01687 private:
    01688     class KToggleToolBarActionPrivate;
    01689     KToggleToolBarActionPrivate *d;
    01690 };
    01691
    01696 class KWidgetAction : public KAction
    01697 {
    01698     Q_OBJECT
    01699 public:
    01705     KWidgetAction( QWidget* widget, const QString& text,
    01706                    const KShortcut& cut,
    01707                    const QObject* receiver, const char* slot,
    01708                    KActionCollection* parent, const char* name );
    01709     virtual ~KWidgetAction();
    01710
    01714     QWidget* widget() { return m_widget; }
    01715
    01716     void setAutoSized( bool );
    01717
    01722     virtual int plug( QWidget* w, int index = -1 );
    01727     virtual void unplug( QWidget *w );
    01728 protected slots:
    01729     void slotToolbarDestroyed();
    01730 private:
    01731     QGuardedPtr<QWidget> m_widget;
    01732     bool                 m_autoSized;
    01733 protected:
    01734     virtual void virtual_hook( int id, void* data );
    01735 private:
    01736     class KWidgetActionPrivate;
    01737     KWidgetActionPrivate *d;
    01738 };
    01739
    01740 class KActionSeparator : public KAction
    01741 {
    01742     Q_OBJECT
    01743 public:
    01744     KActionSeparator( QObject* parent = 0, const char* name = 0 );
    01745     virtual ~KActionSeparator();
    01746
    01747     virtual int plug( QWidget*, int index = -1 );
    01748
    01749 protected:
    01750     virtual void virtual_hook( int id, void* data );
    01751 private:
    01752     class KActionSeparatorPrivate;
    01753     KActionSeparatorPrivate *d;
    01754 };
    01755
    01756 typedef QValueList<KAction *> KActionPtrList;
    01757
    01761 class KActionCollection : public QObject
    01762 {
    01763   friend class KAction;
    01764   friend class KXMLGUIClient;
    01765
    01766   Q_OBJECT
    01767 public:
    01768   KActionCollection( QWidget *parent, const char *name = 0, KInstance *instance = 0 );
    01774   KActionCollection( QWidget *watch, QObject* parent, const char *name = 0, KInstance *instance = 0 );
    01775   KActionCollection( const KActionCollection &copy );
    01776   virtual ~KActionCollection();
    01777
    01782   virtual void setWidget( QWidget *widget );
    01783
    01790   void setAutoConnectShortcuts( bool );
    01791
    01792   bool isAutoConnectShortcuts();
    01793
    01800   //void setDefaultScope( KAction::Scope );
    01801
    01806   bool addDocCollection( KActionCollection* pDoc );
    01807
    01809   //uint widgetCount() const;
    01810
    01816   //bool ownsKAccel() const;
    01817
    01819   virtual KAccel* accel();
    01820   virtual const KAccel* accel() const;
    01821
    01823   KAccel* kaccel();
    01824   const KAccel* kaccel() const;
    01825
    01827   KAccel* builderKAccel() const;
    01829   //KAccel* widgetKAccel( uint i );
    01830   //const KAccel* widgetKAccel( uint i ) const;
    01831
    01832   /* Returns the number of actions in the collection **/
    01833   virtual uint count() const;
    01834   bool isEmpty() const { return count() == 0; }
    01835   virtual KAction* action( int index ) const;
    01836   virtual KAction* action( const char* name, const char* classname = 0 ) const;
    01837
    01838   virtual QStringList groups() const;
    01839   virtual KActionPtrList actions( const QString& group ) const;
    01840   virtual KActionPtrList actions() const;
    01841
    01845   bool readShortcutSettings( const QString& sConfigGroup = QString::null, KConfigBase* pConfig = 0 );
    01849   bool writeShortcutSettings( const QString& sConfigGroup = QString::null, KConfigBase* pConfig = 0 ) const;
    01850
    01851   void setInstance( KInstance *instance );
    01852   KInstance *instance() const;
    01853
    01858   void setXMLFile( const QString& );
    01859   const QString& xmlFile() const;
    01860
    01861   void setHighlightingEnabled( bool enable );
    01862   bool highlightingEnabled() const;
    01863
    01864   void connectHighlight( QWidget *container, KAction *action );
    01865   void disconnectHighlight( QWidget *container, KAction *action );
    01866
    01867 signals:
    01868   void inserted( KAction* );
    01869   void removed( KAction* );
    01870
    01871   void actionHighlighted( KAction *action );
    01872   void actionHighlighted( KAction *action, bool highlight );
    01873
    01874   void actionStatusText( const QString &text );
    01875   void clearStatusText();
    01876
    01877 private:
    01884   void beginXMLPlug( QWidget *widget );
    01885   void endXMLPlug();
    01887   void prepareXMLUnplug();
    01888   void unplugShortcuts( KAccel* kaccel );
    01889
    01890   void _clear();
    01891   void _insert( KAction* );
    01892   void _remove( KAction* );
    01893   KAction* _take( KAction* );
    01894
    01895 private slots:
    01896    void slotMenuItemHighlighted( int id );
    01897    void slotToolBarButtonHighlighted( int id, bool highlight );
    01898    void slotMenuAboutToHide();
    01899    void slotDestroyed();
    01900
    01901 private:
    01902    KAction *findAction( QWidget *container, int id );
    01903
    01904 #ifndef KDE_NO_COMPAT
    01905 public:
    01906   KActionCollection( QObject *parent, const char *name = 0, KInstance *instance = 0 );
    01907
    01908   void insert( KAction* );
    01909   void remove( KAction* );
    01910   KAction* take( KAction* );
    01911
    01912   KActionCollection operator+ ( const KActionCollection& ) const;
    01913   KActionCollection& operator= ( const KActionCollection& );
    01914   KActionCollection& operator+= ( const KActionCollection& );
    01915
    01916 public slots:
    01921   void clear();
    01922 #endif // !KDE_NO_COMPAT
    01923 protected:
    01924     virtual void virtual_hook( int id, void* data );
    01925 private:
    01926     class KActionCollectionPrivate;
    01927     KActionCollectionPrivate *d;
    01928 };
    01929
    01930 #endif

This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Jan 28 12:56:10 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001