kexi

kexiactionproxy.h
1/* This file is part of the KDE project
2 Copyright (C) 2003-2004 Jaroslaw Staniek <js@iidea.pl>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18*/
19
20#ifndef KEXIACTIONPROXY_H
21#define KEXIACTIONPROXY_H
22
23#include <tqguardedptr.h>
24#include <tqasciidict.h>
25#include <tqobject.h>
26#include <tqpair.h>
27#include <tqptrlist.h>
28
29#include <tdeaction.h>
30
31#include "kexiproject.h"
32#include "kexisharedactionhost.h"
33
34class TQSignal;
35class TDEAction;
36class KXMLGUIClient;
37class TDEAction_setEnabled_Helper;
38class KexiActionProxy;
39
41
54//TODO add method for setAvailable()
55class KEXICORE_EXPORT KexiSharedActionConnector
56{
57 public:
58 /* Connects shared actions offered by \a proxy to \a obj. */
59 KexiSharedActionConnector(KexiActionProxy* proxy, TQObject *obj);
60 ~KexiSharedActionConnector();
61
62 protected:
63 void plugSharedAction(const char *action_name, const char *slot);
64
65 void plugSharedActionToExternalGUI(const char *action_name, KXMLGUIClient *client);
66
67 void plugSharedActionsToExternalGUI(
68 const TQValueList<TQCString>& action_names, KXMLGUIClient *client);
69
70 KexiActionProxy* m_proxy;
71 TQObject *m_object;
72};
73
75
82
83class KEXICORE_EXPORT KexiActionProxy
84{
85 public:
89 KexiActionProxy(TQObject *receiver , KexiSharedActionHost *host = 0 );
90 virtual ~KexiActionProxy();
91
94 bool activateSharedAction(const char *action_name, bool alsoCheckInChildren = true);
95
97 void setSharedActionHost(KexiSharedActionHost& host) { m_host = &host; }
98
102 bool isAvailable(const char* action_name, bool alsoCheckInChildren = true) const;
103
105 bool isSupported(const char* action_name) const;
106
107 protected:
110 void plugSharedAction(const char *action_name, TQObject* receiver, const char *slot);
111
112 void unplugSharedAction(const char *action_name);
113
116 inline void plugSharedAction(const char *action_name, const char *slot) {
117 plugSharedAction(action_name, m_receiver, slot);
118 }
119
126 int plugSharedAction(const char *action_name, TQWidget* w);
127
128 void plugSharedActionToExternalGUI(const char *action_name, KXMLGUIClient *client);
129
130 void plugSharedActionsToExternalGUI(
131 const TQValueList<TQCString>& action_names, KXMLGUIClient *client);
132
135 void unplugSharedAction(const char *action_name, TQWidget* w);
136
142 TDEAction* plugSharedAction(const char *action_name, const TQString& alternativeText, TQWidget* w);
143
145 virtual TDEAction* sharedAction(const char* action_name);
146
147 inline TQObject *receiver() const { return m_receiver; }
148
149 virtual void setAvailable(const char* action_name, bool set);
150
158 void addActionProxyChild( KexiActionProxy* child );
159
160 void takeActionProxyChild( KexiActionProxy* child );
161
162 KexiSharedActionHost *m_host;
163 TQGuardedPtr<TQObject> m_receiver;
164 TQAsciiDict< TQPair<TQSignal*,bool> > m_signals;
165
166 TQPtrList<KexiActionProxy> m_sharedActionChildren;
167
168 TQPtrList<TDEAction> m_alternativeActions;
169
170 KexiActionProxy* m_actionProxyParent;
171
173
175 TDEAction_setEnabled_Helper *m_TDEAction_setEnabled_helper;
176
177 public:
180
182 KexiActionProxy *m_focusedChild;
183
184 friend class KexiSharedActionHost;
185 friend class TDEAction_setEnabled_Helper;
186 friend class KexiSharedActionConnector;
187};
188
189#endif
190
An interface that acts as proxy for shared actions within the application.
TDEAction_setEnabled_Helper * m_TDEAction_setEnabled_helper
For internal use by plugSharedActionToExternalGUI().
bool activateSharedAction(const char *action_name, bool alsoCheckInChildren=true)
TQObject m_signal_parent
it's just to have common parent for owned signals
void setActionProxyParent_internal(KexiActionProxy *parent)
For internal use by addActionProxyChild(). parent can be 0.
void plugSharedAction(const char *action_name, TQObject *receiver, const char *slot)
void setSharedActionHost(KexiSharedActionHost &host)
void plugSharedAction(const char *action_name, const char *slot)
KexiActionProxy(TQObject *receiver, KexiSharedActionHost *host=0)