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(); }
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() { 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.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(); }