|
Main Page
Class Hierarchy
Alphabetical List
Compound List
File List
Compound Members
|
00001 /********************************************************************************
00002 * *
00003 * Atomic data target *
00004 * *
00005 *********************************************************************************
00006 * Copyright (C) 2003 by Mathew Robertson. All Rights Reserved. *
00007 *********************************************************************************
00008 * This library is free software; you can redistribute it and/or *
00009 * modify it under the terms of the GNU Lesser General Public *
00010 * License as published by the Free Software Foundation; either *
00011 * version 2.1 of the License, or (at your option) any later version. *
00012 * *
00013 * This library is distributed in the hope that it will be useful, *
00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
00016 * Lesser General Public License for more details. *
00017 * *
00018 * You should have received a copy of the GNU Lesser General Public *
00019 * License along with this library; if not, write to the Free Software *
00020 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
00021 *********************************************************************************/
00022 #ifndef FXATOMICDATATARGET_H
00023 #define FXATOMICDATATARGET_H
00024
00025 #ifndef FXDATATARGET_H
00026 #include <fox/FXDataTarget.h>
00027 using namespace FX;
00028 #endif
00029 namespace FXEX {
00030
00031 /**
00032 * FXAtomicDataTarget is very similar to a normal FXDataTarget. Except that it is
00033 * wrapped up in an FXAtomic so that multiple threads can access the values in the
00034 * valuator widgets (just like a normal data target).
00035 *
00036 * This allows you to create a worker thread (either by using the FXThreadFunction or
00037 * FXThread objects) which continually posts updates to widget values, without requiring
00038 * the programmer to create any glue code.
00039 */
00040 class FXAPI FXAtomicIntDataTarget : public FXDataTarget {
00041 FXDECLARE(FXAtomicIntDataTarget)
00042
00043 public:
00044 enum {
00045 DT_ATOMIC_INT=FXDataTarget::DT_LAST,
00046 DT_LAST
00047 };
00048
00049 public:
00050 long onCmdValue(FXObject*,FXSelector,void*);
00051 long onUpdValue(FXObject*,FXSelector,void*);
00052 long onCmdOption(FXObject*,FXSelector,void*);
00053 long onUpdOption(FXObject*,FXSelector,void*);
00054
00055 public:
00056 /// Create an atomic DataTarget
00057 FXAtomicIntDataTarget(FXObject *tgt=NULL,FXSelector sel=0);
00058
00059 /// Create an atomic DataTarget, and connect it
00060 FXAtomicIntDataTarget(FXAtomicInt &a,FXObject *tgt=NULL,FXSelector sel=0);
00061
00062 /// Associate with / connect to an atomic int
00063 void connect(FXAtomicInt &a);
00064
00065 /// dtor
00066 virtual ~FXAtomicIntDataTarget() {}
00067 };
00068
00069 } // namespace FXEX
00070 #endif // FXATOMICDATATARGET_H
00071