• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • kdeui
 

kdeui

  • kdeui
kaction.h
1 /* This file is part of the KDE libraries
2  Copyright (C) 1999 Reginald Stadlbauer <reggie@kde.org>
3  (C) 1999 Simon Hausmann <hausmann@kde.org>
4  (C) 2000 Nicolas Hadacek <haadcek@kde.org>
5  (C) 2000 Kurt Granroth <granroth@kde.org>
6  (C) 2000 Michael Koch <koch@kde.org>
7  (C) 2001 Holger Freyther <freyther@kde.org>
8  (C) 2002 Ellis Whitehead <ellis@kde.org>
9 
10  This library is free software; you can redistribute it and/or
11  modify it under the terms of the GNU Library General Public
12  License version 2 as published by the Free Software Foundation.
13 
14  This library is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  Library General Public License for more details.
18 
19  You should have received a copy of the GNU Library General Public License
20  along with this library; see the file COPYING.LIB. If not, write to
21  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22  Boston, MA 02110-1301, USA.
23 */
24 //$Id$
25 
26 #ifndef __kaction_h__
27 #define __kaction_h__
28 
29 #include <tqkeysequence.h>
30 #include <tqobject.h>
31 #include <tqvaluelist.h>
32 #include <tqguardedptr.h>
33 #include <kguiitem.h>
34 #include <kshortcut.h>
35 #include <kstdaction.h>
36 #include <kicontheme.h>
37 
38 class TQMenuBar;
39 class TQPopupMenu;
40 class TQComboBox;
41 class TQPoint;
42 class TQIconSet;
43 class TQString;
44 class KToolBar;
45 
46 class KAccel;
47 class KAccelActions;
48 class KConfig;
49 class KConfigBase;
50 class KURL;
51 class KInstance;
52 class KToolBar;
53 class KActionCollection;
54 class KPopupMenu;
55 class KMainWindow;
56 
202 class KDEUI_EXPORT KAction : public TQObject
203 {
204  friend class KActionCollection;
205  Q_OBJECT
206  Q_PROPERTY( int containerCount READ containerCount )
207  Q_PROPERTY( TQString plainText READ plainText )
208  Q_PROPERTY( TQString text READ text WRITE setText )
209  Q_PROPERTY( TQString shortcut READ shortcutText WRITE setShortcutText )
210  Q_PROPERTY( bool enabled READ isEnabled WRITE setEnabled )
211  Q_PROPERTY( TQString group READ group WRITE setGroup )
212  Q_PROPERTY( TQString whatsThis READ whatsThis WRITE setWhatsThis )
213  Q_PROPERTY( TQString toolTip READ toolTip WRITE setToolTip )
214  Q_PROPERTY( TQString icon READ icon WRITE setIcon )
215 public:
236  KAction( const TQString& text, const KShortcut& cut,
237  const TQObject* receiver, const char* slot,
238  KActionCollection* parent, const char* name );
239 
259  KAction( const TQString& text, const TQIconSet& pix, const KShortcut& cut,
260  const TQObject* receiver, const char* slot,
261  KActionCollection* parent, const char* name );
262 
283  KAction( const TQString& text, const TQString& pix, const KShortcut& cut,
284  const TQObject* receiver, const char* slot,
285  KActionCollection* parent, const char* name );
286 
298  KAction( const KGuiItem& item, const KShortcut& cut,
299  const TQObject* receiver, const char* slot,
300  KActionCollection* parent, const char* name );
301 
305  KAction( const TQString& text, const KShortcut& cut = KShortcut(), TQObject* parent = 0, const char* name = 0 );
309  KAction( const TQString& text, const KShortcut& cut,
310  const TQObject* receiver, const char* slot, TQObject* parent, const char* name = 0 );
314  KAction( const TQString& text, const TQIconSet& pix, const KShortcut& cut = KShortcut(),
315  TQObject* parent = 0, const char* name = 0 );
319  KAction( const TQString& text, const TQString& pix, const KShortcut& cut = KShortcut(),
320  TQObject* parent = 0, const char* name = 0 );
324  KAction( const TQString& text, const TQIconSet& pix, const KShortcut& cut,
325  const TQObject* receiver, const char* slot, TQObject* parent, const char* name = 0 );
329  KAction( const TQString& text, const TQString& pix, const KShortcut& cut,
330  const TQObject* receiver, const char* slot, TQObject* parent,
331  const char* name = 0 );
335  KAction( TQObject* parent = 0, const char* name = 0 );
336 
340  virtual ~KAction();
341 
355  virtual int plug( TQWidget *widget, int index = -1 );
356 
367  virtual void plugAccel(KAccel *accel, bool configurable = true) KDE_DEPRECATED;
368 
381  virtual void unplug( TQWidget *w );
382 
387  virtual void unplugAccel() KDE_DEPRECATED;
388 
393  virtual bool isPlugged() const;
394 
398  bool isPlugged( const TQWidget *container ) const;
399 
404  virtual bool isPlugged( const TQWidget *container, int id ) const;
405 
410  virtual bool isPlugged( const TQWidget *container, const TQWidget *_representative ) const;
411 
412  TQWidget* container( int index ) const;
413  int itemId( int index ) const;
414  TQWidget* representative( int index ) const;
415  int containerCount() const;
417  uint kaccelCount() const;
418 
419  virtual bool hasIcon() const;
420 #ifndef KDE_NO_COMPAT
421  bool hasIconSet() const { return hasIcon(); }
422 #endif
423  virtual TQString plainText() const;
424 
428  virtual TQString text() const;
429 
433  virtual const KShortcut& shortcut() const;
437  virtual const KShortcut& shortcutDefault() const;
438 
439  // These two methods are for Q_PROPERTY
440  TQString shortcutText() const;
441  void setShortcutText( const TQString& );
442 
446  virtual bool isEnabled() const;
447 
451  virtual bool isShortcutConfigurable() const;
452 
453  virtual TQString group() const;
454 
458  virtual TQString whatsThis() const;
459 
463  virtual TQString toolTip() const;
464 
472  virtual TQIconSet iconSet( KIcon::Group group, int size=0 ) const;
476  TQIconSet iconSet() const { return iconSet( KIcon::Small ); }
477 
478  virtual TQString icon() const;
479 
480  KActionCollection *parentCollection() const;
481 
486  static int getToolButtonID();
487 
488 
489  void unplugAll();
490 
494  enum ActivationReason { UnknownActivation, EmulatedActivation, AccelActivation, PopupMenuActivation, ToolBarActivation };
495 
496 public slots:
501  virtual void setText(const TQString &text);
502 
506  virtual bool setShortcut( const KShortcut& );
507 
508  virtual void setGroup( const TQString& );
509 
517  virtual void setWhatsThis( const TQString& text );
518 
533  virtual void setToolTip( const TQString& );
534 
539  virtual void setIconSet( const TQIconSet &iconSet );
540 
541  virtual void setIcon( const TQString& icon );
542 
547  virtual void setEnabled(bool enable);
548 
553  void setDisabled(bool disable) { return setEnabled(!disable); }
554 
558  virtual void setShortcutConfigurable( bool );
559 
564  virtual void activate();
565 
566 protected slots:
567  virtual void slotDestroyed();
568  virtual void slotKeycodeChanged();
569  virtual void slotActivated();
571  void slotPopupActivated(); // KDE4: make virtual
573  void slotButtonClicked( int, TQt::ButtonState state ); // KDE4: make virtual
574 
575 protected:
576  KToolBar* toolBar( int index ) const;
577  TQPopupMenu* popupMenu( int index ) const;
578  void removeContainer( int index );
579  int findContainer( const TQWidget* widget ) const;
580  int findContainer( int id ) const;
581  void plugMainWindowAccel( TQWidget *w );
582 
583  void addContainer( TQWidget* parent, int id );
584  void addContainer( TQWidget* parent, TQWidget* representative );
585 
586  virtual void updateShortcut( int i );
587  virtual void updateShortcut( TQPopupMenu* menu, int id );
588  virtual void updateGroup( int id );
589  virtual void updateText(int i );
590  virtual void updateEnabled(int i);
591  virtual void updateIconSet(int i);
592  virtual void updateIcon( int i);
593  virtual void updateToolTip( int id );
594  virtual void updateWhatsThis( int i );
595 
596  KActionCollection *m_parentCollection;
597  TQString whatsThisWithIcon() const;
602  const KGuiItem& guiItem() const;
603 
604 signals:
608  void activated();
623  void activated( KAction::ActivationReason reason, TQt::ButtonState state );
624  void enabled( bool );
625 
626 private:
627  void initPrivate( const TQString& text, const KShortcut& cut,
628  const TQObject* receiver, const char* slot );
629  KAccel* kaccelCurrent();
630  bool initShortcut( const KShortcut& );
631  void plugShortcut();
632  bool updateKAccelShortcut( KAccel* kaccel );
633  void insertKAccel( KAccel* );
635  void removeKAccel( KAccel* );
636 
637 #ifndef KDE_NO_COMPAT
638 public:
643  int accel() const KDE_DEPRECATED;
644 
645  TQString statusText() const
646  { return toolTip(); }
647 
652  void setAccel( int key ) KDE_DEPRECATED;
653 
657  void setStatusText( const TQString &text )
658  { setToolTip( text ); }
659 
663  int menuId( int i ) { return itemId( i ); }
664 #endif // !KDE_NO_COMPAT
665 
666 protected:
667  virtual void virtual_hook( int id, void* data );
668 private:
669  class KActionPrivate;
670  KActionPrivate* const d;
671 };
672 
673 #include <kactioncollection.h>
674 #include <kactionclasses.h>
675 
676 #endif
KURL
KActionCollection
A managed set of KAction objects.
Definition: kactioncollection.h:78
KAccel
KAction::menuId
int menuId(int i)
Definition: kaction.h:663
KPopupMenu
A menu with title items.
Definition: kpopupmenu.h:123
KIcon::Small
KIcon::Group
Group
KAction::ActivationReason
ActivationReason
Definition: kaction.h:494
KAction::iconSet
TQIconSet iconSet() const
Remove in KDE4.
Definition: kaction.h:476
KActionCollection::kaccel
KAccel * kaccel()
Returns the KAccel object of the most recently set widget.
Definition: kactioncollection.cpp:282
KShortcut
KMainWindow
KDE top level main window
Definition: kmainwindow.h:98
KGuiItem
An abstract class for GUI data such as ToolTip and Icon.
Definition: kguiitem.h:38
KAction::setDisabled
void setDisabled(bool disable)
Calls setEnabled( !disable ).
Definition: kaction.h:553
KInstance
KConfigBase
KAction::setStatusText
void setStatusText(const TQString &text)
Definition: kaction.h:657
KConfig
KToolBar
Floatable toolbar with auto resize.
Definition: ktoolbar.h:104
KAction
Class to encapsulate user-driven action or event.
Definition: kaction.h:202
KActionCollection::accel
virtual KAccel * accel() KDE_DEPRECATED
Returns the number of widgets which this collection is associated with.
Definition: kactioncollection.cpp:369

kdeui

Skip menu "kdeui"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdeui

Skip menu "kdeui"
  • arts
  • dcop
  • dnssd
  • interfaces
  •     interface
  •     library
  •   kspeech
  •   ktexteditor
  • kabc
  • kate
  • kcmshell
  • kdecore
  • kded
  • kdefx
  • kdeprint
  • kdesu
  • kdeui
  • kdoctools
  • khtml
  • kimgio
  • kinit
  • kio
  •   bookmarks
  •   httpfilter
  •   kfile
  •   kio
  •   kioexec
  •   kpasswdserver
  •   kssl
  • kioslave
  •   http
  • kjs
  • kmdi
  •   kmdi
  • knewstuff
  • kparts
  • krandr
  • kresources
  • kspell2
  • kunittest
  • kutils
  • kwallet
  • libkmid
  • libkscreensaver
Generated for kdeui by doxygen 1.8.8
This website is maintained by Timothy Pearson.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. |