public ThemeColorSelectorWidget (GuiWidget colorToChangeTo)
		{	

			this.colorToChangeTo = colorToChangeTo;
			//TextWidget colorText = new TextWidget("Accent Color", color: RGBA_Bytes.White);
			//colorText.VAnchor = Agg.UI.VAnchor.ParentCenter;
			//this.AddChild(colorText);
			//Temporary theme changer button

			GuiWidget themeButtons = new GuiWidget(186, 42);

            int themeCount = ActiveTheme.Instance.AvailableThemes.Count;

			themeButtons.BackgroundColor = RGBA_Bytes.White;
			int index = 0;
            for (int x = 0; x < themeCount/2; x++)
			{
                Button buttonOne = getThemeButton(index, x, 0);
                Button buttonTwo = getThemeButton(index + themeCount/2, x, 1);

                themeButtons.AddChild(buttonOne);
                themeButtons.AddChild(buttonTwo);
                index++;
			}

			this.AddChild (themeButtons);
			this.VAnchor = VAnchor.ParentCenter;
		}
		private static void OutputImage(GuiWidget widgetToOutput, string fileName)
		{
			if (saveImagesForDebug)
			{
				OutputImage(widgetToOutput.BackBuffer, fileName);
			}
		}
예제 #3
0
		internal OpenMenuContents(ObservableCollection<MenuItem> MenuItems, GuiWidget widgetRelativeTo, Vector2 openOffset, Direction direction, RGBA_Bytes backgroundColor, RGBA_Bytes borderColor, int borderWidth, double maxHeight, bool alignToRightEdge)
		{
			this.MenuItems = new List<MenuItem>();
			this.MenuItems.AddRange(MenuItems);
			this.alignToRightEdge = alignToRightEdge;
			this.openOffset = openOffset;
			this.borderWidth = borderWidth;
			this.borderColor = borderColor;
			this.BackgroundColor = backgroundColor;

			this.direction = direction;
			this.widgetRelativeTo = widgetRelativeTo;
			scrollingWindow = new ScrollableWidget(true);
			{
				FlowLayoutWidget topToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom);
				foreach (MenuItem menu in MenuItems)
				{
					menu.ClearRemovedFlag();
					topToBottom.AddChild(menu);
					menu.DoClickFunction = AllowClickingItems;
				}

				topToBottom.HAnchor = UI.HAnchor.ParentLeft | UI.HAnchor.FitToChildren;
				topToBottom.VAnchor = UI.VAnchor.ParentBottom;
				Width = topToBottom.Width;
				Height = topToBottom.Height;

				scrollingWindow.AddChild(topToBottom);
			}

			scrollingWindow.HAnchor = HAnchor.ParentLeftRight;
			scrollingWindow.VAnchor = VAnchor.ParentBottomTop;
			if (maxHeight > 0 && Height > maxHeight)
			{
				MakeMenuHaveScroll(maxHeight);
			}
			AddChild(scrollingWindow);

			LostFocus += new EventHandler(DropListItems_LostFocus);

			GuiWidget topParent = widgetRelativeTo.Parent;
			while (topParent.Parent != null)
			{
				// Regretably we don't know who it is that is the window that will actually think it is moving relative to its parent
				// but we need to know anytime our widgetRelativeTo has been moved by any change, so we hook them all.

				if (!widgetRefList.Contains(topParent))
				{
					widgetRefList.Add(topParent);
					topParent.PositionChanged += new EventHandler(widgetRelativeTo_PositionChanged);
					topParent.BoundsChanged += new EventHandler(widgetRelativeTo_PositionChanged);
				}

				topParent = topParent.Parent;
			}
			topParent.AddChild(this);

			widgetRelativeTo_PositionChanged(widgetRelativeTo, null);
			widgetRelativeTo.Closed += widgetRelativeTo_Closed;
		}
        public SetupStepMakeModelName(ConnectionWindow windowController, GuiWidget containerWindowToClose, PrinterSetupStatus setupPrinter = null)
            : base(windowController, containerWindowToClose, setupPrinter)
        {
            //Construct inputs
            printerNameContainer = createPrinterNameContainer();
            printerMakeContainer = createPrinterMakeContainer();
            printerModelContainer = createPrinterModelContainer();

            //Add inputs to main container
            contentRow.AddChild(printerNameContainer);
            contentRow.AddChild(printerMakeContainer);
            contentRow.AddChild(printerModelContainer);

            //Construct buttons
			nextButton = textImageButtonFactory.Generate(new LocalizedString("Save & Continue").Translated);
            nextButton.Click += new ButtonBase.ButtonEventHandler(NextButton_Click);

            GuiWidget hSpacer = new GuiWidget();
            hSpacer.HAnchor = HAnchor.ParentLeftRight;

            //Add buttons to buttonContainer
            footerRow.AddChild(nextButton);
            footerRow.AddChild(hSpacer);
            footerRow.AddChild(cancelButton);

            SetElementState();
        }
		public ThemeColorSelectorWidget(GuiWidget colorToChangeTo)
		{
			this.Padding = new BorderDouble(2, 0);
			this.colorToChangeTo = colorToChangeTo;
			int themeCount = ActiveTheme.AvailableThemes.Count;

			var allThemes = ActiveTheme.AvailableThemes;

			int index = 0;
			for (int x = 0; x < themeCount / 2; x++)
			{
				var columnContainer = new FlowLayoutWidget(Agg.UI.FlowDirection.TopToBottom)
				{
					Width = containerHeight
				};
				columnContainer.AddChild(CreateThemeButton(allThemes[index]));

				int secondRowIndex = index + themeCount / 2;
				columnContainer.AddChild(CreateThemeButton(allThemes[secondRowIndex]));

				this.AddChild(columnContainer);

				index++;
			}
			this.BackgroundColor = RGBA_Bytes.White;
			this.Width = containerHeight * (themeCount / 2);
		}
		public ApplicationMenuRow()
			: base(FlowDirection.LeftToRight)
		{
			linkButtonFactory.textColor = ActiveTheme.Instance.PrimaryTextColor;
			linkButtonFactory.fontSize = 8;

			this.HAnchor = HAnchor.ParentLeftRight;
			this.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;

			// put in the file menu
			this.AddChild(new MenuOptionFile());

			this.AddChild(new MenuOptionSettings());

			// put in the help menu
			if (ActiveSliceSettings.Instance.ActionMacros().Any())
			{
				this.AddChild(new MenuOptionAction());
			}

			// put in the help menu
			this.AddChild(new MenuOptionHelp());

			//linkButtonFactory.textColor = ActiveTheme.Instance.SecondaryAccentColor;
			linkButtonFactory.fontSize = 10;

			Button updateStatusMessage = linkButtonFactory.Generate("Update Available");
			UpdateControlData.Instance.UpdateStatusChanged.RegisterEvent(SetUpdateNotification, ref unregisterEvents);
			popUpAboutPage = new FlowLayoutWidget();
			popUpAboutPage.Margin = new BorderDouble(30, 0, 0, 0);
			popUpAboutPage.HAnchor = HAnchor.FitToChildren;
			popUpAboutPage.VAnchor = VAnchor.FitToChildren | VAnchor.ParentCenter;
			popUpAboutPage.AddChild(updateStatusMessage);
			updateStatusMessage.Click += (sender, e) =>
			{
				UiThread.RunOnIdle(CheckForUpdateWindow.Show);
			};
			this.AddChild(popUpAboutPage);
			SetUpdateNotification(this, null);

			// put in a spacer
			this.AddChild(new HorizontalSpacer());

			// make an object that can hold custom content on the right (like the sign in)
			rightElement = new FlowLayoutWidget(FlowDirection.LeftToRight);
			rightElement.VAnchor = VAnchor.FitToChildren;
			this.AddChild(rightElement);

			this.Padding = new BorderDouble(0);

			AddRightElement?.Invoke(rightElement);

			// When the application is first started, plugins are loaded after the MainView control has been initialized,
			// and as such they not around when this constructor executes. In that case, we run the AddRightElement 
			// delegate after the plugins have been initialized via the PluginsLoaded event
			ApplicationController.Instance.PluginsLoaded.RegisterEvent((s, e) =>
			{
				AddRightElement?.Invoke(rightElement);
			}, ref unregisterEvents);
		}
        public SetupStepInstallDriver(ConnectionWindow windowController, GuiWidget containerWindowToClose, PrinterSetupStatus setupPrinterStatus)
            : base(windowController, containerWindowToClose, setupPrinterStatus)
        {
            this.printerDriverFilePath = this.PrinterSetupStatus.DriverFilePath;

			headerLabel.Text = string.Format(new LocalizedString("Install Communication Driver").Translated);
            printerDriverContainer = createPrinterDriverContainer();
            contentRow.AddChild(printerDriverContainer);
            {
                //Construct buttons
				installButton = textImageButtonFactory.Generate(new LocalizedString("Install Driver").Translated);
                installButton.Click += new ButtonBase.ButtonEventHandler(installButton_Click);

				skipButton = textImageButtonFactory.Generate(new LocalizedString("Skip").Translated);
                skipButton.Click += new ButtonBase.ButtonEventHandler(skipButton_Click);

                GuiWidget hSpacer = new GuiWidget();
                hSpacer.HAnchor = HAnchor.ParentLeftRight;

                //Add buttons to buttonContainer
                footerRow.AddChild(installButton);
                footerRow.AddChild(skipButton);
                footerRow.AddChild(hSpacer);

                footerRow.AddChild(cancelButton);
            }
        }
		public LibraryRowItem(LibraryDataView libraryDataView, GuiWidget thumbnailWidget)
		{
			this.thumbnailWidget = thumbnailWidget;
			this.libraryDataView = libraryDataView;
			this.IsViewHelperItem = false;
			this.EnableSlideInActions = true;
		}
예제 #9
0
		protected void SetViewStates(GuiWidget normal, GuiWidget normalHover, GuiWidget switchNormalToPressed, GuiWidget pressed, GuiWidget pressedHover, GuiWidget switchPressedToNormal, GuiWidget disabled)
		{
			this.normal = normal;
			this.normalHover = normalHover;
			this.switchNormalToPressed = switchNormalToPressed;

			this.pressed = pressed;
			this.pressedHover = pressedHover;
			this.switchPressedToNormal = switchPressedToNormal;
			this.disabled = disabled;

			AddChild(normal);
			AddChild(normalHover);
			AddChild(switchNormalToPressed);

			AddChild(pressed);
			AddChild(pressedHover);
			AddChild(switchPressedToNormal);
			AddChild(disabled);

			SetBoundsToEncloseChildren();

			normalHover.Visible = false;
			switchNormalToPressed.Visible = false;
			pressed.Visible = false;
			pressedHover.Visible = false;
			switchPressedToNormal.Visible = false;
			disabled.Visible = false;

			normal.Visible = true;
		}
		private int extruderIndex; //For multiple materials

		public PresetSelectorWidget(string label, RGBA_Bytes accentColor, string tag, int extruderIndex)
			: base(FlowDirection.TopToBottom)
		{
			this.extruderIndex = extruderIndex;
			this.filterLabel = label;
			this.filterTag = (tag == null) ? label.ToLower() : tag;
			
			this.HAnchor = HAnchor.ParentLeftRight;
			this.VAnchor = Agg.UI.VAnchor.Max_FitToChildren_ParentHeight;
			this.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;

			GuiWidget accentBar = new GuiWidget(7, 5)
			{
				BackgroundColor = accentColor,
				HAnchor = HAnchor.ParentLeftRight
			};

			TextWidget labelText = new TextWidget(label.Localize().ToUpper())
			{
				TextColor = ActiveTheme.Instance.PrimaryTextColor,
				HAnchor = Agg.UI.HAnchor.ParentCenter,
				Margin = new BorderDouble(0, 3, 0, 6)
			};

			this.AddChild(labelText);
			this.AddChild(GetPulldownContainer());
			this.AddChild(new VerticalSpacer());
			this.AddChild(accentBar);
		}
        public PrintProgressBar()
        {
            MinimumSize = new Vector2(0, 24);
            HAnchor = HAnchor.ParentLeftRight;
            BackgroundColor = ActiveTheme.Instance.SecondaryAccentColor;
            Margin = new BorderDouble(0);

            FlowLayoutWidget container = new FlowLayoutWidget(FlowDirection.LeftToRight);
            container.AnchorAll();
            container.Padding = new BorderDouble(6,0);

            printTimeElapsed = new TextWidget("", pointSize:11);
            printTimeElapsed.AutoExpandBoundsToText = true;
            printTimeElapsed.VAnchor = Agg.UI.VAnchor.ParentCenter;


            printTimeRemaining = new TextWidget("", pointSize: 11);
            printTimeRemaining.AutoExpandBoundsToText = true;
            printTimeRemaining.VAnchor = Agg.UI.VAnchor.ParentCenter;

            GuiWidget spacer = new GuiWidget();
            spacer.HAnchor = Agg.UI.HAnchor.ParentLeftRight;

            container.AddChild(printTimeElapsed);
            container.AddChild(spacer);
            container.AddChild(printTimeRemaining);

            AddChild(container);
            AddHandlers();
            SetThemedColors();
            UpdatePrintStatus();            
            UiThread.RunOnIdle(OnIdle);
        }
예제 #12
0
파일: CheckBox.cs 프로젝트: jeske/agg-sharp
        public CheckBox(double x, double y, GuiWidget checkBoxButtonView)
            : base(x, y)
        {
            Margin = DefaultMargin;

            OriginRelativeParent = new Vector2(x, y);

            if (checkBoxButtonView != null)
            {
                checkBoxButtonView.Selectable = false;

                AddChild(checkBoxButtonView);

                SetBoundsToEncloseChildren();

                if (LocalBounds.Left != 0 || LocalBounds.Bottom != 0)
                {
                    // let's make sure that a button has 0, 0 at the lower left
                    // move the children so they will fit with 0, 0 at the lower left
                    foreach (GuiWidget child in Children)
                    {
                        child.OriginRelativeParent = child.OriginRelativeParent + new Vector2(-LocalBounds.Left, -LocalBounds.Bottom);
                    }

                    SetBoundsToEncloseChildren();
                }

                MinimumSize = new Vector2(Width, Height);
            }

            Click += new ButtonEventHandler(CheckBox_Click);
        }
예제 #13
0
        public SetupStepComPortTwo(ConnectionWindow windowController, GuiWidget containerWindowToClose, PrinterSetupStatus setupPrinterStatus)
            : base(windowController, containerWindowToClose, setupPrinterStatus)
        {

            startingPortNames = SerialPort.GetPortNames();
            contentRow.AddChild(createPrinterConnectionMessageContainer());
            {
                //Construct buttons
				nextButton = textImageButtonFactory.Generate(new LocalizedString("Done").Translated);
                nextButton.Click += new ButtonBase.ButtonEventHandler(NextButton_Click);
                nextButton.Visible = false;

				connectButton = textImageButtonFactory.Generate(new LocalizedString("Connect").Translated);
                connectButton.Click += new ButtonBase.ButtonEventHandler(ConnectButton_Click);

                PrinterCommunication.Instance.ConnectionStateChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents);

                GuiWidget hSpacer = new GuiWidget();
                hSpacer.HAnchor = HAnchor.ParentLeftRight;

                //Add buttons to buttonContainer
                footerRow.AddChild(nextButton);
                footerRow.AddChild(connectButton);
                footerRow.AddChild(hSpacer);

                footerRow.AddChild(cancelButton);
            }
        }
예제 #14
0
		public SetupStepInstallDriver(ConnectionWindow windowController, GuiWidget containerWindowToClose, PrinterSetupStatus setupPrinterStatus)
			: base(windowController, containerWindowToClose, setupPrinterStatus)
		{
			this.driversToInstall = this.currentPrinterSetupStatus.DriversToInstall;

			headerLabel.Text = string.Format(LocalizedString.Get("Install Communication Driver"));
			printerDriverContainer = createPrinterDriverContainer();
			contentRow.AddChild(printerDriverContainer);
			{
				//Construct buttons
				installButton = textImageButtonFactory.Generate(LocalizedString.Get("Install Driver"));
				installButton.Click += (sender, e) =>
				{
					UiThread.RunOnIdle(installButton_Click);
				};

				skipButton = textImageButtonFactory.Generate(LocalizedString.Get("Skip"));
				skipButton.Click += new EventHandler(skipButton_Click);

				GuiWidget hSpacer = new GuiWidget();
				hSpacer.HAnchor = HAnchor.ParentLeftRight;

				//Add buttons to buttonContainer
				footerRow.AddChild(installButton);
				footerRow.AddChild(skipButton);
				footerRow.AddChild(hSpacer);

				footerRow.AddChild(cancelButton);
			}
		}
		public LibraryRowItemCollection(PrintItemCollection collection, LibraryDataView libraryDataView, LibraryProvider parentProvider, GuiWidget thumbnailWidget)
			: base(libraryDataView, thumbnailWidget)
		{
			this.parentProvider = parentProvider;
			this.printItemCollection = collection;
			CreateGuiElements();
		}
		private int presetIndex; //For multiple materials

		public SliceSelectorWidget(string label, RGBA_Bytes accentColor, string tag = null, int presetIndex = 1)
			: base(FlowDirection.TopToBottom)
		{
			this.presetIndex = presetIndex;
			this.filterLabel = label;
			if (tag == null)
			{
				this.filterTag = label.ToLower();
			}
			else
			{
				this.filterTag = tag;
			}

			this.HAnchor = HAnchor.ParentLeftRight;
			this.VAnchor = Agg.UI.VAnchor.Max_FitToChildren_ParentHeight;
			this.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;

			GuiWidget accentBar = new GuiWidget(7, 5);
			accentBar.BackgroundColor = accentColor;
			accentBar.HAnchor = HAnchor.ParentLeftRight;


			TextWidget labelText = new TextWidget(LocalizedString.Get(label).ToUpper());
			labelText.TextColor = ActiveTheme.Instance.PrimaryTextColor;
			labelText.HAnchor = Agg.UI.HAnchor.ParentCenter;
			labelText.Margin = new BorderDouble(0, 3, 0, 6);

			this.AddChild(labelText);
			this.AddChild(GetPulldownContainer());
			this.AddChild(new VerticalSpacer());
			this.AddChild(accentBar);
		}
		public SetupStepComPortManual(ConnectionWindow windowController, GuiWidget containerWindowToClose, PrinterSetupStatus setupPrinterStatus)
			: base(windowController, containerWindowToClose, setupPrinterStatus)
		{
			linkButtonFactory.fontSize = 8;

			FlowLayoutWidget printerComPortContainer = createComPortContainer();
			contentRow.AddChild(printerComPortContainer);
			{
				//Construct buttons
				nextButton = textImageButtonFactory.Generate(LocalizedString.Get("Done"));
				nextButton.Click += new EventHandler(NextButton_Click);
				nextButton.Visible = false;

				connectButton = textImageButtonFactory.Generate(LocalizedString.Get("Connect"));
				connectButton.Click += new EventHandler(ConnectButton_Click);

				PrinterConnectionAndCommunication.Instance.CommunicationStateChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents);

				refreshButton = textImageButtonFactory.Generate(LocalizedString.Get("Refresh"));
				refreshButton.Click += new EventHandler(RefreshButton_Click);

				GuiWidget hSpacer = new GuiWidget();
				hSpacer.HAnchor = HAnchor.ParentLeftRight;

				//Add buttons to buttonContainer
				footerRow.AddChild(nextButton);
				footerRow.AddChild(connectButton);
				footerRow.AddChild(refreshButton);
				footerRow.AddChild(hSpacer);
				footerRow.AddChild(cancelButton);
			}
		}
		public Button getThemeButton(int index)
		{
			GuiWidget normal = new GuiWidget(colorSelectSize, colorSelectSize);
			normal.BackgroundColor = ActiveTheme.Instance.AvailableThemes[index].primaryAccentColor;
			GuiWidget hover = new GuiWidget(colorSelectSize, colorSelectSize);
			hover.BackgroundColor = ActiveTheme.Instance.AvailableThemes[index].secondaryAccentColor;
			GuiWidget pressed = new GuiWidget(colorSelectSize, colorSelectSize);
			pressed.BackgroundColor = ActiveTheme.Instance.AvailableThemes[index].secondaryAccentColor;
			GuiWidget disabled = new GuiWidget(colorSelectSize, colorSelectSize);

			Button colorButton = new Button(0, 0, new ButtonViewStates(normal, hover, pressed, disabled));
			colorButton.Name = index.ToString();
			colorButton.Click += (sender, mouseEvent) =>
			{
				UserSettings.Instance.set("ActiveThemeIndex", ((GuiWidget)sender).Name);
				ActiveTheme.Instance.LoadThemeSettings(int.Parse(((GuiWidget)sender).Name));
			};

			colorButton.MouseEnterBounds += (sender, mouseEvent) =>
			{
				colorToChangeTo.BackgroundColor = ActiveTheme.Instance.AvailableThemes[index].primaryAccentColor;
			};

			colorButton.MouseLeaveBounds += (sender, mouseEvent) =>
			{
				colorToChangeTo.BackgroundColor = ActiveTheme.Instance.PrimaryAccentColor;
			};

			return colorButton;
		}
예제 #19
0
		public void ScrollIntoView(GuiWidget widget)
		{
			if (scrollingWindow.VerticalScrollBar.Visible)
			{
				scrollingWindow.ScrollPosition = new Vector2(0, -widget.BoundsRelativeToParent.Bottom + this.Height /2);
			}
		}
예제 #20
0
        public void DoFitToChildrenVertical(GuiWidget widgetToAdjust, ref bool sizeWasChanged)
        {
            if (widgetToAdjust.VAnchorIsSet(VAnchor.FitToChildren))
            {
                double heightToMatchParent = 0;
                if (widgetToAdjust.Parent != null)
                {
                    Vector2 newOriginRelParent;
                    if (!GetOriginAndHeightForChild(widgetToAdjust.Parent, widgetToAdjust, out newOriginRelParent, out heightToMatchParent))
                    {
                        // we don't need to adjust anything for the parent so make sure this is not applied below.
                        heightToMatchParent = 0;
                    }
                }

                // get the bounds
                RectangleDouble parentBounds = widgetToAdjust.LocalBounds;
                // get the bounds to enclose its childern
                RectangleDouble childrenEnclosingBounds = widgetToAdjust.GetMinimumBoundsToEncloseChildren(true);
                // fix the v size to enclose the children
                parentBounds.Bottom = childrenEnclosingBounds.Bottom;
                parentBounds.Top = Math.Max(childrenEnclosingBounds.Bottom + heightToMatchParent, childrenEnclosingBounds.Top);
                if (widgetToAdjust.LocalBounds != parentBounds)
                {
                    // push the new size in
                    widgetToAdjust.LocalBounds = parentBounds;
                    sizeWasChanged = true;
                }
            }
        }
		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);
		}
예제 #22
0
		public RayTracerWindow(int width, int height)
			: base(width, height)
		{
			//CalculateIntersectCostsAndSaveToFile();

			FlowLayoutWidget leftToRight = new FlowLayoutWidget();
			leftToRight.HAnchor |= HAnchor.ParentLeftRight;
			leftToRight.VAnchor |= VAnchor.ParentBottomTop;

			previewWindowRayTrace = new RayTraceWidget();
			AnchorAll();
			previewWindowRayTrace.AnchorAll();

			leftToRight.AddChild(previewWindowRayTrace);

			GuiWidget zBuffer = new GuiWidget(HAnchor.ParentLeftRight, VAnchor.ParentBottomTop);
			zBuffer.BackgroundColor = RGBA_Bytes.Blue;
			leftToRight.AddChild(zBuffer);

			AddChild(leftToRight);

			BackgroundColor = RGBA_Bytes.Black;

			ShowAsSystemWindow();
		}
예제 #23
0
파일: MenuItem.cs 프로젝트: jeske/agg-sharp
 public MenuItem(GuiWidget viewItem, string value = null)
 {
     Value = value;
     HAnchor = UI.HAnchor.ParentLeftRight | UI.HAnchor.FitToChildren;
     VAnchor = UI.VAnchor.FitToChildren;
     AddChild(viewItem);
 }
        private static void AddNotificationButton(GuiWidget iconContainer)
        {
            ImageButtonFactory imageButtonFactory = new ImageButtonFactory();
            imageButtonFactory.invertImageColor = false;
            string notifyIconPath = Path.Combine("PrintStatusControls", "notify.png");
            string notifyHoverIconPath = Path.Combine("PrintStatusControls", "notify-hover.png");
            Button notifyButton = imageButtonFactory.Generate(notifyIconPath, notifyHoverIconPath);
            notifyButton.Cursor = Cursors.Hand;
            notifyButton.Margin = new Agg.BorderDouble(top: 3);
            notifyButton.Click += (sender, mouseEvent) => { 
                UiThread.RunOnIdle((state) =>
                {
                    NotificationFormWindow.Open();
                });
            };
            notifyButton.MouseEnterBounds += (sender, mouseEvent) => {
                UiThread.RunOnIdle((state) =>
                {
                    HelpTextWidget.Instance.ShowHoverText("Edit notification settings");
                }); 
            };
            notifyButton.MouseLeaveBounds += (sender, mouseEvent) => {
                UiThread.RunOnIdle((state) =>
                {
                    HelpTextWidget.Instance.HideHoverText();
                }); 
            };

            iconContainer.AddChild(notifyButton);
        }
예제 #25
0
        public MeshViewerApplication(string meshFileToLoad = "")
            : base(800, 600)
        {
            BackgroundColor = RGBA_Bytes.White;
            MinimumSize = new VectorMath.Vector2(200, 200);
            Title = "MatterHackers MeshViewr";
            UseOpenGL = true;

            FlowLayoutWidget mainContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);
            mainContainer.AnchorAll();

            viewArea = new GuiWidget();

            viewArea.AnchorAll();

            Vector3 viewerVolume = new Vector3(200, 200, 200);
            double scale = 1;
            meshViewerWidget = new MeshViewerWidget(viewerVolume, scale, MeshViewerWidget.BedShape.Rectangular, "No Part Loaded");

            meshViewerWidget.AnchorAll();

            viewArea.AddChild(meshViewerWidget);

            mainContainer.AddChild(viewArea);

            FlowLayoutWidget buttonPanel = new FlowLayoutWidget(FlowDirection.LeftToRight);
            buttonPanel.HAnchor = HAnchor.ParentLeftRight;
            buttonPanel.Padding = new BorderDouble(3, 3);
            buttonPanel.BackgroundColor = RGBA_Bytes.DarkGray;

            if (meshFileToLoad != "")
            {
                meshViewerWidget.LoadMesh(meshFileToLoad);
            }
            else
            {
                openFileButton = new Button("Open 3D File", 0, 0);
                openFileButton.Click += new Button.ButtonEventHandler(openFileButton_ButtonClick);
                buttonPanel.AddChild(openFileButton);
            }

            bedCheckBox = new CheckBox("Bed");
            bedCheckBox.Checked = true;
            buttonPanel.AddChild(bedCheckBox);

            wireframeCheckBox = new CheckBox("Wireframe");
            buttonPanel.AddChild(wireframeCheckBox);

            GuiWidget leftRightSpacer = new GuiWidget();
            leftRightSpacer.HAnchor = HAnchor.ParentLeftRight;
            buttonPanel.AddChild(leftRightSpacer);

            mainContainer.AddChild(buttonPanel);

            this.AddChild(mainContainer);
            this.AnchorAll();

            AddHandlers();
        }
		public TemperatureWidgetBase(string textValue)
			: base(52 * TextWidget.GlobalPointSizeScaleRatio, 52 * TextWidget.GlobalPointSizeScaleRatio)
		{
			whiteButtonFactory.FixedHeight = 18 * TextWidget.GlobalPointSizeScaleRatio;
			whiteButtonFactory.fontSize = 7;
			whiteButtonFactory.normalFillColor = RGBA_Bytes.White;
			whiteButtonFactory.normalTextColor = RGBA_Bytes.DarkGray;

			FlowLayoutWidget container = new FlowLayoutWidget(FlowDirection.TopToBottom);
			container.AnchorAll();

			this.BackgroundColor = new RGBA_Bytes(255, 255, 255, 200);
			this.Margin = new BorderDouble(0, 2) * TextWidget.GlobalPointSizeScaleRatio;

			GuiWidget labelContainer = new GuiWidget();
			labelContainer.HAnchor = Agg.UI.HAnchor.ParentLeftRight;
			labelContainer.Height = 18 * TextWidget.GlobalPointSizeScaleRatio;

			labelTextWidget = new TextWidget("", pointSize: 8);
			labelTextWidget.AutoExpandBoundsToText = true;
			labelTextWidget.HAnchor = HAnchor.ParentCenter;
			labelTextWidget.VAnchor = VAnchor.ParentCenter;
			labelTextWidget.TextColor = ActiveTheme.Instance.SecondaryAccentColor;
			labelTextWidget.Visible = false;

			labelContainer.AddChild(labelTextWidget);

			GuiWidget indicatorContainer = new GuiWidget();
			indicatorContainer.AnchorAll();

			indicatorTextWidget = new TextWidget(textValue, pointSize: 11);
			indicatorTextWidget.TextColor = ActiveTheme.Instance.PrimaryAccentColor;
			indicatorTextWidget.HAnchor = HAnchor.ParentCenter;
			indicatorTextWidget.VAnchor = VAnchor.ParentCenter;
			indicatorTextWidget.AutoExpandBoundsToText = true;

			indicatorContainer.AddChild(indicatorTextWidget);

			GuiWidget buttonContainer = new GuiWidget();
			buttonContainer.HAnchor = Agg.UI.HAnchor.ParentLeftRight;
			buttonContainer.Height = 18 * TextWidget.GlobalPointSizeScaleRatio;

			preheatButton = whiteButtonFactory.Generate("Preheat".Localize().ToUpper());
			preheatButton.Cursor = Cursors.Hand;
			preheatButton.Visible = false;

			buttonContainer.AddChild(preheatButton);

			container.AddChild(labelContainer);
			container.AddChild(indicatorContainer);
			container.AddChild(buttonContainer);

			this.AddChild(container);
			ActiveTheme.Instance.ThemeChanged.RegisterEvent(ThemeChanged, ref unregisterEvents);

			this.MouseEnterBounds += onEnterBounds;
			this.MouseLeaveBounds += onLeaveBounds;
			this.preheatButton.Click += onPreheatButtonClick;
		}
예제 #27
0
		protected static GuiWidget CreateSeparatorLine()
		{
			GuiWidget topLine = new GuiWidget(10 * TextWidget.GlobalPointSizeScaleRatio, 1 * TextWidget.GlobalPointSizeScaleRatio);
			topLine.Margin = new BorderDouble(0, 5) * TextWidget.GlobalPointSizeScaleRatio;
			topLine.HAnchor = Agg.UI.HAnchor.ParentLeftRight;
			topLine.BackgroundColor = ActiveTheme.Instance.PrimaryTextColor;
			return topLine;
		}
        public override void Initialize(GuiWidget application)
        {
            mainApplication = application;
            PrinterConnectionAndCommunication.Instance.PrintFinished.RegisterEvent(SendPrintFinishedNotification, ref unregisterEvents);
            PrintStatusRow.AddIconToPrintStatusRow += AddNotificationButton;

			PrinterConfigurationWidget.openPrintNotificationFunction = OpenConfigurationWindow;
        }
 public static bool ShowMessageBox(string message, string caption, GuiWidget[] extraWidgetsToAdd, MessageType messageType, string yesOk = "", string no = "")
 {
     StyledMessageBox messageBox = new StyledMessageBox(message, caption, messageType, extraWidgetsToAdd, 400, 300, yesOk, no);
     bool okClicked = false;
     messageBox.ClickedOk += (sender, e) => { okClicked = true; };
     messageBox.ShowAsSystemWindow();
     return okClicked;
 }
예제 #30
0
		private void bar_Draw(GuiWidget drawingWidget, DrawEventArgs drawEvent)
		{
			if (drawingWidget != null && drawEvent != null && drawEvent.graphics2D != null)
			{
				drawEvent.graphics2D.FillRectangle(0, 0, drawingWidget.Width * RatioComplete, drawingWidget.Height, FillColor);
				drawEvent.graphics2D.Rectangle(drawingWidget.LocalBounds, BorderColor);
			}
		}