本文整理汇总了C#中MatterHackers.Agg.UI.GuiWidget类的典型用法代码示例。如果您正苦于以下问题:C# GuiWidget类的具体用法?C# GuiWidget怎么用?C# GuiWidget使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GuiWidget类属于MatterHackers.Agg.UI命名空间,在下文中一共展示了GuiWidget类的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: OutputImage
private static void OutputImage(GuiWidget widgetToOutput, string fileName)
{
if (saveImagesForDebug)
{
OutputImage(widgetToOutput.BackBuffer, fileName);
}
}
示例3: OpenMenuContents
internal OpenMenuContents(ObservableCollection<MenuItem> MenuItems, GuiWidget widgetRelativeTo, Vector2 openOffset, Direction direction, RGBA_Bytes backgroundColor, RGBA_Bytes borderColor, int borderWidth, double maxHeight, bool alignToRightEdge)
{
this.MenuItems = new List<MenuItem>();
this.MenuItems.AddRange(MenuItems);
this.alignToRightEdge = alignToRightEdge;
this.openOffset = openOffset;
this.borderWidth = borderWidth;
this.borderColor = borderColor;
this.BackgroundColor = backgroundColor;
this.direction = direction;
this.widgetRelativeTo = widgetRelativeTo;
scrollingWindow = new ScrollableWidget(true);
{
FlowLayoutWidget topToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom);
foreach (MenuItem menu in MenuItems)
{
menu.ClearRemovedFlag();
topToBottom.AddChild(menu);
menu.DoClickFunction = AllowClickingItems;
}
topToBottom.HAnchor = UI.HAnchor.ParentLeft | UI.HAnchor.FitToChildren;
topToBottom.VAnchor = UI.VAnchor.ParentBottom;
Width = topToBottom.Width;
Height = topToBottom.Height;
scrollingWindow.AddChild(topToBottom);
}
scrollingWindow.HAnchor = HAnchor.ParentLeftRight;
scrollingWindow.VAnchor = VAnchor.ParentBottomTop;
if (maxHeight > 0 && Height > maxHeight)
{
MakeMenuHaveScroll(maxHeight);
}
AddChild(scrollingWindow);
LostFocus += new EventHandler(DropListItems_LostFocus);
GuiWidget topParent = widgetRelativeTo.Parent;
while (topParent.Parent != null)
{
// Regretably we don't know who it is that is the window that will actually think it is moving relative to its parent
// but we need to know anytime our widgetRelativeTo has been moved by any change, so we hook them all.
if (!widgetRefList.Contains(topParent))
{
widgetRefList.Add(topParent);
topParent.PositionChanged += new EventHandler(widgetRelativeTo_PositionChanged);
topParent.BoundsChanged += new EventHandler(widgetRelativeTo_PositionChanged);
}
topParent = topParent.Parent;
}
topParent.AddChild(this);
widgetRelativeTo_PositionChanged(widgetRelativeTo, null);
widgetRelativeTo.Closed += widgetRelativeTo_Closed;
}
示例4: SetupStepMakeModelName
public SetupStepMakeModelName(ConnectionWindow windowController, GuiWidget containerWindowToClose, PrinterSetupStatus setupPrinter = null)
: base(windowController, containerWindowToClose, setupPrinter)
{
//Construct inputs
printerNameContainer = createPrinterNameContainer();
printerMakeContainer = createPrinterMakeContainer();
printerModelContainer = createPrinterModelContainer();
//Add inputs to main container
contentRow.AddChild(printerNameContainer);
contentRow.AddChild(printerMakeContainer);
contentRow.AddChild(printerModelContainer);
//Construct buttons
nextButton = textImageButtonFactory.Generate(new LocalizedString("Save & Continue").Translated);
nextButton.Click += new ButtonBase.ButtonEventHandler(NextButton_Click);
GuiWidget hSpacer = new GuiWidget();
hSpacer.HAnchor = HAnchor.ParentLeftRight;
//Add buttons to buttonContainer
footerRow.AddChild(nextButton);
footerRow.AddChild(hSpacer);
footerRow.AddChild(cancelButton);
SetElementState();
}
示例5: ThemeColorSelectorWidget
public ThemeColorSelectorWidget(GuiWidget colorToChangeTo)
{
this.Padding = new BorderDouble(2, 0);
this.colorToChangeTo = colorToChangeTo;
int themeCount = ActiveTheme.AvailableThemes.Count;
var allThemes = ActiveTheme.AvailableThemes;
int index = 0;
for (int x = 0; x < themeCount / 2; x++)
{
var columnContainer = new FlowLayoutWidget(Agg.UI.FlowDirection.TopToBottom)
{
Width = containerHeight
};
columnContainer.AddChild(CreateThemeButton(allThemes[index]));
int secondRowIndex = index + themeCount / 2;
columnContainer.AddChild(CreateThemeButton(allThemes[secondRowIndex]));
this.AddChild(columnContainer);
index++;
}
this.BackgroundColor = RGBA_Bytes.White;
this.Width = containerHeight * (themeCount / 2);
}
示例6: SetupStepInstallDriver
public SetupStepInstallDriver(ConnectionWindow windowController, GuiWidget containerWindowToClose, PrinterSetupStatus setupPrinterStatus)
: base(windowController, containerWindowToClose, setupPrinterStatus)
{
this.printerDriverFilePath = this.PrinterSetupStatus.DriverFilePath;
headerLabel.Text = string.Format(new LocalizedString("Install Communication Driver").Translated);
printerDriverContainer = createPrinterDriverContainer();
contentRow.AddChild(printerDriverContainer);
{
//Construct buttons
installButton = textImageButtonFactory.Generate(new LocalizedString("Install Driver").Translated);
installButton.Click += new ButtonBase.ButtonEventHandler(installButton_Click);
skipButton = textImageButtonFactory.Generate(new LocalizedString("Skip").Translated);
skipButton.Click += new ButtonBase.ButtonEventHandler(skipButton_Click);
GuiWidget hSpacer = new GuiWidget();
hSpacer.HAnchor = HAnchor.ParentLeftRight;
//Add buttons to buttonContainer
footerRow.AddChild(installButton);
footerRow.AddChild(skipButton);
footerRow.AddChild(hSpacer);
footerRow.AddChild(cancelButton);
}
}
示例7: LibraryRowItem
public LibraryRowItem(LibraryDataView libraryDataView, GuiWidget thumbnailWidget)
{
this.thumbnailWidget = thumbnailWidget;
this.libraryDataView = libraryDataView;
this.IsViewHelperItem = false;
this.EnableSlideInActions = true;
}
示例8: SetViewStates
protected void SetViewStates(GuiWidget normal, GuiWidget normalHover, GuiWidget switchNormalToPressed, GuiWidget pressed, GuiWidget pressedHover, GuiWidget switchPressedToNormal, GuiWidget disabled)
{
this.normal = normal;
this.normalHover = normalHover;
this.switchNormalToPressed = switchNormalToPressed;
this.pressed = pressed;
this.pressedHover = pressedHover;
this.switchPressedToNormal = switchPressedToNormal;
this.disabled = disabled;
AddChild(normal);
AddChild(normalHover);
AddChild(switchNormalToPressed);
AddChild(pressed);
AddChild(pressedHover);
AddChild(switchPressedToNormal);
AddChild(disabled);
SetBoundsToEncloseChildren();
normalHover.Visible = false;
switchNormalToPressed.Visible = false;
pressed.Visible = false;
pressedHover.Visible = false;
switchPressedToNormal.Visible = false;
disabled.Visible = false;
normal.Visible = true;
}
示例9: PresetSelectorWidget
private int extruderIndex; //For multiple materials
public PresetSelectorWidget(string label, RGBA_Bytes accentColor, string tag, int extruderIndex)
: base(FlowDirection.TopToBottom)
{
this.extruderIndex = extruderIndex;
this.filterLabel = label;
this.filterTag = (tag == null) ? label.ToLower() : tag;
this.HAnchor = HAnchor.ParentLeftRight;
this.VAnchor = Agg.UI.VAnchor.Max_FitToChildren_ParentHeight;
this.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
GuiWidget accentBar = new GuiWidget(7, 5)
{
BackgroundColor = accentColor,
HAnchor = HAnchor.ParentLeftRight
};
TextWidget labelText = new TextWidget(label.Localize().ToUpper())
{
TextColor = ActiveTheme.Instance.PrimaryTextColor,
HAnchor = Agg.UI.HAnchor.ParentCenter,
Margin = new BorderDouble(0, 3, 0, 6)
};
this.AddChild(labelText);
this.AddChild(GetPulldownContainer());
this.AddChild(new VerticalSpacer());
this.AddChild(accentBar);
}
示例10: PrintProgressBar
public PrintProgressBar()
{
MinimumSize = new Vector2(0, 24);
HAnchor = HAnchor.ParentLeftRight;
BackgroundColor = ActiveTheme.Instance.SecondaryAccentColor;
Margin = new BorderDouble(0);
FlowLayoutWidget container = new FlowLayoutWidget(FlowDirection.LeftToRight);
container.AnchorAll();
container.Padding = new BorderDouble(6,0);
printTimeElapsed = new TextWidget("", pointSize:11);
printTimeElapsed.AutoExpandBoundsToText = true;
printTimeElapsed.VAnchor = Agg.UI.VAnchor.ParentCenter;
printTimeRemaining = new TextWidget("", pointSize: 11);
printTimeRemaining.AutoExpandBoundsToText = true;
printTimeRemaining.VAnchor = Agg.UI.VAnchor.ParentCenter;
GuiWidget spacer = new GuiWidget();
spacer.HAnchor = Agg.UI.HAnchor.ParentLeftRight;
container.AddChild(printTimeElapsed);
container.AddChild(spacer);
container.AddChild(printTimeRemaining);
AddChild(container);
AddHandlers();
SetThemedColors();
UpdatePrintStatus();
UiThread.RunOnIdle(OnIdle);
}
示例11: CheckBox
public CheckBox(double x, double y, GuiWidget checkBoxButtonView)
: base(x, y)
{
Margin = DefaultMargin;
OriginRelativeParent = new Vector2(x, y);
if (checkBoxButtonView != null)
{
checkBoxButtonView.Selectable = false;
AddChild(checkBoxButtonView);
SetBoundsToEncloseChildren();
if (LocalBounds.Left != 0 || LocalBounds.Bottom != 0)
{
// let's make sure that a button has 0, 0 at the lower left
// move the children so they will fit with 0, 0 at the lower left
foreach (GuiWidget child in Children)
{
child.OriginRelativeParent = child.OriginRelativeParent + new Vector2(-LocalBounds.Left, -LocalBounds.Bottom);
}
SetBoundsToEncloseChildren();
}
MinimumSize = new Vector2(Width, Height);
}
Click += new ButtonEventHandler(CheckBox_Click);
}
示例12: SetupStepComPortTwo
public SetupStepComPortTwo(ConnectionWindow windowController, GuiWidget containerWindowToClose, PrinterSetupStatus setupPrinterStatus)
: base(windowController, containerWindowToClose, setupPrinterStatus)
{
startingPortNames = SerialPort.GetPortNames();
contentRow.AddChild(createPrinterConnectionMessageContainer());
{
//Construct buttons
nextButton = textImageButtonFactory.Generate(new LocalizedString("Done").Translated);
nextButton.Click += new ButtonBase.ButtonEventHandler(NextButton_Click);
nextButton.Visible = false;
connectButton = textImageButtonFactory.Generate(new LocalizedString("Connect").Translated);
connectButton.Click += new ButtonBase.ButtonEventHandler(ConnectButton_Click);
PrinterCommunication.Instance.ConnectionStateChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents);
GuiWidget hSpacer = new GuiWidget();
hSpacer.HAnchor = HAnchor.ParentLeftRight;
//Add buttons to buttonContainer
footerRow.AddChild(nextButton);
footerRow.AddChild(connectButton);
footerRow.AddChild(hSpacer);
footerRow.AddChild(cancelButton);
}
}
示例13: SetupStepInstallDriver
public SetupStepInstallDriver(ConnectionWindow windowController, GuiWidget containerWindowToClose, PrinterSetupStatus setupPrinterStatus)
: base(windowController, containerWindowToClose, setupPrinterStatus)
{
this.driversToInstall = this.currentPrinterSetupStatus.DriversToInstall;
headerLabel.Text = string.Format(LocalizedString.Get("Install Communication Driver"));
printerDriverContainer = createPrinterDriverContainer();
contentRow.AddChild(printerDriverContainer);
{
//Construct buttons
installButton = textImageButtonFactory.Generate(LocalizedString.Get("Install Driver"));
installButton.Click += (sender, e) =>
{
UiThread.RunOnIdle(installButton_Click);
};
skipButton = textImageButtonFactory.Generate(LocalizedString.Get("Skip"));
skipButton.Click += new EventHandler(skipButton_Click);
GuiWidget hSpacer = new GuiWidget();
hSpacer.HAnchor = HAnchor.ParentLeftRight;
//Add buttons to buttonContainer
footerRow.AddChild(installButton);
footerRow.AddChild(skipButton);
footerRow.AddChild(hSpacer);
footerRow.AddChild(cancelButton);
}
}
示例14: LibraryRowItemCollection
public LibraryRowItemCollection(PrintItemCollection collection, LibraryDataView libraryDataView, LibraryProvider parentProvider, GuiWidget thumbnailWidget)
: base(libraryDataView, thumbnailWidget)
{
this.parentProvider = parentProvider;
this.printItemCollection = collection;
CreateGuiElements();
}
示例15: SliceSelectorWidget
private int presetIndex; //For multiple materials
public SliceSelectorWidget(string label, RGBA_Bytes accentColor, string tag = null, int presetIndex = 1)
: base(FlowDirection.TopToBottom)
{
this.presetIndex = presetIndex;
this.filterLabel = label;
if (tag == null)
{
this.filterTag = label.ToLower();
}
else
{
this.filterTag = tag;
}
this.HAnchor = HAnchor.ParentLeftRight;
this.VAnchor = Agg.UI.VAnchor.Max_FitToChildren_ParentHeight;
this.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
GuiWidget accentBar = new GuiWidget(7, 5);
accentBar.BackgroundColor = accentColor;
accentBar.HAnchor = HAnchor.ParentLeftRight;
TextWidget labelText = new TextWidget(LocalizedString.Get(label).ToUpper());
labelText.TextColor = ActiveTheme.Instance.PrimaryTextColor;
labelText.HAnchor = Agg.UI.HAnchor.ParentCenter;
labelText.Margin = new BorderDouble(0, 3, 0, 6);
this.AddChild(labelText);
this.AddChild(GetPulldownContainer());
this.AddChild(new VerticalSpacer());
this.AddChild(accentBar);
}