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 / kclipboard.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-11-08  |  3.4 KB  |  124 lines

  1. /* This file is part of the KDE libraries
  2.     Copyright (C) 2002 Carsten Pfeiffer <pfeiffer@kde.org>
  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 version 2, as published by the Free Software Foundation.
  7.  
  8.     This library is distributed in the hope that it will be useful,
  9.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  10.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  11.     Library General Public License for more details.
  12.  
  13.     You should have received a copy of the GNU Library General Public License
  14.     along with this library; see the file COPYING.LIB.  If not, write to
  15.     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  16.     Boston, MA 02110-1301, USA.
  17. */
  18.  
  19. #ifndef KCLIPBOARD_H
  20. #define KCLIPBOARD_H
  21.  
  22. #include <qclipboard.h>
  23. #include <qmime.h>
  24. #include <qobject.h>
  25. #include <qstrlist.h>
  26. #include "kdelibs_export.h"
  27.  
  28. /**
  29.  * This class is only for internal use.
  30.  *
  31.  * @short Allowing to automatically synchronize the X11 Clipboard and Selection buffers.
  32.  * @author Carsten Pfeiffer <pfeiffer@kde.org>
  33.  * @since 3.1
  34.  * @internal
  35.  */
  36. class KDECORE_EXPORT KClipboardSynchronizer : public QObject
  37. {
  38.     Q_OBJECT
  39.  
  40. public:
  41.     /** Systray widget for manipulating the clipboard. */
  42.     friend class KlipperWidget;
  43.     friend class KApplication;
  44.  
  45.     /**
  46.      * Returns the KClipboardSynchronizer singleton object.
  47.      * @return the KClipboardSynchronizer singleton object.
  48.      */
  49.     static KClipboardSynchronizer *self();
  50.  
  51.     /**
  52.      * Configures KClipboardSynchronizer to synchronize the Selection to Clipboard whenever
  53.      * it changes.
  54.      *
  55.      * Default is false.
  56.      * @see isSynchronizing
  57.      */
  58.     static void setSynchronizing( bool sync );
  59.  
  60.     /**
  61.      * Checks whether Clipboard and Selection will be synchronized upon changes.
  62.      * @returns whether Clipboard and Selection will be synchronized upon
  63.      * changes.
  64.      * @see setSynchronizing
  65.      */
  66.     static bool isSynchronizing()
  67.     {
  68.         return s_sync;
  69.     }
  70.  
  71.     /**
  72.      * Configures KClipboardSynchronizer to copy the Clipboard buffer to the Selection
  73.      * buffer whenever the Clipboard changes.
  74.      *
  75.      *
  76.      * @param enable true to enable implicit selection, false otherwise.
  77.      * Default is true.
  78.      * @see selectionSetting
  79.      */
  80.     static void setReverseSynchronizing( bool enable );
  81.  
  82.     /**
  83.      * Checks whether the  Clipboard buffer will be copied to the Selection
  84.      * buffer upon changes.
  85.      * @returns whether the Clipboard buffer will be copied to the Selection
  86.      * buffer upon changes.
  87.      * @see setSelectionSetting
  88.      */
  89.     static bool isReverseSynchronizing()
  90.     {
  91.         return s_reverse_sync;
  92.     }
  93.  
  94.  
  95. protected:
  96.     ~KClipboardSynchronizer();
  97.  
  98. private slots:
  99.     void slotSelectionChanged();
  100.     void slotClipboardChanged();
  101.  
  102. private:
  103.     KClipboardSynchronizer( QObject *parent = 0, const char *name = 0L );
  104.     void setupSignals();
  105.  
  106.     static void setClipboard( QMimeSource* data, QClipboard::Mode mode );
  107.  
  108.     static KClipboardSynchronizer *s_self;
  109.     static bool s_sync;
  110.     static bool s_reverse_sync;
  111.     static bool s_blocked;
  112.  
  113.     class MimeSource;
  114.  
  115. private:
  116.     // needed by klipper
  117.     enum Configuration { Synchronize = 1 };
  118.     // called by KApplication upon kipc message, invoked by klipper
  119.     static void newConfiguration( int config );
  120.  
  121. };
  122.  
  123. #endif // KCLIPBOARD_H
  124.