All pastes #1422823 Raw Edit

Miscellany

public diff v1 · immutable
#1422823 ·published 2009-05-14 17:27 UTC
rendered paste body
diff --git a/src/dependencyproperty.g.cpp b/src/dependencyproperty.g.cppindex 55f3901..0939b07 100644--- a/src/dependencyproperty.g.cpp+++ b/src/dependencyproperty.g.cpp@@ -3009,6 +3009,19 @@ FrameworkElement::SetMargin (Thickness *value) 	SetValue (FrameworkElement::MarginProperty, Value (*value)); } +const char *+FrameworkElement::GetLanguage ()+{+	Value *value = GetValue (FrameworkElement::LanguageProperty);+	return value ? value->AsString () : NULL;+}++void+FrameworkElement::SetLanguage (const char *value)+{+	SetValue (FrameworkElement::LanguageProperty, Value (value));+}+ HorizontalAlignment FrameworkElement::GetHorizontalAlignment () {diff --git a/src/frameworkelement.h b/src/frameworkelement.hindex 2f3a6b8..dfebe66 100644--- a/src/frameworkelement.h+++ b/src/frameworkelement.h@@ -36,7 +36,7 @@ public: 	const static int DataContextProperty; 	/* @PropertyType=HorizontalAlignment,DefaultValue=HorizontalAlignmentStretch,Version=2.0,GenerateAccessors */ 	const static int HorizontalAlignmentProperty;-	/* @PropertyType=string,DefaultValue=\"en-US\",Version=2.0,ManagedPropertyType=XmlLanguage,Validator=NonNullValidator */+	/* @PropertyType=string,DefaultValue=\"en-US\",Version=2.0,ManagedPropertyType=XmlLanguage,Validator=NonNullValidator,GenerateAccessors */ 	const static int LanguageProperty; 	/* @PropertyType=Thickness,DefaultValue=Thickness (0),Version=2.0,GenerateAccessors */ 	const static int MarginProperty;@@ -82,7 +82,10 @@ public: 	 	void SetWidth (double width); 	double GetWidth ();-	++	void SetLanguage (const char *value);+	const char *GetLanguage ();+ 	// 	// 2.0 methods 	//diff --git a/src/xaml.cpp b/src/xaml.cppindex 891a899..a780f45 100644--- a/src/xaml.cpp+++ b/src/xaml.cpp@@ -65,6 +65,7 @@ class XamlParserInfo; class XamlNamespace; class DefaultNamespace; class XNamespace;+class XmlNamespace; class PrimitiveNamespace; class XamlElementInfoNative; class XamlElementInstanceNative;@@ -84,6 +85,7 @@ class XamlElementInstanceStaticResource;  static DefaultNamespace *default_namespace = NULL; static XNamespace *x_namespace = NULL;+static XmlNamespace *xml_namespace = NULL;  static const char* default_namespace_names [] = { 	"http://schemas.microsoft.com/winfx/2006/xaml/presentation",@@ -94,6 +96,7 @@ static const char* default_namespace_names [] = { };  #define X_NAMESPACE_URI "http://schemas.microsoft.com/winfx/2006/xaml"+#define XML_NAMESPACE_URI "http://www.w3.org/XML/1998/namespace" #define PRIMITIVE_NAMESPACE_URI "clr-namespace:System;assembly=mscorlib"  @@ -874,6 +877,36 @@ class DefaultNamespace : public XamlNamespace { 	virtual const char* GetPrefix () { return ""; } }; +class XmlNamespace : public XamlNamespace {+ public:+	XmlNamespace () { }++	virtual ~XmlNamespace () { }++	virtual XamlElementInfo* FindElement (XamlParserInfo *p, const char *el, const char **attr, bool create)+	{+		return NULL;+	}++	virtual bool SetAttribute (XamlParserInfo *p, XamlElementInstance *item, const char *attr, const char *value, bool *reparse)+	{+		if (!strcmp ("lang", attr)) {+			if (item->IsDependencyObject ()) {+				DependencyObject *dob = item->GetAsDependencyObject ();+				if (dob->Is(Type::FRAMEWORKELEMENT)) {+					((FrameworkElement*)dob)->SetLanguage (value);+					return true;+				}+			}+		}++		return false;+	}++	virtual const char* GetUri () { return "http://www.w3.org/XML/1998/namespace"; }+	virtual const char* GetPrefix () { return "xml"; }+};+ class XNamespace : public XamlNamespace {  public: 	XNamespace () { }@@ -1870,7 +1903,8 @@ add_default_namespaces (XamlParserInfo *p) { 	p->implicit_default_namespace = true; 	g_hash_table_insert (p->namespace_map, g_strdup ("http://schemas.microsoft.com/winfx/2006/xaml/presentation"), default_namespace);-	g_hash_table_insert (p->namespace_map, g_strdup ("http://schemas.microsoft.com/winfx/2006/xaml"), x_namespace);+	g_hash_table_insert (p->namespace_map, g_strdup (X_NAMESPACE_URI), x_namespace);+	g_hash_table_insert (p->namespace_map, g_strdup (XML_NAMESPACE_URI), xml_namespace); }  static void@@ -4948,4 +4982,5 @@ xaml_init (void) { 	default_namespace = new DefaultNamespace (); 	x_namespace = new XNamespace ();+	xml_namespace = new XmlNamespace (); }