本文整理汇总了C#中MatterHackers.Agg.UI.FlowLayoutWidget类的典型用法代码示例。如果您正苦于以下问题:C# FlowLayoutWidget类的具体用法?C# FlowLayoutWidget怎么用?C# FlowLayoutWidget使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FlowLayoutWidget类属于MatterHackers.Agg.UI命名空间,在下文中一共展示了FlowLayoutWidget类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ManualPrinterControls
public ManualPrinterControls()
{
SetDisplayAttributes();
FlowLayoutWidget controlsTopToBottomLayout = new FlowLayoutWidget(FlowDirection.TopToBottom);
controlsTopToBottomLayout.HAnchor = Agg.UI.HAnchor.Max_FitToChildren_ParentWidth;
controlsTopToBottomLayout.VAnchor = Agg.UI.VAnchor.FitToChildren;
controlsTopToBottomLayout.Name = "ManualPrinterControls.ControlsContainer";
controlsTopToBottomLayout.Margin = new BorderDouble(0);
AddTemperatureControls(controlsTopToBottomLayout);
AddMovementControls(controlsTopToBottomLayout);
FlowLayoutWidget linearPanel = new FlowLayoutWidget();
linearPanel.HAnchor = Agg.UI.HAnchor.ParentLeftRight;
controlsTopToBottomLayout.AddChild(linearPanel);
AddFanControls(linearPanel);
AddAtxPowerControls(linearPanel);
AddMacroControls(controlsTopToBottomLayout);
AddAdjustmentControls(controlsTopToBottomLayout);
AddChild(controlsTopToBottomLayout);
AddHandlers();
SetVisibleControls();
if (!pluginsQueuedToAdd)
{
UiThread.RunOnIdle(AddPlugins);
pluginsQueuedToAdd = true;
}
}
示例2: 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;
}
示例3: PrinterConfigurationWidget
public PrinterConfigurationWidget()
{
SetDisplayAttributes();
HAnchor = Agg.UI.HAnchor.ParentLeftRight;
VAnchor = Agg.UI.VAnchor.FitToChildren;
FlowLayoutWidget mainLayoutContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);
mainLayoutContainer.HAnchor = Agg.UI.HAnchor.ParentLeftRight;
mainLayoutContainer.VAnchor = Agg.UI.VAnchor.FitToChildren;
mainLayoutContainer.Padding = new BorderDouble(top: 10);
if (!ActiveSliceSettings.Instance.GetValue<bool>(SettingsKey.has_hardware_leveling))
{
mainLayoutContainer.AddChild(new CalibrationSettingsWidget());
}
mainLayoutContainer.AddChild(new HardwareSettingsWidget());
CloudSettingsWidget cloudGroupbox = new CloudSettingsWidget();
mainLayoutContainer.AddChild(cloudGroupbox);
ApplicationSettingsWidget applicationGroupbox = new ApplicationSettingsWidget();
mainLayoutContainer.AddChild(applicationGroupbox);
AddChild(mainLayoutContainer);
AddHandlers();
//SetVisibleControls();
}
示例4: AddChildElements
protected override void AddChildElements()
{
AltGroupBox fanControlsGroupBox = new AltGroupBox(new TextWidget("Fan".Localize(), pointSize: 18, textColor: ActiveTheme.Instance.SecondaryAccentColor));
fanControlsGroupBox.Margin = new BorderDouble(0);
fanControlsGroupBox.BorderColor = ActiveTheme.Instance.PrimaryTextColor;
fanControlsGroupBox.HAnchor |= Agg.UI.HAnchor.ParentLeftRight;
fanControlsGroupBox.VAnchor = Agg.UI.VAnchor.FitToChildren;
this.HAnchor = Agg.UI.HAnchor.ParentLeftRight;
this.AddChild(fanControlsGroupBox);
FlowLayoutWidget leftToRight = new FlowLayoutWidget();
FlowLayoutWidget fanControlsLayout = new FlowLayoutWidget(FlowDirection.TopToBottom);
fanControlsLayout.Padding = new BorderDouble(3, 5, 3, 0);
{
fanControlsLayout.AddChild(CreateFanControls());
}
leftToRight.AddChild(fanControlsLayout);
SetDisplayAttributes();
fanSpeedDisplay = new EditableNumberDisplay(textImageButtonFactory, "{0}%".FormatWith(PrinterConnectionAndCommunication.Instance.FanSpeed0To255.ToString()), "100%");
fanSpeedDisplay.EditComplete += (sender, e) =>
{
PrinterConnectionAndCommunication.Instance.FanSpeed0To255 = (int)(fanSpeedDisplay.GetValue() * 255.5 / 100);
};
leftToRight.AddChild(fanSpeedDisplay);
fanControlsGroupBox.AddChild(leftToRight);
}
示例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: GetCloudSyncDashboardControls
private FlowLayoutWidget GetCloudSyncDashboardControls()
{
FlowLayoutWidget cloudSyncContainer = new FlowLayoutWidget();
cloudSyncContainer.HAnchor |= HAnchor.ParentLeftRight;
cloudSyncContainer.VAnchor |= Agg.UI.VAnchor.ParentCenter;
cloudSyncContainer.Margin = new BorderDouble(0, 0, 0, 0);
cloudSyncContainer.Padding = new BorderDouble(0);
Agg.Image.ImageBuffer cloudMonitorImage = StaticData.Instance.LoadIcon(Path.Combine("PrintStatusControls", "cloud-24x24.png"));
if (!ActiveTheme.Instance.IsDarkTheme)
{
InvertLightness.DoInvertLightness(cloudMonitorImage);
}
ImageWidget cloudSyncIcon = new ImageWidget(cloudMonitorImage);
cloudSyncIcon.Margin = new BorderDouble(right: 6, bottom: 6);
TextWidget cloudSyncLabel = new TextWidget(LocalizedString.Get("Cloud Sync"));
cloudSyncLabel.AutoExpandBoundsToText = true;
cloudSyncLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor;
cloudSyncLabel.VAnchor = VAnchor.ParentCenter;
linkButtonFactory.fontSize = 10;
Button cloudSyncGoLink = linkButtonFactory.Generate("GO TO DASHBOARD");
cloudSyncGoLink.ToolTipText = "Open cloud sync dashboard in web browser";
cloudSyncGoLink.Click += new EventHandler(cloudSyncGoButton_Click);
cloudSyncContainer.AddChild(cloudSyncIcon);
cloudSyncContainer.AddChild(cloudSyncLabel);
cloudSyncContainer.AddChild(new HorizontalSpacer());
cloudSyncContainer.AddChild(cloudSyncGoLink);
return cloudSyncContainer;
}
示例7: SDCardManager
private SDCardManager()
: base(400, 300)
{
BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
this.AnchorAll();
Title = "MatterControl - SD Card Manager";
this.ShowAsSystemWindow();
MinimumSize = new Vector2(Width, Height);
FlowLayoutWidget topToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom);
FlowLayoutWidget topButtons = new FlowLayoutWidget();
topButtons.AddChild(textImageButtonFactory.Generate("Upload"));
topButtons.AddChild(textImageButtonFactory.Generate("Delete"));
topButtons.AddChild(textImageButtonFactory.Generate("New Folder"));
topButtons.AddChild(textImageButtonFactory.Generate("Print"));
topButtons.AddChild(textImageButtonFactory.Generate("Stop"));
topButtons.AddChild(textImageButtonFactory.Generate("Mount"));
topButtons.AddChild(textImageButtonFactory.Generate("Unmount"));
topToBottom.AddChild(topButtons);
this.AddChild(topToBottom);
}
示例8: createPrinterConnectionMessageContainer
public FlowLayoutWidget createPrinterConnectionMessageContainer()
{
FlowLayoutWidget container = new FlowLayoutWidget(FlowDirection.TopToBottom);
container.Margin = new BorderDouble(5);
BorderDouble elementMargin = new BorderDouble(top: 5);
TextWidget continueMessage = new TextWidget("Would you like to connect to this printer now?", 0, 0, 12);
continueMessage.AutoExpandBoundsToText = true;
continueMessage.TextColor = ActiveTheme.Instance.PrimaryTextColor;
continueMessage.HAnchor = HAnchor.ParentLeftRight;
continueMessage.Margin = elementMargin;
TextWidget continueMessageTwo = new TextWidget("You can always configure this later.", 0, 0, 10);
continueMessageTwo.AutoExpandBoundsToText = true;
continueMessageTwo.TextColor = ActiveTheme.Instance.PrimaryTextColor;
continueMessageTwo.HAnchor = HAnchor.ParentLeftRight;
continueMessageTwo.Margin = elementMargin;
printerErrorMessage = new TextWidget("", 0, 0, 10);
printerErrorMessage.AutoExpandBoundsToText = true;
printerErrorMessage.TextColor = RGBA_Bytes.Red;
printerErrorMessage.HAnchor = HAnchor.ParentLeftRight;
printerErrorMessage.Margin = elementMargin;
container.AddChild(continueMessage);
container.AddChild(continueMessageTwo);
container.AddChild(printerErrorMessage);
container.HAnchor = HAnchor.ParentLeftRight;
return container;
}
示例9: PrinterConfigurationWidget
public PrinterConfigurationWidget()
{
SetDisplayAttributes();
HAnchor = Agg.UI.HAnchor.ParentLeftRight;
VAnchor = Agg.UI.VAnchor.FitToChildren;
FlowLayoutWidget mainLayoutContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);
mainLayoutContainer.HAnchor = Agg.UI.HAnchor.ParentLeftRight;
mainLayoutContainer.VAnchor = Agg.UI.VAnchor.FitToChildren;
mainLayoutContainer.Padding = new BorderDouble(top: 10);
HardwareSettingsWidget hardwareGroupbox = new HardwareSettingsWidget();
mainLayoutContainer.AddChild(hardwareGroupbox);
CloudSettingsWidget cloudGroupbox = new CloudSettingsWidget();
mainLayoutContainer.AddChild(cloudGroupbox);
ApplicationSettingsWidget applicationGroupbox = new ApplicationSettingsWidget();
mainLayoutContainer.AddChild(applicationGroupbox);
AddChild(mainLayoutContainer);
AddHandlers();
//SetVisibleControls();
}
示例10: LibraryDataView
public LibraryDataView()
{
// let the application controler know about this window so it can use it to switch library providers if it needs to.
ApplicationController.Instance.CurrentLibraryDataView = this;
currentLibraryProvider = new LibraryProviderSelector(SetCurrentLibraryProvider, false);
currentLibraryProvider.DataReloaded += LibraryDataReloaded;
if (libraryDataViewInstance != null)
{
#if !__ANDROID__ // this is really just for debugging
throw new Exception("There should only ever be one of these, Lars.");
#endif
}
libraryDataViewInstance = this;
// set the display attributes
{
this.AnchorAll();
this.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor;
this.ScrollArea.Padding = new BorderDouble(3);
}
ScrollArea.HAnchor = HAnchor.ParentLeftRight;
AutoScroll = true;
topToBottomItemList = new FlowLayoutWidget(FlowDirection.TopToBottom);
topToBottomItemList.HAnchor = HAnchor.ParentLeftRight;
AddChild(topToBottomItemList);
AddAllItems();
}
示例11: PowerControls
public PowerControls()
{
AltGroupBox fanControlsGroupBox = new AltGroupBox(new TextWidget("ATX Power Control".Localize(), pointSize: 18, textColor: ActiveTheme.Instance.SecondaryAccentColor));
fanControlsGroupBox.Margin = new BorderDouble(0);
fanControlsGroupBox.BorderColor = ActiveTheme.Instance.PrimaryTextColor;
fanControlsGroupBox.HAnchor |= Agg.UI.HAnchor.ParentLeftRight;
this.AddChild(fanControlsGroupBox);
atxPowertoggleSwitch = ImageButtonFactory.CreateToggleSwitch(false);
atxPowertoggleSwitch.Margin = new BorderDouble(6, 0, 6, 6);
atxPowertoggleSwitch.CheckedStateChanged += (sender, e) =>
{
PrinterConnectionAndCommunication.Instance.AtxPowerEnabled = atxPowertoggleSwitch.Checked;
};
FlowLayoutWidget paddingContainer = new FlowLayoutWidget();
paddingContainer.Padding = new BorderDouble(3, 5, 3, 0);
{
paddingContainer.AddChild(atxPowertoggleSwitch);
}
fanControlsGroupBox.AddChild(paddingContainer);
UpdateControlVisibility(null, null);
PrinterConnectionAndCommunication.Instance.CommunicationStateChanged.RegisterEvent(this.UpdateControlVisibility, ref unregisterEvents);
PrinterConnectionAndCommunication.Instance.AtxPowerStateChanged.RegisterEvent(this.UpdatePowerSwitch, ref unregisterEvents);
this.HAnchor = Agg.UI.HAnchor.ParentLeftRight;
this.HAnchor = HAnchor.ParentLeftRight;
this.VAnchor = VAnchor.ParentBottomTop;
}
示例12: CreateOptionsMenu
GuiWidget CreateOptionsMenu()
{
ImageBuffer gearImage = new ImageBuffer();
string imagePathAndFile = Path.Combine(ApplicationDataStorage.Instance.ApplicationStaticDataPath, "gear_icon.png");
ImageBMPIO.LoadImageData(imagePathAndFile, gearImage);
FlowLayoutWidget leftToRight = new FlowLayoutWidget();
leftToRight.Margin = new BorderDouble(5, 0);
string optionsString = new LocalizedString("Options").Translated;
TextWidget optionsText = new TextWidget(optionsString, textColor: RGBA_Bytes.White);
optionsText.VAnchor = Agg.UI.VAnchor.ParentCenter;
optionsText.Margin = new BorderDouble(0, 0, 3, 0);
leftToRight.AddChild(optionsText);
GuiWidget gearWidget = new ImageWidget(gearImage);
gearWidget.VAnchor = Agg.UI.VAnchor.ParentCenter;
leftToRight.AddChild(gearWidget);
leftToRight.HAnchor = HAnchor.FitToChildren;
leftToRight.VAnchor = VAnchor.FitToChildren;
Menu optionMenu = new Menu(leftToRight);
optionMenu.OpenOffset = new Vector2(-2, -10);
optionMenu.VAnchor = Agg.UI.VAnchor.ParentCenter;
optionMenu.MenuItems.Add(new MenuItem(new ThemeColorSelectorWidget()));
return optionMenu;
}
示例13: createPrinterNameContainer
private FlowLayoutWidget createPrinterNameContainer()
{
FlowLayoutWidget container = new FlowLayoutWidget(FlowDirection.TopToBottom);
container.Margin = new BorderDouble(0, 5);
BorderDouble elementMargin = new BorderDouble(top: 3);
string printerNameLabelTxt = LocalizedString.Get("Printer Name");
string printerNameLabelTxtFull = string.Format("{0}:", printerNameLabelTxt);
TextWidget printerNameLabel = new TextWidget(printerNameLabelTxtFull, 0, 0, 12);
printerNameLabel.TextColor = this.defaultTextColor;
printerNameLabel.HAnchor = HAnchor.ParentLeftRight;
printerNameLabel.Margin = new BorderDouble(0, 0, 0, 1);
printerNameInput = new MHTextEditWidget(this.ActivePrinter.Name);
printerNameInput.HAnchor = HAnchor.ParentLeftRight;
printerNameInput.KeyPressed += PrinterNameInput_KeyPressed;
printerNameError = new TextWidget(LocalizedString.Get("Give your printer a name."), 0, 0, 10);
printerNameError.TextColor = ActiveTheme.Instance.PrimaryTextColor;
printerNameError.HAnchor = HAnchor.ParentLeftRight;
printerNameError.Margin = elementMargin;
container.AddChild(printerNameLabel);
container.AddChild(printerNameInput);
container.AddChild(printerNameError);
container.HAnchor = HAnchor.ParentLeftRight;
return container;
}
示例14: RayTracerWindow
public RayTracerWindow(int width, int height)
: base(width, height)
{
//CalculateIntersectCostsAndSaveToFile();
FlowLayoutWidget leftToRight = new FlowLayoutWidget();
leftToRight.HAnchor |= HAnchor.ParentLeftRight;
leftToRight.VAnchor |= VAnchor.ParentBottomTop;
previewWindowRayTrace = new RayTraceWidget();
AnchorAll();
previewWindowRayTrace.AnchorAll();
leftToRight.AddChild(previewWindowRayTrace);
GuiWidget zBuffer = new GuiWidget(HAnchor.ParentLeftRight, VAnchor.ParentBottomTop);
zBuffer.BackgroundColor = RGBA_Bytes.Blue;
leftToRight.AddChild(zBuffer);
AddChild(leftToRight);
BackgroundColor = RGBA_Bytes.Black;
ShowAsSystemWindow();
}
示例15: PrintProgressBar
public PrintProgressBar(bool widgetIsExtended = true)
{
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.Printer.DrawFromHintedCache = true;
printTimeElapsed.AutoExpandBoundsToText = true;
printTimeElapsed.VAnchor = Agg.UI.VAnchor.ParentCenter;
printTimeRemaining = new TextWidget("", pointSize: 11);
printTimeRemaining.Printer.DrawFromHintedCache = true;
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);
if (ActiveTheme.Instance.IsTouchScreen)
{
upImageBuffer = StaticData.Instance.LoadIcon("TouchScreen/arrow_up_32x24.png");
downImageBuffer = StaticData.Instance.LoadIcon("TouchScreen/arrow_down_32x24.png");
indicatorWidget = new ImageWidget(upImageBuffer);
indicatorWidget.HAnchor = HAnchor.ParentCenter;
indicatorWidget.VAnchor = VAnchor.ParentCenter;
WidgetIsExtended = widgetIsExtended;
GuiWidget indicatorOverlay = new GuiWidget();
indicatorOverlay.AnchorAll();
indicatorOverlay.AddChild(indicatorWidget);
AddChild(indicatorOverlay);
}
ClickWidget clickOverlay = new ClickWidget();
clickOverlay.AnchorAll();
clickOverlay.Click += onProgressBarClick;
AddChild(clickOverlay);
AddHandlers();
SetThemedColors();
UpdatePrintStatus();
UiThread.RunOnIdle(OnIdle);
}