Laxkit  0.0.7.1
somedatafactory.h
1 //
2 //
3 // The Laxkit, a windowing toolkit
4 // Please consult http://laxkit.sourceforge.net about where to send any
5 // correspondence about this software.
6 //
7 // This library is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU Library General Public
9 // License as published by the Free Software Foundation; either
10 // version 2 of the License, or (at your option) any later version.
11 //
12 // This library is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 // Library General Public License for more details.
16 //
17 // You should have received a copy of the GNU Library General Public
18 // License along with this library; if not, write to the Free Software
19 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 //
21 // Copyright (C) 2004-2012 by Tom Lechner
22 //
23 #ifndef _LAX_SOMEDATAFACTORY_H
24 #define _LAX_SOMEDATAFACTORY_H
25 
26 #include <lax/interfaces/somedata.h>
27 #include <lax/lists.h>
28 
29 enum LaxInterfaceDataTypes {
30  LAX_BEZDATA,
31  LAX_COLORPATCHDATA,
32  LAX_ELLIPSEDATA,
33  LAX_ENGRAVERFILLDATA,
34  LAX_GRADIENTDATA,
35  LAX_IMAGEDATA,
36  LAX_IMAGEPATCHDATA,
37  LAX_LINESDATA,
38  LAX_PATCHDATA,
39  LAX_PATHSDATA,
40  LAX_RECTDATA,
41  LAX_SOMEDATA,
42  LAX_SOMEDATAREF,
43  LAX_CAPTIONDATA,
44 
45  LAX_DATA_MAX
46 };
47 
48 
49 namespace LaxInterfaces {
50 
51 
52 typedef SomeData *(*NewSomeDataFunc)(SomeData *refobj);
53 typedef int (*DelSomeDataFunc)(SomeData *obj);
54 
55 //---------------------------- SomeFacNode ---------------------------------
57 {
58  public:
59  char *name;
60  int info;
61  int id;
62  NewSomeDataFunc newfunc;
63  DelSomeDataFunc delfunc;
64  SomeFacNode() { info=id=0; name=NULL; }
65  virtual ~SomeFacNode() { delete[] name; }
66 };
67 
68 //---------------------------- SomeDataFactory ---------------------------------
70 {
71  public:
73 
74  virtual ~SomeDataFactory() {}
75  virtual int DefineNewObject(int newid, const char *newname, NewSomeDataFunc newfunc,DelSomeDataFunc delfunc);
76  virtual SomeData *newObject(const char *objtype, SomeData *refobj=NULL);
77  virtual SomeData *newObject(int objtype, SomeData *refobj=NULL);
78  //virtual SomeData *newObject(int id, LaxFiles::Attribute *att);
79  //virtual SomeData *newObject(LaxFiles::Attribute *att);
80  virtual void delObject(SomeData *obj) {}
81 
82  virtual const char *TypeStr(int which);
83  virtual int TypeId(int which);
84  virtual int NumTypes() { return types.n; }
85 };
86 
87 #ifndef SOMEDATAFACTORY_CC
89 #endif
90 
91 } //namespace LaxInterfaces
92 
93 
94 #endif
95 

Mon Feb 17 2014 11:52:57, Laxkit