/*************************************************************************
	Adds a WindowFactory object to the registry
*************************************************************************/
void WindowFactoryManager::addFactory(WindowFactory* factory)
{
    // throw exception if passed factory is null.
    if (!factory)
    {
        throw NullObjectException(
            "The provided WindowFactory pointer was invalid.");
    }

    // throw exception if type name for factory is already in use
    if (d_factoryRegistry.find(factory->getTypeName()) != d_factoryRegistry.end())
    {
        throw AlreadyExistsException(
            "A WindowFactory for type '" + factory->getTypeName() +
            "' is already registered.");
    }

    // add the factory to the registry
    d_factoryRegistry[factory->getTypeName()] = factory;

    char addr_buff[32];
    sprintf(addr_buff, "(%p)", static_cast<void*>(factory));
    Logger::getSingleton().logEvent("WindowFactory for '" +
                                    factory->getTypeName() +"' windows added. " + addr_buff);
}
Beispiel #2
0
	/*************************************************************************
	Set texture for use by this imageset object
	*************************************************************************/
	void Imageset::setTexture(Texture* texture)
	{
		if (d_texture == NULL)
		{
			throw NullObjectException((utf8*)"Imageset::setTexture - Texture object supplied for Imageset creation must not be NULL");
		}

		d_texture = texture;
	}
/*************************************************************************
	Add a new property to the set
*************************************************************************/
void PropertySet::addProperty(Property* property)
{
	if (property == NULL)
	{
		throw NullObjectException((utf8*)"The given Property object pointer is NULL.");
	}

	if (d_properties.find(property->getName()) != d_properties.end())
	{
		throw AlreadyExistsException((utf8*)"A Property named '" + property->getName() + (utf8*)"' already exists in the PropertySet.");
	}

	d_properties[property->getName()] = property;
}
Beispiel #4
0
/*************************************************************************
	Add a new property to the set
*************************************************************************/
void PropertySet::addProperty(Property* property)
{
	if (!property)
	{
		CEGUI_THROW(NullObjectException("The given Property object pointer is invalid."));
	}

	if (!d_properties.insert(std::make_pair(property->getName(), property)).second)
	{
		CEGUI_THROW(AlreadyExistsException("A Property named '" + property->getName() + "' already exists in the PropertySet."));
	}

    property->initialisePropertyReceiver(this);
}
/*************************************************************************
	Add a new property to the set
*************************************************************************/
void PropertySet::addProperty(Property* property)
{
	if (!property)
	{
		CEGUI_THROW(NullObjectException("The given Property object pointer is invalid."));
	}

	if (d_properties.find(property->getName()) != d_properties.end())
	{
		CEGUI_THROW(AlreadyExistsException("A Property named '" + property->getName() + "' already exists in the PropertySet."));
	}

	d_properties[property->getName()] = property;
    property->initialisePropertyReceiver(this);
}
Beispiel #6
0
/*************************************************************************
	Constructor
*************************************************************************/
Image::Image(const Imageset* owner, const String& name, const Rect& area, const Point& render_offset, float horzScaling, float vertScaling) :
	d_owner(owner),
	d_area(area),
	d_offset(render_offset),
	d_name(name)
{
	if (d_owner == NULL)
	{
		throw NullObjectException((utf8*)"Image::Image - Imageset pointer passed to Image constructor must not be null.");
	}

	// setup initial image scaling
	setHorzScaling(horzScaling);
	setVertScaling(vertScaling);

	// TODO: if we ever store texture co-ordinates, they should be calculated here.
}
/*************************************************************************
	Adds a WindowFactory object to the registry
*************************************************************************/
void WindowFactoryManager::addFactory(WindowFactory* factory)
{
    // throw exception if passed factory is null.
    if (factory == NULL)
    {
        throw NullObjectException((utf8*)"WindowFactoryManager::addFactory - The provided WindowFactory pointer was NULL");
    }

    // throw exception if type name for factory is already in use
    if (d_factoryRegistry.find(factory->getTypeName()) != d_factoryRegistry.end())
    {
        throw AlreadyExistsException((utf8*)"WindowFactoryManager::addFactory - A WindowFactory for type '" + factory->getTypeName() + (utf8*)"' is already registered.");
    }

    // add the factory to the registry
    d_factoryRegistry[factory->getTypeName()] = factory;

    Logger::getSingleton().logEvent((utf8*)"WindowFactory for '" + factory->getTypeName() +"' windows added.");
}