public PrinterListItemEdit(Printer printerRecord, ConnectionWindow windowController) : base(printerRecord, windowController) { this.printerRecord = printerRecord; this.Margin = new BorderDouble(1); this.BackgroundColor = this.defaultBackgroundColor; this.Padding = new BorderDouble(0); this.HAnchor = HAnchor.ParentLeftRight; FlowLayoutWidget printerNameContainer = new FlowLayoutWidget(); printerNameContainer.HAnchor = HAnchor.ParentLeftRight; printerName = new TextWidget(this.printerRecord.Name); printerName.TextColor = this.defaultTextColor; printerName.Margin = new BorderDouble(5, 10, 0, 10); printerName.HAnchor = HAnchor.ParentLeftRight; printerNameContainer.AddChild(printerName); FlowLayoutWidget rightButtonOverlayContainer = new FlowLayoutWidget(FlowDirection.RightToLeft); rightButtonOverlayContainer.HAnchor = HAnchor.ParentLeftRight; rightButtonOverlayContainer.VAnchor = VAnchor.ParentBottomTop; this.rightButtonOverlay = getItemActionButtons(); this.rightButtonOverlay.Padding = new BorderDouble(0); this.rightButtonOverlay.Visible = true; rightButtonOverlayContainer.AddChild(rightButtonOverlay); this.AddChild(printerNameContainer); this.AddChild(rightButtonOverlayContainer); }
public PrinterListItemEdit(Printer printerRecord, ConnectionWindow windowController) : base(printerRecord, windowController) { this.printerRecord = printerRecord; this.Margin = new BorderDouble(1); this.BackgroundColor = this.defaultBackgroundColor; this.Padding = new BorderDouble(0); this.HAnchor = HAnchor.ParentLeftRight; printerName = new TextWidget(this.printerRecord.Name); printerName.TextColor = this.defaultTextColor; printerName.Margin = new BorderDouble(5, 10, 5, 10); printerName.HAnchor = HAnchor.ParentLeftRight; this.AddChild(printerName); this.rightButtonOverlay = getItemActionButtons(); this.rightButtonOverlay.Padding = new BorderDouble(0); this.rightButtonOverlay.Visible = true; this.AddChild(rightButtonOverlay); //BindHandlers(); }
protected override SlideWidget GetItemActionButtons() { SlideWidget buttonContainer = new SlideWidget(); buttonContainer.VAnchor = VAnchor.ParentBottomTop; FlowLayoutWidget buttonFlowContainer = new FlowLayoutWidget(FlowDirection.LeftToRight); buttonFlowContainer.VAnchor = VAnchor.ParentBottomTop; TextWidget openLabel = new TextWidget("Open".Localize()); openLabel.TextColor = RGBA_Bytes.White; openLabel.VAnchor = VAnchor.ParentCenter; openLabel.HAnchor = HAnchor.ParentCenter; FatFlatClickWidget openButton = new FatFlatClickWidget(openLabel); openButton.VAnchor = VAnchor.ParentBottomTop; openButton.BackgroundColor = ActiveTheme.Instance.PrimaryAccentColor; openButton.Width = 100; openButton.Click += (sender, e) => { ChangeCollection(); }; buttonFlowContainer.AddChild(openButton); buttonContainer.AddChild(buttonFlowContainer); buttonContainer.Width = 100; return(buttonContainer); }
SlideWidget getItemActionButtons() { int buttonWidth; if (ActiveTheme.Instance.DisplayMode == ActiveTheme.ApplicationDisplayType.Touchscreen) { buttonWidth = 120; } else { buttonWidth = 80; } SlideWidget buttonContainer = new SlideWidget(); buttonContainer.VAnchor = VAnchor.ParentBottomTop; FlowLayoutWidget buttonFlowContainer = new FlowLayoutWidget(FlowDirection.LeftToRight); buttonFlowContainer.VAnchor = VAnchor.ParentBottomTop; ClickWidget removeButton = new ClickWidget(); removeButton.VAnchor = VAnchor.ParentBottomTop; removeButton.BackgroundColor = ActiveTheme.Instance.PrimaryAccentColor; removeButton.Width = buttonWidth; TextWidget printLabel = new TextWidget("Remove".Localize()); printLabel.TextColor = RGBA_Bytes.White; printLabel.VAnchor = VAnchor.ParentCenter; printLabel.HAnchor = HAnchor.ParentCenter; removeButton.AddChild(printLabel); removeButton.Click += RemoveConnectionLink_Click; ClickWidget editButton = new ClickWidget(); editButton.VAnchor = VAnchor.ParentBottomTop; editButton.BackgroundColor = ActiveTheme.Instance.SecondaryAccentColor; editButton.Width = buttonWidth; TextWidget editLabel = new TextWidget("Edit".Localize()); editLabel.TextColor = RGBA_Bytes.White; editLabel.VAnchor = VAnchor.ParentCenter; editLabel.HAnchor = HAnchor.ParentCenter; editButton.AddChild(editLabel); editButton.Click += EditConnectionLink_Click; buttonFlowContainer.AddChild(editButton); buttonFlowContainer.AddChild(removeButton); buttonContainer.AddChild(buttonFlowContainer); buttonContainer.Width = buttonWidth * 2; return(buttonContainer); }
private SlideWidget getItemActionButtons() { SlideWidget buttonContainer = new SlideWidget(); buttonContainer.VAnchor = VAnchor.ParentBottomTop; buttonContainer.HAnchor = HAnchor.ParentRight; FlowLayoutWidget buttonFlowContainer = new FlowLayoutWidget(FlowDirection.LeftToRight); buttonFlowContainer.VAnchor = VAnchor.ParentBottomTop; TextWidget removeLabel = new TextWidget("Remove".Localize()); removeLabel.TextColor = RGBA_Bytes.White; removeLabel.VAnchor = VAnchor.ParentCenter; removeLabel.HAnchor = HAnchor.ParentCenter; FatFlatClickWidget removeButton = new FatFlatClickWidget(removeLabel); removeButton.VAnchor = VAnchor.ParentBottomTop; removeButton.BackgroundColor = ActiveTheme.Instance.PrimaryAccentColor; removeButton.Width = 100; removeButton.Click += onRemovePartClick; viewButtonLabel = new TextWidget("View".Localize()); viewButtonLabel.TextColor = RGBA_Bytes.White; viewButtonLabel.VAnchor = VAnchor.ParentCenter; viewButtonLabel.HAnchor = HAnchor.ParentCenter; viewButton = new FatFlatClickWidget(viewButtonLabel); viewButton.VAnchor = VAnchor.ParentBottomTop; viewButton.BackgroundColor = ActiveTheme.Instance.SecondaryAccentColor; viewButton.Width = 100; viewButton.Click += onViewPartClick; prioritizeButtonLabel = new TextWidget("Prioritize".Localize()); prioritizeButtonLabel.TextColor = RGBA_Bytes.White; prioritizeButtonLabel.VAnchor = VAnchor.ParentCenter; prioritizeButtonLabel.HAnchor = HAnchor.ParentCenter; prioritizeButton = new FatFlatClickWidget(prioritizeButtonLabel); prioritizeButton.VAnchor = VAnchor.ParentBottomTop; prioritizeButton.BackgroundColor = ActiveTheme.Instance.SecondaryAccentColor; prioritizeButton.Width = 100; prioritizeButton.Click += onPrioritizePartClick; buttonFlowContainer.AddChild(viewButton); buttonFlowContainer.AddChild(removeButton); buttonFlowContainer.AddChild(prioritizeButton); buttonContainer.AddChild(buttonFlowContainer); buttonContainer.Width = 300; //buttonContainer.Width = 100; return(buttonContainer); }
protected override SlideWidget GetItemActionButtons() { SlideWidget buttonContainer = new SlideWidget(); buttonContainer.VAnchor = VAnchor.ParentBottomTop; FlowLayoutWidget buttonFlowContainer = new FlowLayoutWidget(FlowDirection.LeftToRight); buttonFlowContainer.VAnchor = VAnchor.ParentBottomTop; TextWidget printLabel = new TextWidget("Print".Localize()); printLabel.TextColor = RGBA_Bytes.White; printLabel.VAnchor = VAnchor.ParentCenter; printLabel.HAnchor = HAnchor.ParentCenter; FatFlatClickWidget printButton = new FatFlatClickWidget(printLabel); printButton.VAnchor = VAnchor.ParentBottomTop; printButton.BackgroundColor = ActiveTheme.Instance.PrimaryAccentColor; printButton.Width = 100; printButton.Click += (sender, e) => { if (!PrinterCommunication.PrinterConnectionAndCommunication.Instance.PrintIsActive) { QueueData.Instance.AddItem(MakeCopyForQueue(), 0); QueueData.Instance.SelectedIndex = QueueData.Instance.Count - 1; PrinterCommunication.PrinterConnectionAndCommunication.Instance.PrintActivePartIfPossible(); } else { QueueData.Instance.AddItem(MakeCopyForQueue()); } buttonContainer.SlideOut(); this.Invalidate(); };; TextWidget viewButtonLabel = new TextWidget("View".Localize()); viewButtonLabel.TextColor = RGBA_Bytes.White; viewButtonLabel.VAnchor = VAnchor.ParentCenter; viewButtonLabel.HAnchor = HAnchor.ParentCenter; FatFlatClickWidget viewButton = new FatFlatClickWidget(viewButtonLabel); viewButton.VAnchor = VAnchor.ParentBottomTop; viewButton.BackgroundColor = ActiveTheme.Instance.SecondaryAccentColor; viewButton.Width = 100; viewButton.Click += onViewPartClick; buttonFlowContainer.AddChild(viewButton); buttonFlowContainer.AddChild(printButton); buttonContainer.AddChild(buttonFlowContainer); buttonContainer.Width = 200; return(buttonContainer); }
SlideWidget getItemActionButtons() { SlideWidget buttonContainer = new SlideWidget(); buttonContainer.VAnchor = VAnchor.ParentBottomTop; FlowLayoutWidget buttonFlowContainer = new FlowLayoutWidget(FlowDirection.LeftToRight); buttonFlowContainer.VAnchor = VAnchor.ParentBottomTop; ClickWidget printButton = new ClickWidget(); printButton.VAnchor = VAnchor.ParentBottomTop; printButton.BackgroundColor = ActiveTheme.Instance.PrimaryAccentColor; printButton.Width = 100; TextWidget printLabel = new TextWidget("Print".Localize()); printLabel.TextColor = RGBA_Bytes.White; printLabel.VAnchor = VAnchor.ParentCenter; printLabel.HAnchor = HAnchor.ParentCenter; printButton.AddChild(printLabel); printButton.Click += (sender, e) => { QueueData.Instance.AddItem(this.printItemWrapper, 0); if (!PrinterCommunication.PrinterConnectionAndCommunication.Instance.PrintIsActive) { QueueData.Instance.SelectedIndex = 0; PrinterCommunication.PrinterConnectionAndCommunication.Instance.PrintActivePartIfPossible(); } this.Invalidate(); };; ClickWidget editButton = new ClickWidget(); editButton.VAnchor = VAnchor.ParentBottomTop; editButton.BackgroundColor = ActiveTheme.Instance.SecondaryAccentColor; editButton.Width = 100; TextWidget editLabel = new TextWidget("View".Localize()); editLabel.TextColor = RGBA_Bytes.White; editLabel.VAnchor = VAnchor.ParentCenter; editLabel.HAnchor = HAnchor.ParentCenter; editButton.AddChild(editLabel); editButton.Click += onViewPartClick; buttonFlowContainer.AddChild(editButton); buttonFlowContainer.AddChild(printButton); buttonContainer.AddChild(buttonFlowContainer); buttonContainer.Width = 200; return(buttonContainer); }
protected void CreateGuiElements() { 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(); rightButtonOverlay.Visible = false; mainContainer.AddChild(primaryContainer); mainContainer.AddChild(rightButtonOverlay); } this.AddChild(mainContainer); AddHandlers(); }
SlideWidget getItemActionButtons() { SlideWidget buttonContainer = new SlideWidget(); buttonContainer.VAnchor = VAnchor.ParentBottomTop; buttonContainer.HAnchor = HAnchor.ParentRight; FlowLayoutWidget buttonFlowContainer = new FlowLayoutWidget(FlowDirection.LeftToRight); buttonFlowContainer.VAnchor = VAnchor.ParentBottomTop; ClickWidget printButton = new ClickWidget(); printButton.VAnchor = VAnchor.ParentBottomTop; printButton.BackgroundColor = ActiveTheme.Instance.PrimaryAccentColor; printButton.Width = 100; TextWidget printLabel = new TextWidget("Remove".Localize()); printLabel.TextColor = RGBA_Bytes.White; printLabel.VAnchor = VAnchor.ParentCenter; printLabel.HAnchor = HAnchor.ParentCenter; printButton.AddChild(printLabel); printButton.Click += (sender, e) => { UiThread.RunOnIdle(DeletePartFromQueue); };; ClickWidget viewButton = new ClickWidget(); viewButton.VAnchor = VAnchor.ParentBottomTop; viewButton.BackgroundColor = ActiveTheme.Instance.SecondaryAccentColor; viewButton.Width = 100; TextWidget editLabel = new TextWidget("View".Localize()); editLabel.TextColor = RGBA_Bytes.White; editLabel.VAnchor = VAnchor.ParentCenter; editLabel.HAnchor = HAnchor.ParentCenter; viewButton.AddChild(editLabel); viewButton.Click += onViewPartClick; //buttonFlowContainer.AddChild(viewButton); buttonFlowContainer.AddChild(printButton); buttonContainer.AddChild(buttonFlowContainer); //buttonContainer.Width = 200; buttonContainer.Width = 100; return(buttonContainer); }
protected override SlideWidget GetItemActionButtons() { SlideWidget buttonContainer = new SlideWidget(); buttonContainer.VAnchor = VAnchor.ParentBottomTop; FlowLayoutWidget buttonFlowContainer = new FlowLayoutWidget(FlowDirection.LeftToRight); buttonFlowContainer.VAnchor = VAnchor.ParentBottomTop; TextWidget printLabel = new TextWidget("Print".Localize()); printLabel.TextColor = RGBA_Bytes.White; printLabel.VAnchor = VAnchor.ParentCenter; printLabel.HAnchor = HAnchor.ParentCenter; FatFlatClickWidget printButton = new FatFlatClickWidget(printLabel); printButton.Name = "Row Item " + partLabel.Text + " Print Button"; printButton.VAnchor = VAnchor.ParentBottomTop; printButton.BackgroundColor = ActiveTheme.Instance.PrimaryAccentColor; printButton.Width = 100; printButton.Click += printButton_Click; // HACK: No clear immediate workaround beyond this printButton.Click += (s, e) => buttonContainer.SlideOut(); TextWidget viewButtonLabel = new TextWidget("View".Localize()); viewButtonLabel.TextColor = RGBA_Bytes.White; viewButtonLabel.VAnchor = VAnchor.ParentCenter; viewButtonLabel.HAnchor = HAnchor.ParentCenter; FatFlatClickWidget viewButton = new FatFlatClickWidget(viewButtonLabel); viewButton.Name = "Row Item " + partLabel.Text + " View Button"; viewButton.VAnchor = VAnchor.ParentBottomTop; viewButton.BackgroundColor = ActiveTheme.Instance.SecondaryAccentColor; viewButton.Width = 100; viewButton.Click += onViewPartClick; buttonFlowContainer.AddChild(viewButton); buttonFlowContainer.AddChild(printButton); buttonContainer.AddChild(buttonFlowContainer); buttonContainer.Width = 200; return(buttonContainer); }
public void ConstructPrintQueueItem() { linkButtonFactory.fontSize = 10; linkButtonFactory.textColor = RGBA_Bytes.Black; WidgetTextColor = RGBA_Bytes.Black; WidgetBackgroundColor = RGBA_Bytes.White; TextInfo textInfo = new CultureInfo("en-US", false).TextInfo; SetDisplayAttributes(); FlowLayoutWidget topToBottomLayout = new FlowLayoutWidget(FlowDirection.TopToBottom); topToBottomLayout.HAnchor |= Agg.UI.HAnchor.ParentLeftRight; FlowLayoutWidget topContentsFlowLayout = new FlowLayoutWidget(FlowDirection.LeftToRight); topContentsFlowLayout.HAnchor |= Agg.UI.HAnchor.ParentLeftRight; { FlowLayoutWidget leftColumn = new FlowLayoutWidget(FlowDirection.LeftToRight); leftColumn.VAnchor = VAnchor.ParentTop | Agg.UI.VAnchor.FitToChildren; { selectionCheckBoxContainer = new GuiWidget(); selectionCheckBoxContainer.VAnchor = VAnchor.ParentBottomTop; selectionCheckBoxContainer.Width = 40; selectionCheckBoxContainer.Visible = false; selectionCheckBoxContainer.Margin = new BorderDouble(left: 6); selectionCheckBox = new CheckBox(""); selectionCheckBox.VAnchor = VAnchor.ParentCenter; selectionCheckBox.HAnchor = HAnchor.ParentCenter; selectionCheckBoxContainer.AddChild(selectionCheckBox); PartThumbnailWidget thumbnailWidget = new PartThumbnailWidget(PrintItemWrapper, "part_icon_transparent_40x40.png", "building_thumbnail_40x40.png", PartThumbnailWidget.ImageSizes.Size50x50); leftColumn.AddChild(selectionCheckBoxContainer); leftColumn.AddChild(thumbnailWidget); } FlowLayoutWidget middleColumn = new FlowLayoutWidget(FlowDirection.TopToBottom); middleColumn.VAnchor = VAnchor.ParentTop | Agg.UI.VAnchor.FitToChildren; middleColumn.HAnchor = HAnchor.ParentLeftRight;// | Agg.UI.HAnchor.FitToChildren; middleColumn.Padding = new BorderDouble(8); middleColumn.Margin = new BorderDouble(10, 0); { string labelName = textInfo.ToTitleCase(PrintItemWrapper.Name); labelName = labelName.Replace('_', ' '); partLabel = new TextWidget(labelName, pointSize: 14); partLabel.TextColor = WidgetTextColor; partLabel.MinimumSize = new Vector2(1, 16); string partStatusLabelTxt = LocalizedString.Get("Status").ToUpper(); string partStatusLabelTxtTest = LocalizedString.Get("Queued to Print"); string partStatusLabelTxtFull = "{0}: {1}".FormatWith(partStatusLabelTxt, partStatusLabelTxtTest); partStatus = new TextWidget(partStatusLabelTxtFull, pointSize: 10); partStatus.AutoExpandBoundsToText = true; partStatus.TextColor = WidgetTextColor; partStatus.MinimumSize = new Vector2(50, 12); middleColumn.AddChild(partLabel); middleColumn.AddChild(partStatus); } CreateEditControls(); topContentsFlowLayout.AddChild(leftColumn); topContentsFlowLayout.AddChild(middleColumn); //topContentsFlowLayout.AddChild(editControls); editControls.Visible = false; } // The ConditionalClickWidget supplies a user driven Enabled property based on a delegate of your choosing conditionalClickContainer = new ConditionalClickWidget(() => queueDataView.EditMode); conditionalClickContainer.HAnchor = HAnchor.ParentLeftRight; conditionalClickContainer.VAnchor = VAnchor.ParentBottomTop; conditionalClickContainer.Click += onLibraryItemClick; topToBottomLayout.AddChild(topContentsFlowLayout); this.AddChild(topToBottomLayout); actionButtonContainer = getItemActionButtons(); actionButtonContainer.Visible = false; this.AddChild(conditionalClickContainer); this.AddChild(actionButtonContainer); AddHandlers(); }
private SlideWidget getItemActionButtons() { int buttonWidth; if (ActiveTheme.Instance.DisplayMode == ActiveTheme.ApplicationDisplayType.Touchscreen) { buttonWidth = 120; } else { buttonWidth = 80;//80 } SlideWidget buttonContainer = new SlideWidget(); buttonContainer.VAnchor = VAnchor.ParentBottomTop; FlowLayoutWidget buttonFlowContainer = new FlowLayoutWidget(FlowDirection.LeftToRight); buttonFlowContainer.VAnchor = VAnchor.ParentBottomTop; TextWidget printLabel = new TextWidget("Remove".Localize()); printLabel.TextColor = RGBA_Bytes.White; printLabel.VAnchor = VAnchor.ParentCenter; printLabel.HAnchor = HAnchor.ParentCenter; FatFlatClickWidget removeButton = new FatFlatClickWidget(printLabel); removeButton.VAnchor = VAnchor.ParentBottomTop; removeButton.BackgroundColor = ActiveTheme.Instance.PrimaryAccentColor; removeButton.Width = buttonWidth; removeButton.Click += RemoveConnectionLink_Click; TextWidget editLabel = new TextWidget("Edit".Localize()); editLabel.TextColor = RGBA_Bytes.White; editLabel.VAnchor = VAnchor.ParentCenter; editLabel.HAnchor = HAnchor.ParentCenter; FatFlatClickWidget editButton = new FatFlatClickWidget(editLabel); editButton.VAnchor = VAnchor.ParentBottomTop; editButton.BackgroundColor = ActiveTheme.Instance.SecondaryAccentColor; editButton.Width = buttonWidth; editButton.Click += EditConnectionLink_Click; buttonFlowContainer.AddChild(editButton); buttonFlowContainer.AddChild(removeButton); buttonContainer.AddChild(buttonFlowContainer); buttonContainer.Width = buttonWidth * 2; return buttonContainer; }
protected void CreateGuiElements() { 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; selectionCheckBoxContainer = new GuiWidget(); selectionCheckBoxContainer.VAnchor = VAnchor.ParentBottomTop; selectionCheckBoxContainer.Width = 40; selectionCheckBoxContainer.Visible = false; selectionCheckBoxContainer.Margin = new BorderDouble(left: 6); selectionCheckBox = new CheckBox(""); selectionCheckBox.VAnchor = VAnchor.ParentCenter; selectionCheckBox.HAnchor = HAnchor.ParentCenter; selectionCheckBoxContainer.AddChild(selectionCheckBox); 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); { string labelName = GetItemName(); labelName = labelName.Replace('_', ' '); partLabel = new TextWidget(labelName, pointSize: 14); partLabel.TextColor = WidgetTextColor; partLabel.MinimumSize = new Vector2(1, 18); partLabel.VAnchor = VAnchor.ParentCenter; middleColumn.AddChild(partLabel); } primaryFlow.AddChild(selectionCheckBoxContainer); primaryFlow.AddChild(thumbnailWidget); primaryFlow.AddChild(middleColumn); primaryContainer.AddChild(primaryFlow); // The ConditionalClickWidget supplies a user driven Enabled property based on a delegate of your choosing primaryClickContainer = new ConditionalClickWidget(() => libraryDataView.EditMode); primaryClickContainer.HAnchor = HAnchor.ParentLeftRight; primaryClickContainer.VAnchor = VAnchor.ParentBottomTop; primaryContainer.AddChild(primaryClickContainer); rightButtonOverlay = GetItemActionButtons(); rightButtonOverlay.Visible = false; mainContainer.AddChild(primaryContainer); mainContainer.AddChild(rightButtonOverlay); } this.AddChild(mainContainer); AddHandlers(); }
public void ConstructPrintQueueItem() { linkButtonFactory.fontSize = 10; linkButtonFactory.textColor = RGBA_Bytes.Black; WidgetTextColor = RGBA_Bytes.Black; WidgetBackgroundColor = RGBA_Bytes.White; TextInfo textInfo = new CultureInfo("en-US", false).TextInfo; SetDisplayAttributes(); FlowLayoutWidget topToBottomLayout = new FlowLayoutWidget(FlowDirection.TopToBottom); topToBottomLayout.HAnchor |= Agg.UI.HAnchor.ParentLeftRight; FlowLayoutWidget topContentsFlowLayout = new FlowLayoutWidget(FlowDirection.LeftToRight); topContentsFlowLayout.HAnchor |= Agg.UI.HAnchor.ParentLeftRight; { FlowLayoutWidget leftColumn = new FlowLayoutWidget(FlowDirection.LeftToRight); leftColumn.VAnchor = VAnchor.ParentTop | Agg.UI.VAnchor.FitToChildren; { selectionCheckBoxContainer = new GuiWidget(); selectionCheckBoxContainer.VAnchor = VAnchor.ParentBottomTop; selectionCheckBoxContainer.Width = 40; selectionCheckBoxContainer.Visible = false; selectionCheckBoxContainer.Margin = new BorderDouble(left: 6); selectionCheckBox = new CheckBox(""); selectionCheckBox.Name = "Queue Item Checkbox"; selectionCheckBox.VAnchor = VAnchor.ParentCenter; selectionCheckBox.HAnchor = HAnchor.ParentCenter; selectionCheckBoxContainer.AddChild(selectionCheckBox); PartThumbnailWidget thumbnailWidget = new PartThumbnailWidget(PrintItemWrapper, "part_icon_transparent_40x40.png", "building_thumbnail_40x40.png", PartThumbnailWidget.ImageSizes.Size50x50); thumbnailWidget.Name = "Queue Item Thumbnail"; leftColumn.AddChild(selectionCheckBoxContainer); leftColumn.AddChild(thumbnailWidget); } FlowLayoutWidget middleColumn = new FlowLayoutWidget(FlowDirection.TopToBottom); middleColumn.VAnchor = VAnchor.ParentTop | Agg.UI.VAnchor.FitToChildren; middleColumn.HAnchor = HAnchor.ParentLeftRight; // | Agg.UI.HAnchor.FitToChildren; middleColumn.Padding = new BorderDouble(8); middleColumn.Margin = new BorderDouble(10, 0); { string labelName = textInfo.ToTitleCase(PrintItemWrapper.Name); labelName = labelName.Replace('_', ' '); partLabel = new TextWidget(labelName, pointSize: 14); partLabel.TextColor = WidgetTextColor; partLabel.MinimumSize = new Vector2(1, 16); string partStatusLabelTxt = LocalizedString.Get("Status").ToUpper(); string partStatusLabelTxtTest = LocalizedString.Get("Queued to Print"); string partStatusLabelTxtFull = "{0}: {1}".FormatWith(partStatusLabelTxt, partStatusLabelTxtTest); partStatus = new TextWidget(partStatusLabelTxtFull, pointSize: 10); partStatus.AutoExpandBoundsToText = true; partStatus.TextColor = WidgetTextColor; partStatus.MinimumSize = new Vector2(50, 12); middleColumn.AddChild(partLabel); middleColumn.AddChild(partStatus); } topContentsFlowLayout.AddChild(leftColumn); topContentsFlowLayout.AddChild(middleColumn); } // The ConditionalClickWidget supplies a user driven Enabled property based on a delegate of your choosing conditionalClickContainer = new ConditionalClickWidget(() => queueDataView.EditMode); conditionalClickContainer.HAnchor = HAnchor.ParentLeftRight; conditionalClickContainer.VAnchor = VAnchor.ParentBottomTop; conditionalClickContainer.Click += onQueueItemClick; topToBottomLayout.AddChild(topContentsFlowLayout); this.AddChild(topToBottomLayout); actionButtonContainer = getItemActionButtons(); actionButtonContainer.Visible = false; this.AddChild(conditionalClickContainer); this.AddChild(actionButtonContainer); AddHandlers(); }
protected SlideWidget GetItemActionButtons(string openButtonText) { SlideWidget buttonContainer = new SlideWidget(); buttonContainer.VAnchor = VAnchor.ParentBottomTop; FlowLayoutWidget buttonFlowContainer = new FlowLayoutWidget(FlowDirection.LeftToRight); buttonFlowContainer.VAnchor = VAnchor.ParentBottomTop; TextWidget openLabel = new TextWidget(openButtonText); openLabel.TextColor = RGBA_Bytes.White; openLabel.VAnchor = VAnchor.ParentCenter; openLabel.HAnchor = HAnchor.ParentCenter; FatFlatClickWidget openButton = new FatFlatClickWidget(openLabel); openButton.Cursor = Cursors.Hand; openButton.Name = "Open Collection"; openButton.VAnchor = VAnchor.ParentBottomTop; openButton.BackgroundColor = ActiveTheme.Instance.PrimaryAccentColor; openButton.Width = 100; openButton.Click += (sender, e) => { ChangeCollection(); }; buttonFlowContainer.AddChild(openButton); buttonContainer.AddChild(buttonFlowContainer); buttonContainer.Width = 100; return buttonContainer; }
private void AddChildElements() { GuiWidget mainContainer = new GuiWidget(); mainContainer.HAnchor = Agg.UI.HAnchor.ParentLeftRight; mainContainer.VAnchor = VAnchor.ParentBottomTop; TextInfo textInfo = new CultureInfo("en-US", false).TextInfo; { GuiWidget indicator = new GuiWidget(); indicator.VAnchor = Agg.UI.VAnchor.ParentBottomTop; indicator.Width = 15; if (printTask.PrintComplete) { indicator.BackgroundColor = new RGBA_Bytes(38, 147, 51, 180); } else { indicator.BackgroundColor = new RGBA_Bytes(252, 209, 22, 180); } FlowLayoutWidget middleColumn = new FlowLayoutWidget(FlowDirection.TopToBottom); middleColumn.HAnchor = Agg.UI.HAnchor.ParentLeftRight; middleColumn.Padding = new BorderDouble(6, 3); { FlowLayoutWidget labelContainer = new FlowLayoutWidget(); labelContainer.HAnchor = Agg.UI.HAnchor.ParentLeftRight; string labelName = textInfo.ToTitleCase(printTask.PrintName); labelName = labelName.Replace('_', ' '); partLabel = new TextWidget(labelName, pointSize: 15 * pointSizeFactor); partLabel.TextColor = WidgetTextColor; labelContainer.AddChild(partLabel); middleColumn.AddChild(labelContainer); } RGBA_Bytes timeTextColor = new RGBA_Bytes(34, 34, 34); FlowLayoutWidget buttonContainer = new FlowLayoutWidget(); buttonContainer.Margin = new BorderDouble(0); buttonContainer.HAnchor = Agg.UI.HAnchor.ParentLeftRight; { TextWidget statusIndicator = new TextWidget("Status: Completed".Localize(), pointSize: 8 * pointSizeFactor); statusIndicator.Margin = new BorderDouble(right: 3); //buttonContainer.AddChild(statusIndicator); string printTimeLabel = "Time".Localize().ToUpper(); string printTimeLabelFull = string.Format("{0}: ", printTimeLabel); TextWidget timeLabel = new TextWidget(printTimeLabelFull, pointSize: 8 * pointSizeFactor); timeLabel.TextColor = timeTextColor; TextWidget timeIndicator; int minutes = printTask.PrintTimeMinutes; if (minutes < 0) { timeIndicator = new TextWidget("Unknown".Localize()); } else if (minutes > 60) { timeIndicator = new TextWidget("{0}hrs {1}min".FormatWith(printTask.PrintTimeMinutes / 60, printTask.PrintTimeMinutes % 60), pointSize: 12 * pointSizeFactor); } else { timeIndicator = new TextWidget(string.Format("{0}min", printTask.PrintTimeMinutes), pointSize: 12 * pointSizeFactor); } if (printTask.PercentDone > 0) { timeIndicator.AutoExpandBoundsToText = true; timeIndicator.Text += " ({0:0.0}%)".FormatWith(printTask.PercentDone); } timeIndicator.Margin = new BorderDouble(right: 6); timeIndicator.TextColor = timeTextColor; buttonContainer.AddChild(timeLabel); buttonContainer.AddChild(timeIndicator); buttonContainer.AddChild(new HorizontalSpacer()); middleColumn.AddChild(buttonContainer); } 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; primaryFlow.AddChild(indicator); primaryFlow.AddChild(middleColumn); primaryContainer.AddChild(primaryFlow); rightButtonOverlay = new SlideWidget(); rightButtonOverlay.VAnchor = VAnchor.ParentBottomTop; rightButtonOverlay.HAnchor = Agg.UI.HAnchor.ParentRight; rightButtonOverlay.Width = rightOverlayWidth; rightButtonOverlay.Visible = false; FlowLayoutWidget rightMiddleColumnContainer = new FlowLayoutWidget(FlowDirection.LeftToRight); rightMiddleColumnContainer.VAnchor = VAnchor.ParentBottomTop; { TextWidget viewLabel = new TextWidget("View".Localize()); viewLabel.TextColor = RGBA_Bytes.White; viewLabel.VAnchor = VAnchor.ParentCenter; viewLabel.HAnchor = HAnchor.ParentCenter; FatFlatClickWidget viewButton = new FatFlatClickWidget(viewLabel); viewButton.VAnchor = VAnchor.ParentBottomTop; viewButton.BackgroundColor = ActiveTheme.Instance.SecondaryAccentColor; viewButton.Width = actionButtonSize; viewButton.Click += ViewButton_Click; rightMiddleColumnContainer.AddChild(viewButton); TextWidget printLabel = new TextWidget("Print".Localize()); printLabel.TextColor = RGBA_Bytes.White; printLabel.VAnchor = VAnchor.ParentCenter; printLabel.HAnchor = HAnchor.ParentCenter; FatFlatClickWidget printButton = new FatFlatClickWidget(printLabel); printButton.VAnchor = VAnchor.ParentBottomTop; printButton.BackgroundColor = ActiveTheme.Instance.PrimaryAccentColor; printButton.Width = actionButtonSize; printButton.Click += (sender, e) => { UiThread.RunOnIdle(() => { if (!PrinterCommunication.PrinterConnectionAndCommunication.Instance.PrintIsActive) { QueueData.Instance.AddItem(new PrintItemWrapper(printTask.PrintItemId), 0); QueueData.Instance.SelectedIndex = 0; PrinterCommunication.PrinterConnectionAndCommunication.Instance.PrintActivePartIfPossible(); } else { QueueData.Instance.AddItem(new PrintItemWrapper(printTask.PrintItemId)); } rightButtonOverlay.SlideOut(); }); }; rightMiddleColumnContainer.AddChild(printButton); } rightButtonOverlay.AddChild(rightMiddleColumnContainer); if (showTimestamp) { FlowLayoutWidget timestampColumn = new FlowLayoutWidget(FlowDirection.TopToBottom); timestampColumn.VAnchor = Agg.UI.VAnchor.ParentBottomTop; timestampColumn.BackgroundColor = RGBA_Bytes.LightGray; timestampColumn.Padding = new BorderDouble(6, 0); FlowLayoutWidget startTimeContainer = new FlowLayoutWidget(); startTimeContainer.HAnchor = Agg.UI.HAnchor.ParentLeftRight; startTimeContainer.Padding = new BorderDouble(0, 3); string startLabelFull = "{0}:".FormatWith("Start".Localize().ToUpper()); TextWidget startLabel = new TextWidget(startLabelFull, pointSize: 8 * pointSizeFactor); startLabel.TextColor = timeTextColor; string startTimeString = printTask.PrintStart.ToString("MMM d yyyy h:mm ") + printTask.PrintStart.ToString("tt").ToLower(); TextWidget startDate = new TextWidget(startTimeString, pointSize: 12 * pointSizeFactor); startDate.TextColor = timeTextColor; startTimeContainer.AddChild(startLabel); startTimeContainer.AddChild(new HorizontalSpacer()); startTimeContainer.AddChild(startDate); FlowLayoutWidget endTimeContainer = new FlowLayoutWidget(); endTimeContainer.HAnchor = Agg.UI.HAnchor.ParentLeftRight; endTimeContainer.Padding = new BorderDouble(0, 3); string endLabelFull = "{0}:".FormatWith("End".Localize().ToUpper()); TextWidget endLabel = new TextWidget(endLabelFull, pointSize: 8 * pointSizeFactor); endLabel.TextColor = timeTextColor; string endTimeString; if (printTask.PrintEnd != DateTime.MinValue) { endTimeString = printTask.PrintEnd.ToString("MMM d yyyy h:mm ") + printTask.PrintEnd.ToString("tt").ToLower(); } else { endTimeString = "Unknown".Localize(); } TextWidget endDate = new TextWidget(endTimeString, pointSize: 12 * pointSizeFactor); endDate.TextColor = timeTextColor; endTimeContainer.AddChild(endLabel); endTimeContainer.AddChild(new HorizontalSpacer()); endTimeContainer.AddChild(endDate); HorizontalLine horizontalLine = new HorizontalLine(); horizontalLine.BackgroundColor = RGBA_Bytes.Gray; timestampColumn.AddChild(endTimeContainer); timestampColumn.AddChild(horizontalLine); timestampColumn.AddChild(startTimeContainer); timestampColumn.HAnchor = HAnchor.ParentLeftRight; timestampColumn.Padding = new BorderDouble(5, 0, 15, 0); primaryFlow.AddChild(timestampColumn); } mainContainer.AddChild(primaryContainer); mainContainer.AddChild(rightButtonOverlay); this.AddChild(mainContainer); } }
protected void CreateGuiElements() { 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; { partLabel = new TextWidget(this.ItemName.Replace('_', ' '), pointSize: 14); GuiWidget primaryContainer = new GuiWidget(); primaryContainer.HAnchor = HAnchor.ParentLeftRight; primaryContainer.VAnchor = VAnchor.ParentBottomTop; primaryContainer.Name = "Row Item " + partLabel.Text; FlowLayoutWidget primaryFlow = new FlowLayoutWidget(FlowDirection.LeftToRight); primaryFlow.HAnchor = HAnchor.ParentLeftRight; primaryFlow.VAnchor = VAnchor.ParentBottomTop; selectionCheckBoxContainer = new GuiWidget(); selectionCheckBoxContainer.VAnchor = VAnchor.ParentBottomTop; selectionCheckBoxContainer.Width = 40; selectionCheckBoxContainer.Visible = false; selectionCheckBoxContainer.Margin = new BorderDouble(left: 6); selectionCheckBox = new CheckBox(""); selectionCheckBox.Click += selectionCheckBox_Click; selectionCheckBox.Name = "Row Item Select Checkbox"; selectionCheckBox.VAnchor = VAnchor.ParentCenter; selectionCheckBox.HAnchor = HAnchor.ParentCenter; selectionCheckBoxContainer.AddChild(selectionCheckBox); middleColumn = new GuiWidget(0.0, 0.0); middleColumn.HAnchor = Agg.UI.HAnchor.ParentLeftRight; middleColumn.VAnchor = Agg.UI.VAnchor.ParentBottomTop; middleColumn.Margin = new BorderDouble(10, 3); { partLabel.TextColor = WidgetTextColor; partLabel.MinimumSize = new Vector2(1, 18); partLabel.VAnchor = VAnchor.ParentCenter; middleColumn.AddChild(partLabel); bool mouseDownOnMiddle = false; middleColumn.MouseDown += (sender, e) => { // Abort normal processing for view helpers if (this.IsViewHelperItem) { return; } mouseDownOnMiddle = true; }; middleColumn.MouseUp += (sender, e) => { if (mouseDownOnMiddle & middleColumn.LocalBounds.Contains(e.Position)) { if (this.libraryDataView.EditMode) { if (this.IsSelectedItem) { libraryDataView.SelectedItems.Remove(this); } else { libraryDataView.SelectedItems.Add(this); } Invalidate(); } else { // we only have single selection if (this.IsSelectedItem) { // It is already selected, do nothing. } else { libraryDataView.ClearSelectedItems(); libraryDataView.SelectedItems.Add(this); Invalidate(); } } } mouseDownOnMiddle = false; }; } primaryFlow.AddChild(selectionCheckBoxContainer); primaryFlow.AddChild(thumbnailWidget); primaryFlow.AddChild(middleColumn); primaryContainer.AddChild(primaryFlow); rightButtonOverlay = GetItemActionButtons(); rightButtonOverlay.Visible = false; mainContainer.AddChild(primaryContainer); mainContainer.AddChild(rightButtonOverlay); } this.AddChild(mainContainer); AddHandlers(); }
private SlideWidget getItemActionButtons() { SlideWidget buttonContainer = new SlideWidget(); buttonContainer.VAnchor = VAnchor.ParentBottomTop; buttonContainer.HAnchor = HAnchor.ParentRight; FlowLayoutWidget buttonFlowContainer = new FlowLayoutWidget(FlowDirection.LeftToRight); buttonFlowContainer.VAnchor = VAnchor.ParentBottomTop; TextWidget removeLabel = new TextWidget("Remove".Localize()); removeLabel.TextColor = RGBA_Bytes.White; removeLabel.VAnchor = VAnchor.ParentCenter; removeLabel.HAnchor = HAnchor.ParentCenter; FatFlatClickWidget removeButton = new FatFlatClickWidget(removeLabel); removeButton.VAnchor = VAnchor.ParentBottomTop; removeButton.BackgroundColor = ActiveTheme.Instance.PrimaryAccentColor; removeButton.Width = 100; removeButton.Click += onRemovePartClick; viewButtonLabel = new TextWidget("View".Localize()); viewButtonLabel.TextColor = RGBA_Bytes.White; viewButtonLabel.VAnchor = VAnchor.ParentCenter; viewButtonLabel.HAnchor = HAnchor.ParentCenter; viewButton = new FatFlatClickWidget(viewButtonLabel); viewButton.VAnchor = VAnchor.ParentBottomTop; viewButton.BackgroundColor = ActiveTheme.Instance.SecondaryAccentColor; viewButton.Width = 100; viewButton.Click += onViewPartClick; buttonFlowContainer.AddChild(viewButton); buttonFlowContainer.AddChild(removeButton); buttonContainer.AddChild(buttonFlowContainer); buttonContainer.Width = 200; //buttonContainer.Width = 100; return buttonContainer; }
protected override SlideWidget GetItemActionButtons() { SlideWidget buttonContainer = new SlideWidget(); buttonContainer.VAnchor = VAnchor.ParentBottomTop; FlowLayoutWidget buttonFlowContainer = new FlowLayoutWidget(FlowDirection.LeftToRight); buttonFlowContainer.VAnchor = VAnchor.ParentBottomTop; TextWidget printLabel = new TextWidget("Print".Localize()); printLabel.TextColor = RGBA_Bytes.White; printLabel.VAnchor = VAnchor.ParentCenter; printLabel.HAnchor = HAnchor.ParentCenter; FatFlatClickWidget printButton = new FatFlatClickWidget(printLabel); printButton.VAnchor = VAnchor.ParentBottomTop; printButton.BackgroundColor = ActiveTheme.Instance.PrimaryAccentColor; printButton.Width = 100; printButton.Click += printButton_Click; // HACK: No clear immediate workaround beyond this printButton.Click += (s, e) => buttonContainer.SlideOut(); TextWidget viewButtonLabel = new TextWidget("View".Localize()); viewButtonLabel.TextColor = RGBA_Bytes.White; viewButtonLabel.VAnchor = VAnchor.ParentCenter; viewButtonLabel.HAnchor = HAnchor.ParentCenter; FatFlatClickWidget viewButton = new FatFlatClickWidget(viewButtonLabel); viewButton.Name = "Row Item " + partLabel.Text + " View Button"; viewButton.VAnchor = VAnchor.ParentBottomTop; viewButton.BackgroundColor = ActiveTheme.Instance.SecondaryAccentColor; viewButton.Width = 100; viewButton.Click += onViewPartClick; buttonFlowContainer.AddChild(viewButton); buttonFlowContainer.AddChild(printButton); buttonContainer.AddChild(buttonFlowContainer); buttonContainer.Width = 200; return buttonContainer; }
public void ConstructPrintQueueItem() { linkButtonFactory.fontSize = 10; linkButtonFactory.textColor = RGBA_Bytes.Black; WidgetTextColor = RGBA_Bytes.Black; WidgetBackgroundColor = RGBA_Bytes.White; SetDisplayAttributes(); FlowLayoutWidget topToBottomLayout = new FlowLayoutWidget(FlowDirection.TopToBottom); topToBottomLayout.HAnchor |= Agg.UI.HAnchor.ParentLeftRight; FlowLayoutWidget topContentsFlowLayout = new FlowLayoutWidget(FlowDirection.LeftToRight); topContentsFlowLayout.HAnchor |= Agg.UI.HAnchor.ParentLeftRight; { FlowLayoutWidget leftColumn = new FlowLayoutWidget(FlowDirection.LeftToRight); leftColumn.VAnchor = VAnchor.ParentTop | Agg.UI.VAnchor.FitToChildren; { selectionCheckBoxContainer = new GuiWidget(); selectionCheckBoxContainer.VAnchor = VAnchor.ParentBottomTop; selectionCheckBoxContainer.Width = 40; selectionCheckBoxContainer.Visible = false; selectionCheckBoxContainer.Margin = new BorderDouble(left: 6); selectionCheckBox = new CheckBox(""); selectionCheckBox.Name = "Queue Item Checkbox"; selectionCheckBox.VAnchor = VAnchor.ParentCenter; selectionCheckBox.HAnchor = HAnchor.ParentCenter; selectionCheckBoxContainer.AddChild(selectionCheckBox); PartThumbnailWidget thumbnailWidget = new PartThumbnailWidget(PrintItemWrapper, "part_icon_transparent_40x40.png", "building_thumbnail_40x40.png", PartThumbnailWidget.ImageSizes.Size50x50); thumbnailWidget.Name = "Queue Item Thumbnail"; leftColumn.AddChild(selectionCheckBoxContainer); leftColumn.AddChild(thumbnailWidget); } FlowLayoutWidget middleColumn = new FlowLayoutWidget(FlowDirection.TopToBottom); middleColumn.VAnchor = VAnchor.ParentTop | Agg.UI.VAnchor.FitToChildren; middleColumn.HAnchor = HAnchor.ParentLeftRight; // | Agg.UI.HAnchor.FitToChildren; middleColumn.Padding = new BorderDouble(8); middleColumn.Margin = new BorderDouble(10, 0); { partLabel = new TextWidget(PrintItemWrapper.GetFriendlyName(), pointSize: 14); partLabel.TextColor = WidgetTextColor; partLabel.MinimumSize = new Vector2(1, 16); partStatus = new TextWidget($"{"Status".Localize().ToUpper()}: {"Queued to Print".Localize()}", pointSize: 10); partStatus.AutoExpandBoundsToText = true; partStatus.TextColor = WidgetTextColor; partStatus.MinimumSize = new Vector2(50, 12); middleColumn.AddChild(partLabel); middleColumn.AddChild(partStatus); } topContentsFlowLayout.AddChild(leftColumn); topContentsFlowLayout.AddChild(middleColumn); } // The ConditionalClickWidget supplies a user driven Enabled property based on a delegate of your choosing conditionalClickContainer = new ConditionalClickWidget(() => queueDataView.EditMode); conditionalClickContainer.HAnchor = HAnchor.ParentLeftRight; conditionalClickContainer.VAnchor = VAnchor.ParentBottomTop; topToBottomLayout.AddChild(topContentsFlowLayout); this.AddChild(topToBottomLayout); actionButtonContainer = getItemActionButtons(); actionButtonContainer.Visible = false; this.AddChild(conditionalClickContainer); this.AddChild(actionButtonContainer); PrintItemWrapper.SlicingOutputMessage += PrintItem_SlicingOutputMessage; }
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(); }
protected override SlideWidget GetItemActionButtons() { SlideWidget buttonContainer = new SlideWidget(); buttonContainer.VAnchor = VAnchor.ParentBottomTop; FlowLayoutWidget buttonFlowContainer = new FlowLayoutWidget(FlowDirection.LeftToRight); buttonFlowContainer.VAnchor = VAnchor.ParentBottomTop; TextWidget printLabel = new TextWidget("Print".Localize()); printLabel.TextColor = RGBA_Bytes.White; printLabel.VAnchor = VAnchor.ParentCenter; printLabel.HAnchor = HAnchor.ParentCenter; FatFlatClickWidget printButton = new FatFlatClickWidget(printLabel); printButton.VAnchor = VAnchor.ParentBottomTop; printButton.BackgroundColor = ActiveTheme.Instance.PrimaryAccentColor; printButton.Width = 100; printButton.Click += (sender, e) => { if (!PrinterCommunication.PrinterConnectionAndCommunication.Instance.PrintIsActive) { QueueData.Instance.AddItem(MakeCopyForQueue(), 0); QueueData.Instance.SelectedIndex = QueueData.Instance.Count - 1; PrinterCommunication.PrinterConnectionAndCommunication.Instance.PrintActivePartIfPossible(); } else { QueueData.Instance.AddItem(MakeCopyForQueue()); } buttonContainer.SlideOut(); this.Invalidate(); }; ; TextWidget viewButtonLabel = new TextWidget("View".Localize()); viewButtonLabel.TextColor = RGBA_Bytes.White; viewButtonLabel.VAnchor = VAnchor.ParentCenter; viewButtonLabel.HAnchor = HAnchor.ParentCenter; FatFlatClickWidget viewButton = new FatFlatClickWidget(viewButtonLabel); viewButton.VAnchor = VAnchor.ParentBottomTop; viewButton.BackgroundColor = ActiveTheme.Instance.SecondaryAccentColor; viewButton.Width = 100; viewButton.Click += onViewPartClick; buttonFlowContainer.AddChild(viewButton); buttonFlowContainer.AddChild(printButton); buttonContainer.AddChild(buttonFlowContainer); buttonContainer.Width = 200; return buttonContainer; }
private void AddChildElements() { GuiWidget mainContainer = new GuiWidget(); mainContainer.HAnchor = Agg.UI.HAnchor.ParentLeftRight; mainContainer.VAnchor = VAnchor.ParentBottomTop; TextInfo textInfo = new CultureInfo("en-US", false).TextInfo; { GuiWidget indicator = new GuiWidget(); indicator.VAnchor = Agg.UI.VAnchor.ParentBottomTop; indicator.Width = 15; if (printTask.PrintComplete) { indicator.BackgroundColor = new RGBA_Bytes(38, 147, 51, 180); } else { indicator.BackgroundColor = new RGBA_Bytes(252, 209, 22, 180); } FlowLayoutWidget middleColumn = new FlowLayoutWidget(FlowDirection.TopToBottom); middleColumn.HAnchor = Agg.UI.HAnchor.ParentLeftRight; middleColumn.Padding = new BorderDouble(6, 3); { FlowLayoutWidget labelContainer = new FlowLayoutWidget(); labelContainer.HAnchor = Agg.UI.HAnchor.ParentLeftRight; string labelName = textInfo.ToTitleCase(printTask.PrintName); labelName = labelName.Replace('_', ' '); partLabel = new TextWidget(labelName, pointSize: 15 * pointSizeFactor); partLabel.TextColor = WidgetTextColor; labelContainer.AddChild(partLabel); middleColumn.AddChild(labelContainer); } RGBA_Bytes timeTextColor = new RGBA_Bytes(34, 34, 34); FlowLayoutWidget buttonContainer = new FlowLayoutWidget(); buttonContainer.Margin = new BorderDouble(0); buttonContainer.HAnchor = Agg.UI.HAnchor.ParentLeftRight; { TextWidget statusIndicator = new TextWidget("Status: Completed".Localize(), pointSize: 8 * pointSizeFactor); statusIndicator.Margin = new BorderDouble(right: 3); //buttonContainer.AddChild(statusIndicator); string printTimeLabel = "Time".Localize().ToUpper(); string printTimeLabelFull = string.Format("{0}: ", printTimeLabel); TextWidget timeLabel = new TextWidget(printTimeLabelFull, pointSize: 8 * pointSizeFactor); timeLabel.TextColor = timeTextColor; TextWidget timeIndicator; int minutes = printTask.PrintTimeMinutes; if (minutes < 0) { timeIndicator = new TextWidget("Unknown".Localize()); } else if (minutes > 60) { timeIndicator = new TextWidget("{0}hrs {1}min".FormatWith(printTask.PrintTimeMinutes / 60, printTask.PrintTimeMinutes % 60), pointSize: 12 * pointSizeFactor); } else { timeIndicator = new TextWidget(string.Format("{0}min", printTask.PrintTimeMinutes), pointSize: 12 * pointSizeFactor); } timeIndicator.Margin = new BorderDouble(right: 6); timeIndicator.TextColor = timeTextColor; buttonContainer.AddChild(timeLabel); buttonContainer.AddChild(timeIndicator); buttonContainer.AddChild(new HorizontalSpacer()); middleColumn.AddChild(buttonContainer); } 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; primaryFlow.AddChild(indicator); primaryFlow.AddChild(middleColumn); primaryContainer.AddChild(primaryFlow); rightButtonOverlay = new SlideWidget(); rightButtonOverlay.VAnchor = VAnchor.ParentBottomTop; rightButtonOverlay.HAnchor = Agg.UI.HAnchor.ParentRight; rightButtonOverlay.Width = rightOverlayWidth; rightButtonOverlay.Visible = false; FlowLayoutWidget rightMiddleColumnContainer = new FlowLayoutWidget(FlowDirection.LeftToRight); rightMiddleColumnContainer.VAnchor = VAnchor.ParentBottomTop; { TextWidget viewLabel = new TextWidget("View".Localize()); viewLabel.TextColor = RGBA_Bytes.White; viewLabel.VAnchor = VAnchor.ParentCenter; viewLabel.HAnchor = HAnchor.ParentCenter; FatFlatClickWidget viewButton = new FatFlatClickWidget(viewLabel); viewButton.VAnchor = VAnchor.ParentBottomTop; viewButton.BackgroundColor = ActiveTheme.Instance.SecondaryAccentColor; viewButton.Width = actionButtonSize; viewButton.Click += ViewButton_Click; rightMiddleColumnContainer.AddChild(viewButton); TextWidget printLabel = new TextWidget("Print".Localize()); printLabel.TextColor = RGBA_Bytes.White; printLabel.VAnchor = VAnchor.ParentCenter; printLabel.HAnchor = HAnchor.ParentCenter; FatFlatClickWidget printButton = new FatFlatClickWidget(printLabel); printButton.VAnchor = VAnchor.ParentBottomTop; printButton.BackgroundColor = ActiveTheme.Instance.PrimaryAccentColor; printButton.Width = actionButtonSize; printButton.Click += (sender, e) => { UiThread.RunOnIdle(() => { if (!PrinterCommunication.PrinterConnectionAndCommunication.Instance.PrintIsActive) { QueueData.Instance.AddItem(new PrintItemWrapper(printTask.PrintItemId), 0); QueueData.Instance.SelectedIndex = 0; PrinterCommunication.PrinterConnectionAndCommunication.Instance.PrintActivePartIfPossible(); } else { QueueData.Instance.AddItem(new PrintItemWrapper(printTask.PrintItemId)); } rightButtonOverlay.SlideOut(); }); }; rightMiddleColumnContainer.AddChild(printButton); } rightButtonOverlay.AddChild(rightMiddleColumnContainer); if (showTimestamp) { FlowLayoutWidget timestampColumn = new FlowLayoutWidget(FlowDirection.TopToBottom); timestampColumn.VAnchor = Agg.UI.VAnchor.ParentBottomTop; timestampColumn.BackgroundColor = RGBA_Bytes.LightGray; timestampColumn.Padding = new BorderDouble(6, 0); FlowLayoutWidget startTimeContainer = new FlowLayoutWidget(); startTimeContainer.HAnchor = Agg.UI.HAnchor.ParentLeftRight; startTimeContainer.Padding = new BorderDouble(0, 3); string startLabelFull = "{0}:".FormatWith("Start".Localize().ToUpper()); TextWidget startLabel = new TextWidget(startLabelFull, pointSize: 8 * pointSizeFactor); startLabel.TextColor = timeTextColor; string startTimeString = printTask.PrintStart.ToString("MMM d yyyy h:mm ") + printTask.PrintStart.ToString("tt").ToLower(); TextWidget startDate = new TextWidget(startTimeString, pointSize: 12 * pointSizeFactor); startDate.TextColor = timeTextColor; startTimeContainer.AddChild(startLabel); startTimeContainer.AddChild(new HorizontalSpacer()); startTimeContainer.AddChild(startDate); FlowLayoutWidget endTimeContainer = new FlowLayoutWidget(); endTimeContainer.HAnchor = Agg.UI.HAnchor.ParentLeftRight; endTimeContainer.Padding = new BorderDouble(0, 3); string endLabelFull = "{0}:".FormatWith("End".Localize().ToUpper()); TextWidget endLabel = new TextWidget(endLabelFull, pointSize: 8 * pointSizeFactor); endLabel.TextColor = timeTextColor; string endTimeString; if (printTask.PrintEnd != DateTime.MinValue) { endTimeString = printTask.PrintEnd.ToString("MMM d yyyy h:mm ") + printTask.PrintEnd.ToString("tt").ToLower(); } else { endTimeString = "Unknown".Localize(); } TextWidget endDate = new TextWidget(endTimeString, pointSize: 12 * pointSizeFactor); endDate.TextColor = timeTextColor; endTimeContainer.AddChild(endLabel); endTimeContainer.AddChild(new HorizontalSpacer()); endTimeContainer.AddChild(endDate); HorizontalLine horizontalLine = new HorizontalLine(); horizontalLine.BackgroundColor = RGBA_Bytes.Gray; timestampColumn.AddChild(endTimeContainer); timestampColumn.AddChild(horizontalLine); timestampColumn.AddChild(startTimeContainer); timestampColumn.Width = rightOverlayWidth; primaryFlow.AddChild(timestampColumn); } mainContainer.AddChild(primaryContainer); mainContainer.AddChild(rightButtonOverlay); this.AddChild(mainContainer); } }