public override Widget GetHeader(Context context) { if (context.compact) { HBox header = new HBox(false, 0); header.PackStart(new Label(name), false, false, 0); header.PackStart(Graphics.GetIcon(Threat.C, Graphics.GetColor(affiliation), Graphics.textSize), false, false, (uint)(Graphics.textSize / 5)); return(new InspectableBox(header, this, context)); } else { VBox headerBox = new VBox(false, 5); InspectableBox namebox = new InspectableBox(new Label(name), this, context); Gtk.Alignment align = new Gtk.Alignment(0.5f, 0.5f, 0, 0) { Child = namebox, WidthRequest = 200 }; headerBox.PackStart(align, false, false, 0); if (parent != null) { headerBox.PackStart(UIFactory.Align(Graphics.GetSmartHeader(context.butCompact, parent), 0.5f, 0.5f, 0, 0)); } return(headerBox); } }
public EffectiveRatingsMultiview (PropertyInfo property, object obj, Context context, DisplayableAttribute attribute) { this.context = context; BorderWidth = 5; // Nest containers VBox mainBox = new VBox(); HBox navigation = new HBox(); SquareContainer square = new SquareContainer(); notebook = new Notebook { ShowTabs = false, ShowBorder = false }; square.Add(notebook); mainBox.PackStart(navigation, false, false, 5); mainBox.PackStart(square, true, true, 0); Add(mainBox); // Navigation Label pageLabel = new Label("Table (final)"); ClickableEventBox leftArrow = new ClickableEventBox(); leftArrow.Add(Graphics.GetIcon(IconTemplate.LeftArrow, new Gdk.Color(100, 100, 100), Graphics.textSize)); leftArrow.Clicked += delegate { if (notebook.CurrentPage > 0) { notebook.CurrentPage--; } else { notebook.CurrentPage = notebook.NPages - 1; } pageLabel.Text = labels[notebook.CurrentPage]; }; ClickableEventBox rightArrow = new ClickableEventBox(); rightArrow.Add(Graphics.GetIcon(IconTemplate.RightArrow, new Gdk.Color(100, 100, 100), Graphics.textSize)); rightArrow.Clicked += delegate { if (notebook.CurrentPage < notebook.NPages - 1) { notebook.CurrentPage++; } else { notebook.CurrentPage = 0; } pageLabel.Text = labels[notebook.CurrentPage]; }; navigation.PackStart(leftArrow, false, false, 5); navigation.PackStart(pageLabel, true, true, 0); navigation.PackStart(rightArrow, false, false, 5); // Fill notebook EffectiveRatingsProfile erp = (EffectiveRatingsProfile)property.GetValue(obj); RatingsRadarChart radar1 = new RatingsRadarChart(context.butCompact, erp.final, erp.multipliers, erp.metamultipliers); RatingsTable table1 = new RatingsTable(context.butCompact, erp.final, erp.multipliers, erp.metamultipliers); RatingsRadarChart radar2 = new RatingsRadarChart(context.butCompact, erp.original); RatingsTable table2 = new RatingsTable(context.butCompact, erp.original); notebook.AppendPage(radar1, null); notebook.AppendPage(UIFactory.Align(table1, 0.5f, 0.5f, 0, 0), null); notebook.AppendPage(radar2, null); notebook.AppendPage(UIFactory.Align(table2, 0.5f, 0.5f, 0, 0), null); }
public Widget GenerateDeploymentInterface(Deployment deployment, string label) { VBox mainBox = new VBox { BorderWidth = 10 }; mainBox.PackStart(UIFactory.Align(new Label(label), 0, 0, 1, 1), false, false, 10); mainBox.PackStart(new HSeparator(), false, false, 0); ScrolledWindow scrolledWindow = new ScrolledWindow { HscrollbarPolicy = PolicyType.Never }; scrolledWindow.AddWithViewport(UIFactory.Generate(new Context(battle), deployment)); mainBox.PackStart(scrolledWindow, true, true, 5); return(mainBox); }
protected override Widget GetElementWidget(Trait obj) { if (!obj.Known(context)) { Table table = new Table(1, 1, true); Label number = new Label { UseMarkup = true, Markup = "<big><b>" + obj.secrecy + "</b></big>" }; Gtk.Image image = new Gtk.Image(Stock.DialogAuthentication, IconSize.Dnd); table.Attach(UIFactory.Align(number, 0.5f, 0.5f, 0, 0), 0, 1, 0, 1); table.Attach(UIFactory.Align(image, 0.5f, 0.5f, 0, 0), 0, 1, 0, 1); table.BorderWidth = 10; return(new Frame { Child = table, Label = "???" }); } return(base.GetElementWidget(obj)); }
//IGUIComplete stuff public virtual Widget GetHeader(Context context) { if (context.compact) { return(new InspectableBox(new Label(name), this, context)); } else { VBox headerBox = new VBox(false, 5); InspectableBox namebox = new InspectableBox(new Label(name), this, context); Gtk.Alignment align = new Gtk.Alignment(0.5f, 0.5f, 0, 0) { Child = namebox, WidthRequest = 200 }; headerBox.PackStart(align, false, false, 0); if (parent != null) { headerBox.PackStart(UIFactory.Align(Graphics.GetSmartHeader(context.butCompact, parent), 0.5f, 0.5f, 0, 0)); } return(headerBox); } }
public DialogTextEditableField(PropertyInfo property, object obj, Context context, DisplayableAttribute attribute) : base(false, 2) { this.property = property; this.obj = (IDependable)obj; this.context = context; editable = attribute.EditAuthorized(obj); // Create the label if (!context.compact) { Label label = new Label(attribute.overrideLabel ?? UIFactory.ToReadable(property.Name) + ": "); label.SetAlignment(0, 1); if (attribute.tooltipText != null) { label.HasTooltip = true; label.TooltipMarkup = attribute.tooltipText; } PackStart(label, false, false, 0); } // Create the text body Label val = new Label((string)property.GetValue(obj)); if (val.Text == "") { val.Text = "-"; } val.SetAlignment(0, 0); if (!context.compact) { val.LineWrap = true; val.Justify = Justification.Fill; val.SetSizeRequest(0, -1); val.SizeAllocated += (o, a) => val.SetSizeRequest(a.Allocation.Width, -1); val.LineWrapMode = Pango.WrapMode.WordChar; } //Create the "clickable" functionality ClickableEventBox eventBox = new ClickableEventBox(); eventBox.DoubleClicked += OpenDialog; eventBox.RightClicked += delegate { rightclickMenu.Popup(); rightclickMenu.ShowAll(); }; if (context.compact) { Gtk.Alignment alignment = UIFactory.Align(val, 0, 0, 1, 1); alignment.BorderWidth = 5; if (editable) { eventBox.Add(alignment); PackStart(eventBox); } else { PackStart(alignment); } } else { Gtk.Alignment alignment = new Gtk.Alignment(0, 0, 1, 1); if (editable) { eventBox.Add(val); alignment.Add(eventBox); } else { alignment.Add(val); } alignment.LeftPadding = 10; PackStart(alignment, true, true, 0); } rightclickMenu = new Menu(); MenuItem edit = new MenuItem("Edit"); edit.Activated += OpenDialog; rightclickMenu.Append(edit); }