/usr/include/cegui-0.8.4/CEGUI/WindowFactory.h is in libcegui-mk2-dev 0.8.4+dfsg-4ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 | /***********************************************************************
created: 21/2/2004
author: Paul D Turner
purpose: Defines abstract base class for WindowFactory objects
*************************************************************************/
/***************************************************************************
* Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
***************************************************************************/
#ifndef _CEGUIWindowFactory_h_
#define _CEGUIWindowFactory_h_
#include "CEGUI/Base.h"
#include "CEGUI/String.h"
#include "CEGUI/Window.h"
/*!
\brief
Declares a window factory class.
\param T
The window class name.
\note
The class that will be generated is is named <classname>Factory.
A statement like this:
CEGUI_DECLARE_WINDOW_FACTORY(MyWidget);
Would generate a factory class named MyWidgetFactory.
The factory is automatically instantiated and for the example it would
be available as:
WindowFactory* wf = &(getMyWidgetFactory());
or
WindowFactory* wf = &CEGUI_WINDOW_FACTORY(MyWidget);
*/
#define CEGUI_DECLARE_WINDOW_FACTORY( T )\
class T ## Factory : public WindowFactory\
{\
public:\
T ## Factory() : WindowFactory( T::WidgetTypeName ) {}\
Window* createWindow(const String& name)\
{\
return CEGUI_NEW_AO T(d_type, name);\
}\
void destroyWindow(Window* window)\
{\
CEGUI_DELETE_AO window;\
}\
};\
T ## Factory& get ## T ## Factory();
/*!
\brief
Generates code for the constructor for the instance of the window factory
generated from the class name \a T
*/
#define CEGUI_DEFINE_WINDOW_FACTORY( T )\
T ## Factory& get ## T ## Factory()\
{\
static T ## Factory s_factory;\
return s_factory;\
}
/*!
\brief
Helper macro that return the real factory class name from a given class
name \a T
*/
#define CEGUI_WINDOW_FACTORY( T ) (get ## T ## Factory())
// Start of CEGUI namespace section
namespace CEGUI
{
/*!
\brief
Abstract class that defines the required interface for all WindowFactory
objects.
A WindowFactory is used to create and destroy windows of a specific type.
For every type of Window object wihin the system (widgets, dialogs, movable
windows etc) there must be an associated WindowFactory registered with the
WindowFactoryManager so that the system knows how to create and destroy
those types of Window base object.
\note
The use if of the CEGUI_DECLARE_WINDOW_FACTORY, CEGUI_DEFINE_WINDOW_FACTORY
and CEGUI_WINDOW_FACTORY macros is deprecated in favour of the
template class TplWindowFactory and templatised
WindowFactoryManager::addFactory function, whereby you no longer need to
directly create any supporting structure for your new window type, and can
simply do:
\code
CEGUI::WindowFactoryManager::addFactory<TplWindowFactory<MyWidget> >();
\endcode
*/
class CEGUIEXPORT WindowFactory :
public AllocatedObject<WindowFactory>
{
public:
/*!
\brief
Create a new Window object of whatever type this WindowFactory produces.
\param name
A unique name that is to be assigned to the newly created Window object
\return
Pointer to the new Window object.
*/
virtual Window* createWindow(const String& name) = 0;
/*!
\brief
Destroys the given Window object.
\param window
Pointer to the Window object to be destroyed.
\return
Nothing.
*/
virtual void destroyWindow(Window* window) = 0;
/*!
\brief
Get the string that describes the type of Window object this
WindowFactory produces.
\return
String object that contains the unique Window object type produced by
this WindowFactory
*/
const String& getTypeName() const
{ return d_type; }
//! Destructor.
virtual ~WindowFactory()
{}
protected:
//! Constructor
WindowFactory(const String& type) :
d_type(type)
{}
protected:
//! String holding the type of object created by this factory.
String d_type;
};
} // End of CEGUI namespace section
#endif // end of guard _CEGUIWindowFactory_h_
|