source: OGRE/trunk/ogrenew/Dependencies/include/CEGUI/CEGUIFactoryModule.h @ 657

Revision 657, 4.1 KB checked in by mattausch, 19 years ago (diff)

added ogre dependencies and patched ogre sources

Line 
1/************************************************************************
2        filename:       CEGUIFactoryModule.h
3        created:        12/4/2004
4        author:         Paul D Turner
5       
6        purpose:        Defines interface for object that controls a loadable
7                                module (.dll/.so/ whatever) that contains concrete
8                                window / widget implementations and their factories.
9*************************************************************************/
10/*************************************************************************
11    Crazy Eddie's GUI System (http://www.cegui.org.uk)
12    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
13
14    This library is free software; you can redistribute it and/or
15    modify it under the terms of the GNU Lesser General Public
16    License as published by the Free Software Foundation; either
17    version 2.1 of the License, or (at your option) any later version.
18
19    This library is distributed in the hope that it will be useful,
20    but WITHOUT ANY WARRANTY; without even the implied warranty of
21    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
22    Lesser General Public License for more details.
23
24    You should have received a copy of the GNU Lesser General Public
25    License along with this library; if not, write to the Free Software
26    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
27*************************************************************************/
28#ifndef _CEGUIFactoryModule_h_
29#define _CEGUIFactoryModule_h_
30
31/*************************************************************************
32        The following is basically taken from DynLib.h, which is part of
33        the Ogre project (http://www.ogre3d.org/)
34*************************************************************************/
35#if defined(__WIN32__) || defined(_WIN32)
36#    define DYNLIB_HANDLE hInstance
37#    define DYNLIB_LOAD( a ) LoadLibrary( a )
38#    define DYNLIB_GETSYM( a, b ) GetProcAddress( a, b )
39#    define DYNLIB_UNLOAD( a ) !FreeLibrary( a )
40#    define DYNLIB_ERROR( )  "Unknown Error"
41
42        struct HINSTANCE__;
43        typedef struct HINSTANCE__* hInstance;
44
45#elif defined(__linux__)
46#    define DYNLIB_HANDLE void*
47#    define DYNLIB_LOAD( a ) dlopen( a, RTLD_LAZY )
48#    define DYNLIB_GETSYM( a, b ) dlsym( a, b )
49#    define DYNLIB_UNLOAD( a ) dlclose( a )
50#    define DYNLIB_ERROR( ) dlerror( )
51
52#elif defined(__APPLE_CC__)
53#    define DYNLIB_HANDLE CFBundleRef
54#    define DYNLIB_LOAD( a ) mac_loadExeBundle( a )
55#    define DYNLIB_GETSYM( a, b ) mac_getBundleSym( a, b )
56#    define DYNLIB_UNLOAD( a ) mac_unloadExeBundle( a )
57#    define DYNLIB_ERROR( ) mac_errorBundle()
58#endif
59
60
61// Start of CEGUI namespace section
62namespace CEGUI
63{
64
65/*!
66\brief
67        Class that encapsulates access to a dynamic loadable module containing implementations of Windows, Widgets, and their factories.
68*/
69class FactoryModule
70{
71public:
72        /*!
73        \brief
74                Construct the FactoryModule object by loading the dynamic loadable module specified.
75
76        \param filename
77                String object holding the filename of a loadable module.
78
79        \return
80                Nothing
81        */
82        FactoryModule(const String& filename);
83
84
85        /*!
86        \brief
87                Destroys the FactoryModule object and unloads any loadable module.
88
89        \return
90                Nothing
91        */
92        virtual ~FactoryModule(void);
93
94
95        /*!
96        \brief
97                Register a WindowFactory for \a type Windows.
98
99        \param type
100                String object holding the name of the Window type a factory is to be registered for.
101
102        \return
103                Nothing.
104        */
105        void    registerFactory(const String& type) const;
106
107private:
108        /*************************************************************************
109                Implementation Data
110        *************************************************************************/
111        static const char       RegisterFactoryFunctionName[];
112
113        typedef void (*FactoryRegisterFunction)(const String&);
114
115        FactoryRegisterFunction d_regFunc;      //!< Pointer to the function called to register factories.
116        String                  d_moduleName;           //!< Holds the name of the loaded module.
117        DYNLIB_HANDLE   d_handle;                       //!< Pointer to a ImplDat derived class that can hold any required implementation data
118};
119
120} // End of  CEGUI namespace section
121
122
123#endif  // end of guard _CEGUIFactoryModule_h_
Note: See TracBrowser for help on using the repository browser.