예제 #1
0
파일: ui_image.cpp 프로젝트: cfr/qfusion
bool ElementImage::LoadCachedTexture()
{
	texture_dirty = false;

	// Get the source URL for the image.
	String image_source = GetAttribute< String >("_cached_src", "");
	if( image_source.Empty() ) {
		SetPseudoClass( "loading", false );
		return false;
	}

 	geometry_dirty = true;

	URL image_url( image_source );
	bool res = texture.Load( image_url.GetHost() + "/" + image_url.GetPathedFileName() );

	SetPseudoClass( "loading", false );

	if( !res ) {
		geometry.SetTexture( NULL );
		return false;
	}

	// Set the texture onto our geometry object.
	geometry.SetTexture( &texture );

	DirtyLayout();
	return true;
}
예제 #2
0
파일: ui_image.cpp 프로젝트: cfr/qfusion
bool ElementImage::LoadTexture()
{
	// Get the source URL for the image.
	String source = GetAttribute< String >("src", "");
	bool nocache = GetAttribute< int >("nocache", 0) != 0;

	SetPseudoClass( "loading", true );

	if( !source.Empty() ) {
		if( trap::FS_IsUrl( source.CString() ) ) {
			texture_dirty = false;

			// the stream cache object references this element
			// (passed as the void * pointer below)
			AddReference();

			UI_Main::Get()->getStreamCache()->PerformRequest( 
				source.CString(), "GET", NULL, 
				NULL, NULL, &CacheRead, (void *)this,
				WSW_UI_STREAMCACHE_TIMEOUT, nocache ? 0 : WSW_UI_IMAGES_CACHE_TTL
			);

			return false;
		}
	}

	bool res = LoadDiskTexture();
	
	SetPseudoClass( "loading", false );

	return res;
}
예제 #3
0
// Checks for changes to the 'disabled' attribute.
void ElementFormControl::OnAttributeChange(const Core::AttributeNameList& changed_attributes)
{
	Core::Element::OnAttributeChange(changed_attributes);

	if (changed_attributes.find("disabled") != changed_attributes.end())
		SetPseudoClass("disabled", IsDisabled());
}