Esempio n. 1
0
GHashTable *
Type::CopyProperties (bool inherited)
{
	GHashTable *props = g_hash_table_new (g_str_hash, g_str_equal);
	Type *type = this;
	
	do {
		if (type->properties)
			g_hash_table_foreach (type->properties, property_add, props);
		
		if (!inherited || !type->HasParent ())
			break;
		
		type = type->GetParentType ();
	} while (type);
	
	return props;
}
Esempio n. 2
0
DependencyProperty *
DependencyProperty::GetDependencyPropertyFull (Type::Kind type, const char *name, bool inherits)
{
	DependencyProperty *property;
	Type *t = Type::Find (Deployment::GetCurrent (), type);
	
	if (t == NULL)
		return NULL;
		
	property = GetDependencyProperty (t, name, inherits);
	
	if (property == NULL) {
		if (inherits)
			property = GetDependencyProperty (t, name, false);
		if (property == NULL && t->HasParent ())
			return GetDependencyPropertyFull (t->GetParentType (), name, inherits);
	}

	return property;
}
Esempio n. 3
0
Value *
DependencyProperty::GetDefaultValue (Type::Kind kind)
{
	if (default_value_overrides) {
		Value *value = (Value *) g_hash_table_lookup (default_value_overrides, GINT_TO_POINTER (kind));
		if (value)
			return new Value (*value);
	
		Types *types = Deployment::GetCurrent ()->GetTypes ();
		Type *t = types->Find (kind);
		while ((t = t->GetParentType ()) != NULL) {
			value = (Value *) g_hash_table_lookup (default_value_overrides, GINT_TO_POINTER (t->GetKind ()));
			if (value)
				return new Value (*value);
		}
	}

	if (autocreator) {
		return autocreator (kind, this);
	} else {
		return default_value ? new Value (*default_value) : NULL;
	}
}