本文整理汇总了C#中MatterHackers.Agg.UI.GuiWidget类的典型用法代码示例。如果您正苦于以下问题:C# GuiWidget类的具体用法?C# GuiWidget怎么用?C# GuiWidget使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GuiWidget类属于MatterHackers.Agg.UI命名空间,在下文中一共展示了GuiWidget类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:klewisjohnson,项目名称:MatterControl,代码行数:28,代码来源:ThemeColorSelectorWidget.cs
示例2: OutputImage
private static void OutputImage(GuiWidget widgetToOutput, string fileName)
{
if (saveImagesForDebug)
{
OutputImage(widgetToOutput.BackBuffer, fileName);
}
}
开发者ID:ChapmanCPSC370,项目名称:MatterControl,代码行数:7,代码来源:MatterControlUtilities.cs
示例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;
}
开发者ID:CNCBrasil,项目名称:agg-sharp,代码行数:60,代码来源:OpenMenuContents.cs
示例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();
}
开发者ID:rubenkar,项目名称:MatterControl,代码行数:27,代码来源:SetupStepMakeModelName.cs
示例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);
}
开发者ID:unlimitedbacon,项目名称:MatterControl,代码行数:27,代码来源:ThemeColorSelectorWidget.cs
示例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);
}
}
开发者ID:rubenkar,项目名称:MatterControl,代码行数:27,代码来源:SetupStepInstallDriver.cs
示例7: LibraryRowItem
public LibraryRowItem(LibraryDataView libraryDataView, GuiWidget thumbnailWidget)
{
this.thumbnailWidget = thumbnailWidget;
this.libraryDataView = libraryDataView;
this.IsViewHelperItem = false;
this.EnableSlideInActions = true;
}
开发者ID:tellingmachine,项目名称:MatterControl,代码行数:7,代码来源:LibraryRowItem.cs
示例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;
}
开发者ID:glocklueng,项目名称:agg-sharp,代码行数:31,代码来源:CheckBoxViewSates.cs
示例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);
}
开发者ID:broettge,项目名称:MatterControl,代码行数:31,代码来源:SettingsControlSelectors.cs
示例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);
}
开发者ID:rubenkar,项目名称:MatterControl,代码行数:33,代码来源:PrintProgressBarWidget.cs
示例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);
}
开发者ID:jeske,项目名称:agg-sharp,代码行数:32,代码来源:CheckBox.cs
示例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);
}
}
开发者ID:rubenkar,项目名称:MatterControl,代码行数:28,代码来源:SetupStepComPortTwo.cs
示例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);
}
}
开发者ID:fuding,项目名称:MatterControl,代码行数:30,代码来源:SetupStepInstallDriver.cs
示例14: LibraryRowItemCollection
public LibraryRowItemCollection(PrintItemCollection collection, LibraryDataView libraryDataView, LibraryProvider parentProvider, GuiWidget thumbnailWidget)
: base(libraryDataView, thumbnailWidget)
{
this.parentProvider = parentProvider;
this.printItemCollection = collection;
CreateGuiElements();
}
开发者ID:annafeldman,项目名称:MatterControl,代码行数:7,代码来源:LibraryRowItemCollection.cs
示例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);
}
开发者ID:Joao-Fonseca,项目名称:MatterControl,代码行数:35,代码来源:SettingsControlSelectors.cs
示例16: SetupStepComPortManual
public SetupStepComPortManual(ConnectionWindow windowController, GuiWidget containerWindowToClose, PrinterSetupStatus setupPrinterStatus)
: base(windowController, containerWindowToClose, setupPrinterStatus)
{
linkButtonFactory.fontSize = 8;
FlowLayoutWidget printerComPortContainer = createComPortContainer();
contentRow.AddChild(printerComPortContainer);
{
//Construct buttons
nextButton = textImageButtonFactory.Generate(LocalizedString.Get("Done"));
nextButton.Click += new EventHandler(NextButton_Click);
nextButton.Visible = false;
connectButton = textImageButtonFactory.Generate(LocalizedString.Get("Connect"));
connectButton.Click += new EventHandler(ConnectButton_Click);
PrinterConnectionAndCommunication.Instance.CommunicationStateChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents);
refreshButton = textImageButtonFactory.Generate(LocalizedString.Get("Refresh"));
refreshButton.Click += new EventHandler(RefreshButton_Click);
GuiWidget hSpacer = new GuiWidget();
hSpacer.HAnchor = HAnchor.ParentLeftRight;
//Add buttons to buttonContainer
footerRow.AddChild(nextButton);
footerRow.AddChild(connectButton);
footerRow.AddChild(refreshButton);
footerRow.AddChild(hSpacer);
footerRow.AddChild(cancelButton);
}
}
开发者ID:rorypond,项目名称:MatterControl,代码行数:32,代码来源:SetupStepComPortManual.cs
示例17: getThemeButton
public Button getThemeButton(int index)
{
GuiWidget normal = new GuiWidget(colorSelectSize, colorSelectSize);
normal.BackgroundColor = ActiveTheme.Instance.AvailableThemes[index].primaryAccentColor;
GuiWidget hover = new GuiWidget(colorSelectSize, colorSelectSize);
hover.BackgroundColor = ActiveTheme.Instance.AvailableThemes[index].secondaryAccentColor;
GuiWidget pressed = new GuiWidget(colorSelectSize, colorSelectSize);
pressed.BackgroundColor = ActiveTheme.Instance.AvailableThemes[index].secondaryAccentColor;
GuiWidget disabled = new GuiWidget(colorSelectSize, colorSelectSize);
Button colorButton = new Button(0, 0, 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));
};
colorButton.MouseEnterBounds += (sender, mouseEvent) =>
{
colorToChangeTo.BackgroundColor = ActiveTheme.Instance.AvailableThemes[index].primaryAccentColor;
};
colorButton.MouseLeaveBounds += (sender, mouseEvent) =>
{
colorToChangeTo.BackgroundColor = ActiveTheme.Instance.PrimaryAccentColor;
};
return colorButton;
}
开发者ID:broettge,项目名称:MatterControl,代码行数:30,代码来源:ThemeColorSelectorWidget.cs
示例18: ScrollIntoView
public void ScrollIntoView(GuiWidget widget)
{
if (scrollingWindow.VerticalScrollBar.Visible)
{
scrollingWindow.ScrollPosition = new Vector2(0, -widget.BoundsRelativeToParent.Bottom + this.Height /2);
}
}
开发者ID:glocklueng,项目名称:agg-sharp,代码行数:7,代码来源:OpenMenuContents.cs
示例19: DoFitToChildrenVertical
public void DoFitToChildrenVertical(GuiWidget widgetToAdjust, ref bool sizeWasChanged)
{
if (widgetToAdjust.VAnchorIsSet(VAnchor.FitToChildren))
{
double heightToMatchParent = 0;
if (widgetToAdjust.Parent != null)
{
Vector2 newOriginRelParent;
if (!GetOriginAndHeightForChild(widgetToAdjust.Parent, widgetToAdjust, out newOriginRelParent, out heightToMatchParent))
{
// we don't need to adjust anything for the parent so make sure this is not applied below.
heightToMatchParent = 0;
}
}
// get the bounds
RectangleDouble parentBounds = widgetToAdjust.LocalBounds;
// get the bounds to enclose its childern
RectangleDouble childrenEnclosingBounds = widgetToAdjust.GetMinimumBoundsToEncloseChildren(true);
// fix the v size to enclose the children
parentBounds.Bottom = childrenEnclosingBounds.Bottom;
parentBounds.Top = Math.Max(childrenEnclosingBounds.Bottom + heightToMatchParent, childrenEnclosingBounds.Top);
if (widgetToAdjust.LocalBounds != parentBounds)
{
// push the new size in
widgetToAdjust.LocalBounds = parentBounds;
sizeWasChanged = true;
}
}
}
开发者ID:jeske,项目名称:agg-sharp,代码行数:30,代码来源:LayoutEngineSimpleAlign.cs
示例20: LibraryRowItemPart
public LibraryRowItemPart(LibraryProvider libraryProvider, int itemIndex, LibraryDataView libraryDataView, GuiWidget thumbnailWidget)
: base(libraryDataView, thumbnailWidget)
{
thumbnailWidth = thumbnailWidget.Width;
var widget = thumbnailWidget as IClickable;
if (widget != null)
{
widget.Click += onViewPartClick;
}
this.ItemName = libraryProvider.GetPrintItemName(itemIndex);
if(this.ItemName == LibraryRowItem.LoadingPlaceholderToken)
{
this.ItemName = "Retrieving Contents...".Localize();
this.IsViewHelperItem = true;
this.EnableSlideInActions = false;
}
this.libraryProvider = libraryProvider;
this.ItemIndex = itemIndex;
CreateGuiElements();
AddLoadingProgressBar();
libraryProvider.RegisterForProgress(itemIndex, ReportProgressRatio);
}
开发者ID:Joao-Fonseca,项目名称:MatterControl,代码行数:27,代码来源:LibraryRowItemPart.cs
注:本文中的MatterHackers.Agg.UI.GuiWidget类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论