本文整理汇总了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;
}
示例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;
}
示例3: GetState
public override bool GetState(Widget w)
{
if (w.Id == "CREATESERVER_CHECKBOX_ONLINE")
return AdvertiseServerOnline;
return false;
}
示例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";
}
示例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;
}
示例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 ();
}
示例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);
}
示例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;
}
示例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);
}
示例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);
}
示例11: VerticalLine
public VerticalLine(Widget parent)
: base(parent)
{
Background = parent.Background;
Foreground = ConsoleColor.Black;
Border = BorderStyle.Thin;
}
示例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);
}
}
示例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;
}
示例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();
}
}
}
}
}
示例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));
}