Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members

FXId.h
Go to the documentation of this file.
1 /********************************************************************************
2 * *
3 * X - O b j e c t *
4 * *
5 *********************************************************************************
6 * Copyright (C) 1997,2006 by Jeroen van der Zijp. All Rights Reserved. *
7 *********************************************************************************
8 * This library is free software; you can redistribute it and/or *
9 * modify it under the terms of the GNU Lesser General Public *
10 * License as published by the Free Software Foundation; either *
11 * version 2.1 of the License, or (at your option) any later version. *
12 * *
13 * This library is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
16 * Lesser General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU Lesser General Public *
19 * License along with this library; if not, write to the Free Software *
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
21 *********************************************************************************
22 * $Id: FXId.h,v 1.18 2006/01/22 17:58:05 fox Exp $ *
23 ********************************************************************************/
24 #ifndef FXID_H
25 #define FXID_H
26 
27 #ifndef FXOBJECT_H
28 #include "FXObject.h"
29 #endif
30 
31 namespace FX {
32 
33 class FXApp;
34 
35 
36 /// Encapsulates server side resource
37 class FXAPI FXId : public FXObject {
39 private:
40  FXApp *app; // Back link to application object
41  void *data; // User data
42 protected:
43  FXID xid;
44 private:
45  FXId(const FXId&);
46  FXId &operator=(const FXId&);
47 protected:
48  FXId():app((FXApp*)-1L),data(NULL),xid(0){}
49  FXId(FXApp* a):app(a),data(NULL),xid(0){}
50 public:
51 
52  /// Get application
53  FXApp* getApp() const { return app; }
54 
55  /// Get XID handle
56  FXID id() const { return xid; }
57 
58  /// Create resource
59  virtual void create(){}
60 
61  /// Detach resource
62  virtual void detach(){}
63 
64  /// Destroy resource
65  virtual void destroy(){}
66 
67  /// Set user data pointer
68  void setUserData(void *ptr){ data=ptr; }
69 
70  /// Get user data pointer
71  void* getUserData() const { return data; }
72 
73  /// Save object to stream
74  virtual void save(FXStream& store) const;
75 
76  /// Load object from stream
77  virtual void load(FXStream& store);
78 
79  /// Destructor
80  virtual ~FXId(){app=(FXApp*)-1L;}
81  };
82 
83 }
84 
85 #endif
unsigned long FXID
Definition: fxdefs.h:442
#define FXAPI
Definition: fxdefs.h:122
Application Object.
Definition: FXApp.h:158
#define FXDECLARE_ABSTRACT(classname)
Macro to set up abstract class declaration.
Definition: FXObject.h:114
#define NULL
Definition: fxdefs.h:41
A stream is a way to serialize data and objects into a byte stream.
Definition: FXStream.h:99
Encapsulates server side resource.
Definition: FXId.h:37
Definition: FX4Splitter.h:31
Object is the base class for all objects in FOX; in order to receive messages from the user interface...
Definition: FXObject.h:166

Copyright © 1997-2005 Jeroen van der Zijp