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 KMainWindow;
00033 class KexiActionProxy;
00034 class KexiSharedActionHostPrivate;
00035 
00036 namespace KexiPart {
00037     class Part;
00038 }
00039 
00041 
00051 class KEXICORE_EXPORT KexiSharedActionHost
00052 {
00053     public:
00054 
00056         KexiSharedActionHost(KMainWindow* mainWin);
00057 
00058         virtual ~KexiSharedActionHost();
00059 
00069         virtual bool acceptsSharedActions(QObject *o);
00070 
00077         QWidget* focusWindow();
00078 
00080         void setAsDefaultHost();
00081 
00085         static KexiSharedActionHost& defaultHost();
00086 
00088         KActionPtrList sharedActions() const;
00089 
00091         void setActionVolatile( KAction *a, bool set );
00092 
00093 
00094     protected:
00095 
00108         virtual void invalidateSharedActions(QObject *o);
00109 
00110         void setActionAvailable(const char *action_name, bool avail);
00111 
00113         void plugActionProxy(KexiActionProxy *proxy);
00114 
00117         void updateActionAvailable(const char *action_name, bool avail, QObject *obj);
00118 
00120         KMainWindow* mainWindow() const;
00121 
00128         KAction* createSharedAction(const QString &text, const QString &pix_name, 
00129             const KShortcut &cut, const char *name, KActionCollection* col = 0,
00130             const char *subclassName = 0);
00131 
00134         KAction* createSharedAction( KStdAction::StdAction id, const char *name, 
00135             KActionCollection* col = 0);
00136 
00139         KexiActionProxy* actionProxyFor(QObject *o) const;
00140 
00143         KexiActionProxy* takeActionProxyFor(QObject *o);
00144 
00145     private:
00147         KAction* createSharedActionInternal( KAction *action );
00148 
00149         KexiSharedActionHostPrivate *d;
00150 
00151     friend class KexiActionProxy;
00152     friend class KexiPart::Part;
00153     friend class KexiViewBase;
00154     friend class KexiDialogBase;
00155 };
00156 
00157 #endif
00158 
KDE Home | KDE Accessibility Home | Description of Access Keys