Inheritance: Stetic.Wrapper.Widget
Exemplo n.º 1
0
        public static ObjectWrapper ReadObject(ObjectReader reader, XmlElement elem)
        {
            string          className = elem.GetAttribute("class");
            ClassDescriptor klass;

            if (reader.Format == FileFormat.Native)
            {
                klass = Registry.LookupClassByName(className);
            }
            else
            {
                klass = Registry.LookupClassByCName(className);
            }

            if (klass == null)
            {
                ErrorWidget        we   = new ErrorWidget(className, elem.GetAttribute("id"));
                ErrorWidgetWrapper wrap = (ErrorWidgetWrapper)Create(reader.Project, we);
                wrap.Read(reader, elem);
                return(wrap);
            }
            if (!klass.SupportsGtkVersion(reader.Project.TargetGtkVersion))
            {
                ErrorWidget        we   = new ErrorWidget(className, klass.TargetGtkVersion, reader.Project.TargetGtkVersion, elem.GetAttribute("id"));
                ErrorWidgetWrapper wrap = (ErrorWidgetWrapper)Create(reader.Project, we);
                wrap.Read(reader, elem);
                return(wrap);
            }

            ObjectWrapper wrapper = klass.CreateWrapper();

            wrapper.classDescriptor = klass;
            wrapper.proj            = reader.Project;
            return(ReadObject(reader, elem, wrapper));
        }
Exemplo n.º 2
0
        public static ObjectWrapper ReadObject(ObjectReader reader, XmlElement elem)
        {
            string          className = elem.GetAttribute("class");
            ClassDescriptor klass;

            if (reader.Format == FileFormat.Native)
            {
                klass = Registry.LookupClassByName(className);
            }
            else
            {
                klass = Registry.LookupClassByCName(className);
            }

            if (klass == null)
            {
                ErrorWidget        we   = new ErrorWidget(className, elem.GetAttribute("id"));
                ErrorWidgetWrapper wrap = (ErrorWidgetWrapper)Create(reader.Project, we);
                wrap.Read(reader, elem);
                return(wrap);
            }
            if (!klass.SupportsGtkVersion(reader.Project.TargetGtkVersion))
            {
                ErrorWidget        we   = new ErrorWidget(className, klass.TargetGtkVersion, reader.Project.TargetGtkVersion, elem.GetAttribute("id"));
                ErrorWidgetWrapper wrap = (ErrorWidgetWrapper)Create(reader.Project, we);
                wrap.Read(reader, elem);
                return(wrap);
            }

            ObjectWrapper wrapper = klass.CreateWrapper();

            wrapper.classDescriptor = klass;
            wrapper.proj            = reader.Project;
            try {
                wrapper.OnBeginRead(reader.Format);
                wrapper.Read(reader, elem);
            } catch (Exception ex) {
                Console.WriteLine(ex);
                ErrorWidget        we   = new ErrorWidget(ex, elem.GetAttribute("id"));
                ErrorWidgetWrapper wrap = (ErrorWidgetWrapper)Create(reader.Project, we);
                wrap.Read(reader, elem);
                return(wrap);
            } finally {
                wrapper.OnEndRead(reader.Format);
            }
            return(wrapper);
        }
Exemplo n.º 3
0
 public static ObjectWrapper ReadObject(ObjectReader reader, XmlElement elem, ObjectWrapper wrapper)
 {
     try {
         wrapper.OnBeginRead(reader.Format);
         wrapper.Read(reader, elem);
         return(wrapper);
     }
     catch (Exception ex) {
         Console.WriteLine(ex);
         ErrorWidget        we   = new ErrorWidget(ex, elem.GetAttribute("id"));
         ErrorWidgetWrapper wrap = (ErrorWidgetWrapper)Create(reader.Project, we);
         wrap.Read(reader, elem);
         return(wrap);
     }
     finally {
         wrapper.OnEndRead(reader.Format);
     }
 }