public LibrarySelectorRowItem(PrintItemCollection collection, int collectionIndex, LibrarySelectorWidget libraryDataView, LibraryProvider parentProvider, GuiWidget thumbnailWidget) { this.thumbnailWidget = thumbnailWidget; this.libraryDataView = libraryDataView; this.CollectionIndex = collectionIndex; this.parentProvider = parentProvider; this.printItemCollection = collection; this.ItemName = printItemCollection.Name; CreateGuiElements(); }
public LibrarySelectorRowItem(PrintItemCollection collection, int collectionIndex, LibrarySelectorWidget libraryDataView, LibraryProvider parentProvider, GuiWidget thumbnailWidget, string openButtonText) { this.thumbnailWidget = thumbnailWidget; this.libraryDataView = libraryDataView; this.CollectionIndex = collectionIndex; this.parentProvider = parentProvider; this.printItemCollection = collection; this.ItemName = printItemCollection.Name; this.Name = this.ItemName + " Row Item Collection"; CreateGuiElements(openButtonText); MouseEnterBounds += (s, e) => UpdateHoverState(); MouseLeaveBounds += (s, e) => UpdateHoverState(); }
public SaveAsWindow(Action<SaveAsReturnInfo> functionToCallOnSaveAs, List<ProviderLocatorNode> providerLocator) : base(480, 450) { Title = "MatterControl - " + "Save As".Localize(); AlwaysOnTopOfMain = true; this.functionToCallOnSaveAs = functionToCallOnSaveAs; FlowLayoutWidget topToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom); topToBottom.AnchorAll(); topToBottom.Padding = new BorderDouble(3, 0, 3, 5); // Creates Header FlowLayoutWidget headerRow = new FlowLayoutWidget(FlowDirection.LeftToRight); headerRow.HAnchor = HAnchor.ParentLeftRight; headerRow.Margin = new BorderDouble(0, 3, 0, 0); headerRow.Padding = new BorderDouble(0, 3, 0, 3); BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor; //Creates Text and adds into header { string saveAsLabel = "Save New Design".Localize() + ":"; TextWidget elementHeader = new TextWidget(saveAsLabel, pointSize: 14); elementHeader.TextColor = ActiveTheme.Instance.PrimaryTextColor; elementHeader.HAnchor = HAnchor.ParentLeftRight; elementHeader.VAnchor = Agg.UI.VAnchor.ParentBottom; headerRow.AddChild(elementHeader); topToBottom.AddChild(headerRow); this.AddChild(topToBottom); } //Creates container in the middle of window FlowLayoutWidget middleRowContainer = new FlowLayoutWidget(FlowDirection.TopToBottom); { middleRowContainer.HAnchor = HAnchor.ParentLeftRight; middleRowContainer.VAnchor = VAnchor.ParentBottomTop; middleRowContainer.Padding = new BorderDouble(5); middleRowContainer.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor; } librarySelectorWidget = new LibrarySelectorWidget(); // put in the bread crumb widget FolderBreadCrumbWidget breadCrumbWidget = new FolderBreadCrumbWidget(librarySelectorWidget.SetCurrentLibraryProvider, librarySelectorWidget.CurrentLibraryProvider); middleRowContainer.AddChild(breadCrumbWidget); librarySelectorWidget.ChangedCurrentLibraryProvider += breadCrumbWidget.SetBreadCrumbs; // put in the area to pick the provider to save to { //Adds text box and check box to the above container GuiWidget chooseWindow = new GuiWidget(10, 30); chooseWindow.HAnchor = HAnchor.ParentLeftRight; chooseWindow.VAnchor = VAnchor.ParentBottomTop; chooseWindow.Margin = new BorderDouble(5); chooseWindow.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor; chooseWindow.Padding = new BorderDouble(3); chooseWindow.AddChild(librarySelectorWidget); middleRowContainer.AddChild(chooseWindow); } // put in the area to type in the new name { string fileNameLabel = "Design Name".Localize(); TextWidget textBoxHeader = new TextWidget(fileNameLabel, pointSize: 12); textBoxHeader.TextColor = ActiveTheme.Instance.PrimaryTextColor; textBoxHeader.Margin = new BorderDouble(5); textBoxHeader.HAnchor = HAnchor.ParentLeft; //Adds text box and check box to the above container textToAddWidget = new MHTextEditWidget("", pixelWidth: 300, messageWhenEmptyAndNotSelected: "Enter a Design Name Here".Localize()); textToAddWidget.HAnchor = HAnchor.ParentLeftRight; textToAddWidget.Margin = new BorderDouble(5); textToAddWidget.ActualTextEditWidget.EnterPressed += new KeyEventHandler(ActualTextEditWidget_EnterPressed); middleRowContainer.AddChild(textBoxHeader); middleRowContainer.AddChild(textToAddWidget); } middleRowContainer.AddChild(new HorizontalSpacer()); topToBottom.AddChild(middleRowContainer); //Creates button container on the bottom of window FlowLayoutWidget buttonRow = new FlowLayoutWidget(FlowDirection.LeftToRight); { BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor; buttonRow.HAnchor = HAnchor.ParentLeftRight; buttonRow.Padding = new BorderDouble(0, 3); } Button saveAsButton = textImageButtonFactory.Generate("Save".Localize(), centerText: true); saveAsButton.Visible = true; saveAsButton.Cursor = Cursors.Hand; buttonRow.AddChild(saveAsButton); saveAsButton.Click += new EventHandler(saveAsButton_Click); //Adds SaveAs and Close Button to button container buttonRow.AddChild(new HorizontalSpacer()); Button cancelButton = textImageButtonFactory.Generate("Cancel".Localize(), centerText: true); cancelButton.Visible = true; cancelButton.Cursor = Cursors.Hand; buttonRow.AddChild(cancelButton); cancelButton.Click += (sender, e) => { CloseOnIdle(); }; topToBottom.AddChild(buttonRow); ShowAsSystemWindow(); }