home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / ksharedpixmap.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-09-10  |  3.1 KB  |  116 lines

  1. /* vi: ts=8 sts=4 sw=4
  2.  *
  3.  * $Id: ksharedpixmap.h 363180 2004-11-15 14:50:36Z mueller $
  4.  *
  5.  * This file is part of the KDE libraries.
  6.  * Copyright (C) 1999,2000 Geert Jansen <jansen@kde.org>
  7.  *
  8.  * This library is free software; you can redistribute it and/or
  9.  * modify it under the terms of the GNU Library General Public
  10.  * License as published by the Free Software Foundation; either
  11.  * version 2 of the License, or (at your option) any later version.
  12.  */
  13.  
  14. #ifndef __KSharedPixmap_h_Included__
  15. #define __KSharedPixmap_h_Included__
  16.  
  17. #include <kpixmap.h>
  18.  
  19. #ifdef Q_WS_X11
  20.  
  21. #include <qstring.h>
  22. #include <qpixmap.h>
  23. #include <qwidget.h>
  24.  
  25. class KSharedPixmapPrivate;
  26.  
  27. /**
  28.  * Shared pixmap client.
  29.  *
  30.  * A shared pixmap is a pixmap that resides on the X server, is referenced
  31.  * by a global id string, and can be accessed by all X clients.
  32.  *
  33.  * This class is a client class to shared pixmaps in KDE. You can use it
  34.  * to copy (a part of) a shared pixmap into. KSharedPixmap inherits KPixmap
  35.  * for that purpose.
  36.  *
  37.  * The server part of shared pixmaps is not implemented here. 
  38.  * That part is provided by KPixmapServer, in the source file:
  39.  * kdebase/kdesktop/pixmapserver.cc.
  40.  *
  41.  * An example: copy from a shared pixmap:
  42.  * \code
  43.  *   KSharedPixmap *pm = new KSharedPixmap;
  44.  *   connect(pm, SIGNAL(done(bool)), SLOT(slotDone(bool)));
  45.  *   pm->loadFromShared("My Pixmap");
  46.  * \endcode
  47.  *
  48.  * @author Geert Jansen <jansen@kde.org>
  49.  * @version $Id: ksharedpixmap.h 363180 2004-11-15 14:50:36Z mueller $
  50.  *
  51.  */
  52. class KDEUI_EXPORT KSharedPixmap: 
  53.     public QWidget,
  54.     public KPixmap
  55. {
  56.     Q_OBJECT
  57.  
  58. public:
  59.  
  60.     /**
  61.      * Construct an empty pixmap.
  62.      */
  63.     KSharedPixmap();
  64.  
  65.     /**
  66.      * Destroys the pixmap.
  67.      */
  68.     ~KSharedPixmap();
  69.  
  70.     /**
  71.      * Load from a shared pixmap reference. The signal done() is emitted
  72.      * when the operation has finished.
  73.      *
  74.      * @param name The shared pixmap name.
  75.      * @param rect If you pass a nonzero rectangle, a tile is generated which 
  76.      * is able to fill up the specified rectangle completely. This is solely 
  77.      * for optimization: in some cases the tile will be much smaller than the 
  78.      * original pixmap. It reflects KSharedPixmap's original use: sharing
  79.      * of the desktop background to achieve pseudo transparency.
  80.      * @return True if the shared pixmap exists and loading has started
  81.      * successfully, false otherwise.
  82.      */
  83.     bool loadFromShared(const QString & name, const QRect & rect=QRect());
  84.  
  85.     /**
  86.      * Check whether a shared pixmap is available.
  87.      *
  88.      * @param name The shared pixmap name.
  89.      * @return True if the shared pixmap is available, false otherwise.
  90.      */
  91.     bool isAvailable(const QString & name) const;
  92.  
  93. signals:
  94.     /** 
  95.      * This signal is raised when a pixmap load operation has finished.
  96.      *
  97.      * @param success True if successful, false otherwise.
  98.      */
  99.     void done(bool success);
  100.  
  101. protected:
  102.     bool x11Event(XEvent *);
  103.     
  104. private:
  105.     bool copy(const QString & id, const QRect & rect);
  106.     void init();
  107.  
  108.     KSharedPixmapPrivate *d;
  109. };
  110. #else // WIN32, Qt Embedded
  111. // Let's simply assume KPixmap will do for now. Yes, I know that's broken.
  112. #define KSharedPixmap KPixmap
  113. #endif
  114.  
  115. #endif
  116.