kexi

kexisharedactionhost.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 2004 Jaroslaw Staniek <js@iidea.pl>
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 KEXISHAREDACTIONHOST_H
00021 #define KEXISHAREDACTIONHOST_H
00022 
00023 #include <qguardedptr.h>
00024 #include <qasciidict.h>
00025 #include <qobject.h>
00026 #include <qpair.h>
00027 
00028 #include <kstdaction.h>
00029 #include <kaction.h>
00030 
00031 class KShortcut;
00032 class KGuiItem;
00033 class KMainWindow;
00034 class KexiActionProxy;
00035 class KexiSharedActionHostPrivate;
00036 
00037 namespace KexiPart {
00038     class Part;
00039 }
00040 
00042 
00052 class KEXICORE_EXPORT KexiSharedActionHost
00053 {
00054     public:
00055 
00057         KexiSharedActionHost(KMainWindow* mainWin);
00058 
00059         virtual ~KexiSharedActionHost();
00060 
00070         virtual bool acceptsSharedActions(QObject *o);
00071 
00078         QWidget* focusWindow();
00079 
00081         void setAsDefaultHost();
00082 
00086         static KexiSharedActionHost& defaultHost();
00087 
00089         KActionPtrList sharedActions() const;
00090 
00092         void setActionVolatile( KAction *a, bool set );
00093 
00094 
00095     protected:
00096 
00109         virtual void invalidateSharedActions(QObject *o);
00110 
00111         void setActionAvailable(const char *action_name, bool avail);
00112 
00114         void plugActionProxy(KexiActionProxy *proxy);
00115 
00118         void updateActionAvailable(const char *action_name, bool avail, QObject *obj);
00119 
00121         KMainWindow* mainWindow() const;
00122 
00129         KAction* createSharedAction(const QString &text, const QString &pix_name, 
00130             const KShortcut &cut, const char *name, KActionCollection* col = 0,
00131             const char *subclassName = 0);
00132 
00135         KAction* createSharedAction( KStdAction::StdAction id, const char *name, 
00136             KActionCollection* col = 0);
00137 
00141         KAction* createSharedAction(const KGuiItem& guiItem, const KShortcut &cut, const char *name,
00142             KActionCollection* col = 0);
00143 
00146         KexiActionProxy* actionProxyFor(QObject *o) const;
00147 
00150         KexiActionProxy* takeActionProxyFor(QObject *o);
00151 
00152     private:
00154         KAction* createSharedActionInternal( KAction *action );
00155 
00156         KexiSharedActionHostPrivate *d;
00157 
00158     friend class KexiActionProxy;
00159     friend class KexiPart::Part;
00160     friend class KexiViewBase;
00161     friend class KexiDialogBase;
00162 };
00163 
00164 #endif
00165 
KDE Home | KDE Accessibility Home | Description of Access Keys