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


C# Widget类代码示例

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


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

示例1: OnMouseUp

        public override bool OnMouseUp(Widget w, MouseInput mi)
        {
            if (w.Id == "MAINMENU_BUTTON_CREATE")
            {
                Game.chrome.rootWidget.ShowMenu("CREATESERVER_BG");
                return true;
            }

            if (w.Id == "CREATESERVER_BUTTON_CANCEL")
            {
                Game.chrome.rootWidget.ShowMenu("MAINMENU_BG");
                return true;
            }

            if (w.Id == "CREATESERVER_BUTTON_START")
            {
                Game.chrome.rootWidget.ShowMenu(null);
                Log.Write("Creating server");

                Server.Server.ServerMain(AdvertiseServerOnline, Game.Settings.MasterServer,
                                        Game.Settings.GameName, Game.Settings.ListenPort,
                                        Game.Settings.ExternalPort, Game.Settings.InitialMods);

                Log.Write("Joining server");
                Game.JoinServer(IPAddress.Loopback.ToString(), Game.Settings.ListenPort);
                return true;
            }

            return false;
        }
开发者ID:comradpara,项目名称:OpenRA,代码行数:30,代码来源:CreateServerMenuDelegate.cs

示例2: AddWidget

	public static void AddWidget(Container box, Widget widget, int position, bool expandAndFill = false)
	{
		box.Add(widget);
		((Box.BoxChild)box[widget]).Position = position;
		((Box.BoxChild)box[widget]).Expand = expandAndFill;
		((Box.BoxChild)box[widget]).Fill = expandAndFill;
	}
开发者ID:xbadcode,项目名称:Rubezh,代码行数:7,代码来源:WidgetHelper.cs

示例3: GetState

        public override bool GetState(Widget w)
        {
            if (w.Id == "CREATESERVER_CHECKBOX_ONLINE")
                return AdvertiseServerOnline;

            return false;
        }
开发者ID:comradpara,项目名称:OpenRA,代码行数:7,代码来源:CreateServerMenuDelegate.cs

示例4: GetAlign

 private string GetAlign(Widget frame)
 {
     if (((RadioButton)((HBox)((Frame)((Alignment)frame).Child).Child).Children[0]).Active == true)
         return "persistent-apps";
     else
         return "persistent-others";
 }
开发者ID:Eun,项目名称:AddAnyDock,代码行数:7,代码来源:MainWindow.cs

示例5: make

 //////////////////////////////////////////////////////////////////////////
 // Constructor
 //////////////////////////////////////////////////////////////////////////
 public static WidgetPeer make(Widget self)
 {
     System.Type type = System.Type.GetType("Fan.Fwt." + self.type().name().val + "Peer");
       WidgetPeer peer = (WidgetPeer)System.Activator.CreateInstance(type);
       peer.m_self = self;
       return peer;
 }
开发者ID:nomit007,项目名称:f4,代码行数:10,代码来源:WidgetPeer.cs

示例6: OnRender

	protected override void OnRender (Cairo.Context cr, Widget widget, Rectangle background_area, Rectangle cell_area, CellRendererState flags)
	{
		int x = (int) (cell_area.X + this.Xpad);
		int y = (int) (cell_area.Y + this.Ypad);
		int width = (int) (cell_area.Width - this.Xpad * 2);
		int height = (int) (cell_area.Height - this.Ypad * 2);

		widget.StyleContext.Save ();
		widget.StyleContext.AddClass ("trough");
		widget.StyleContext.RenderBackground (cr, x, y, width, height);
		widget.StyleContext.RenderFrame (cr, x, y, width, height);
		
		Border padding = widget.StyleContext.GetPadding (StateFlags.Normal);
		x += padding.Left;
		y += padding.Top;
		width -= padding.Left + padding.Right;
		height -= padding.Top + padding.Bottom;

		widget.StyleContext.Restore ();
		
		widget.StyleContext.Save ();
		widget.StyleContext.AddClass ("progressbar");
		widget.StyleContext.RenderActivity (cr, x, y, (int) (width * Percentage), height);
		widget.StyleContext.Restore ();
	}
开发者ID:liberostelios,项目名称:gtk-sharp,代码行数:25,代码来源:CustomCellRenderer.cs

示例7: GetAllProperties_By_Generic

        public void GetAllProperties_By_Generic() {
            var widget = new Widget(1, "Widget No1");
            var accessor = DynamicAccessorFactory.CreateDynamicAccessor<Widget>();
            var properties = accessor.GetPropertyNameValueCollection(widget).ToDictionary(pair => pair.Key, pair => pair.Value);

            VerifyPropertyCollection(properties);
        }
开发者ID:debop,项目名称:NFramework,代码行数:7,代码来源:DynamicAccessorToolFixture.cs

示例8: CreateBoundColumnTemplate

		internal static FrameworkElementFactory CreateBoundColumnTemplate (ApplicationContext ctx, Widget parent, CellViewCollection views, string dataPath = ".")
		{
			if (views.Count == 1)
                return CreateBoundCellRenderer(ctx, parent, views[0], dataPath);
			
			FrameworkElementFactory container = new FrameworkElementFactory (typeof (StackPanel));
			container.SetValue (StackPanel.OrientationProperty, System.Windows.Controls.Orientation.Horizontal);

			foreach (CellView view in views) {
				var factory = CreateBoundCellRenderer(ctx, parent, view, dataPath);

				factory.SetValue(FrameworkElement.MarginProperty, CellMargins);

				if (view.VisibleField != null)
				{
					var binding = new Binding(dataPath + "[" + view.VisibleField.Index + "]");
					binding.Converter = new BooleanToVisibilityConverter();
					factory.SetBinding(UIElement.VisibilityProperty, binding);
				}
				else if (!view.Visible)
					factory.SetValue(UIElement.VisibilityProperty, Visibility.Collapsed);

				container.AppendChild(factory);
			}

			return container;
		}
开发者ID:m13253,项目名称:xwt,代码行数:27,代码来源:CellUtil.cs

示例9: Build

        public WidgetInstance Build(Widget widget, IEnumerable<int> path, IBuildData buildData)
        {
            // Add the widget's parameters to the context to be picked up by any children
            var propertyInstances = widget.Properties.Select(p => p.Build(buildData)).ToList();
            buildData.ContextSets.Push(propertyInstances);

            var areas = widget.Areas.Select(
                (a, i) => new { Name = a.Name, Components = a.Build(this, path.Append(i), buildData) })
                .ToList()
                .ToDictionary(d => d.Name, d => d.Components);

            buildData.AreaContents.Push(areas);

            var specification = this.widgetSpecificationFinder(widget.Name);

            if (this.renderingInstructions.ShowAmendments)
            {
                specification.ApplyAmendments(this.componentLibrary);
            }

            // Notice that we're passing null as the path - we don't want to annotate the components from the widget
            // specification because they're not components that the editor of the current template can do anything about
            var components = specification.Components.Select((c, i) => c.Build(this, null, buildData)).ToList();

            buildData.AreaContents.Pop();
            buildData.ContextSets.Pop();

            return new WidgetInstance(
                path,
                this.renderingInstructions,
                components);
        }
开发者ID:mr-sandy,项目名称:kola,代码行数:32,代码来源:InstanceBuildingComponentVisitor.cs

示例10: Render

	protected override void Render (Drawable window, Widget widget, Rectangle background_area, Rectangle cell_area, Rectangle expose_area, CellRendererState flags)
	{
		int width = 0, height = 0, x_offset = 0, y_offset = 0;
		StateType state;
		GetSize (widget, ref cell_area, out x_offset, out y_offset, out width, out height);

		if (widget.HasFocus)
			state = StateType.Active;
		else
			state = StateType.Normal;

		width -= (int) this.Xpad * 2;
		height -= (int) this.Ypad * 2;


		//FIXME: Style.PaintBox needs some customization so that if you pass it
		//a Gdk.Rectangle.Zero it gives a clipping area big enough to draw
		//everything
		Gdk.Rectangle clipping_area = new Gdk.Rectangle ((int) (cell_area.X + x_offset + this.Xpad), (int) (cell_area.Y + y_offset + this.Ypad), width - 1, height - 1);
		
		Style.PaintBox (widget.Style, (Gdk.Window) window, StateType.Normal, ShadowType.In, clipping_area, widget, "trough", (int) (cell_area.X + x_offset + this.Xpad), (int) (cell_area.Y + y_offset + this.Ypad), width - 1, height - 1);

		Gdk.Rectangle clipping_area2 = new Gdk.Rectangle ((int) (cell_area.X + x_offset + this.Xpad), (int) (cell_area.Y + y_offset + this.Ypad), (int) (width * Percentage), height - 1);
		
		Style.PaintBox (widget.Style, (Gdk.Window) window, state, ShadowType.Out, clipping_area2, widget, "bar", (int) (cell_area.X + x_offset + this.Xpad), (int) (cell_area.Y + y_offset + this.Ypad), (int) (width * Percentage), height - 1);
	}
开发者ID:ystk,项目名称:debian-gtk-sharp2,代码行数:26,代码来源:CustomCellRenderer.cs

示例11: VerticalLine

 public VerticalLine(Widget parent)
     : base(parent)
 {
     Background = parent.Background;
     Foreground = ConsoleColor.Black;
     Border = BorderStyle.Thin;
 }
开发者ID:Maxwolf,项目名称:MaxCursesTemp,代码行数:7,代码来源:VerticalLine.cs

示例12: AppendExcluded

 //Take a widget, and extract its excluded choices, into excluded_choices list
 public void AppendExcluded(Widget w)
 {
     foreach(string s in (w as DialogWidget).excluded_choices)
     {
         excluded_choices.Add(s);
     }
 }
开发者ID:EmergentRealityLab,项目名称:BasicCAVETest,代码行数:8,代码来源:TeaDialogTree.cs

示例13: OnMouseDown

        public override bool OnMouseDown(Widget w, MouseInput mi)
        {
            if (w.Id == "SETTINGS_CHECKBOX_UNITDEBUG")
            {
                Game.Settings.UnitDebug = !Game.Settings.UnitDebug;
                return true;
            }

            if (w.Id == "SETTINGS_CHECKBOX_PATHDEBUG")
            {
                Game.Settings.PathDebug = !Game.Settings.PathDebug;
                return true;
            }

            if (w.Id == "SETTINGS_CHECKBOX_INDEXDEBUG")
            {
                Game.Settings.IndexDebug = !Game.Settings.IndexDebug;
                return true;
            }

            if (w.Id == "SETTINGS_CHECKBOX_PERFGRAPH")
            {
                Game.Settings.PerfGraph = !Game.Settings.PerfGraph;
                return true;
            }

            if (w.Id == "SETTINGS_CHECKBOX_PERFTEXT")
            {
                Game.Settings.PerfText = !Game.Settings.PerfText;
                return true;
            }

            return false;
        }
开发者ID:comradpara,项目名称:OpenRA,代码行数:34,代码来源:SettingsMenuDelegate.cs

示例14: SaveValue

 public static void SaveValue(Widget editor, PropertyItem item, dynamic target)
 {
     var getEditValue = editor as IGetEditValue;
     if (getEditValue != null)
         getEditValue.GetEditValue(item, target);
     else
     {
         var stringValue = editor as IStringValue;
         if (stringValue != null)
             target[item.Name] = stringValue.Value;
         else
         {
             var booleanValue = editor as IBooleanValue;
             if (booleanValue != null)
                 target[item.Name] = booleanValue.Value;
             else
             {
                 var doubleValue = editor as IDoubleValue;
                 if (doubleValue != null)
                 {
                     var value = doubleValue.Value;
                     target[item.Name] = Double.IsNaN(value.As<double>()) ? null : value;
                 }
                 else if (editor.Element.Is(":input"))
                 {
                     target[item.Name] = editor.Element.GetValue();
                 }
             }
         }
     }
 }
开发者ID:fzhenmei,项目名称:Serenity,代码行数:31,代码来源:EditorUtils.cs

示例15: Can_delete_entity

 public void Can_delete_entity()
 {
     var w = new Widget { Name = "sproket", Tags = new[] { "big", "small" } };
     var doc = _sx.Save(w);
     _sx.Delete(w);
     Assert.IsFalse(_sx.ListDocuments().Any(x => x.Id == doc.Id && x.Revision == doc.Revision));
 }
开发者ID:nicknystrom,项目名称:RedBranch.Hammock,代码行数:7,代码来源:SessionTests.cs


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