author | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
commit | a08aff328d4393031d5ba7d622c2b05705a89d73 (patch) (side-by-side diff) | |
tree | 8ee90d686081c52e7c69b5ce946e9b1a7d690001 /microkde/kdeui/kactionclasses.h | |
parent | 11edc920afe4f274c0964436633aa632c8288a40 (diff) | |
download | kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.zip kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.gz kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.bz2 |
initial public commit of qt4 portp1
Diffstat (limited to 'microkde/kdeui/kactionclasses.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | microkde/kdeui/kactionclasses.h | 51 |
1 files changed, 27 insertions, 24 deletions
diff --git a/microkde/kdeui/kactionclasses.h b/microkde/kdeui/kactionclasses.h index f6e7a0f..a9b9104 100644 --- a/microkde/kdeui/kactionclasses.h +++ b/microkde/kdeui/kactionclasses.h @@ -13,69 +13,72 @@ This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ //$Id$ #ifndef __kactionclasses_h__ #define __kactionclasses_h__ #include <kaction.h> //US#include <qkeysequence.h> //US#include <qobject.h> //US#include <qvaluelist.h> //US#include <qguardedptr.h> //US#include <kguiitem.h> #include <kshortcut.h> +//Added by qt3to4: +#include <Q3CString> +#include <Q3PopupMenu> //US#include <kstdaction.h> //US#include <kicontheme.h> class QMenuBar; -class QPopupMenu; +class Q3PopupMenu; //USclass QComboBox; //USclass QPoint; //USclass QIconSet; //USclass QString; //USclass KToolBar; //USclass KAccel; //USclass KAccelActions; class KConfig; //USclass KConfigBase; class KURL; //USclass KInstance; //US class KToolBar needs to be replaced -class KToolBar; +#include "ktoolbar.h" class KActionCollection; //US class KPopupMenu needs to be replaced //US class KPopupMenu; //USclass KMainWindow; /** * Checkbox like action. * * This action provides two states: checked or not. * * @short Checkbox like action. */ class KToggleAction : public KAction { Q_OBJECT Q_PROPERTY( bool checked READ isChecked WRITE setChecked ) Q_PROPERTY( QString exclusiveGroup READ exclusiveGroup WRITE setExclusiveGroup ) public: /** * Constructs a toggle action with text and potential keyboard * accelerator but nothing else. Use this only if you really * know what you are doing. @@ -84,71 +87,71 @@ public: * @param cut The corresponding keyboard accelerator (shortcut). * @param parent This action's parent. * @param name An internal name for this action. */ KToggleAction( const QString& text, const KShortcut& cut = KShortcut(), QObject* parent = 0, const char* name = 0 ); /** * @param text The text that will be displayed. * @param cut The corresponding keyboard accelerator (shortcut). * @param receiver The SLOT's parent. * @param slot The SLOT to invoke to execute this action. * @param parent This action's parent. * @param name An internal name for this action. */ KToggleAction( const QString& text, const KShortcut& cut, const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 ); /** * @param text The text that will be displayed. * @param pix The icons that go with this action. * @param cut The corresponding keyboard accelerator (shortcut). * @param parent This action's parent. * @param name An internal name for this action. */ - KToggleAction( const QString& text, const QIconSet& pix, const KShortcut& cut = KShortcut(), + KToggleAction( const QString& text, const QIcon& pix, const KShortcut& cut = KShortcut(), QObject* parent = 0, const char* name = 0 ); /** * @param text The text that will be displayed. * @param pix The dynamically loaded icon that goes with this action. * @param cut The corresponding keyboard accelerator (shortcut). * @param parent This action's parent. * @param name An internal name for this action. */ KToggleAction( const QString& text, const QString& pix, const KShortcut& cut = KShortcut(), QObject* parent = 0, const char* name = 0 ); /** * @param text The text that will be displayed. * @param pix The icons that go with this action. * @param cut The corresponding keyboard accelerator (shortcut). * @param receiver The SLOT's parent. * @param slot The SLOT to invoke to execute this action. * @param parent This action's parent. * @param name An internal name for this action. */ - KToggleAction( const QString& text, const QIconSet& pix, const KShortcut& cut, + KToggleAction( const QString& text, const QIcon& pix, const KShortcut& cut, const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 ); /** * @param text The text that will be displayed. * @param pix The dynamically loaded icon that goes with this action. * @param cut The corresponding keyboard accelerator (shortcut). * @param receiver The SLOT's parent. * @param slot The SLOT to invoke to execute this action. * @param parent This action's parent. * @param name An internal name for this action. */ KToggleAction( const QString& text, const QString& pix, const KShortcut& cut, const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 ); /** * @param parent This action's parent. * @param name An internal name for this action. */ KToggleAction( QObject* parent = 0, const char* name = 0 ); /** * Destructor */ @@ -225,71 +228,71 @@ public: * @param cut The corresponding keyboard accelerator (shortcut). * @param parent This action's parent. * @param name An internal name for this action. */ KRadioAction( const QString& text, const KShortcut& cut = KShortcut(), QObject* parent = 0, const char* name = 0 ); /** * @param text The text that will be displayed. * @param cut The corresponding keyboard accelerator (shortcut). * @param receiver The SLOT's parent. * @param slot The SLOT to invoke to execute this action. * @param parent This action's parent. * @param name An internal name for this action. */ KRadioAction( const QString& text, const KShortcut& cut, const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 ); /** * @param text The text that will be displayed. * @param pix The icons that go with this action. * @param cut The corresponding keyboard accelerator (shortcut). * @param parent This action's parent. * @param name An internal name for this action. */ - KRadioAction( const QString& text, const QIconSet& pix, const KShortcut& cut = KShortcut(), + KRadioAction( const QString& text, const QIcon& pix, const KShortcut& cut = KShortcut(), QObject* parent = 0, const char* name = 0 ); /** * @param text The text that will be displayed. * @param pix The dynamically loaded icon that goes with this action. * @param cut The corresponding keyboard accelerator (shortcut). * @param parent This action's parent. * @param name An internal name for this action. */ KRadioAction( const QString& text, const QString& pix, const KShortcut& cut = KShortcut(), QObject* parent = 0, const char* name = 0 ); /** * @param text The text that will be displayed. * @param pix The icons that go with this action. * @param cut The corresponding keyboard accelerator (shortcut). * @param receiver The SLOT's parent. * @param slot The SLOT to invoke to execute this action. * @param parent This action's parent. * @param name An internal name for this action. */ - KRadioAction( const QString& text, const QIconSet& pix, const KShortcut& cut, + KRadioAction( const QString& text, const QIcon& pix, const KShortcut& cut, const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 ); /** * @param text The text that will be displayed. * @param pix The dynamically loaded icon that goes with this action. * @param cut The corresponding keyboard accelerator (shortcut). * @param receiver The SLOT's parent. * @param slot The SLOT to invoke to execute this action. * @param parent This action's parent. * @param name An internal name for this action. */ KRadioAction( const QString& text, const QString& pix, const KShortcut& cut, const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 ); /** * @param parent This action's parent. * @param name An internal name for this action. */ KRadioAction( QObject* parent = 0, const char* name = 0 ); protected: virtual void slotActivated(); @@ -331,71 +334,71 @@ public: * @param cut The corresponding keyboard accelerator (shortcut). * @param parent This action's parent. * @param name An internal name for this action. */ KSelectAction( const QString& text, const KShortcut& cut = KShortcut(), QObject* parent = 0, const char* name = 0 ); /** * @param text The text that will be displayed. * @param cut The corresponding keyboard accelerator (shortcut). * @param receiver The SLOT's parent. * @param slot The SLOT to invoke to execute this action. * @param parent This action's parent. * @param name An internal name for this action. */ KSelectAction( const QString& text, const KShortcut& cut, const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 ); /** * @param text The text that will be displayed. * @param pix The icons that go with this action. * @param cut The corresponding keyboard accelerator (shortcut). * @param parent This action's parent. * @param name An internal name for this action. */ - KSelectAction( const QString& text, const QIconSet& pix, const KShortcut& cut = KShortcut(), + KSelectAction( const QString& text, const QIcon& pix, const KShortcut& cut = KShortcut(), QObject* parent = 0, const char* name = 0 ); /** * @param text The text that will be displayed. * @param pix The dynamically loaded icon that goes with this action. * @param cut The corresponding keyboard accelerator (shortcut). * @param parent This action's parent. * @param name An internal name for this action. */ KSelectAction( const QString& text, const QString& pix, const KShortcut& cut = KShortcut(), QObject* parent = 0, const char* name = 0 ); /** * @param text The text that will be displayed. * @param pix The icons that go with this action. * @param cut The corresponding keyboard accelerator (shortcut). * @param receiver The SLOT's parent. * @param slot The SLOT to invoke to execute this action. * @param parent This action's parent. * @param name An internal name for this action. */ - KSelectAction( const QString& text, const QIconSet& pix, const KShortcut& cut, + KSelectAction( const QString& text, const QIcon& pix, const KShortcut& cut, const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 ); /** * @param text The text that will be displayed. * @param pix The dynamically loaded icon that goes with this action. * @param cut The corresponding keyboard accelerator (shortcut). * @param receiver The SLOT's parent. * @param slot The SLOT to invoke to execute this action. * @param parent This action's parent. * @param name An internal name for this action. */ KSelectAction( const QString& text, const QString& pix, const KShortcut& cut, const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 ); /** * @param parent This action's parent. * @param name An internal name for this action. */ KSelectAction( QObject* parent = 0, const char* name = 0 ); /** * Destructor */ @@ -417,49 +420,49 @@ public: /** * When this action is plugged into a toolbar, it creates a combobox. * @return true if the combo editable. */ virtual bool isEditable() const; /** * @return the items that can be selected with this action. * Use setItems to set them. */ virtual QStringList items() const; virtual void changeItem( int index, const QString& text ); virtual QString currentText() const; virtual int currentItem() const; /** * When this action is plugged into a toolbar, it creates a combobox. * This returns the maximum width set by setComboWidth */ virtual int comboWidth() const; - QPopupMenu* popupMenu() const; + Q3PopupMenu* popupMenu() const; /** * Deprecated. See @ref setMenuAccelsEnabled . * @since 3.1 */ void setRemoveAmpersandsInCombo( bool b ); /// @since 3.1 bool removeAmpersandsInCombo() const; /** * Sets whether any occurence of the ampersand character ( & ) in items * should be interpreted as keyboard accelerator for items displayed in a * menu or not. * @since 3.1 */ void setMenuAccelsEnabled( bool b ); /// @since 3.1 bool menuAccelsEnabled() const; public slots: /** * Sets the currently checked item. * * @param index Index of the item (remember the first item is zero). @@ -546,71 +549,71 @@ public: * @param parent This action's parent. * @param name An internal name for this action. */ KListAction( const QString& text, const KShortcut& cut = KShortcut(), QObject* parent = 0, const char* name = 0 ); /** * @param text The text that will be displayed. * @param cut The corresponding keyboard accelerator (shortcut). * @param receiver The SLOT's parent. * @param slot The SLOT to invoke to execute this action. * @param parent This action's parent. * @param name An internal name for this action. */ KListAction( const QString& text, const KShortcut& cut, const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 ); /** * @param text The text that will be displayed. * @param pix The icons that go with this action. * @param cut The corresponding keyboard accelerator (shortcut). * @param parent This action's parent. * @param name An internal name for this action. */ - KListAction( const QString& text, const QIconSet& pix, const KShortcut& cut = KShortcut(), + KListAction( const QString& text, const QIcon& pix, const KShortcut& cut = KShortcut(), QObject* parent = 0, const char* name = 0 ); /** * @param text The text that will be displayed. * @param pix The dynamically loaded icon that goes with this action. * @param cut The corresponding keyboard accelerator (shortcut). * @param parent This action's parent. * @param name An internal name for this action. */ KListAction( const QString& text, const QString& pix, const KShortcut& cut = KShortcut(), QObject* parent = 0, const char* name = 0 ); /** * @param text The text that will be displayed. * @param pix The icons that go with this action. * @param cut The corresponding keyboard accelerator (shortcut). * @param receiver The SLOT's parent. * @param slot The SLOT to invoke to execute this action. * @param parent This action's parent. * @param name An internal name for this action. */ - KListAction( const QString& text, const QIconSet& pix, const KShortcut& cut, + KListAction( const QString& text, const QIcon& pix, const KShortcut& cut, const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 ); /** * @param text The text that will be displayed. * @param pix The dynamically loaded icon that goes with this action. * @param cut The corresponding keyboard accelerator (shortcut). * @param receiver The SLOT's parent. * @param slot The SLOT to invoke to execute this action. * @param parent This action's parent. * @param name An internal name for this action. */ KListAction( const QString& text, const QString& pix, const KShortcut& cut, const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 ); /** * @param parent This action's parent. * @param name An internal name for this action. */ KListAction( QObject* parent = 0, const char* name = 0 ); /** * Destructor @@ -664,76 +667,76 @@ public: /** * @param text The text that will be displayed. * @param cut The corresponding keyboard accelerator (shortcut). * @param receiver The SLOT's parent. * @param slot The SLOT to invoke when a URL is selected. * Its signature is of the form slotURLSelected( const KURL & ). * @param parent This action's parent. * @param name An internal name for this action. * @param maxItems The maximum number of files to display */ KRecentFilesAction( const QString& text, const KShortcut& cut, const QObject* receiver, const char* slot, QObject* parent, const char* name = 0, uint maxItems = 10 ); /** * @param text The text that will be displayed. * @param pix The icons that go with this action. * @param cut The corresponding keyboard accelerator (shortcut). * @param parent This action's parent. * @param name An internal name for this action. * @param maxItems The maximum number of files to display */ - KRecentFilesAction( const QString& text, const QIconSet& pix, const KShortcut& cut, + KRecentFilesAction( const QString& text, const QIcon& pix, const KShortcut& cut, QObject* parent, const char* name = 0, uint maxItems = 10 ); /** * @param text The text that will be displayed. * @param pix The dynamically loaded icon that goes with this action. * @param cut The corresponding keyboard accelerator (shortcut). * @param parent This action's parent. * @param name An internal name for this action. * @param maxItems The maximum number of files to display */ KRecentFilesAction( const QString& text, const QString& pix, const KShortcut& cut, QObject* parent, const char* name = 0, uint maxItems = 10 ); /** * @param text The text that will be displayed. * @param pix The icons that go with this action. * @param cut The corresponding keyboard accelerator (shortcut). * @param receiver The SLOT's parent. * @param slot The SLOT to invoke when a URL is selected. * Its signature is of the form slotURLSelected( const KURL & ). * @param parent This action's parent. * @param name An internal name for this action. * @param maxItems The maximum number of files to display */ - KRecentFilesAction( const QString& text, const QIconSet& pix, const KShortcut& cut, + KRecentFilesAction( const QString& text, const QIcon& pix, const KShortcut& cut, const QObject* receiver, const char* slot, QObject* parent, const char* name = 0, uint maxItems = 10 ); /** * @param text The text that will be displayed. * @param pix The dynamically loaded icon that goes with this action. * @param cut The corresponding keyboard accelerator (shortcut). * @param receiver The SLOT's parent. * @param slot The SLOT to invoke when a URL is selected. * Its signature is of the form slotURLSelected( const KURL & ). * @param parent This action's parent. * @param name An internal name for this action. * @param maxItems The maximum number of files to display */ KRecentFilesAction( const QString& text, const QString& pix, const KShortcut& cut, const QObject* receiver, const char* slot, QObject* parent, const char* name = 0, uint maxItems = 10 ); /** * @param parent This action's parent. * @param name An internal name for this action. * @param maxItems The maximum number of files to display @@ -813,92 +816,92 @@ protected slots: /** * */ void itemSelected( const QString& string ); protected: virtual void virtual_hook( int id, void* data ); private: void init(); class KRecentFilesActionPrivate; KRecentFilesActionPrivate *d; }; class KFontAction : public KSelectAction { Q_OBJECT Q_PROPERTY( QString font READ font WRITE setFont ) public: KFontAction( const QString& text, const KShortcut& cut = KShortcut(), QObject* parent = 0, const char* name = 0 ); KFontAction( const QString& text, const KShortcut& cut, const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 ); - KFontAction( const QString& text, const QIconSet& pix, const KShortcut& cut = KShortcut(), + KFontAction( const QString& text, const QIcon& pix, const KShortcut& cut = KShortcut(), QObject* parent = 0, const char* name = 0 ); KFontAction( const QString& text, const QString& pix, const KShortcut& cut = KShortcut(), QObject* parent = 0, const char* name = 0 ); - KFontAction( const QString& text, const QIconSet& pix, const KShortcut& cut, + KFontAction( const QString& text, const QIcon& pix, const KShortcut& cut, const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 ); KFontAction( const QString& text, const QString& pix, const KShortcut& cut, const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 ); KFontAction( QObject* parent = 0, const char* name = 0 ); ~KFontAction(); QString font() const { return currentText(); } int plug( QWidget*, int index = -1 ); public slots: void setFont( const QString &family ); protected: virtual void virtual_hook( int id, void* data ); private: class KFontActionPrivate; KFontActionPrivate *d; }; class KFontSizeAction : public KSelectAction { Q_OBJECT Q_PROPERTY( int fontSize READ fontSize WRITE setFontSize ) public: KFontSizeAction( const QString& text, const KShortcut& cut = KShortcut(), QObject* parent = 0, const char* name = 0 ); KFontSizeAction( const QString& text, const KShortcut& cut, const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 ); - KFontSizeAction( const QString& text, const QIconSet& pix, const KShortcut& cut = KShortcut(), + KFontSizeAction( const QString& text, const QIcon& pix, const KShortcut& cut = KShortcut(), QObject* parent = 0, const char* name = 0 ); KFontSizeAction( const QString& text, const QString& pix, const KShortcut& cut = KShortcut(), QObject* parent = 0, const char* name = 0 ); - KFontSizeAction( const QString& text, const QIconSet& pix, const KShortcut& cut, + KFontSizeAction( const QString& text, const QIcon& pix, const KShortcut& cut, const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 ); KFontSizeAction( const QString& text, const QString& pix, const KShortcut& cut, const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 ); KFontSizeAction( QObject* parent = 0, const char* name = 0 ); virtual ~KFontSizeAction(); virtual int fontSize() const; public slots: virtual void setFontSize( int size ); protected slots: virtual void slotActivated( int ); virtual void slotActivated( const QString& ); virtual void slotActivated() { KAction::slotActivated(); } signals: void fontSizeChanged( int ); private: void init(); @@ -910,60 +913,60 @@ private: class KFontSizeActionPrivate; KFontSizeActionPrivate *d; }; /** * A KActionMenu is an action that holds a sub-menu of other actions. * insert() and remove() allow to insert and remove actions into this action-menu. * Plugged in a popupmenu, it will create a submenu. * Plugged in a toolbar, it will create a button with a popup menu. * * This is the action used by the XMLGUI since it holds other actions. * If you want a submenu for selecting one tool among many (without icons), see KSelectAction. * See also setDelayed about the main action. */ class KActionMenu : public KAction { Q_OBJECT Q_PROPERTY( bool delayed READ delayed WRITE setDelayed ) Q_PROPERTY( bool stickyMenu READ stickyMenu WRITE setStickyMenu ) public: KActionMenu( const QString& text, QObject* parent = 0, const char* name = 0 ); - KActionMenu( const QString& text, const QIconSet& icon, + KActionMenu( const QString& text, const QIcon& icon, QObject* parent = 0, const char* name = 0 ); KActionMenu( const QString& text, const QString& icon, QObject* parent = 0, const char* name = 0 ); KActionMenu( QObject* parent = 0, const char* name = 0 ); virtual ~KActionMenu(); virtual void insert( KAction*, int index = -1 ); virtual void remove( KAction* ); //US KPopupMenu* popupMenu() const; - QPopupMenu* popupMenu() const; + Q3PopupMenu* popupMenu() const; void popup( const QPoint& global ); /** * Returns true if this action creates a delayed popup menu * when plugged in a KToolbar. */ bool delayed() const; /** * If set to true, this action will create a delayed popup menu * when plugged in a KToolbar. Otherwise it creates a normal popup. * Default: delayed * * Remember that if the "main" action (the toolbar button itself) * cannot be clicked, then you should call setDelayed(false). * * On the opposite, if the main action can be clicked, it can only happen * in a toolbar: in a menu, the parent of a submenu can't be activated. * To get a "normal" menu item when plugged a menu (and no submenu) * use KToolBarPopupAction. */ void setDelayed(bool _delayed); /** * Returns true if this action creates a sticky popup menu. @@ -1046,177 +1049,177 @@ public: * @p cut param to 0. * * @param item The text and icon that will be displayed. * @param cut The corresponding keyboard accelerator (shortcut). * @param receiver The SLOT's owner. * @param slot The SLOT to invoke to execute this action. * @param parent This action's parent. * @param name An internal name for this action. */ KToolBarPopupAction( const KGuiItem& item, const KShortcut& cut, const QObject* receiver, const char* slot, KActionCollection* parent, const char* name ); virtual ~KToolBarPopupAction(); virtual int plug( QWidget *widget, int index = -1 ); /** * The popup menu that is shown when clicking (some time) on the toolbar * button. You may want to plug items into it on creation, or connect to * aboutToShow for a more dynamic menu. */ //US KPopupMenu *popupMenu() const; - QPopupMenu *popupMenu() const; + Q3PopupMenu *popupMenu() const; /** * Returns true if this action creates a delayed popup menu * when plugged in a KToolbar. */ bool delayed() const; /** * If set to true, this action will create a delayed popup menu * when plugged in a KToolbar. Otherwise it creates a normal popup. * Default: delayed. */ void setDelayed(bool delayed); /** * Returns true if this action creates a sticky popup menu. * See @ref setStickyMenu. */ bool stickyMenu() const; /** * If set to true, this action will create a sticky popup menu * when plugged in a KToolbar. * "Sticky", means it's visible until a selection is made or the mouse is * clicked elsewhere. This feature allows you to make a selection without * having to press and hold down the mouse while making a selection. * Only available if delayed() is true. * Default: sticky. */ void setStickyMenu(bool sticky); private: //US KPopupMenu *m_popup; - QPopupMenu *m_popup; + Q3PopupMenu *m_popup; bool m_delayed:1; bool m_stickyMenu:1; protected: virtual void virtual_hook( int id, void* data ); private: class KToolBarPopupActionPrivate; KToolBarPopupActionPrivate *d; }; /** * An action that takes care of everything associated with * showing or hiding a toolbar by a menu action. It will * show or hide the toolbar with the given name when * activated, and check or uncheck itself if the toolbar * is manually shown or hidden. * * If you need to perfom some additional action when the * toolbar is shown or hidden, connect to the toggled(bool) * signal. It will be emitted after the toolbar's * visibility has changed, whenever it changes. * @since 3.1 */ class KToggleToolBarAction : public KToggleAction { Q_OBJECT public: /** * Create a KToggleToolbarAction that manages the toolbar * named toolBarName. This can be either the name of a * toolbar in an xml ui file, or a toolbar programmatically * created with that name. */ KToggleToolBarAction( const char* toolBarName, const QString& text, KActionCollection* parent, const char* name ); KToggleToolBarAction( KToolBar *toolBar, const QString &text, KActionCollection *parent, const char *name ); virtual ~KToggleToolBarAction(); virtual int plug( QWidget*, int index = -1 ); KToolBar *toolBar() { return m_toolBar; } public slots: virtual void setChecked( bool ); private: - QCString m_toolBarName; - QGuardedPtr<KToolBar> m_toolBar; + Q3CString m_toolBarName; + QPointer<KToolBar> m_toolBar; protected: virtual void virtual_hook( int id, void* data ); private: class KToggleToolBarActionPrivate; KToggleToolBarActionPrivate *d; }; /** * An action that automatically embeds a widget into a * toolbar. */ class KWidgetAction : public KAction { Q_OBJECT public: /** * Create an action that will embed widget into a toolbar * when plugged. This action may only be plugged into * a toolbar. */ KWidgetAction( QWidget* widget, const QString& text, const KShortcut& cut, const QObject* receiver, const char* slot, KActionCollection* parent, const char* name ); virtual ~KWidgetAction(); /** * Returns the widget associated with this action. */ QWidget* widget() { return m_widget; } void setAutoSized( bool ); /** * Plug the action. The widget passed to the constructor * will be reparented to w, which must inherit KToolBar. */ virtual int plug( QWidget* w, int index = -1 ); /** * Unplug the action. Ensures that the action is not * destroyed. It will be hidden and reparented to 0L instead. */ virtual void unplug( QWidget *w ); protected slots: void slotToolbarDestroyed(); private: - QGuardedPtr<QWidget> m_widget; + QPointer<QWidget> m_widget; bool m_autoSized; protected: virtual void virtual_hook( int id, void* data ); private: class KWidgetActionPrivate; KWidgetActionPrivate *d; }; class KActionSeparator : public KAction { Q_OBJECT public: KActionSeparator( QObject* parent = 0, const char* name = 0 ); virtual ~KActionSeparator(); virtual int plug( QWidget*, int index = -1 ); protected: virtual void virtual_hook( int id, void* data ); private: class KActionSeparatorPrivate; KActionSeparatorPrivate *d; }; |