public LibraryRowItemCollection(PrintItemCollection collection, LibraryDataView libraryDataView, LibraryProvider parentProvider, GuiWidget thumbnailWidget)
     : base(libraryDataView, thumbnailWidget)
 {
     this.parentProvider      = parentProvider;
     this.printItemCollection = collection;
     CreateGuiElements();
 }
		public LibraryDataView()
		{
			currentLibraryProvider = new LibraryProviderSelector();
			currentLibraryProvider.DataReloaded += LibraryDataReloaded;

			if (libraryDataViewInstance != null)
			{
				throw new Exception("There should only ever be one of these, Lars.");
			}
			libraryDataViewInstance = this;

			// set the display attributes
			{
				this.AnchorAll();
				this.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor;
				this.ScrollArea.Padding = new BorderDouble(3, 3, 5, 3);
			}

			ScrollArea.HAnchor = HAnchor.ParentLeftRight;

			AutoScroll = true;
			topToBottomItemList = new FlowLayoutWidget(FlowDirection.TopToBottom);
			topToBottomItemList.HAnchor = HAnchor.ParentLeftRight;
			AddChild(topToBottomItemList);

			AddAllItems();
		}
Exemple #3
0
        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);
        }
		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();
		}
Exemple #5
0
 public LibraryRowItem(LibraryDataView libraryDataView, GuiWidget thumbnailWidget)
 {
     this.thumbnailWidget      = thumbnailWidget;
     this.libraryDataView      = libraryDataView;
     this.IsViewHelperItem     = false;
     this.EnableSlideInActions = true;
 }
		public LibraryRowItemCollection(PrintItemCollection collection, LibraryDataView libraryDataView, LibraryProvider parentProvider, GuiWidget thumbnailWidget)
			: base(libraryDataView, thumbnailWidget)
		{
			this.parentProvider = parentProvider;
			this.printItemCollection = collection;
			CreateGuiElements();
		}
		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);
		}
        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();
        }
		public LibraryRowItem(LibraryDataView libraryDataView, GuiWidget thumbnailWidget)
		{
			this.thumbnailWidget = thumbnailWidget;
			this.libraryDataView = libraryDataView;
			this.IsViewHelperItem = false;
			this.EnableSlideInActions = true;
		}
		public LibraryRowItem(LibraryDataView libraryDataView, GuiWidget thumbnailWidget)
		{
			this.thumbnailWidget = thumbnailWidget;
			this.libraryDataView = libraryDataView;
			this.IsViewHelperItem = false;
			this.EnableSlideInActions = true;

			MouseEnterBounds += (s, e) => EnteredBounds();
			MouseLeaveBounds += (s, e) => EnteredBounds();
		}
Exemple #11
0
        public LibraryRowItem(LibraryDataView libraryDataView, GuiWidget thumbnailWidget)
        {
            this.thumbnailWidget      = thumbnailWidget;
            this.libraryDataView      = libraryDataView;
            this.IsViewHelperItem     = false;
            this.EnableSlideInActions = true;

            MouseEnterBounds += (s, e) => UpdateHoverState();
            MouseLeaveBounds += (s, e) => UpdateHoverState();
        }
		public LibraryRowItemCollection(PrintItemCollection collection, LibraryProvider currentProvider, int collectionIndex, LibraryDataView libraryDataView, LibraryProvider parentProvider, GuiWidget thumbnailWidget)
			: base(libraryDataView, thumbnailWidget)
		{
			this.currentProvider = currentProvider;
			this.CollectionIndex = collectionIndex;
			this.parentProvider = parentProvider;
			this.printItemCollection = collection;
			this.ItemName = printItemCollection.Name;

			CreateGuiElements();
		}
        public override void OnClosed(EventArgs e)
        {
            currentLibraryProvider.DataReloaded -= LibraryDataReloaded;

            if (unregisterEvents != null)
            {
                unregisterEvents(this, null);
            }
            base.OnClosed(e);
            libraryDataViewInstance = null;
        }
        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);
            currentLibraryProvider.DataReloaded += LibraryDataReloaded;

            if (libraryDataViewInstance != null)
            {
                throw new Exception("There should only ever be one of these, Lars.");
            }
            libraryDataViewInstance = this;

            // set the display attributes
            {
                this.AnchorAll();
                this.BackgroundColor    = ActiveTheme.Instance.SecondaryBackgroundColor;
                this.ScrollArea.Padding = new BorderDouble(3, 3, 5, 3);
            }

            ScrollArea.HAnchor = HAnchor.ParentLeftRight;

            AutoScroll                  = true;
            topToBottomItemList         = new FlowLayoutWidget(FlowDirection.TopToBottom);
            topToBottomItemList.HAnchor = HAnchor.ParentLeftRight;
            AddChild(topToBottomItemList);

            AddAllItems();

            providerMessageWidget = new TextWidget("")
            {
                PointSize = 8,
                HAnchor   = HAnchor.ParentRight,
                VAnchor   = VAnchor.ParentBottom,
                TextColor = ActiveTheme.Instance.SecondaryTextColor,
                Margin    = new BorderDouble(6),
                AutoExpandBoundsToText = true,
            };

            providerMessageContainer = new GuiWidget()
            {
                VAnchor         = VAnchor.FitToChildren,
                HAnchor         = HAnchor.ParentLeftRight,
                BackgroundColor = new RGBA_Bytes(ActiveTheme.Instance.SecondaryBackgroundColor, 220),
                Visible         = false,
            };

            providerMessageContainer.AddChild(providerMessageWidget);
            this.AddChildToBackground(providerMessageContainer, -1);
        }
		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);
			currentLibraryProvider.DataReloaded += LibraryDataReloaded;

			if (libraryDataViewInstance != null)
			{
				throw new Exception("There should only ever be one of these, Lars.");
			}
			libraryDataViewInstance = this;

			// set the display attributes
			{
				this.AnchorAll();
				this.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor;
				this.ScrollArea.Padding = new BorderDouble(3, 3, 5, 3);
			}

			ScrollArea.HAnchor = HAnchor.ParentLeftRight;

			AutoScroll = true;
			topToBottomItemList = new FlowLayoutWidget(FlowDirection.TopToBottom);
			topToBottomItemList.HAnchor = HAnchor.ParentLeftRight;
			AddChild(topToBottomItemList);

			AddAllItems();

			providerMessageWidget = new TextWidget("")
			{
				PointSize = 8,
				HAnchor = HAnchor.ParentRight,
				VAnchor = VAnchor.ParentBottom,
				TextColor = ActiveTheme.Instance.SecondaryTextColor,
				Margin = new BorderDouble(6),
				AutoExpandBoundsToText = true,
			};

			providerMessageContainer = new GuiWidget()
			{
				VAnchor = VAnchor.FitToChildren,
				HAnchor = HAnchor.ParentLeftRight,
				BackgroundColor = new RGBA_Bytes(ActiveTheme.Instance.SecondaryBackgroundColor, 220),
				Visible = false,
			};

			providerMessageContainer.AddChild(providerMessageWidget);
			this.AddChildToBackground(providerMessageContainer, -1);
		}
		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);
			this.libraryProvider = libraryProvider;
			this.ItemIndex = itemIndex;

			CreateGuiElements();

			AddLoadingProgressBar();
		}
		public LibraryRowItemCollection(PrintItemCollection collection, LibraryProvider currentProvider, int collectionIndex, LibraryDataView libraryDataView, LibraryProvider parentProvider, GuiWidget thumbnailWidget, string openButtonText)
			: base(libraryDataView, thumbnailWidget)
		{
			this.openButtonText = openButtonText;
			this.currentProvider = currentProvider;
			this.CollectionIndex = collectionIndex;
			this.parentProvider = parentProvider;
			this.printItemCollection = collection;
			this.ItemName = printItemCollection.Name;

			this.Name = this.ItemName + " Row Item Collection";

			if (collection.Key == LibraryRowItem.LoadingPlaceholderToken)
			{
				this.EnableSlideInActions = false;
				this.IsViewHelperItem = true;
			}

			CreateGuiElements();
		}
        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);
            this.libraryProvider = libraryProvider;
            this.ItemIndex       = itemIndex;

            CreateGuiElements();

            AddLoadingProgressBar();

            libraryProvider.RegisterForProgress(itemIndex, ReportProgressRatio);
        }
		public override void OnClosed(EventArgs e)
		{
			currentLibraryProvider.DataReloaded -= LibraryDataReloaded;

			if (unregisterEvents != null)
			{
				unregisterEvents(this, null);
			}
			base.OnClosed(e);
			libraryDataViewInstance = null;
		}
Exemple #20
0
        private void LoadContent()
        {
            this.Padding         = new BorderDouble(3);
            this.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
            this.AnchorAll();

            textImageButtonFactory.borderWidth = 0;

            editButtonFactory.normalTextColor   = ActiveTheme.Instance.PrimaryTextColor;
            editButtonFactory.hoverTextColor    = ActiveTheme.Instance.PrimaryTextColor;
            editButtonFactory.disabledTextColor = ActiveTheme.Instance.TabLabelUnselected;
            editButtonFactory.disabledFillColor = new RGBA_Bytes();
            editButtonFactory.pressedTextColor  = ActiveTheme.Instance.PrimaryTextColor;
            editButtonFactory.borderWidth       = 0;
            editButtonFactory.Margin            = new BorderDouble(10, 0);

            FlowLayoutWidget allControls = new FlowLayoutWidget(FlowDirection.TopToBottom);

            {
                enterEditModeButton        = editButtonFactory.Generate("Edit".Localize(), centerText: true);
                enterEditModeButton.Click += enterEditModeButtonClick;

                leaveEditModeButton        = editButtonFactory.Generate("Done".Localize(), centerText: true);
                leaveEditModeButton.Click += leaveEditModeButtonClick;

                // make sure the buttons are the same size even when localized
                if (leaveEditModeButton.Width < enterEditModeButton.Width)
                {
                    editButtonFactory.FixedWidth = enterEditModeButton.Width;
                    leaveEditModeButton          = editButtonFactory.Generate("Done".Localize(), centerText: true);
                    leaveEditModeButton.Click   += leaveEditModeButtonClick;
                }
                else
                {
                    editButtonFactory.FixedWidth = leaveEditModeButton.Width;
                    enterEditModeButton          = editButtonFactory.Generate("Edit".Localize(), centerText: true);
                    enterEditModeButton.Click   += enterEditModeButtonClick;
                }

                enterEditModeButton.Name = "Library Edit Button";

                leaveEditModeButton.Visible = false;

                FlowLayoutWidget navigationPanel = new FlowLayoutWidget();
                navigationPanel.HAnchor         = HAnchor.ParentLeftRight;
                navigationPanel.Padding         = new BorderDouble(0);
                navigationPanel.BackgroundColor = ActiveTheme.Instance.TransparentLightOverlay;

                navigationLabel           = new TextWidget("My Library".Localize(), pointSize: 14);
                navigationLabel.VAnchor   = Agg.UI.VAnchor.ParentCenter;
                navigationLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor;

                navigationPanel.AddChild(new GuiWidget(50, 0));                 //Add this as temporary balance to edit buttons
                navigationPanel.AddChild(new HorizontalSpacer());
                navigationPanel.AddChild(navigationLabel);
                navigationPanel.AddChild(new HorizontalSpacer());

                buttonPanel             = new FlowLayoutWidget();
                buttonPanel.HAnchor     = HAnchor.ParentLeftRight;
                buttonPanel.Padding     = new BorderDouble(0, 3);
                buttonPanel.MinimumSize = new Vector2(0, 46);

                AddLibraryButtonElements();

                //allControls.AddChild(navigationPanel);
                searchPanel = CreateSearchPannel();
                allControls.AddChild(searchPanel);

                libraryDataView  = new LibraryDataView();
                breadCrumbWidget = new FolderBreadCrumbWidget(libraryDataView.SetCurrentLibraryProvider, libraryDataView.CurrentLibraryProvider);
                FlowLayoutWidget breadCrumbSpaceHolder = new FlowLayoutWidget()
                {
                    HAnchor = HAnchor.ParentLeftRight,
                };
                breadCrumbSpaceHolder.AddChild(breadCrumbWidget);
                libraryDataView.ChangedCurrentLibraryProvider += breadCrumbWidget.SetBreadCrumbs;

                libraryDataView.ChangedCurrentLibraryProvider += LibraryProviderChanged;
                breadCrumbAndActionBar = new FlowLayoutWidget()
                {
                    HAnchor = HAnchor.ParentLeftRight,
                };

                breadCrumbAndActionBar.AddChild(breadCrumbSpaceHolder);
                breadCrumbAndActionBar.AddChild(CreateActionsMenu());

                allControls.AddChild(breadCrumbAndActionBar);

                allControls.AddChild(libraryDataView);
                allControls.AddChild(buttonPanel);
            }

            allControls.AnchorAll();

            this.AddChild(allControls);
        }
Exemple #21
0
 public LibraryRowItem(LibraryDataView libraryDataView, GuiWidget thumbnailWidget)
 {
     this.thumbnailWidget = thumbnailWidget;
     this.libraryDataView = libraryDataView;
 }
        public PrintLibraryWidget()
        {
            SetDisplayAttributes();

            textImageButtonFactory.borderWidth = 0;

            searchButtonFactory.normalTextColor   = RGBA_Bytes.White;
            searchButtonFactory.hoverTextColor    = RGBA_Bytes.White;
            searchButtonFactory.disabledTextColor = RGBA_Bytes.White;
            searchButtonFactory.pressedTextColor  = RGBA_Bytes.White;
            searchButtonFactory.borderWidth       = 0;
            searchButtonFactory.FixedWidth        = 80;

            FlowLayoutWidget allControls = new FlowLayoutWidget(FlowDirection.TopToBottom);

            {
                FlowLayoutWidget searchPanel = new FlowLayoutWidget();
                searchPanel.BackgroundColor = ActiveTheme.Instance.TransparentDarkOverlay;
                searchPanel.HAnchor         = HAnchor.ParentLeftRight;
                searchPanel.Padding         = new BorderDouble(0);
                {
                    searchInput         = new MHTextEditWidget();
                    searchInput.Margin  = new BorderDouble(6, 3, 0, 0);
                    searchInput.HAnchor = HAnchor.ParentLeftRight;
                    searchInput.VAnchor = VAnchor.ParentCenter;

                    searchButton = searchButtonFactory.Generate(LocalizedString.Get("Search"), centerText: true);

                    searchPanel.AddChild(searchInput);
                    searchPanel.AddChild(searchButton);
                }

                FlowLayoutWidget buttonPanel = new FlowLayoutWidget();
                buttonPanel.HAnchor = HAnchor.ParentLeftRight;
                buttonPanel.Padding = new BorderDouble(0, 3);
                {
                    Button addToLibrary = textImageButtonFactory.Generate(LocalizedString.Get("Import"), "icon_import_white_32x32.png");
                    buttonPanel.AddChild(addToLibrary);
                    addToLibrary.Margin = new BorderDouble(0, 0, 3, 0);
                    addToLibrary.Click += new ButtonBase.ButtonEventHandler(loadFile_Click);

                    addToQueueButton         = textImageButtonFactory.Generate("Add to Queue");
                    addToQueueButton.Margin  = new BorderDouble(3, 0);
                    addToQueueButton.Click  += new ButtonBase.ButtonEventHandler(addToQueueButton_Click);
                    addToQueueButton.Visible = false;
                    buttonPanel.AddChild(addToQueueButton);

                    deleteFromLibraryButton         = textImageButtonFactory.Generate("Remove");
                    deleteFromLibraryButton.Margin  = new BorderDouble(3, 0);
                    deleteFromLibraryButton.Click  += new ButtonBase.ButtonEventHandler(deleteFromQueueButton_Click);
                    deleteFromLibraryButton.Visible = false;
                    buttonPanel.AddChild(deleteFromLibraryButton);

                    GuiWidget spacer = new GuiWidget();
                    spacer.HAnchor = HAnchor.ParentLeftRight;
                    buttonPanel.AddChild(spacer);
                }

                allControls.AddChild(searchPanel);
                libraryDataView = new LibraryDataView();
                allControls.AddChild(libraryDataView);
                allControls.AddChild(buttonPanel);
            }
            allControls.AnchorAll();

            this.AddChild(allControls);

            AddHandlers();
        }
Exemple #23
0
 public LibraryRowItemPart(PrintItemWrapper printItem, LibraryDataView libraryDataView, GuiWidget thumbnailWidget)
     : base(libraryDataView, thumbnailWidget)
 {
     this.printItemWrapper = printItem;
     CreateGuiElements();
 }
		public LibraryRowItem(PrintItemWrapper printItem, LibraryDataView libraryDataView)
		{
			this.libraryDataView = libraryDataView;
			this.printItemWrapper = printItem;
			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;

				PartThumbnailWidget thumbnailWidget = new PartThumbnailWidget(printItem, "part_icon_transparent_40x40.png", "building_thumbnail_40x40.png", PartThumbnailWidget.ImageSizes.Size50x50);

				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 = textInfo.ToTitleCase(printItem.Name);
					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();
		}
Exemple #25
0
        public PrintLibraryWidget()
        {
            SetDisplayAttributes();

            textImageButtonFactory.borderWidth = 0;

            searchButtonFactory.normalTextColor   = RGBA_Bytes.White;
            searchButtonFactory.hoverTextColor    = RGBA_Bytes.White;
            searchButtonFactory.disabledTextColor = RGBA_Bytes.White;
            searchButtonFactory.pressedTextColor  = RGBA_Bytes.White;
            searchButtonFactory.borderWidth       = 0;
            searchButtonFactory.FixedWidth        = 80 * TextWidget.GlobalPointSizeScaleRatio;

            editButtonFactory.normalTextColor   = ActiveTheme.Instance.PrimaryTextColor;
            editButtonFactory.hoverTextColor    = ActiveTheme.Instance.PrimaryTextColor;
            editButtonFactory.disabledTextColor = ActiveTheme.Instance.PrimaryTextColor;
            editButtonFactory.pressedTextColor  = ActiveTheme.Instance.PrimaryTextColor;
            editButtonFactory.borderWidth       = 0;
            editButtonFactory.FixedWidth        = 70 * TextWidget.GlobalPointSizeScaleRatio;

            FlowLayoutWidget allControls = new FlowLayoutWidget(FlowDirection.TopToBottom);

            {
                enterEditModeButton         = editButtonFactory.Generate("Edit".Localize(), centerText: true);
                leaveEditModeButton         = editButtonFactory.Generate("Done".Localize(), centerText: true);
                leaveEditModeButton.Visible = false;

                FlowLayoutWidget searchPanel = new FlowLayoutWidget();
                searchPanel.BackgroundColor = ActiveTheme.Instance.TransparentDarkOverlay;
                searchPanel.HAnchor         = HAnchor.ParentLeftRight;
                searchPanel.Padding         = new BorderDouble(0);
                {
                    searchInput         = new MHTextEditWidget(messageWhenEmptyAndNotSelected: "Search Library".Localize());
                    searchInput.Margin  = new BorderDouble(0, 3, 0, 0);
                    searchInput.HAnchor = HAnchor.ParentLeftRight;
                    searchInput.VAnchor = VAnchor.ParentCenter;


                    searchButton = searchButtonFactory.Generate(LocalizedString.Get("Search"), centerText: true);

                    searchPanel.AddChild(enterEditModeButton);
                    searchPanel.AddChild(leaveEditModeButton);

                    searchPanel.AddChild(searchInput);
                    searchPanel.AddChild(searchButton);
                }

                FlowLayoutWidget navigationPanel = new FlowLayoutWidget();
                navigationPanel.HAnchor         = HAnchor.ParentLeftRight;
                navigationPanel.Padding         = new BorderDouble(0);
                navigationPanel.BackgroundColor = ActiveTheme.Instance.TransparentLightOverlay;

                navigationLabel           = new TextWidget("My Library".Localize(), pointSize: 14);
                navigationLabel.VAnchor   = Agg.UI.VAnchor.ParentCenter;
                navigationLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor;



                navigationPanel.AddChild(new GuiWidget(50, 0)); //Add this as temporary balance to edit buttons
                navigationPanel.AddChild(new HorizontalSpacer());
                navigationPanel.AddChild(navigationLabel);
                navigationPanel.AddChild(new HorizontalSpacer());
                //navigationPanel.AddChild(enterEditModeButton);
                //navigationPanel.AddChild(leaveEditModeButton);



                FlowLayoutWidget buttonPanel = new FlowLayoutWidget();
                buttonPanel.HAnchor     = HAnchor.ParentLeftRight;
                buttonPanel.Padding     = new BorderDouble(0, 3);
                buttonPanel.MinimumSize = new Vector2(0, 46);
                {
                    addToLibraryButton = textImageButtonFactory.Generate(LocalizedString.Get("Import"), "icon_import_white_32x32.png");
                    buttonPanel.AddChild(addToLibraryButton);
                    addToLibraryButton.Margin = new BorderDouble(0, 0, 3, 0);
                    addToLibraryButton.Click += new EventHandler(importToLibraryloadFile_Click);

                    addToQueueButton         = textImageButtonFactory.Generate("Add to Queue".Localize());
                    addToQueueButton.Margin  = new BorderDouble(3, 0);
                    addToQueueButton.Click  += new EventHandler(addToQueueButton_Click);
                    addToQueueButton.Visible = false;
                    buttonPanel.AddChild(addToQueueButton);

                    exportItemButton         = textImageButtonFactory.Generate("Export".Localize());
                    exportItemButton.Margin  = new BorderDouble(3, 0);
                    exportItemButton.Click  += new EventHandler(exportButton_Click);
                    exportItemButton.Visible = false;
                    buttonPanel.AddChild(exportItemButton);

                    editItemButton         = textImageButtonFactory.Generate("Edit".Localize());
                    editItemButton.Margin  = new BorderDouble(3, 0);
                    editItemButton.Click  += new EventHandler(editButton_Click);
                    editItemButton.Visible = false;
                    buttonPanel.AddChild(editItemButton);

                    removeFromLibraryButton         = textImageButtonFactory.Generate("Remove".Localize());
                    removeFromLibraryButton.Margin  = new BorderDouble(3, 0);
                    removeFromLibraryButton.Click  += new EventHandler(deleteFromQueueButton_Click);
                    removeFromLibraryButton.Visible = false;
                    buttonPanel.AddChild(removeFromLibraryButton);

                    GuiWidget spacer = new GuiWidget();
                    spacer.HAnchor = HAnchor.ParentLeftRight;
                    buttonPanel.AddChild(spacer);
                }
                //allControls.AddChild(navigationPanel);
                allControls.AddChild(searchPanel);
                libraryDataView = new LibraryDataView();
                allControls.AddChild(libraryDataView);
                allControls.AddChild(buttonPanel);
            }
            allControls.AnchorAll();

            this.AddChild(allControls);

            AddHandlers();
        }
        public PrintLibraryWidget()
        {
            SetDisplayAttributes();

            textImageButtonFactory.borderWidth = 0;

            searchButtonFactory.normalTextColor = RGBA_Bytes.White;
            searchButtonFactory.hoverTextColor = RGBA_Bytes.White;
            searchButtonFactory.disabledTextColor = RGBA_Bytes.White;
            searchButtonFactory.pressedTextColor = RGBA_Bytes.White;
            searchButtonFactory.borderWidth = 0;
            searchButtonFactory.FixedWidth = 80;

            FlowLayoutWidget allControls = new FlowLayoutWidget(FlowDirection.TopToBottom);
            {   
                FlowLayoutWidget searchPanel = new FlowLayoutWidget();
                searchPanel.BackgroundColor = ActiveTheme.Instance.TransparentDarkOverlay;
                searchPanel.HAnchor = HAnchor.ParentLeftRight;
                searchPanel.Padding = new BorderDouble(0);                
                {
                    searchInput = new MHTextEditWidget();
                    searchInput.Margin = new BorderDouble(6, 3, 0, 0);
                    searchInput.HAnchor = HAnchor.ParentLeftRight;
                    searchInput.VAnchor = VAnchor.ParentCenter;

					searchButton = searchButtonFactory.Generate(LocalizedString.Get("Search"),centerText:true);

                    searchPanel.AddChild(searchInput);
                    searchPanel.AddChild(searchButton);
                }

                FlowLayoutWidget buttonPanel = new FlowLayoutWidget();
                buttonPanel.HAnchor = HAnchor.ParentLeftRight;
                buttonPanel.Padding = new BorderDouble(0, 3);
                {
					Button addToLibrary = textImageButtonFactory.Generate(LocalizedString.Get("Import"), "icon_import_white_32x32.png");
                    buttonPanel.AddChild(addToLibrary);
                    addToLibrary.Margin = new BorderDouble(0, 0, 3, 0);
                    addToLibrary.Click += new ButtonBase.ButtonEventHandler(loadFile_Click);

					addToQueueButton = textImageButtonFactory.Generate("Add to Queue");
                    addToQueueButton.Margin = new BorderDouble(3, 0);
                    addToQueueButton.Click += new ButtonBase.ButtonEventHandler(addToQueueButton_Click);
                    addToQueueButton.Visible = false;
                    buttonPanel.AddChild(addToQueueButton);

					deleteFromLibraryButton = textImageButtonFactory.Generate("Remove");
                    deleteFromLibraryButton.Margin = new BorderDouble(3, 0);
                    deleteFromLibraryButton.Click += new ButtonBase.ButtonEventHandler(deleteFromQueueButton_Click);
                    deleteFromLibraryButton.Visible = false;
                    buttonPanel.AddChild(deleteFromLibraryButton);

                    GuiWidget spacer = new GuiWidget();
                    spacer.HAnchor = HAnchor.ParentLeftRight;
                    buttonPanel.AddChild(spacer);
                }

                allControls.AddChild(searchPanel);
                libraryDataView = new LibraryDataView();
                allControls.AddChild(libraryDataView);
                allControls.AddChild(buttonPanel);
            }
            allControls.AnchorAll();

            this.AddChild(allControls);

            AddHandlers();
        }
		public LibraryRowItemPart(PrintItemWrapper printItem, LibraryDataView libraryDataView, GuiWidget thumbnailWidget)
			: base(libraryDataView, thumbnailWidget)
		{
			this.printItemWrapper = printItem;
			CreateGuiElements();
		}
        public LibraryRowItem(PrintItemWrapper printItem, LibraryDataView libraryDataView)
        {
            this.libraryDataView  = libraryDataView;
            this.printItemWrapper = printItem;
            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;

                PartThumbnailWidget thumbnailWidget = new PartThumbnailWidget(printItem, "part_icon_transparent_40x40.png", "building_thumbnail_40x40.png", PartThumbnailWidget.ImageSizes.Size50x50);

                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 = textInfo.ToTitleCase(printItem.Name);
                    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();
        }
Exemple #29
0
        public LibraryRowItem(PrintItemWrapper printItem, LibraryDataView libraryDataView)
        {
            this.libraryDataView        = libraryDataView;
            this.printItemWrapper       = printItem;
            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;
            {
                GuiWidget selectionCheckBoxContainer = new GuiWidget();
                selectionCheckBoxContainer.VAnchor = VAnchor.Max_FitToChildren_ParentHeight;
                selectionCheckBoxContainer.HAnchor = Agg.UI.HAnchor.FitToChildren;
                selectionCheckBoxContainer.Margin  = new BorderDouble(left: 6);
                selectionCheckBox         = new CheckBox("");
                selectionCheckBox.VAnchor = VAnchor.ParentCenter;
                selectionCheckBox.HAnchor = HAnchor.ParentCenter;
                selectionCheckBoxContainer.AddChild(selectionCheckBox);

                FlowLayoutWidget leftColumn = new FlowLayoutWidget(FlowDirection.TopToBottom);
                leftColumn.VAnchor |= VAnchor.ParentTop;


                FlowLayoutWidget middleColumn = new FlowLayoutWidget(FlowDirection.TopToBottom);
                middleColumn.HAnchor = Agg.UI.HAnchor.ParentLeftRight;
                middleColumn.VAnchor = Agg.UI.VAnchor.ParentBottomTop;
                middleColumn.Padding = new BorderDouble(0, 6);
                middleColumn.Margin  = new BorderDouble(10, 0);
                {
                    string labelName = textInfo.ToTitleCase(printItem.Name);
                    labelName             = labelName.Replace('_', ' ');
                    partLabel             = new TextWidget(labelName, pointSize: 12);
                    partLabel.TextColor   = WidgetTextColor;
                    partLabel.MinimumSize = new Vector2(1, 16);
                    middleColumn.AddChild(partLabel);
                }

                FlowLayoutWidget rightColumn = new FlowLayoutWidget(FlowDirection.TopToBottom);
                rightColumn.VAnchor = Agg.UI.VAnchor.ParentBottomTop;

                buttonContainer         = new FlowLayoutWidget();
                buttonContainer.Margin  = new BorderDouble(0, 6);
                buttonContainer.HAnchor = Agg.UI.HAnchor.ParentLeftRight;
                {
                    addToQueueLink         = linkButtonFactory.Generate(LocalizedString.Get("Add to Queue"));
                    addToQueueLink.Margin  = new BorderDouble(left: 0, right: 10);
                    addToQueueLink.VAnchor = VAnchor.ParentCenter;

                    addToQueueLink.Click += (sender, e) =>
                    {
                        QueueData.Instance.AddItem(new PrintItemWrapper(new PrintItem(this.printItemWrapper.Name, this.printItemWrapper.FileLocation)));
                    };

                    viewLink         = linkButtonFactory.Generate(LocalizedString.Get("View"));
                    viewLink.Margin  = new BorderDouble(left: 0, right: 10);
                    viewLink.VAnchor = VAnchor.ParentCenter;

                    exportLink         = linkButtonFactory.Generate(LocalizedString.Get("Export"));
                    exportLink.Margin  = new BorderDouble(left: 0, right: 10);
                    exportLink.VAnchor = VAnchor.ParentCenter;

                    exportLink.Click += (sender, e) =>
                    {
                        OpenExportWindow();
                    };

                    removeLink         = linkButtonFactory.Generate(LocalizedString.Get("Remove"));
                    removeLink.Margin  = new BorderDouble(left: 10, right: 10);
                    removeLink.VAnchor = VAnchor.ParentCenter;

                    buttonContainer.AddChild(addToQueueLink);
                    buttonContainer.AddChild(viewLink);
                    buttonContainer.AddChild(exportLink);
                    buttonContainer.AddChild(removeLink);
                }
                middleColumn.AddChild(buttonContainer);
                //rightColumn.AddChild(buttonContainer);

                mainContainer.AddChild(selectionCheckBoxContainer);
                {
                    PartThumbnailWidget thumbnailWidget = new PartThumbnailWidget(printItem, "part_icon_transparent_40x40.png", "building_thumbnail_40x40.png", PartThumbnailWidget.ImageSizes.Size50x50);
                    mainContainer.AddChild(thumbnailWidget);
                }
                mainContainer.AddChild(leftColumn);
                mainContainer.AddChild(middleColumn);
                mainContainer.AddChild(rightColumn);
            }
            this.AddChild(mainContainer);
            AddHandlers();
        }
Exemple #30
0
        public LibraryRowItemCollection(PrintItemCollection collection, LibraryProvider currentProvider, int collectionIndex, LibraryDataView libraryDataView, LibraryProvider parentProvider, GuiWidget thumbnailWidget)
            : base(libraryDataView, thumbnailWidget)
        {
            this.currentProvider     = currentProvider;
            this.CollectionIndex     = collectionIndex;
            this.parentProvider      = parentProvider;
            this.printItemCollection = collection;
            this.ItemName            = printItemCollection.Name;

            CreateGuiElements();
        }
        public LibraryRowItem(PrintItemWrapper printItem, LibraryDataView libraryDataView)
        {
            this.libraryDataView = libraryDataView;
            this.printItemWrapper = printItem;
            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;
            {
                GuiWidget selectionCheckBoxContainer = new GuiWidget();
                selectionCheckBoxContainer.VAnchor = VAnchor.Max_FitToChildren_ParentHeight;
                selectionCheckBoxContainer.HAnchor = Agg.UI.HAnchor.FitToChildren;
                selectionCheckBoxContainer.Margin = new BorderDouble(left: 6);
                selectionCheckBox = new CheckBox("");
                selectionCheckBox.VAnchor = VAnchor.ParentCenter;
                selectionCheckBox.HAnchor = HAnchor.ParentCenter;
                selectionCheckBoxContainer.AddChild(selectionCheckBox);
                
                FlowLayoutWidget leftColumn = new FlowLayoutWidget(FlowDirection.TopToBottom);
                leftColumn.VAnchor |= VAnchor.ParentTop;


                FlowLayoutWidget middleColumn = new FlowLayoutWidget(FlowDirection.TopToBottom);
                middleColumn.HAnchor = Agg.UI.HAnchor.ParentLeftRight;
                middleColumn.VAnchor = Agg.UI.VAnchor.ParentBottomTop;
                middleColumn.Padding = new BorderDouble(0,6);
                middleColumn.Margin = new BorderDouble(10,0);
                {
                    string labelName = textInfo.ToTitleCase(printItem.Name);
                    labelName = labelName.Replace('_', ' ');
                    partLabel = new TextWidget(labelName, pointSize: 12);
                    partLabel.TextColor = WidgetTextColor;
                    partLabel.MinimumSize = new Vector2(1, 16);
                    middleColumn.AddChild(partLabel);
                }

                FlowLayoutWidget rightColumn = new FlowLayoutWidget(FlowDirection.TopToBottom);
                rightColumn.VAnchor = Agg.UI.VAnchor.ParentBottomTop;                

                buttonContainer = new FlowLayoutWidget();
                buttonContainer.Margin = new BorderDouble(0,6);
                buttonContainer.HAnchor = Agg.UI.HAnchor.ParentLeftRight; 
                {
					addToQueueLink = linkButtonFactory.Generate(LocalizedString.Get("Add to Queue"));
                    addToQueueLink.Margin = new BorderDouble(left: 0, right: 10);
                    addToQueueLink.VAnchor = VAnchor.ParentCenter;

                    addToQueueLink.Click += (sender, e) =>
                    {
                        QueueData.Instance.AddItem(new PrintItemWrapper(new PrintItem(this.printItemWrapper.Name, this.printItemWrapper.FileLocation)));
                    };

					viewLink = linkButtonFactory.Generate(LocalizedString.Get("View"));
                    viewLink.Margin = new BorderDouble(left: 0, right:10);
                    viewLink.VAnchor = VAnchor.ParentCenter;                    

					exportLink = linkButtonFactory.Generate(LocalizedString.Get("Export"));
                    exportLink.Margin = new BorderDouble(left: 0, right: 10);
                    exportLink.VAnchor = VAnchor.ParentCenter;

                    exportLink.Click += (sender, e) =>
                    {
						OpenExportWindow();
                    };

					removeLink = linkButtonFactory.Generate(LocalizedString.Get("Remove"));
                    removeLink.Margin = new BorderDouble(left: 10, right: 10);
                    removeLink.VAnchor = VAnchor.ParentCenter;

                    buttonContainer.AddChild(addToQueueLink);
                    buttonContainer.AddChild(viewLink);
                    buttonContainer.AddChild(exportLink);
                    buttonContainer.AddChild(removeLink);
                }
                middleColumn.AddChild(buttonContainer);
                //rightColumn.AddChild(buttonContainer);

                mainContainer.AddChild(selectionCheckBoxContainer);
                {
                    PartThumbnailWidget thumbnailWidget = new PartThumbnailWidget(printItem, "part_icon_transparent_40x40.png", "building_thumbnail_40x40.png", PartThumbnailWidget.ImageSizes.Size50x50);
                    mainContainer.AddChild(thumbnailWidget);
                }
                mainContainer.AddChild(leftColumn);
                mainContainer.AddChild(middleColumn);                
                mainContainer.AddChild(rightColumn);
            }
            this.AddChild(mainContainer);
            AddHandlers();
        }
		private void LoadContent()
		{
			this.Padding = new BorderDouble(3);
			this.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
			this.AnchorAll();

			textImageButtonFactory.borderWidth = 0;

			editButtonFactory.normalTextColor = ActiveTheme.Instance.PrimaryTextColor;
			editButtonFactory.hoverTextColor = ActiveTheme.Instance.PrimaryTextColor;
			editButtonFactory.disabledTextColor = ActiveTheme.Instance.TabLabelUnselected;
			editButtonFactory.disabledFillColor = new RGBA_Bytes();
			editButtonFactory.pressedTextColor = ActiveTheme.Instance.PrimaryTextColor;
			editButtonFactory.borderWidth = 0;
			editButtonFactory.Margin = new BorderDouble(10, 0);

			FlowLayoutWidget allControls = new FlowLayoutWidget(FlowDirection.TopToBottom);
			{
				enterEditModeButton = editButtonFactory.Generate("Edit".Localize(), centerText: true);
				enterEditModeButton.Click += enterEditModeButtonClick;

				leaveEditModeButton = editButtonFactory.Generate("Done".Localize(), centerText: true);
				leaveEditModeButton.Click += leaveEditModeButtonClick;

				// make sure the buttons are the same size even when localized
				if (leaveEditModeButton.Width < enterEditModeButton.Width)
				{
					editButtonFactory.FixedWidth = enterEditModeButton.Width;
					leaveEditModeButton = editButtonFactory.Generate("Done".Localize(), centerText: true);
					leaveEditModeButton.Click += leaveEditModeButtonClick;
				}
				else
				{
					editButtonFactory.FixedWidth = leaveEditModeButton.Width;
					enterEditModeButton = editButtonFactory.Generate("Edit".Localize(), centerText: true);
					enterEditModeButton.Click += enterEditModeButtonClick;
				}

				enterEditModeButton.Name = "Library Edit Button";

				leaveEditModeButton.Visible = false;

				FlowLayoutWidget navigationPanel = new FlowLayoutWidget();
				navigationPanel.HAnchor = HAnchor.ParentLeftRight;
				navigationPanel.Padding = new BorderDouble(0);
				navigationPanel.BackgroundColor = ActiveTheme.Instance.TransparentLightOverlay;

				navigationLabel = new TextWidget("My Library".Localize(), pointSize: 14);
				navigationLabel.VAnchor = Agg.UI.VAnchor.ParentCenter;
				navigationLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor;

				navigationPanel.AddChild(new GuiWidget(50, 0)); //Add this as temporary balance to edit buttons
				navigationPanel.AddChild(new HorizontalSpacer());
				navigationPanel.AddChild(navigationLabel);
				navigationPanel.AddChild(new HorizontalSpacer());

				buttonPanel = new FlowLayoutWidget();
				buttonPanel.HAnchor = HAnchor.ParentLeftRight;
				buttonPanel.Padding = new BorderDouble(0, 3);
				buttonPanel.MinimumSize = new Vector2(0, 46);

				AddLibraryButtonElements();

				//allControls.AddChild(navigationPanel);
				allControls.AddChild(CreateSearchPannel());

				libraryDataView = new LibraryDataView();
				breadCrumbWidget = new FolderBreadCrumbWidget(libraryDataView.SetCurrentLibraryProvider, libraryDataView.CurrentLibraryProvider);
				FlowLayoutWidget breadCrumbSpaceHolder = new FlowLayoutWidget()
				{
					HAnchor = HAnchor.ParentLeftRight,
				};
				breadCrumbSpaceHolder.AddChild(breadCrumbWidget);
				libraryDataView.ChangedCurrentLibraryProvider += breadCrumbWidget.SetBreadCrumbs;

				libraryDataView.ChangedCurrentLibraryProvider += LibraryProviderChanged;
				breadCrumbAndActionBar = new FlowLayoutWidget()
				{
					HAnchor = HAnchor.ParentLeftRight,
				};

				breadCrumbAndActionBar.AddChild(breadCrumbSpaceHolder);
				breadCrumbAndActionBar.AddChild(CreateActionsMenu());

				allControls.AddChild(breadCrumbAndActionBar);

				allControls.AddChild(libraryDataView);
				allControls.AddChild(buttonPanel);
			}

			allControls.AnchorAll();

			this.AddChild(allControls);
		}
Exemple #33
0
        public LibraryRowItemCollection(PrintItemCollection collection, LibraryProvider currentProvider, int collectionIndex, LibraryDataView libraryDataView, LibraryProvider parentProvider, GuiWidget thumbnailWidget, string openButtonText)
            : base(libraryDataView, thumbnailWidget)
        {
            this.openButtonText      = openButtonText;
            this.currentProvider     = currentProvider;
            this.CollectionIndex     = collectionIndex;
            this.parentProvider      = parentProvider;
            this.printItemCollection = collection;
            this.ItemName            = printItemCollection.Name;

            this.Name = this.ItemName + " Row Item Collection";

            if (collection.Key == LibraryRowItem.LoadingPlaceholderToken)
            {
                this.EnableSlideInActions = false;
                this.IsViewHelperItem     = true;
            }

            CreateGuiElements();
        }
		public PrintLibraryWidget()
		{
			SetDisplayAttributes();

			textImageButtonFactory.borderWidth = 0;

			searchButtonFactory.normalTextColor = RGBA_Bytes.White;
			searchButtonFactory.hoverTextColor = RGBA_Bytes.White;
			searchButtonFactory.disabledTextColor = RGBA_Bytes.White;
			searchButtonFactory.pressedTextColor = RGBA_Bytes.White;
			searchButtonFactory.borderWidth = 0;
			searchButtonFactory.FixedWidth = 80 * TextWidget.GlobalPointSizeScaleRatio;

			editButtonFactory.normalTextColor = ActiveTheme.Instance.PrimaryTextColor;
			editButtonFactory.hoverTextColor = ActiveTheme.Instance.PrimaryTextColor;
			editButtonFactory.disabledTextColor = ActiveTheme.Instance.PrimaryTextColor;
			editButtonFactory.pressedTextColor = ActiveTheme.Instance.PrimaryTextColor;
			editButtonFactory.borderWidth = 0;
			editButtonFactory.FixedWidth = 70 * TextWidget.GlobalPointSizeScaleRatio;

			FlowLayoutWidget allControls = new FlowLayoutWidget(FlowDirection.TopToBottom);
			{
				enterEditModeButton = editButtonFactory.Generate("Edit".Localize(), centerText: true);
				leaveEditModeButton = editButtonFactory.Generate("Done".Localize(), centerText: true);
				leaveEditModeButton.Visible = false;

				FlowLayoutWidget searchPanel = new FlowLayoutWidget();
				searchPanel.BackgroundColor = ActiveTheme.Instance.TransparentDarkOverlay;
				searchPanel.HAnchor = HAnchor.ParentLeftRight;
				searchPanel.Padding = new BorderDouble(0);
				{
					searchInput = new MHTextEditWidget(messageWhenEmptyAndNotSelected: "Search Library".Localize());
					searchInput.Margin = new BorderDouble(0, 3, 0, 0);
					searchInput.HAnchor = HAnchor.ParentLeftRight;
					searchInput.VAnchor = VAnchor.ParentCenter;

					searchButton = searchButtonFactory.Generate(LocalizedString.Get("Search"), centerText: true);

					searchPanel.AddChild(enterEditModeButton);
					searchPanel.AddChild(leaveEditModeButton);

					searchPanel.AddChild(searchInput);
					searchPanel.AddChild(searchButton);
				}

				FlowLayoutWidget navigationPanel = new FlowLayoutWidget();
				navigationPanel.HAnchor = HAnchor.ParentLeftRight;
				navigationPanel.Padding = new BorderDouble(0);
				navigationPanel.BackgroundColor = ActiveTheme.Instance.TransparentLightOverlay;

				navigationLabel = new TextWidget("My Library".Localize(), pointSize: 14);
				navigationLabel.VAnchor = Agg.UI.VAnchor.ParentCenter;
				navigationLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor;

				navigationPanel.AddChild(new GuiWidget(50, 0)); //Add this as temporary balance to edit buttons
				navigationPanel.AddChild(new HorizontalSpacer());
				navigationPanel.AddChild(navigationLabel);
				navigationPanel.AddChild(new HorizontalSpacer());
				//navigationPanel.AddChild(enterEditModeButton);
				//navigationPanel.AddChild(leaveEditModeButton);

				FlowLayoutWidget buttonPanel = new FlowLayoutWidget();
				buttonPanel.HAnchor = HAnchor.ParentLeftRight;
				buttonPanel.Padding = new BorderDouble(0, 3);
				buttonPanel.MinimumSize = new Vector2(0, 46);
				{
					addToLibraryButton = textImageButtonFactory.Generate(LocalizedString.Get("Import"), "icon_import_white_32x32.png");
					buttonPanel.AddChild(addToLibraryButton);
					addToLibraryButton.Margin = new BorderDouble(0, 0, 3, 0);
					addToLibraryButton.Click += new EventHandler(importToLibraryloadFile_Click);

					addToQueueButton = textImageButtonFactory.Generate("Add to Queue".Localize());
					addToQueueButton.Margin = new BorderDouble(3, 0);
					addToQueueButton.Click += new EventHandler(addToQueueButton_Click);
					addToQueueButton.Visible = false;
					buttonPanel.AddChild(addToQueueButton);

					exportItemButton = textImageButtonFactory.Generate("Export".Localize());
					exportItemButton.Margin = new BorderDouble(3, 0);
					exportItemButton.Click += new EventHandler(exportButton_Click);
					exportItemButton.Visible = false;
					buttonPanel.AddChild(exportItemButton);

					editItemButton = textImageButtonFactory.Generate("Edit".Localize());
					editItemButton.Margin = new BorderDouble(3, 0);
					editItemButton.Click += new EventHandler(editButton_Click);
					editItemButton.Visible = false;
					buttonPanel.AddChild(editItemButton);

					removeFromLibraryButton = textImageButtonFactory.Generate("Remove".Localize());
					removeFromLibraryButton.Margin = new BorderDouble(3, 0);
					removeFromLibraryButton.Click += new EventHandler(deleteFromQueueButton_Click);
					removeFromLibraryButton.Visible = false;
					buttonPanel.AddChild(removeFromLibraryButton);

					GuiWidget spacer = new GuiWidget();
					spacer.HAnchor = HAnchor.ParentLeftRight;
					buttonPanel.AddChild(spacer);
				}
				//allControls.AddChild(navigationPanel);
				allControls.AddChild(searchPanel);
				libraryDataView = new LibraryDataView();
				allControls.AddChild(libraryDataView);
				allControls.AddChild(buttonPanel);
			}
			allControls.AnchorAll();

			this.AddChild(allControls);

			AddHandlers();
		}
        public PrintLibraryWidget()
        {
            currentPrintLibraryWidget = this;
            SetDisplayAttributes();

            textImageButtonFactory.borderWidth = 0;

            editButtonFactory.normalTextColor   = ActiveTheme.Instance.PrimaryTextColor;
            editButtonFactory.hoverTextColor    = ActiveTheme.Instance.PrimaryTextColor;
            editButtonFactory.disabledTextColor = ActiveTheme.Instance.TabLabelUnselected;
            editButtonFactory.disabledFillColor = new RGBA_Bytes();
            editButtonFactory.pressedTextColor  = ActiveTheme.Instance.PrimaryTextColor;
            editButtonFactory.borderWidth       = 0;
            editButtonFactory.Margin            = new BorderDouble(10, 0);

            FlowLayoutWidget allControls = new FlowLayoutWidget(FlowDirection.TopToBottom);

            {
                enterEditModeButton        = editButtonFactory.Generate("Edit".Localize(), centerText: true);
                enterEditModeButton.Click += enterEditModeButtonClick;

                leaveEditModeButton        = editButtonFactory.Generate("Done".Localize(), centerText: true);
                leaveEditModeButton.Click += leaveEditModeButtonClick;

                // make sure the buttons are the same size even when localized
                if (leaveEditModeButton.Width < enterEditModeButton.Width)
                {
                    editButtonFactory.FixedWidth = enterEditModeButton.Width;
                    leaveEditModeButton          = editButtonFactory.Generate("Done".Localize(), centerText: true);
                    leaveEditModeButton.Click   += leaveEditModeButtonClick;
                }
                else
                {
                    editButtonFactory.FixedWidth = leaveEditModeButton.Width;
                    enterEditModeButton          = editButtonFactory.Generate("Edit".Localize(), centerText: true);
                    enterEditModeButton.Click   += enterEditModeButtonClick;
                }

                enterEditModeButton.Name = "Library Edit Button";

                leaveEditModeButton.Visible = false;

                searchPanel = new FlowLayoutWidget();
                searchPanel.BackgroundColor = ActiveTheme.Instance.TransparentDarkOverlay;
                searchPanel.HAnchor         = HAnchor.ParentLeftRight;
                searchPanel.Padding         = new BorderDouble(0);
                {
                    searchInput         = new MHTextEditWidget(messageWhenEmptyAndNotSelected: "Search Library".Localize());
                    searchInput.Name    = "Search Library Edit";
                    searchInput.Margin  = new BorderDouble(0, 3, 0, 0);
                    searchInput.HAnchor = HAnchor.ParentLeftRight;
                    searchInput.VAnchor = VAnchor.ParentCenter;
                    searchInput.ActualTextEditWidget.EnterPressed += new KeyEventHandler(searchInputEnterPressed);

                    double oldWidth = editButtonFactory.FixedWidth;
                    editButtonFactory.FixedWidth = 0;
                    Button searchButton = editButtonFactory.Generate(LocalizedString.Get("Search"), centerText: true);
                    searchButton.Name            = "Search Library Button";
                    searchButton.Click          += searchButtonClick;
                    editButtonFactory.FixedWidth = oldWidth;

                    searchPanel.AddChild(enterEditModeButton);
                    searchPanel.AddChild(leaveEditModeButton);

                    searchPanel.AddChild(searchInput);
                    searchPanel.AddChild(searchButton);
                }

                searchPanel.Visible = false;

                FlowLayoutWidget navigationPanel = new FlowLayoutWidget();
                navigationPanel.HAnchor         = HAnchor.ParentLeftRight;
                navigationPanel.Padding         = new BorderDouble(0);
                navigationPanel.BackgroundColor = ActiveTheme.Instance.TransparentLightOverlay;

                navigationLabel           = new TextWidget("My Library".Localize(), pointSize: 14);
                navigationLabel.VAnchor   = Agg.UI.VAnchor.ParentCenter;
                navigationLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor;

                navigationPanel.AddChild(new GuiWidget(50, 0));                 //Add this as temporary balance to edit buttons
                navigationPanel.AddChild(new HorizontalSpacer());
                navigationPanel.AddChild(navigationLabel);
                navigationPanel.AddChild(new HorizontalSpacer());

                buttonPanel             = new FlowLayoutWidget();
                buttonPanel.HAnchor     = HAnchor.ParentLeftRight;
                buttonPanel.Padding     = new BorderDouble(0, 3);
                buttonPanel.MinimumSize = new Vector2(0, 46);

                AddLibraryButtonElements();
                CreateEditBarButtons();

                //allControls.AddChild(navigationPanel);
                allControls.AddChild(searchPanel);
                allControls.AddChild(itemOperationButtons);

                libraryDataView  = new LibraryDataView();
                breadCrumbWidget = new FolderBreadCrumbWidget(libraryDataView.SetCurrentLibraryProvider, libraryDataView.CurrentLibraryProvider);
                libraryDataView.ChangedCurrentLibraryProvider += breadCrumbWidget.SetBreadCrumbs;

                libraryDataView.ChangedCurrentLibraryProvider += LibraryProviderChanged;

                allControls.AddChild(breadCrumbWidget);

                allControls.AddChild(libraryDataView);
                allControls.AddChild(buttonPanel);
            }

            allControls.AnchorAll();

            this.AddChild(allControls);

            AddHandlers();
        }
		public PrintLibraryWidget()
		{
			currentPrintLibraryWidget = this;
			SetDisplayAttributes();

			textImageButtonFactory.borderWidth = 0;

			editButtonFactory.normalTextColor = ActiveTheme.Instance.PrimaryTextColor;
			editButtonFactory.hoverTextColor = ActiveTheme.Instance.PrimaryTextColor;
			editButtonFactory.disabledTextColor = ActiveTheme.Instance.TabLabelUnselected;
			editButtonFactory.disabledFillColor = new RGBA_Bytes();
			editButtonFactory.pressedTextColor = ActiveTheme.Instance.PrimaryTextColor;
			editButtonFactory.borderWidth = 0;
			editButtonFactory.Margin = new BorderDouble(10, 0);

			FlowLayoutWidget allControls = new FlowLayoutWidget(FlowDirection.TopToBottom);
			{
				enterEditModeButton = editButtonFactory.Generate("Edit".Localize(), centerText: true);
				enterEditModeButton.Click += enterEditModeButtonClick;

				leaveEditModeButton = editButtonFactory.Generate("Done".Localize(), centerText: true);
				leaveEditModeButton.Click += leaveEditModeButtonClick;

				// make sure the buttons are the same size even when localized
				if (leaveEditModeButton.Width < enterEditModeButton.Width)
				{
					editButtonFactory.FixedWidth = enterEditModeButton.Width;
					leaveEditModeButton = editButtonFactory.Generate("Done".Localize(), centerText: true);
					leaveEditModeButton.Click += leaveEditModeButtonClick;
				}
				else
				{
					editButtonFactory.FixedWidth = leaveEditModeButton.Width;
					enterEditModeButton = editButtonFactory.Generate("Edit".Localize(), centerText: true);
					enterEditModeButton.Click += enterEditModeButtonClick;
				}

				leaveEditModeButton.Visible = false;

				FlowLayoutWidget searchPanel = new FlowLayoutWidget();
				searchPanel.BackgroundColor = ActiveTheme.Instance.TransparentDarkOverlay;
				searchPanel.HAnchor = HAnchor.ParentLeftRight;
				searchPanel.Padding = new BorderDouble(0);
				{
					searchInput = new MHTextEditWidget(messageWhenEmptyAndNotSelected: "Search Library".Localize());
					searchInput.Margin = new BorderDouble(0, 3, 0, 0);
					searchInput.HAnchor = HAnchor.ParentLeftRight;
					searchInput.VAnchor = VAnchor.ParentCenter;
					searchInput.ActualTextEditWidget.EnterPressed += new KeyEventHandler(searchInputEnterPressed);

					double oldWidth = editButtonFactory.FixedWidth;
					editButtonFactory.FixedWidth = 0;
					Button searchButton = editButtonFactory.Generate(LocalizedString.Get("Search"), centerText: true);
					searchButton.Click += searchButtonClick;
					editButtonFactory.FixedWidth = oldWidth;

					searchPanel.AddChild(enterEditModeButton);
					searchPanel.AddChild(leaveEditModeButton);

					searchPanel.AddChild(searchInput);
					searchPanel.AddChild(searchButton);
				}

				FlowLayoutWidget navigationPanel = new FlowLayoutWidget();
				navigationPanel.HAnchor = HAnchor.ParentLeftRight;
				navigationPanel.Padding = new BorderDouble(0);
				navigationPanel.BackgroundColor = ActiveTheme.Instance.TransparentLightOverlay;

				navigationLabel = new TextWidget("My Library".Localize(), pointSize: 14);
				navigationLabel.VAnchor = Agg.UI.VAnchor.ParentCenter;
				navigationLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor;

				navigationPanel.AddChild(new GuiWidget(50, 0)); //Add this as temporary balance to edit buttons
				navigationPanel.AddChild(new HorizontalSpacer());
				navigationPanel.AddChild(navigationLabel);
				navigationPanel.AddChild(new HorizontalSpacer());

				buttonPanel = new FlowLayoutWidget();
				buttonPanel.HAnchor = HAnchor.ParentLeftRight;
				buttonPanel.Padding = new BorderDouble(0, 3);
				buttonPanel.MinimumSize = new Vector2(0, 46);

                AddLibraryButtonElements();
				CreateEditBarButtons();

				//allControls.AddChild(navigationPanel);
				allControls.AddChild(searchPanel);
				allControls.AddChild(itemOperationButtons);

				libraryDataView = new LibraryDataView();
				breadCrumbWidget = new FolderBreadCrumbWidget(libraryDataView.SetCurrentLibraryProvider, libraryDataView.CurrentLibraryProvider);
				libraryDataView.ChangedCurrentLibraryProvider += breadCrumbWidget.SetBreadCrumbs;

				libraryDataView.ChangedCurrentLibraryProvider += ClearSearchWidget;

				allControls.AddChild(breadCrumbWidget);

				allControls.AddChild(libraryDataView);
				allControls.AddChild(buttonPanel);
			}
			allControls.AnchorAll();

			this.AddChild(allControls);

			AddHandlers();
		}
		public LibraryRowItem(LibraryDataView libraryDataView, GuiWidget thumbnailWidget)
		{
			this.thumbnailWidget = thumbnailWidget;
			this.libraryDataView = libraryDataView;
		}