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

kdeui

  • kdeui
kxmlguiclient.h
1 /* This file is part of the KDE libraries
2  Copyright (C) 2000 Simon Hausmann <hausmann@kde.org>
3  Copyright (C) 2000 Kurt Granroth <granroth@kde.org>
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Library General Public
7  License version 2 as published by the Free Software Foundation.
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 #ifndef _KXMLGUICLIENT_H
20 #define _KXMLGUICLIENT_H
21 
22 #include <tqdom.h>
23 #include <tqptrlist.h>
24 #include <tqmap.h>
25 #include <tqstringlist.h>
26 
27 #include <kdelibs_export.h>
28 
29 class TQWidget;
30 class KAction;
31 class KActionCollection;
32 class KInstance;
33 class KXMLGUIClientPrivate;
34 class KXMLGUIFactory;
35 class KXMLGUIBuilder;
36 
43 class KDEUI_EXPORT KXMLGUIClient
44 {
45  friend class KEditToolbarWidget; // for setXMLFile(3 args)
46 public:
52  KXMLGUIClient();
53 
65  KXMLGUIClient( KXMLGUIClient *parent );
66 
70  virtual ~KXMLGUIClient();
71 
77  KAction* action( const char* name ) const;
78 
84  virtual KAction *action( const TQDomElement &element ) const;
85 
95  virtual KActionCollection* actionCollection() const;
96 
100  virtual KInstance *instance() const;
101 
107  virtual TQDomDocument domDocument() const;
108 
122  virtual TQString xmlFile() const;
123 
124  virtual TQString localXMLFile() const;
125 
129  void setXMLGUIBuildDocument( const TQDomDocument &doc );
133  TQDomDocument xmlguiBuildDocument() const;
134 
139  void setFactory( KXMLGUIFactory *factory );
145  KXMLGUIFactory *factory() const;
146 
152  KXMLGUIClient *parentClient() const;
153 
160  void insertChildClient( KXMLGUIClient *child );
161 
165  void removeChildClient( KXMLGUIClient *child );
166 
170  const TQPtrList<KXMLGUIClient> *childClients();
171 
180  void setClientBuilder( KXMLGUIBuilder *builder );
181 
186  KXMLGUIBuilder *clientBuilder() const;
187 
195  void reloadXML();
196 
237  void plugActionList( const TQString &name, const TQPtrList<KAction> &actionList );
238 
242  void unplugActionList( const TQString &name );
243 
244  static TQString findMostRecentXMLFile( const TQStringList &files, TQString &doc );
245 
246  void addStateActionEnabled(const TQString& state, const TQString& action);
247 
248  void addStateActionDisabled(const TQString& state, const TQString& action);
249 
250  enum ReverseStateChange { StateNoReverse, StateReverse };
251  struct StateChange
252  {
253  TQStringList actionsToEnable;
254  TQStringList actionsToDisable;
255  };
256 
257  StateChange getActionsToChangeForState(const TQString& state);
258 
260  void beginXMLPlug( TQWidget * );
262  void endXMLPlug();
264  void prepareXMLUnplug( TQWidget * );
265 
266 protected:
271  //bool addSuperClient( KXMLGUIClient * );
272 
279  virtual void setInstance( KInstance *instance );
280 
294  virtual void setXMLFile( const TQString& file, bool merge = false, bool setXMLDoc = true );
295 
296  virtual void setLocalXMLFile( const TQString &file );
297 
304  virtual void setXML( const TQString &document, bool merge = false );
305 
312  virtual void setDOMDocument( const TQDomDocument &document, bool merge = false );
313 
319  virtual void conserveMemory();
320 
332  virtual void stateChanged(const TQString &newstate, ReverseStateChange reverse = StateNoReverse);
333 
334  // Use this one for KDE 4.0
335  //virtual void stateChanged(const TQString &newstate, bool reverse = false);
336 
337 private:
338  struct DocStruct
339  {
340  TQString file;
341  TQString data;
342  };
343 
344  bool mergeXML( TQDomElement &base, const TQDomElement &additive,
345  KActionCollection *actionCollection );
346 
347  TQDomElement findMatchingElement( const TQDomElement &base,
348  const TQDomElement &additive );
349 
350  typedef TQMap<TQString, TQMap<TQString, TQString> > ActionPropertiesMap;
351 
352  static ActionPropertiesMap extractActionProperties( const TQDomDocument &doc );
353 
354  static void storeActionProperties( TQDomDocument &doc, const ActionPropertiesMap &properties );
355 
356  static TQString findVersionNumber( const TQString &_xml );
357 
358  // Actions to enable/disable on a state change
359  TQMap<TQString,StateChange> m_actionsStateMap;
360 
361 protected:
362  virtual void virtual_hook( int id, void* data );
363 private:
364  KXMLGUIClientPrivate *d;
365 };
366 
367 #endif

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.1.2
This website is maintained by Timothy Pearson.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. |