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

tdeui

  • tdeui
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 <tdelibs_export.h>
28 
29 class TQWidget;
30 class TDEAction;
31 class TDEActionCollection;
32 class TDEInstance;
33 class KXMLGUIClientPrivate;
34 class KXMLGUIFactory;
35 class KXMLGUIBuilder;
36 
43 class TDEUI_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  TDEAction* action( const char* name ) const;
78 
84  virtual TDEAction *action( const TQDomElement &element ) const;
85 
95  virtual TDEActionCollection* actionCollection() const;
96 
100  virtual TDEInstance *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<TDEAction> &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( TDEInstance *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  TDEActionCollection *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
KXMLGUIClient::xmlguiBuildDocument
TQDomDocument xmlguiBuildDocument() const
Definition: kxmlguiclient.cpp:545
KXMLGUIClient
A KXMLGUIClient can be used with KXMLGUIFactory to create a GUI from actions and an XML document...
Definition: kxmlguiclient.h:43
KXMLGUIClient::setXMLGUIBuildDocument
void setXMLGUIBuildDocument(const TQDomDocument &doc)
Definition: kxmlguiclient.cpp:540
KXMLGUIClient::removeChildClient
void removeChildClient(KXMLGUIClient *child)
Removes the given child from the client's children list.
Definition: kxmlguiclient.cpp:573
KXMLGUIClient::setClientBuilder
void setClientBuilder(KXMLGUIBuilder *builder)
A client can have an own KXMLGUIBuilder.
Definition: kxmlguiclient.cpp:593
KXMLGUIClient::childClients
const TQPtrList< KXMLGUIClient > * childClients()
Retrieves a list of all child clients.
Definition: kxmlguiclient.cpp:588
KEditToolbarWidget::actionCollection
virtual TDEActionCollection * actionCollection() const
Definition: kedittoolbar.cpp:1062
KXMLGUIClient::factory
KXMLGUIFactory * factory() const
Retrieves a pointer to the KXMLGUIFactory this client is associated with (will return 0L if the clien...
Definition: kxmlguiclient.cpp:555
KXMLGUIClient::reloadXML
void reloadXML()
Forces this client to re-read its XML resource file.
Definition: kxmlguiclient.cpp:150
TDEActionCollection
A managed set of TDEAction objects.
Definition: tdeactioncollection.h:78
TDEAction
Class to encapsulate user-driven action or event.
Definition: tdeaction.h:202
KXMLGUIClient::action
TDEAction * action(const char *name) const
Retrieves an action of the client by name.
Definition: kxmlguiclient.cpp:93
KXMLGUIClient::setFactory
void setFactory(KXMLGUIFactory *factory)
This method is called by the KXMLGUIFactory as soon as the client is added to the KXMLGUIFactory's GU...
Definition: kxmlguiclient.cpp:550
KXMLGUIClient::unplugActionList
void unplugActionList(const TQString &name)
The complement of plugActionList() ...
Definition: kxmlguiclient.cpp:613
KXMLGUIBuilder
Abstract interface for a "GUI builder", used by the GUIFactory This interface is implemented by TDEMa...
Definition: kxmlguibuilder.h:39
KXMLGUIFactory
KXMLGUIFactory, together with KXMLGUIClient objects, can be used to create a GUI of container widgets...
Definition: kxmlguifactory.h:61
KXMLGUIClient::parentClient
KXMLGUIClient * parentClient() const
KXMLGUIClients can form a simple child/parent object tree.
Definition: kxmlguiclient.cpp:560
KXMLGUIClient::domDocument
virtual TQDomDocument domDocument() const
Definition: kxmlguiclient.cpp:128
KEditToolbarWidget
A widget used to customize or configure toolbars.
Definition: kedittoolbar.h:269
KXMLGUIClient::instance
virtual TDEInstance * instance() const
Definition: kxmlguiclient.cpp:123
KXMLGUIClient::~KXMLGUIClient
virtual ~KXMLGUIClient()
Destructs the KXMLGUIClient.
Definition: kxmlguiclient.cpp:78
KXMLGUIClient::plugActionList
void plugActionList(const TQString &name, const TQPtrList< TDEAction > &actionList)
ActionLists are a way for XMLGUI to support dynamic lists of actions.
Definition: kxmlguiclient.cpp:605
KXMLGUIClient::insertChildClient
void insertChildClient(KXMLGUIClient *child)
Use this method to make a client a child client of another client.
Definition: kxmlguiclient.cpp:565
KXMLGUIClient::clientBuilder
KXMLGUIBuilder * clientBuilder() const
Retrieves the client's GUI builder or 0L if no client specific builder has been assigned via setClien...
Definition: kxmlguiclient.cpp:600
TDEInstance
KXMLGUIClient::xmlFile
virtual TQString xmlFile() const
This will return the name of the XML file as set by setXMLFile().
Definition: kxmlguiclient.cpp:133
KXMLGUIClient::KXMLGUIClient
KXMLGUIClient()
Constructs a KXMLGUIClient which can be used with a KXMLGUIFactory to create a GUI from actions and a...
Definition: kxmlguiclient.cpp:67

tdeui

Skip menu "tdeui"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

tdeui

Skip menu "tdeui"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  •     tdecore
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  • tdeioslave
  •   http
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeui by doxygen 1.8.8
This website is maintained by Timothy Pearson.