Crazy Eddie's GUI System  0.8.4
CEGUI::System Class Reference

The System class is the CEGUI class that provides access to all other elements in this system. More...

+ Inheritance diagram for CEGUI::System:
+ Collaboration diagram for CEGUI::System:

List of all members.

Public Member Functions

RenderergetRenderer (void) const
 Return a pointer to the Renderer object being used by the system.
ClipboardgetClipboard () const
 Retrieves internal CEGUI clipboard, optionally synced with system wide clipboard.
GUIContextgetDefaultGUIContext () const
void renderAllGUIContexts ()
 Depending upon the internal state, for each GUIContext this may either re-use cached rendering from last time or trigger a full re-draw of all elements.
ScriptModulegetScriptingModule (void) const
 Return a pointer to the ScriptModule being used for scripting within the GUI system.
void setScriptingModule (ScriptModule *scriptModule)
 Set the ScriptModule to be used for scripting within the GUI system.
ResourceProvidergetResourceProvider (void) const
 Return a pointer to the ResourceProvider being used within the GUI system.
void executeScriptFile (const String &filename, const String &resourceGroup="") const
 Execute a script file if possible.
int executeScriptGlobal (const String &function_name) const
 Execute a scripted global function if possible. The function should not take any parameters and should return an integer.
void executeScriptString (const String &str) const
 If possible, execute script code contained in the given CEGUI::String object.
void setXMLParser (const String &parserName)
 Set a new XML parser module to be used.
void setXMLParser (XMLParser *parser)
 Sets the XMLParser object to be used by the system.
XMLParsergetXMLParser (void) const
 Return the XMLParser object.
ImageCodecgetImageCodec () const
 Retrieve the image codec to be used by the system.
void setImageCodec (const String &codecName)
 Set the image codec to be used by the system.
void setImageCodec (ImageCodec &codec)
 Set the image codec to use from an existing image codec.
void notifyDisplaySizeChanged (const Sizef &new_size)
 Notification function to be called when the main display changes size. Client code should call this function when the host window changes size, or if the display resolution is changed in full-screen mode.
RenderedStringParsergetDefaultCustomRenderedStringParser () const
 Return pointer to the currently set global default custom RenderedStringParser object.
void setDefaultCustomRenderedStringParser (RenderedStringParser *parser)
 Set the global default custom RenderedStringParser object. This change is reflected the next time an affected window reparses it's text. This may be set to 0 for no system wide custom parser (which is the default).
void invalidateAllCachedRendering ()
 Invalidate all imagery and geometry caches for CEGUI managed elements.
RegexMatchercreateRegexMatcher () const
 Create a RegexMatcher instance if support is available.
void destroyRegexMatcher (RegexMatcher *rm) const
 destroy a RegexMatcher instance returned by System::createRegexMatcher.
bool injectTimePulse (float timeElapsed)
 call this to ensure system-level time based updates occur.
GUIContextcreateGUIContext (RenderTarget &rt)
void destroyGUIContext (GUIContext &context)
void addStandardWindowFactories ()
 adds factories for all the basic window types

Static Public Member Functions

static Systemcreate (Renderer &renderer, ResourceProvider *resourceProvider=0, XMLParser *xmlParser=0, ImageCodec *imageCodec=0, ScriptModule *scriptModule=0, const String &configFile="", const String &logFile="CEGUI.log", const int abi=CEGUI_VERSION_ABI)
 Create the System object and return a reference to it.
static void destroy ()
 Destroy the System object.
static unsigned int getMajorVersion ()
 Retrieves CEGUI's major version as an integer.
static unsigned int getMinorVersion ()
 Retrieves CEGUI's minor version as an integer.
static unsigned int getPatchVersion ()
 Retrieves CEGUI's patch version as an integer.
static const StringgetVersion ()
 Retrieves CEGUI's "short" version ("1.2.3" for example)
static const StringgetVerboseVersion ()
 Retrieves CEGUI's "verbose" version, includes info about compiler, platform, etc...
static SystemgetSingleton (void)
 Return singleton System object.
static SystemgetSingletonPtr (void)
 Return pointer to singleton System object.
static void setDefaultXMLParserName (const String &parserName)
 Static member to set the name of the default XML parser module that should be used.
static const String getDefaultXMLParserName ()
 Return the name of the currently set default xml parser module.
static void setDefaultImageCodecName (const String &codecName)
 Set the name of the default image codec to be used.
static const StringgetDefaultImageCodecName ()
 Get the name of the default image codec.
static const StringTranscodergetStringTranscoder ()
 Return the system StringTranscoder object.
static void performVersionTest (const int expected, const int received, const String &func)
 Internal CEGUI version validation function.

Static Public Attributes

static const String EventNamespace
 Namespace for global events.
static const String EventDisplaySizeChanged
static const String EventRenderedStringParserChanged

Protected Types

typedef std::vector
< GUIContext
*CEGUI_VECTOR_ALLOC(GUIContext *) 
GUIContextCollection )

Protected Member Functions

 System (Renderer &renderer, ResourceProvider *resourceProvider, XMLParser *xmlParser, ImageCodec *imageCodec, ScriptModule *scriptModule, const String &configFile, const String &logFile)
 Construct a new System object.
 ~System (void)
 Destructor for System objects.
void outputLogHeader ()
 output the standard log header
void createSingletons ()
 create the other core system singleton objects (except the logger)
void destroySingletons ()
 cleanup the core system singleton objects
void setupXMLParser ()
 handle creation and initialisation of the XML parser.
void cleanupXMLParser ()
 handle cleanup of the XML parser
void setupImageCodec (const String &codecName)
 setup image codec
void cleanupImageCodec ()
 cleanup image codec
void invalidateAllWindows ()
 invalidate all windows and any rendering surfaces they may be using.

Protected Attributes

Rendererd_renderer
 Holds the pointer to the Renderer object given to us in the constructor.
ResourceProviderd_resourceProvider
 Holds the pointer to the ResourceProvider object given to us by the renderer or the System constructor.
bool d_ourResourceProvider
Clipboardd_clipboard
 Internal clipboard with optional sync with native clipboard.
ScriptModuled_scriptModule
 Points to the scripting support module.
String d_termScriptName
 Name of the script to run upon system shutdown.
XMLParserd_xmlParser
 XMLParser object we use to process xml files.
bool d_ourXmlParser
 true when we created the xml parser.
DynamicModuled_parserModule
ImageCodecd_imageCodec
 Holds a pointer to the image codec to use.
bool d_ourImageCodec
 true when we created the image codec.
DynamicModuled_imageCodecModule
bool d_ourLogger
 true when we created the CEGUI::Logger based object.
RenderedStringParserd_customRenderedStringParser
 currently set global RenderedStringParser.
GUIContextCollection d_guiContexts

Static Protected Attributes

static String d_defaultXMLParserName
 pointer to parser module.
static String d_defaultImageCodecName
 Holds the name of the default codec to use.
static const IconvStringTranscoder d_stringTranscoder
 instance of class that can convert string encodings

Detailed Description

The System class is the CEGUI class that provides access to all other elements in this system.

This object must be created by the client application. The System object requires that you pass it an initialised Renderer object which it can use to interface to whatever rendering system will be used to display the GUI imagery.


Constructor & Destructor Documentation

CEGUI::System::System ( Renderer renderer,
ResourceProvider resourceProvider,
XMLParser xmlParser,
ImageCodec imageCodec,
ScriptModule scriptModule,
const String configFile,
const String logFile 
) [protected]

Construct a new System object.

Parameters:
rendererReference to a valid Renderer object that will be used to render GUI imagery.
resourceProviderPointer to a ResourceProvider object, or NULL to use whichever default the Renderer provides.
xmlParserPointer to a valid XMLParser object to be used when parsing XML files, or NULL to use a default parser.
imageCodecPointer to a valid ImageCodec object to be used when loading image files, or NULL to use a default image codec.
scriptModulePointer to a ScriptModule object. may be NULL for none.
configFileString object containing the name of a configuration file to use.
logFileString object containing the name to use for the log file.

Member Function Documentation

adds factories for all the basic window types

You do not need to call this manually! Standard Window factories will be added automatically. One occasion when you will need this is if you remove all window factories from WindowFactoryManager and want to add the standard ones back

static System& CEGUI::System::create ( Renderer renderer,
ResourceProvider resourceProvider = 0,
XMLParser xmlParser = 0,
ImageCodec imageCodec = 0,
ScriptModule scriptModule = 0,
const String configFile = "",
const String logFile = "CEGUI.log",
const int  abi = CEGUI_VERSION_ABI 
) [static]

Create the System object and return a reference to it.

Parameters:
rendererReference to a valid Renderer object that will be used to render GUI imagery.
resourceProviderPointer to a ResourceProvider object, or NULL to use whichever default the Renderer provides.
xmlParserPointer to a valid XMLParser object to be used when parsing XML files, or NULL to use a default parser.
imageCodecPointer to a valid ImageCodec object to be used when loading image files, or NULL to use a default image codec.
scriptModulePointer to a ScriptModule object. may be NULL for none.
configFileString object containing the name of a configuration file to use.
logFileString object containing the name to use for the log file.
abiThis must be set to CEGUI_VERSION_ABI

Create a RegexMatcher instance if support is available.

Returns:
Pointer to an object that implements the RegexMatcher interface, or 0 if the system has no built in support for RegexMatcher creation.
Note:
The created RegexMatcher is not tracked in any way, and it is the resposibility of the caller to destroy the RegexMatcher when it is no longer needed by calling System::destroyRegexMatcher.
void CEGUI::System::executeScriptFile ( const String filename,
const String resourceGroup = "" 
) const

Execute a script file if possible.

Parameters:
filenameString object holding the filename of the script file that is to be executed
resourceGroupResource group identifier to be passed to the ResourceProvider when loading the script file.
int CEGUI::System::executeScriptGlobal ( const String function_name) const

Execute a scripted global function if possible. The function should not take any parameters and should return an integer.

Parameters:
function_nameString object holding the name of the function, in the global script environment, that is to be executed.
Returns:
The integer value returned from the script function.
void CEGUI::System::executeScriptString ( const String str) const

If possible, execute script code contained in the given CEGUI::String object.

Parameters:
strString object holding the valid script code that should be executed.
Returns:
Nothing.

Return pointer to the currently set global default custom RenderedStringParser object.

The returned RenderedStringParser is used for all windows that have parsing enabled and no custom RenderedStringParser set on the window itself.

If this global custom RenderedStringParser is set to 0, then all windows with parsing enabled and no custom RenderedStringParser set on the window itself will use the systems BasicRenderedStringParser.

Return the name of the currently set default xml parser module.

Returns:
String holding the currently set default xml parser name. Note that if this name has been changed after instantiating the system, the name returned may not actually correspond to the module in use.
static unsigned int CEGUI::System::getMajorVersion ( ) [static]

Retrieves CEGUI's major version as an integer.

Note:
API/headers major version is a macro called CEGUI_MAJOR_VERSION, this returns the version your application is linking to
static unsigned int CEGUI::System::getMinorVersion ( ) [static]

Retrieves CEGUI's minor version as an integer.

Note:
API/headers minor version is a macro called CEGUI_MINOR_VERSION, this returns the version your application is linking to
static unsigned int CEGUI::System::getPatchVersion ( ) [static]

Retrieves CEGUI's patch version as an integer.

Note:
API/headers patch version is a macro called CEGUI_PATCH_VERSION, this returns the version your application is linking to
Renderer* CEGUI::System::getRenderer ( void  ) const [inline]

Return a pointer to the Renderer object being used by the system.

Returns:
Pointer to the Renderer object used by the system.

Return a pointer to the ResourceProvider being used within the GUI system.

Returns:
Pointer to a ResourceProvider based object.

Referenced by CEGUI::NamedXMLResourceManager< T, U >::createAll().

Return a pointer to the ScriptModule being used for scripting within the GUI system.

Returns:
Pointer to a ScriptModule based object.
static System& CEGUI::System::getSingleton ( void  ) [static]
static System* CEGUI::System::getSingletonPtr ( void  ) [static]

Return pointer to singleton System object.

Returns:
Pointer to singleton System object

Reimplemented from CEGUI::Singleton< System >.

static const String& CEGUI::System::getVerboseVersion ( ) [static]

Retrieves CEGUI's "verbose" version, includes info about compiler, platform, etc...

Note:
API/headers verbose version can be constructed using various compiler specific macros, this returns the version your application is linking to
static const String& CEGUI::System::getVersion ( ) [static]

Retrieves CEGUI's "short" version ("1.2.3" for example)

Note:
API/headers version can be constructed using CEGUI_*_VERSION macros, this returns the version your application is linking to

Invalidate all imagery and geometry caches for CEGUI managed elements.

This function will invalidate the caches used for both imagery and geometry for all content that is managed by the core CEGUI manager objects, causing a full and total redraw of that content. This includes Window object's cached geometry, rendering surfaces and rendering windows and the mouse pointer geometry.

void CEGUI::System::notifyDisplaySizeChanged ( const Sizef new_size)

Notification function to be called when the main display changes size. Client code should call this function when the host window changes size, or if the display resolution is changed in full-screen mode.

Calling this function ensures that any other parts of the system that need to know about display size changes are notified. This affects things such as the MouseCursor default constraint area, and also the auto-scale functioning of Imagesets and Fonts.

Note:
This function will also fire the System::EventDisplaySizeChanged event.
Parameters:
new_sizeSize object describing the new display size in pixels.

Set the global default custom RenderedStringParser object. This change is reflected the next time an affected window reparses it's text. This may be set to 0 for no system wide custom parser (which is the default).

The set RenderedStringParser is used for all windows that have parsing enabled and no custom RenderedStringParser set on the window itself.

If this global custom RenderedStringParser is set to 0, then all windows with parsing enabled and no custom RenderedStringParser set on the window itself will use the systems BasicRenderedStringParser.

static void CEGUI::System::setDefaultXMLParserName ( const String parserName) [static]

Static member to set the name of the default XML parser module that should be used.

If you want to modify the default parser from the one compiled in, you need to call this static member prior to instantiating the main CEGUI::System object.

Note that calling this member to change the name of the default module after CEGUI::System, and therefore the default xml parser, has been created will have no real effect - the default parser name will be updated, though no actual changes to the xml parser module will occur.

The built-in options for this are:

Whether these are actually available, depends upon how you built the system. If you have some custom parser, you can provide the name of that here to have it used as the default, though note that the final filename of the parser module should be of the form:

[prefix]CEGUI[parserName][suffix]

where:

  • [prefix] is some optional prefix; like 'lib' on linux.
  • CEGUI is a required prefix.
  • [parserName] is the name of the parser, as supplied to this function.
  • [suffix] is the filename suffix, like .dll or .so

Final module filenames are, thus, of the form:

  • CEGUIXercesParser.dll
  • libCEGUIXercesParser.so
Parameters:
parserNameString describing the name of the xml parser module to be used as the default.
Returns:
Nothing.

Set the image codec to use from an existing image codec.

In this case the renderer does not take the ownership of the image codec object.

Parameters:
codecThe ImageCodec object to be used.

Set the ScriptModule to be used for scripting within the GUI system.

Parameters:
scriptModulePointer to a ScriptModule based object, or 0 for none (be careful!)
Returns:
Nothing
void CEGUI::System::setXMLParser ( const String parserName)

Set a new XML parser module to be used.

The current XMLParser will be cleaned up and, if owned by the system, also deleted, as will any dynamically loaded module associated with the XMLParser object. The newly created XMLParser object, and the associated module will be owned by the system.

Parameters:
parserNameString object describing the name of the XML parser module to be used.

Sets the XMLParser object to be used by the system.

The current XMLParser will be cleaned up and, if owned by the system, also deleted, as will any dynamically loaded module associated with the XMLParser object.

If the argument passed in the parser parameter is 0, the system will cleanup any existing parser as described above, and revert to using the parser provided by the default module (see getDefaultXMLParserName and setDefaultXMLParserName).

Parameters:
parserPointer to the XMLParser object to be used by the system, or 0 to cause the system to initialise a default parser.

Member Data Documentation

pointer to parser module.

Holds name of default XMLParser

Holds a pointer to the image codec module. If d_imageCodecModule is 0 we are not owner of the image codec object

Event fired for display size changes (as notified by client code). Handlers are passed a const DisplayEventArgs reference with DisplayEventArgs::size set to the pixel size that was notifiied to the system.

Event fired when global custom RenderedStringParser is set. Handlers are passed a const reference to a generic EventArgs struct.

 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends