当前位置: 首页>>代码示例>>C#>>正文


C# Stetic.ObjectWrapper类代码示例

本文整理汇总了C#中Stetic.ObjectWrapper的典型用法代码示例。如果您正苦于以下问题:C# ObjectWrapper类的具体用法?C# ObjectWrapper怎么用?C# ObjectWrapper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ObjectWrapper类属于Stetic命名空间,在下文中一共展示了ObjectWrapper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetDiff

		protected override object GetDiff (ObjectWrapper w)
		{
			// Only track changes in widgets.
			Wrapper.Widget widget = w as Wrapper.Widget;
			if (widget != null) return w.GetUndoDiff ();
			else return null;
		}
开发者ID:FreeBSD-DotNet,项目名称:monodevelop,代码行数:7,代码来源:ContainerUndoRedoManager.cs

示例2: GenerateInstanceExpression

		public virtual CodeExpression GenerateInstanceExpression (ObjectWrapper wrapper, CodeExpression newObject)
		{
			string varName = NewId ();
			CodeVariableDeclarationStatement varDec = new CodeVariableDeclarationStatement (wrapper.WrappedTypeName.ToGlobalTypeRef (), varName);
			varDec.InitExpression = newObject;
			statements.Add (varDec);
			return new CodeVariableReferenceExpression (varName);
		}
开发者ID:FreeBSD-DotNet,项目名称:monodevelop,代码行数:8,代码来源:GeneratorContext.cs

示例3: CanNotifyChanged

		internal bool CanNotifyChanged (ObjectWrapper wrapper)
		{
			if (!InAtomicChange) {
				if (IsRegistered (wrapper) && UndoCheckpoint != null)
					UndoCheckpoint (this, new UndoCheckpointEventArgs (new ObjectWrapper[] { wrapper }));
				return true;
			} else
				return atomicChangeTracker.ProcessChange (wrapper);
		}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:9,代码来源:UndoManager.cs

示例4: SetRoot

		public void SetRoot (ObjectWrapper wrapper)
		{
			root = wrapper;
			wrapper.UndoManager = this;
			elements.Clear ();
			
			doc = new XmlDocument ();
			UndoWriter writer = new UndoWriter (doc, this);
			writer.WriteObject (wrapper);
		}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:10,代码来源:UndoManager.cs

示例5: RegisterObject

		// This method can be called by containers to register new objects in the tree.
		// Unless an object is registered in this way, no status will be tracked for it.
		// The provided status element must be a direct or indirect child of the parent status.
		internal void RegisterObject (ObjectWrapper w, XmlElement status)
		{
			VerifyManager ();
				
			if (IsRegistered (w))
				throw new InvalidOperationException ("Object already registered: " + w.GetType ());

			elements [w] = GetLocalElement (status);
			
			w.Disposed += OnObjectDisposed;
		}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:14,代码来源:UndoManager.cs

示例6: Write

		public static XmlElement Write (ObjectWrapper wrapper, XmlDocument doc)
		{
			ClassDescriptor klass = wrapper.ClassDescriptor;

			XmlElement elem = doc.CreateElement ("widget");
			elem.SetAttribute ("class", klass.Name);
			elem.SetAttribute ("id", ((Gtk.Widget)wrapper.Wrapped).Name);

			GetProps (wrapper, elem);
			GetSignals (wrapper, elem);
			return elem;
		}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:12,代码来源:WidgetUtils.cs

示例7: WidgetDesignerBackend

        internal WidgetDesignerBackend(Gtk.Container container, int designWidth, int designHeight)
        {
            ShadowType = ShadowType.None;
            HscrollbarPolicy = PolicyType.Automatic;
            VscrollbarPolicy = PolicyType.Automatic;

            resizableFixed = new ResizableFixed ();
            resizableFixed.ObjectViewer = defaultObjectViewer;

            wrapper = ObjectWrapper.Lookup (container);
            Gtk.Window window = container as Gtk.Window;

            if (window != null) {
                try {
                    metacityPreview = CreateMetacityPreview (window);
                    preview = metacityPreview;
                    if (wrapper != null)
                        wrapper.Notify += OnWindowPropChange;
                } catch {
                    // If metacity is not available, use a regular box.
                    EventBox eventBox = new EventBox ();
                    eventBox.Add (container);
                    preview = eventBox;
                }

            } else {
                EventBox eventBox = new EventBox ();
                eventBox.Add (container);
                preview = eventBox;
            }

            resizableFixed.Put (preview, container);

            if (designWidth != -1) {
                preview.WidthRequest = designWidth;
                preview.HeightRequest = designHeight;
                resizableFixed.AllowResize = true;
            } else {
                resizableFixed.AllowResize = false;
            }

            preview.SizeAllocated += new Gtk.SizeAllocatedHandler (OnResized);

            AddWithViewport (resizableFixed);

            if (wrapper != null)
                wrapper.AttachDesigner (resizableFixed);

            resizableFixed.SelectionChanged += OnSelectionChanged;
        }
开发者ID:mono,项目名称:stetic,代码行数:50,代码来源:WidgetDesignerBackend.cs

示例8: GetProps

		public static void GetProps (ObjectWrapper wrapper, XmlElement parent_elem)
		{
			ClassDescriptor klass = wrapper.ClassDescriptor;

			foreach (ItemGroup group in klass.ItemGroups) {
				foreach (ItemDescriptor item in group) {
					PropertyDescriptor prop = item as PropertyDescriptor;
					if (prop == null)
						continue;
					if (!prop.VisibleFor (wrapper.Wrapped) || !prop.CanWrite || prop.Name == "Name")	// Name is written in the id attribute
						continue;

					object value = prop.GetValue (wrapper.Wrapped);
					
					// If the property has its default value, we don't need to write it
					if (value == null || (prop.HasDefault && prop.IsDefaultValue (value)))
						continue;
				
					string val = prop.ValueToString (value);
					if (val == null)
						continue;

					XmlElement prop_elem = parent_elem.OwnerDocument.CreateElement ("property");
					prop_elem.SetAttribute ("name", prop.Name);
					if (val.Length > 0)
						prop_elem.InnerText = val;

					if (prop.Translatable && prop.IsTranslated (wrapper.Wrapped)) {
						prop_elem.SetAttribute ("translatable", "yes");
						string tcx = prop.TranslationContext (wrapper.Wrapped);
						if (tcx != null && tcx.Length > 0) {
							prop_elem.SetAttribute ("context", "yes");
							prop_elem.InnerText = tcx + "|" + prop_elem.InnerText;
						}
						string tcm = prop.TranslationComment (wrapper.Wrapped);
						if (tcm != null && tcm.Length > 0)
							prop_elem.SetAttribute ("comments", prop.TranslationComment (wrapper.Wrapped));
					}

					parent_elem.AppendChild (prop_elem);
				}
			}
		}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:43,代码来源:WidgetUtils.cs

示例9: Read

		static public void Read (ObjectWrapper wrapper, XmlElement elem)
		{
			string className = elem.GetAttribute ("class");
			if (className == null)
				throw new GladeException ("<widget> node with no class name");

			ClassDescriptor klass = Registry.LookupClassByName (className);
			if (klass == null)
				throw new GladeException ("No stetic ClassDescriptor for " + className);

			Gtk.Widget widget = (Gtk.Widget) wrapper.Wrapped;
			if (widget == null) {
				widget = (Gtk.Widget) klass.CreateInstance (wrapper.Project);
				//set name before binding to ensure 
				//that ObjectWrapper.RootWrapperName will be valid
				widget.Name = elem.GetAttribute ("id");
				ObjectWrapper.Bind (wrapper.Project, klass, wrapper, widget, true);
			} else {
				widget.Name = elem.GetAttribute ("id");
			}
			
			ReadMembers (klass, wrapper, widget, elem);
			
			if (!(widget is Gtk.Window))
				widget.ShowAll ();
		}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:26,代码来源:WidgetUtils.cs

示例10: GetSignals

		public static void GetSignals (ObjectWrapper ob, XmlElement parent_elem)
		{
			foreach (Signal signal in ob.Signals) {
				if (!signal.SignalDescriptor.VisibleFor (ob.Wrapped))
					continue;

				XmlElement signal_elem = parent_elem.OwnerDocument.CreateElement ("signal");
				signal_elem.SetAttribute ("name", signal.SignalDescriptor.Name);
				signal_elem.SetAttribute ("handler", signal.Handler);
				if (signal.After)
					signal_elem.SetAttribute ("after", "yes");
				parent_elem.AppendChild (signal_elem);
			}
		}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:14,代码来源:WidgetUtils.cs

示例11: SignalCollection

		internal SignalCollection (ObjectWrapper owner)
		{
			this.owner = owner;
		}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:4,代码来源:SignalCollection.cs

示例12: GenerateInstanceExpression

		public override CodeExpression GenerateInstanceExpression (ObjectWrapper wrapper, CodeExpression newObject)
		{
			string typeName = wrapper.WrappedTypeName;
			string memberName = null;
			if (wrapper is Wrapper.Widget)
				memberName = ((Wrapper.Widget) wrapper).Wrapped.Name;
			else if (wrapper is Wrapper.Action)
				memberName = ((Wrapper.Action) wrapper).Name;
			
			if (memberName == null)
				return base.GenerateInstanceExpression (wrapper, newObject);
			
			if (Options.UsePartialClasses) {
				// Don't generate fields for top level widgets and for widgets accessible
				// through other widget's properties
				Wrapper.Widget ww = wrapper as Wrapper.Widget;
				if (ww == null || (!ww.IsTopLevel && ww.InternalChildProperty == null && !ww.Unselectable)) {
					type.Members.Add (
						new CodeMemberField (
							new CodeTypeReference (typeName, CodeTypeReferenceOptions.GlobalReference),
							memberName
						)
					);
					CodeExpression var = new CodeFieldReferenceExpression (
					                          new CodeThisReferenceExpression (),
					                          memberName
					);

					Statements.Add (
						new CodeAssignStatement (
							var,
							newObject
						)
					);
					return var;
				} else 
					return base.GenerateInstanceExpression (wrapper, newObject);
			} else {
				CodeExpression var = base.GenerateInstanceExpression (wrapper, newObject);
				Statements.Add (
					new CodeAssignStatement (
						new CodeIndexerExpression (
							new CodeVariableReferenceExpression ("bindings"),
							new CodePrimitiveExpression (memberName)
						),
						var
					)
				);
				return var;
			}
		}
开发者ID:FreeBSD-DotNet,项目名称:monodevelop,代码行数:51,代码来源:CodeGenerator.cs

示例13: GetFieldsToBind

		static void GetFieldsToBind (List<ObjectBindInfo> tobind, ObjectWrapper wrapper)
		{
			string memberName = null;
			
			if (wrapper is Wrapper.Widget) {
				Wrapper.Widget ww = wrapper as Wrapper.Widget;
				if (!String.IsNullOrEmpty (ww.UIManagerName)) 
					tobind.Add (new ObjectBindInfo ("Gtk.UIManager", ww.UIManagerName));

				if (!ww.IsTopLevel && ww.InternalChildProperty == null && !ww.Unselectable)
					memberName = ((Wrapper.Widget) wrapper).Wrapped.Name;
			}
			else if (wrapper is Wrapper.Action)
				memberName = ((Wrapper.Action) wrapper).Name;
			
			if (memberName != null) {
				ObjectBindInfo binfo = new ObjectBindInfo (wrapper.WrappedTypeName, memberName);
				tobind.Add (binfo);
			}
			
			Wrapper.ActionGroup agroup = wrapper as Wrapper.ActionGroup;
			if (agroup != null) {
				foreach (Wrapper.Action ac in agroup.Actions)
					GetFieldsToBind (tobind, ac);
			}
			
			Wrapper.Widget widget = wrapper as Wrapper.Widget;
			if (widget != null && widget.IsTopLevel) {
				// Generate fields for local actions
				foreach (Wrapper.ActionGroup grp in widget.LocalActionGroups) {
					GetFieldsToBind (tobind, grp);
				}
			}
			
			Gtk.Container cont = wrapper.Wrapped as Gtk.Container;
			if (cont != null) {
				foreach (Gtk.Widget child in cont.AllChildren) {
					Stetic.Wrapper.Widget ww = Stetic.Wrapper.Widget.Lookup (child);
					if (ww != null)
						GetFieldsToBind (tobind, ww);
				}
			}
		}
开发者ID:FreeBSD-DotNet,项目名称:monodevelop,代码行数:43,代码来源:CodeGenerator.cs

示例14: GenerateWrapperFields

		static void GenerateWrapperFields (CodeTypeDeclaration type, ObjectWrapper wrapper)
		{
			foreach (ObjectBindInfo binfo in CodeGenerator.GetFieldsToBind (wrapper)) {
				type.Members.Add (
					new CodeMemberField (
						new CodeTypeReference (binfo.TypeName, CodeTypeReferenceOptions.GlobalReference),
						binfo.Name
					)
				);
			}
		}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:11,代码来源:CodeGeneratorPartialClass.cs

示例15: ReadProperty

		public static void ReadProperty (ClassDescriptor klass, ObjectWrapper wrapper, object wrapped, XmlElement prop_node)
		{
			string name = prop_node.GetAttribute ("name");
			PropertyDescriptor prop = klass [name] as PropertyDescriptor;
			if (prop == null || !prop.CanWrite)
				return;

			string strval = prop_node.InnerText;
			
			// Skip translation context
			if (prop_node.GetAttribute ("context") == "yes" && strval.IndexOf ('|') != -1)
				strval = strval.Substring (strval.IndexOf ('|') + 1);
				
			object value = prop.StringToValue (strval);
			prop.SetValue (wrapped, value);
			
			if (prop.Translatable) {
				if (prop_node.GetAttribute ("translatable") != "yes") {
					prop.SetTranslated (wrapped, false);
				}
				else {
					prop.SetTranslated (wrapped, true);
					if (prop_node.GetAttribute ("context") == "yes") {
						strval = prop_node.InnerText;
						int bar = strval.IndexOf ('|');
						if (bar != -1)
							prop.SetTranslationContext (wrapped, strval.Substring (0, bar));
					}

					if (prop_node.HasAttribute ("comments"))
						prop.SetTranslationComment (wrapped, prop_node.GetAttribute ("comments"));
				}
			}
		}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:34,代码来源:WidgetUtils.cs


注:本文中的Stetic.ObjectWrapper类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。