00001 /******************************************************************************** 00002 * * 00003 * X - O b j e c t * 00004 * * 00005 ********************************************************************************* 00006 * Copyright (C) 1997,2006 by Jeroen van der Zijp. 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 * $Id: FXId.h,v 1.18 2006/01/22 17:58:05 fox Exp $ * 00023 ********************************************************************************/ 00024 #ifndef FXID_H 00025 #define FXID_H 00026 00027 #include "FXApp.h" 00028 00029 namespace FX { 00030 00032 class FXAPI FXId : public FXObject { 00033 FXDECLARE_ABSTRACT(FXId) 00034 private: 00035 FXApp *app; // Back link to application object 00036 FXEventLoop *eventLoop; // Back link to event loop 00037 void *data; // User data 00038 protected: 00039 FXID xid; 00040 private: 00041 FXId(const FXId&); 00042 FXId &operator=(const FXId&); 00043 protected: 00044 FXId():app((FXApp*)-1L),eventLoop((FXEventLoop*)-1L),data(NULL),xid(0){} 00045 FXId(FXApp* a):app(a),eventLoop(a->getEventLoop()),data(NULL),xid(0){} 00046 public: 00047 00049 FXApp* getApp() const { return app; } 00050 00052 FXEventLoop* getEventLoop() const { return eventLoop; } 00053 00055 FXID id() const { return xid; } 00056 00058 virtual void create(){} 00059 00061 virtual void detach(){} 00062 00064 virtual void destroy(){} 00065 00067 void setUserData(void *ptr){ data=ptr; } 00068 00070 void* getUserData() const { return data; } 00071 00073 virtual void save(FXStream& store) const; 00074 00076 virtual void load(FXStream& store); 00077 00079 virtual ~FXId(){app=(FXApp*)-1L;} 00080 }; 00081 00082 } 00083 00084 #endif