本文整理汇总了C#中MatterHackers.Agg.UI.GuiWidget.AddChild方法的典型用法代码示例。如果您正苦于以下问题:C# GuiWidget.AddChild方法的具体用法?C# GuiWidget.AddChild怎么用?C# GuiWidget.AddChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MatterHackers.Agg.UI.GuiWidget
的用法示例。
在下文中一共展示了GuiWidget.AddChild方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ThemeColorSelectorWidget
public ThemeColorSelectorWidget (GuiWidget colorToChangeTo)
{
this.colorToChangeTo = colorToChangeTo;
//TextWidget colorText = new TextWidget("Accent Color", color: RGBA_Bytes.White);
//colorText.VAnchor = Agg.UI.VAnchor.ParentCenter;
//this.AddChild(colorText);
//Temporary theme changer button
GuiWidget themeButtons = new GuiWidget(186, 42);
int themeCount = ActiveTheme.Instance.AvailableThemes.Count;
themeButtons.BackgroundColor = RGBA_Bytes.White;
int index = 0;
for (int x = 0; x < themeCount/2; x++)
{
Button buttonOne = getThemeButton(index, x, 0);
Button buttonTwo = getThemeButton(index + themeCount/2, x, 1);
themeButtons.AddChild(buttonOne);
themeButtons.AddChild(buttonTwo);
index++;
}
this.AddChild (themeButtons);
this.VAnchor = VAnchor.ParentCenter;
}
示例2: AddNotificationButton
private static void AddNotificationButton(GuiWidget iconContainer)
{
ImageButtonFactory imageButtonFactory = new ImageButtonFactory();
imageButtonFactory.invertImageColor = false;
string notifyIconPath = Path.Combine("PrintStatusControls", "notify.png");
string notifyHoverIconPath = Path.Combine("PrintStatusControls", "notify-hover.png");
Button notifyButton = imageButtonFactory.Generate(notifyIconPath, notifyHoverIconPath);
notifyButton.Cursor = Cursors.Hand;
notifyButton.Margin = new Agg.BorderDouble(top: 3);
notifyButton.Click += (sender, mouseEvent) => {
UiThread.RunOnIdle((state) =>
{
NotificationFormWindow.Open();
});
};
notifyButton.MouseEnterBounds += (sender, mouseEvent) => {
UiThread.RunOnIdle((state) =>
{
HelpTextWidget.Instance.ShowHoverText("Edit notification settings");
});
};
notifyButton.MouseLeaveBounds += (sender, mouseEvent) => {
UiThread.RunOnIdle((state) =>
{
HelpTextWidget.Instance.HideHoverText();
});
};
iconContainer.AddChild(notifyButton);
}
示例3: MeshViewerApplication
public MeshViewerApplication(string meshFileToLoad = "")
: base(800, 600)
{
BackgroundColor = RGBA_Bytes.White;
MinimumSize = new VectorMath.Vector2(200, 200);
Title = "MatterHackers MeshViewr";
UseOpenGL = true;
FlowLayoutWidget mainContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);
mainContainer.AnchorAll();
viewArea = new GuiWidget();
viewArea.AnchorAll();
Vector3 viewerVolume = new Vector3(200, 200, 200);
double scale = 1;
meshViewerWidget = new MeshViewerWidget(viewerVolume, scale, MeshViewerWidget.BedShape.Rectangular, "No Part Loaded");
meshViewerWidget.AnchorAll();
viewArea.AddChild(meshViewerWidget);
mainContainer.AddChild(viewArea);
FlowLayoutWidget buttonPanel = new FlowLayoutWidget(FlowDirection.LeftToRight);
buttonPanel.HAnchor = HAnchor.ParentLeftRight;
buttonPanel.Padding = new BorderDouble(3, 3);
buttonPanel.BackgroundColor = RGBA_Bytes.DarkGray;
if (meshFileToLoad != "")
{
meshViewerWidget.LoadMesh(meshFileToLoad);
}
else
{
openFileButton = new Button("Open 3D File", 0, 0);
openFileButton.Click += new Button.ButtonEventHandler(openFileButton_ButtonClick);
buttonPanel.AddChild(openFileButton);
}
bedCheckBox = new CheckBox("Bed");
bedCheckBox.Checked = true;
buttonPanel.AddChild(bedCheckBox);
wireframeCheckBox = new CheckBox("Wireframe");
buttonPanel.AddChild(wireframeCheckBox);
GuiWidget leftRightSpacer = new GuiWidget();
leftRightSpacer.HAnchor = HAnchor.ParentLeftRight;
buttonPanel.AddChild(leftRightSpacer);
mainContainer.AddChild(buttonPanel);
this.AddChild(mainContainer);
this.AnchorAll();
AddHandlers();
}
示例4: ApplicationMenuRow
public ApplicationMenuRow()
: base(FlowDirection.LeftToRight)
{
linkButtonFactory.textColor = ActiveTheme.Instance.PrimaryTextColor;
linkButtonFactory.fontSize = 8;
this.HAnchor = HAnchor.ParentLeftRight;
this.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
// put in the file menu
MenuOptionFile menuOptionFile = new MenuOptionFile();
this.AddChild(menuOptionFile);
MenuOptionSettings menuOptionSettings = new MenuOptionSettings();
this.AddChild(menuOptionSettings);
// put in the help menu
MenuOptionHelp menuOptionHelp = new MenuOptionHelp();
this.AddChild(menuOptionHelp);
//linkButtonFactory.textColor = ActiveTheme.Instance.SecondaryAccentColor;
linkButtonFactory.fontSize = 10;
Button updateStatusMessage = linkButtonFactory.Generate("Update Available");
UpdateControlData.Instance.UpdateStatusChanged.RegisterEvent(SetUpdateNotification, ref unregisterEvents);
popUpAboutPage = new FlowLayoutWidget();
popUpAboutPage.Margin = new BorderDouble(30, 0, 0, 0);
popUpAboutPage.HAnchor = HAnchor.FitToChildren;
popUpAboutPage.VAnchor = VAnchor.FitToChildren | VAnchor.ParentCenter;
popUpAboutPage.AddChild(updateStatusMessage);
updateStatusMessage.Click += (sender, e) =>
{
UiThread.RunOnIdle(CheckForUpdateWindow.Show);
};
this.AddChild(popUpAboutPage);
SetUpdateNotification(this, null);
// put in a spacer
this.AddChild(new HorizontalSpacer());
// make an object that can hold custom content on the right (like the sign in)
rightElement = new FlowLayoutWidget(FlowDirection.LeftToRight);
rightElement.Height = 24;
rightElement.Margin = new BorderDouble(bottom: 4);
this.AddChild(rightElement);
this.Padding = new BorderDouble(0, 0, 6, 0);
if (AddRightElement != null)
{
AddRightElement(rightElement);
}
// When the application is first started, plugins are loaded after the MainView control has been initialize,
// and such they not around when this constructor executes. In that case, we run the AddRightElement
// delegate after the plugins get initialized via the PluginsLoaded event
ApplicationController.Instance.PluginsLoaded.RegisterEvent(PluginsLoaded, ref unregisterEvents);
}
示例5: AddText
private void AddText(string tabText, GuiWidget widgetState, RGBA_Bytes textColor, RGBA_Bytes backgroundColor, double pointSize)
{
tabTitle = new TextWidget(tabText, pointSize: pointSize, textColor: textColor);
tabTitle.AutoExpandBoundsToText = true;
widgetState.AddChild(tabTitle);
widgetState.Selectable = false;
widgetState.SetBoundsToEncloseChildren();
widgetState.BackgroundColor = backgroundColor;
}
示例6: ApplicationMenuRow
public ApplicationMenuRow()
: base(FlowDirection.LeftToRight)
{
linkButtonFactory.textColor = ActiveTheme.Instance.PrimaryTextColor;
linkButtonFactory.fontSize = 8;
Button signInLink = linkButtonFactory.Generate("(Sign Out)");
signInLink.VAnchor = Agg.UI.VAnchor.ParentCenter;
signInLink.Margin = new BorderDouble(top: 0);
this.HAnchor = HAnchor.ParentLeftRight;
this.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
// put in the file menu
MenuOptionFile menuOptionFile = new MenuOptionFile();
this.AddChild(menuOptionFile);
MenuOptionSettings menuOptionSettings = new MenuOptionSettings();
this.AddChild(menuOptionSettings);
// put in the help menu
MenuOptionHelp menuOptionHelp = new MenuOptionHelp();
this.AddChild(menuOptionHelp);
//linkButtonFactory.textColor = ActiveTheme.Instance.SecondaryAccentColor;
linkButtonFactory.fontSize = 10;
Button updateStatusMessage = linkButtonFactory.Generate("Update Available");
UpdateControlData.Instance.UpdateStatusChanged.RegisterEvent(SetUpdateNotification, ref unregisterEvents);
popUpAboutPage = new FlowLayoutWidget();
popUpAboutPage.Margin = new BorderDouble(30, 0, 0, 0);
popUpAboutPage.HAnchor = HAnchor.FitToChildren;
popUpAboutPage.VAnchor = VAnchor.FitToChildren | VAnchor.ParentCenter;
popUpAboutPage.AddChild(updateStatusMessage);
updateStatusMessage.Click += (sender, e) =>
{
UiThread.RunOnIdle(AboutWindow.Show);
};
this.AddChild(popUpAboutPage);
SetUpdateNotification(this, null);
// put in a spacer
this.AddChild(new HorizontalSpacer());
// make an object that can hold custom content on the right (like the sign in)
rightElement = new FlowLayoutWidget(FlowDirection.LeftToRight);
rightElement.Height = 24;
rightElement.Margin = new BorderDouble(bottom: 4);
this.AddChild(rightElement);
this.Padding = new BorderDouble(0, 0, 6, 0);
if (privateAddRightElement != null)
{
privateAddRightElement(rightElement);
}
}
示例7: TopToBottomContainerAppliesExpectedMarginToToggleView
public void TopToBottomContainerAppliesExpectedMarginToToggleView()
{
TestContext.CurrentContext.SetCompatibleWorkingDirectory();
int marginSize = 40;
int dimensions = 300;
GuiWidget outerContainer = new GuiWidget(dimensions, dimensions);
FlowLayoutWidget topToBottomContainer = new FlowLayoutWidget(FlowDirection.TopToBottom)
{
HAnchor = HAnchor.ParentLeftRight,
VAnchor = VAnchor.ParentBottomTop,
};
outerContainer.AddChild(topToBottomContainer);
CheckBox toggleBox = new CheckBox("test");
toggleBox.HAnchor = HAnchor.ParentLeftRight;
toggleBox.VAnchor = VAnchor.ParentBottomTop;
toggleBox.Margin = new BorderDouble(marginSize);
toggleBox.BackgroundColor = RGBA_Bytes.Red;
toggleBox.DebugShowBounds = true;
topToBottomContainer.AddChild(toggleBox);
topToBottomContainer.AnchorAll();
topToBottomContainer.PerformLayout();
outerContainer.DoubleBuffer = true;
outerContainer.BackBuffer.NewGraphics2D().Clear(RGBA_Bytes.White);
outerContainer.OnDraw(outerContainer.NewGraphics2D());
// For troubleshooting or visual validation
OutputImages(outerContainer, outerContainer);
var bounds = toggleBox.BoundsRelativeToParent;
Assert.IsTrue(bounds.Left == marginSize, "Left margin is incorrect");
Assert.IsTrue(bounds.Right == dimensions - marginSize, "Right margin is incorrect");
Assert.IsTrue(bounds.Top == dimensions - marginSize, "Top margin is incorrect");
Assert.IsTrue(bounds.Bottom == marginSize, "Bottom margin is incorrect");
}
示例8: ThemeColorSelectorWidget
public ThemeColorSelectorWidget ()
{
//TextWidget colorText = new TextWidget("Accent Color", color: RGBA_Bytes.White);
//colorText.VAnchor = Agg.UI.VAnchor.ParentCenter;
//this.AddChild(colorText);
//Temporary theme changer button
GuiWidget themeButtons = new GuiWidget(96, 42);
themeButtons.BackgroundColor = RGBA_Bytes.White;
int index = 0;
for (int x = 0; x < 5; x++)
{
for (int y = 0; y < 2; y++)
{
GuiWidget normal = new GuiWidget(16, 16);
normal.BackgroundColor = ActiveTheme.Instance.AvailableThemes[index].primaryAccentColor;
GuiWidget hover = new GuiWidget(16, 16);
hover.BackgroundColor = ActiveTheme.Instance.AvailableThemes[index].secondaryAccentColor;
GuiWidget pressed = new GuiWidget(16, 16);
pressed.BackgroundColor = ActiveTheme.Instance.AvailableThemes[index].secondaryAccentColor;
GuiWidget disabled = new GuiWidget(16, 16);
new GuiWidget(16, 16);
Button colorButton = new Button(4 + x * 18, 4 + y * 18, new ButtonViewStates(normal, hover, pressed, disabled));
colorButton.Name = index.ToString();
colorButton.Click += (sender, mouseEvent) =>
{
UserSettings.Instance.set("ActiveThemeIndex",((GuiWidget)sender).Name);
ActiveTheme.Instance.LoadThemeSettings(int.Parse(((GuiWidget)sender).Name));
};
index++;
themeButtons.AddChild(colorButton);
}
}
themeButtons.Margin = new BorderDouble(5);
this.AddChild(themeButtons);
this.VAnchor = VAnchor.ParentCenter;
}
示例9: CreateGuiElements
protected void CreateGuiElements(string openButtonText)
{
this.Cursor = Cursors.Hand;
linkButtonFactory.fontSize = 10;
linkButtonFactory.textColor = RGBA_Bytes.White;
WidgetTextColor = RGBA_Bytes.Black;
WidgetBackgroundColor = RGBA_Bytes.White;
TextInfo textInfo = new CultureInfo("en-US", false).TextInfo;
SetDisplayAttributes();
FlowLayoutWidget mainContainer = new FlowLayoutWidget(FlowDirection.LeftToRight);
mainContainer.HAnchor = Agg.UI.HAnchor.ParentLeftRight;
mainContainer.VAnchor = VAnchor.ParentBottomTop;
{
GuiWidget primaryContainer = new GuiWidget();
primaryContainer.HAnchor = HAnchor.ParentLeftRight;
primaryContainer.VAnchor = VAnchor.ParentBottomTop;
FlowLayoutWidget primaryFlow = new FlowLayoutWidget(FlowDirection.LeftToRight);
primaryFlow.HAnchor = HAnchor.ParentLeftRight;
primaryFlow.VAnchor = VAnchor.ParentBottomTop;
GuiWidget middleColumn = new GuiWidget(0.0, 0.0);
middleColumn.HAnchor = Agg.UI.HAnchor.ParentLeftRight;
middleColumn.VAnchor = Agg.UI.VAnchor.ParentBottomTop;
middleColumn.Margin = new BorderDouble(10, 6);
{
partLabel = new TextWidget(this.ItemName.Replace('_', ' '), pointSize: 14);
partLabel.Name = "Row Item " + partLabel.Text;
partLabel.TextColor = WidgetTextColor;
partLabel.MinimumSize = new Vector2(1, 18);
partLabel.VAnchor = VAnchor.ParentCenter;
middleColumn.AddChild(partLabel);
}
primaryFlow.AddChild(thumbnailWidget);
primaryFlow.AddChild(middleColumn);
primaryContainer.AddChild(primaryFlow);
rightButtonOverlay = GetItemActionButtons(openButtonText);
rightButtonOverlay.Visible = false;
mainContainer.AddChild(primaryContainer);
mainContainer.AddChild(rightButtonOverlay);
}
this.AddChild(mainContainer);
AddHandlers();
}
示例10: AddThemeControls
private void AddThemeControls(FlowLayoutWidget controlsTopToBottomLayout)
{
DisableableWidget container = new DisableableWidget();
AltGroupBox themeControlsGroupBox = new AltGroupBox(LocalizedString.Get("Theme Settings"));
themeControlsGroupBox.TextColor = ActiveTheme.Instance.PrimaryTextColor;
themeControlsGroupBox.BorderColor = ActiveTheme.Instance.PrimaryTextColor;
themeControlsGroupBox.HAnchor = Agg.UI.HAnchor.ParentLeftRight;
themeControlsGroupBox.VAnchor = Agg.UI.VAnchor.FitToChildren;
themeControlsGroupBox.Height = 78;
FlowLayoutWidget colorSelectorContainer = new FlowLayoutWidget(FlowDirection.LeftToRight);
colorSelectorContainer.HAnchor = HAnchor.ParentLeftRight;
GuiWidget currentColorThemeBorder = new GuiWidget();
currentColorThemeBorder.HAnchor = Agg.UI.HAnchor.ParentLeftRight;
currentColorThemeBorder.VAnchor = VAnchor.ParentBottomTop;
currentColorThemeBorder.Margin = new BorderDouble(top: 2, bottom: 2);
currentColorThemeBorder.Padding = new BorderDouble(4);
currentColorThemeBorder.BackgroundColor = RGBA_Bytes.White;
GuiWidget currentColorTheme = new GuiWidget();
currentColorTheme.HAnchor = HAnchor.ParentLeftRight;
currentColorTheme.VAnchor = VAnchor.ParentBottomTop;
currentColorTheme.BackgroundColor = ActiveTheme.Instance.PrimaryAccentColor;
ThemeColorSelectorWidget themeSelector = new ThemeColorSelectorWidget(colorToChangeTo: currentColorTheme);
themeSelector.Margin = new BorderDouble(right: 5);
themeControlsGroupBox.AddChild(colorSelectorContainer);
colorSelectorContainer.AddChild(themeSelector);
colorSelectorContainer.AddChild(currentColorThemeBorder);
currentColorThemeBorder.AddChild(currentColorTheme);
container.AddChild(themeControlsGroupBox);
controlsTopToBottomLayout.AddChild(container);
}
示例11: AddText
private void AddText(string tabText, GuiWidget widgetState, RGBA_Bytes textColor, RGBA_Bytes backgroundColor, double pointSize)
{
leftToRight = new FlowLayoutWidget();
tabTitle = new TextWidget(tabText, pointSize: pointSize, textColor: textColor);
tabTitle.AutoExpandBoundsToText = true;
leftToRight.AddChild(tabTitle);
ImageBuffer popOutImageClick = StaticData.Instance.LoadIcon(Path.Combine("icon_pop_out_32x32.png"));
if (ActiveTheme.Instance.IsDarkTheme)
{
InvertLightness.DoInvertLightness(popOutImageClick);
}
ImageBuffer popOutImage = new ImageBuffer(popOutImageClick);
byte[] buffer = popOutImage.GetBuffer();
for (int i = 0; i < buffer.Length; i++)
{
if ((i & 3) != 3)
{
buffer[i] = textColor.red;
}
}
Button popOut = new Button(0, 0, new ButtonViewStates(new ImageWidget(popOutImage), new ImageWidget(popOutImage), new ImageWidget(popOutImageClick), new ImageWidget(popOutImageClick)));
popOut.ToolTipText = "Pop This Tab out into its own Window".Localize();
popOut.Click += (sender, e) =>
{
popOutManager.ShowContentInWindow();
};
popOut.Margin = new BorderDouble(3, 0);
popOut.VAnchor = VAnchor.ParentTop;
leftToRight.AddChild(popOut);
widgetState.AddChild(leftToRight);
widgetState.SetBoundsToEncloseChildren();
widgetState.BackgroundColor = backgroundColor;
}
示例12: AddChildElements
protected void AddChildElements()
{
actionBarButtonFactory.invertImageLocation = false;
actionBarButtonFactory.borderWidth = 1;
if (ActiveTheme.Instance.IsDarkTheme)
{
actionBarButtonFactory.normalBorderColor = new RGBA_Bytes(77, 77, 77);
}
else
{
actionBarButtonFactory.normalBorderColor = new RGBA_Bytes(190, 190, 190);
}
actionBarButtonFactory.hoverBorderColor = new RGBA_Bytes(128, 128, 128);
// connect and disconnect buttons
{
connectPrinterButton = actionBarButtonFactory.Generate("Connect".Localize().ToUpper(), "icon_power_32x32.png");
connectPrinterButton.Name = "Connect to printer button";
connectPrinterButton.ToolTipText = "Connect to the currently selected printer".Localize();
connectPrinterButton.Margin = new BorderDouble(6, 0, 3, 3);
connectPrinterButton.VAnchor = VAnchor.ParentTop;
connectPrinterButton.Cursor = Cursors.Hand;
connectPrinterButton.Click += (s, e) =>
{
Button buttonClicked = ((Button)s);
if (buttonClicked.Enabled)
{
if (ActiveSliceSettings.Instance.PrinterSelected)
{
UserRequestedConnectToActivePrinter();
}
}
};
disconnectPrinterButton = actionBarButtonFactory.Generate("Disconnect".Localize().ToUpper(), "icon_power_32x32.png");
disconnectPrinterButton.Name = "Disconnect from printer button";
disconnectPrinterButton.ToolTipText = "Disconnect from current printer".Localize();
disconnectPrinterButton.Margin = new BorderDouble(6, 0, 3, 3);
disconnectPrinterButton.VAnchor = VAnchor.ParentTop;
disconnectPrinterButton.Cursor = Cursors.Hand;
disconnectPrinterButton.Click += (s, e) => UiThread.RunOnIdle(OnIdleDisconnect);
actionBarButtonFactory.invertImageLocation = true;
this.AddChild(connectPrinterButton);
this.AddChild(disconnectPrinterButton);
}
// printer selector and edit button
{
GuiWidget container = new GuiWidget()
{
HAnchor = HAnchor.ParentLeftRight,
VAnchor = VAnchor.FitToChildren,
};
FlowLayoutWidget printerSelectorAndEditButton = new FlowLayoutWidget()
{
HAnchor = HAnchor.ParentLeftRight,
};
printerSelector = new PrinterSelector()
{
HAnchor = HAnchor.ParentLeftRight,
Cursor = Cursors.Hand,
Margin = new BorderDouble(0, 6, 0, 3)
};
printerSelector.AddPrinter += (s, e) => WizardWindow.ShowPrinterSetup(true);
// make sure the control can get smaller but maintains its height
printerSelector.MinimumSize = new Vector2(0, connectPrinterButton.MinimumSize.y);
printerSelectorAndEditButton.AddChild(printerSelector);
editPrinterButton = TextImageButtonFactory.GetThemedEditButton();
editPrinterButton.Name = "Edit Printer Button";
editPrinterButton.VAnchor = VAnchor.ParentCenter;
editPrinterButton.Click += UiNavigation.OpenEditPrinterWizard_Click;
printerSelectorAndEditButton.AddChild(editPrinterButton);
container.AddChild(printerSelectorAndEditButton);
printerSelectorAndEditOverlay = new GuiWidget()
{
HAnchor = HAnchor.ParentLeftRight,
VAnchor = VAnchor.ParentBottomTop,
Selectable = false,
};
container.AddChild(printerSelectorAndEditOverlay);
this.AddChild(container);
}
// reset connection button
{
string resetConnectionText = "Reset\nConnection".Localize().ToUpper();
Button resetConnectionButton = actionBarButtonFactory.Generate(resetConnectionText, "e_stop4.png");
resetConnectionButton.Margin = new BorderDouble(6, 0, 3, 3);
this.AddChild(resetConnectionButton);
resetConnectionButton.Click += new EventHandler((s,e) => PrinterConnectionAndCommunication.Instance.RebootBoard());
resetConnectionButton.Visible = ActiveSliceSettings.Instance.GetValue<bool>(SettingsKey.show_reset_connection);
//.........这里部分代码省略.........
示例13: AddItem
public MenuItem AddItem(string name, string value = null)
{
if (value == null)
{
value = name;
}
mainControlText.Margin = MenuItemsPadding;
GuiWidget normalTextWithMargin = new GuiWidget();
normalTextWithMargin.HAnchor = UI.HAnchor.ParentLeftRight | UI.HAnchor.FitToChildren;
normalTextWithMargin.VAnchor = UI.VAnchor.FitToChildren;
normalTextWithMargin.BackgroundColor = MenuItemsBackgroundColor;
TextWidget normal = new TextWidget(name);
normal.Margin = MenuItemsPadding;
normal.TextColor = MenuItemsTextColor;
normalTextWithMargin.AddChild(normal);
GuiWidget hoverTextWithMargin = new GuiWidget();
hoverTextWithMargin.HAnchor = UI.HAnchor.ParentLeftRight | UI.HAnchor.FitToChildren;
hoverTextWithMargin.VAnchor = UI.VAnchor.FitToChildren;
hoverTextWithMargin.BackgroundColor = MenuItemsBackgroundHoverColor;
TextWidget hover = new TextWidget(name);
hover.Margin = MenuItemsPadding;
hover.TextColor = MenuItemsTextHoverColor;
hoverTextWithMargin.AddChild(hover);
MenuItem menuItem = new MenuItem(new MenuItemStatesView(normalTextWithMargin, hoverTextWithMargin), value);
menuItem.Text = name;
MenuItems.Add(menuItem);
return menuItem;
}
示例14: CreateContentForEmptyControl
private GuiWidget CreateContentForEmptyControl()
{
GuiWidget allContent = new GuiWidget(HAnchor.ParentLeftRight, VAnchor.ParentBottomTop);
allContent.Padding = new BorderDouble(5, 10, 5, 10);
FlowLayoutWidget flowWidget = new FlowLayoutWidget();
flowWidget.BackgroundColor = ActiveTheme.Instance.TransparentDarkOverlay;
flowWidget.HAnchor = HAnchor.ParentLeftRight;
flowWidget.VAnchor = VAnchor.ParentTop;
flowWidget.Padding = new BorderDouble(10, 0);
flowWidget.Height = 60;
TextImageButtonFactory bringBackButtonFactory = new TextImageButtonFactory();
bringBackButtonFactory.normalFillColor = RGBA_Bytes.Gray;
bringBackButtonFactory.normalTextColor = ActiveTheme.Instance.PrimaryTextColor;
Button bringBackToTabButton = bringBackButtonFactory.Generate(LocalizedString.Get("Restore"));
bringBackToTabButton.ToolTipText = "Bring the Window back into this Tab".Localize();
bringBackToTabButton.VAnchor = VAnchor.ParentCenter;
bringBackToTabButton.Cursor = Cursors.Hand;
bringBackToTabButton.Click += (sender, e) =>
{
UiThread.RunOnIdle(() =>
{
SaveWindowShouldStartClosed();
SystemWindow temp = systemWindowWithPopContent;
SystemWindow_Closing(null, null);
temp.Close();
});
};
TextWidget windowedModeMessage = new TextWidget(LocalizedString.Get("WINDOWED MODE: This tab has been moved to a separate window."),
pointSize: 10, textColor: ActiveTheme.Instance.PrimaryTextColor);
windowedModeMessage.VAnchor = VAnchor.ParentCenter;
flowWidget.AddChild(windowedModeMessage);
flowWidget.AddChild(new HorizontalSpacer());
flowWidget.AddChild(bringBackToTabButton);
allContent.AddChild(flowWidget);
return allContent;
}
示例15: Create4FieldSet
private GuiWidget Create4FieldSet(string label,
string field1Label, ref MHNumberEdit field1,
string field2Label, ref MHNumberEdit field2,
string field3Label, ref MHNumberEdit field3,
string field4Label, ref MHNumberEdit field4)
{
FlowLayoutWidget row = new FlowLayoutWidget();
row.Margin = new BorderDouble(3);
row.HAnchor = Agg.UI.HAnchor.ParentLeftRight;
TextWidget labelWidget = new TextWidget(LocalizedString.Get(label), textColor: ActiveTheme.Instance.PrimaryTextColor);
labelWidget.VAnchor = VAnchor.ParentCenter;
maxWidthOfLeftStuff = Math.Max(maxWidthOfLeftStuff, labelWidget.Width);
GuiWidget holder = new GuiWidget(labelWidget.Width, labelWidget.Height);
holder.Margin = new BorderDouble(3, 0);
holder.AddChild(labelWidget);
leftStuffToSize.Add(holder);
row.AddChild(holder);
{
row.AddChild(CreateTextField(field1Label));
GuiWidget nextTabIndex = CreateMHNumEdit(ref field1);
nextTabIndex.TabIndex = GetNextTabIndex();
row.AddChild(nextTabIndex);
}
if (field2Label != null)
{
row.AddChild(CreateTextField(field2Label));
GuiWidget nextTabIndex = CreateMHNumEdit(ref field2);
nextTabIndex.TabIndex = GetNextTabIndex();
row.AddChild(nextTabIndex);
}
if (field3Label != null)
{
row.AddChild(CreateTextField(field3Label));
GuiWidget nextTabIndex = CreateMHNumEdit(ref field3);
nextTabIndex.TabIndex = GetNextTabIndex();
row.AddChild(nextTabIndex);
}
if (field4Label != null)
{
row.AddChild(CreateTextField(field4Label));
GuiWidget nextTabIndex = CreateMHNumEdit(ref field4);
nextTabIndex.TabIndex = GetNextTabIndex();
row.AddChild(nextTabIndex);
}
return row;
}