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

tderesources

  • tderesources
resource.h
1 /*
2  This file is part of libtderesources
3 
4  Copyright (c) 2001-2003 Cornelius Schumacher <schumacher@kde.org>
5  Copyright (c) 2002 Jan-Pascal van Best <janpascal@vanbest.org>
6 
7  This library is free software; you can redistribute it and/or
8  modify it under the terms of the GNU Library General Public
9  License as published by the Free Software Foundation; either
10  version 2 of the License, or (at your option) any later version.
11 
12  This library is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  Library General Public License for more details.
16 
17  You should have received a copy of the GNU Library General Public License
18  along with this library; see the file COPYING.LIB. If not, write to
19  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20  Boston, MA 02110-1301, USA.
21 */
22 #ifndef TDERESOURCES_RESOURCE_H
23 #define TDERESOURCES_RESOURCE_H
24 
25 #include <tqmutex.h>
26 #include <tqvaluelist.h>
27 #include <tqwidget.h>
28 
29 #include <klibloader.h>
30 
31 class TDEConfig;
32 
33 namespace KRES {
34 
35 class ConfigWidget;
36 
255 class TDERESOURCES_EXPORT Resource : public TQObject
256 {
257  friend class Factory;
258  friend class ManagerImpl;
259 
260  Q_OBJECT
261  public:
262  typedef TQValueList<Resource *> List;
263 
269  Resource( const TDEConfig *config );
270 
274  virtual ~Resource();
275 
282  virtual void writeConfig( TDEConfig *config );
283 
293  bool open();
294 
301  void close();
302 
306  bool isOpen() const;
307 
314  TQString identifier() const;
315 
319  TQString type() const;
320 
325  virtual void setReadOnly( bool value );
326 
330  virtual bool readOnly() const;
331 
336  virtual void setResourceName( const TQString &name );
337 
341  virtual TQString resourceName() const;
342 
346  void setActive( bool active );
347 
351  bool isActive() const;
352 
356  virtual void dump() const;
357 
358  protected:
368  virtual bool doOpen() { return true; }
369 
374  virtual void doClose() {}
375 
376  void setIdentifier( const TQString &identifier );
377  void setType( const TQString &type );
378 
379  private:
380  class ResourcePrivate;
381  ResourcePrivate *d;
382 };
383 
384 class TDERESOURCES_EXPORT PluginFactoryBase : public KLibFactory
385 {
386  public:
387  virtual Resource *resource( const TDEConfig *config ) = 0;
388 
389  virtual ConfigWidget *configWidget( TQWidget *parent ) = 0;
390 
391  protected:
392  virtual TQObject* createObject( TQObject *parent, const char *name, const char *className,
393  const TQStringList & args)
394  {
395  Q_UNUSED(parent);
396  Q_UNUSED(name);
397  Q_UNUSED(className);
398  Q_UNUSED(args);
399  return 0;
400  }
401 };
402 
403 template<class TR,class TC>
404 class PluginFactory : public PluginFactoryBase
405 {
406  public:
407  Resource *resource( const TDEConfig *config )
408  {
409  return new TR( config );
410  }
411 
412  ConfigWidget *configWidget( TQWidget *parent )
413  {
414  return new TC( parent );
415  }
416 };
417 
418 }
419 
420 #endif
KRES
Definition: configdialog.h:31
KRES::Resource
This class provides a resource which is managed in a general way.
Definition: resource.h:255
KRES::Resource::doClose
virtual void doClose()
Close this resource.
Definition: resource.h:374
KRES::Factory
Class for loading resource plugins.
Definition: factory.h:62
KRES::Resource::doOpen
virtual bool doOpen()
Open this resource.
Definition: resource.h:368

tderesources

Skip menu "tderesources"
  • Main Page
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members

tderesources

Skip menu "tderesources"
  • 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 tderesources by doxygen 1.8.8
This website is maintained by Timothy Pearson.