Beispiel #1
0
        private NTableFlowPanel CreateContactsPanel()
        {
            NTableFlowPanel table = new NTableFlowPanel();

            table.Direction  = ENHVDirection.LeftToRight;
            table.MaxOrdinal = 2;

            byte[] metaImage = m_EmfDecompressor.GetMetaImage("PhoneIcon.emf");
            table.Add(new NImageBox(new NBytesImageSource(metaImage)));

            NLabel phoneLabel = new NLabel("+1-888-201-6088");

            phoneLabel.UserClass = "ContactLabel";
            phoneLabel.MouseUp  += OnPhoneLabelMouseUp;
            table.Add(phoneLabel);

            metaImage = m_EmfDecompressor.GetMetaImage("MailIcon.emf");
            table.Add(new NImageBox(new NBytesImageSource(metaImage)));

            NLabel emailLabel = new NLabel("*****@*****.**");

            emailLabel.UserClass = "ContactLabel";
            emailLabel.MouseUp  += OnEmailLabelMouseUp;
            table.Add(emailLabel);

            return(table);
        }
Beispiel #2
0
        /// <summary>
        /// Creates a group box for the given group element or a directly a table panel if the
        /// given group element does not have a name. Group elements can contain only tile
        /// elements, label elements and other group elements.
        /// </summary>
        /// <param name="group"></param>
        /// <param name="borderColor"></param>
        /// <returns></returns>
        private NWidget CreateGroup(NXmlElement group, NColor borderColor)
        {
            // Create a table panel
            NTableFlowPanel tablePanel = CreateTablePanel(group, borderColor);

            // Get the group title
            string groupTitle = group.GetAttributeValue("name");

            if (String.IsNullOrEmpty(groupTitle))
            {
                return(tablePanel);
            }

            // Create a group box
            NLabel    headerLabel = new NLabel(groupTitle);
            NGroupBox groupBox    = new NGroupBox(headerLabel);

            groupBox.Header.HorizontalPlacement = ENHorizontalPlacement.Center;
            groupBox.Padding = new NMargins(ItemVerticalSpacing);
            groupBox.Border  = NBorder.CreateFilledBorder(borderColor);

            // Create the table panel with the examples tiles
            groupBox.Content = CreateTablePanel(group, borderColor);

            return(groupBox);
        }
Beispiel #3
0
        protected override NWidget CreateExampleControls()
        {
            NTableFlowPanel table = new NTableFlowPanel();

            table.MaxOrdinal = 2;

            NLabel label = new NLabel("Value:");

            label.HorizontalPlacement = ENHorizontalPlacement.Right;
            label.VerticalPlacement   = ENVerticalPlacement.Center;
            table.Add(label);

            NNumericUpDown numericUpDown = new NNumericUpDown();

            numericUpDown.Minimum       = 0;
            numericUpDown.Maximum       = 100;
            numericUpDown.Value         = DefaultProgress;
            numericUpDown.ValueChanged += new Function <NValueChangeEventArgs>(OnValueChanged);
            table.Add(numericUpDown);

            label = new NLabel("Label Style:");
            label.HorizontalPlacement = ENHorizontalPlacement.Right;
            label.VerticalPlacement   = ENVerticalPlacement.Center;
            table.Add(label);

            NComboBox comboBox = new NComboBox();

            comboBox.FillFromEnum <ENProgressBarLabelStyle>();
            comboBox.SelectedIndex         = (int)m_HorizontalProgressBar.LabelStyle;
            comboBox.SelectedIndexChanged += OnLabelStyleSelected;
            table.Add(comboBox);

            return(table);
        }
Beispiel #4
0
        private void OnAddAttributeButtonClick(NEventArgs arg)
        {
            NTopLevelWindow dialog = NApplication.CreateTopLevelWindow();

            dialog.SetupDialogWindow("Enter attribute's name and value", false);

            NTableFlowPanel table = new NTableFlowPanel();

            table.Direction   = ENHVDirection.LeftToRight;
            table.ColFillMode = ENStackFillMode.Last;
            table.ColFitMode  = ENStackFitMode.Last;
            table.MaxOrdinal  = 2;

            NLabel nameLabel = new NLabel("Name:");

            table.Add(nameLabel);

            NTextBox nameTextBox = new NTextBox();

            table.Add(nameTextBox);

            NLabel valueLabel = new NLabel("Value:");

            table.Add(valueLabel);

            NTextBox valueTextBox = new NTextBox();

            table.Add(valueTextBox);

            table.Add(new NWidget());

            NButtonStrip buttonStrip = new NButtonStrip();

            buttonStrip.InitOKCancelButtonStrip();
            table.Add(buttonStrip);

            dialog.Content = table;

            dialog.Opened += delegate(NEventArgs args) {
                nameTextBox.Focus();
            };

            dialog.Closed += delegate(NEventArgs args) {
                if (dialog.Result == ENWindowResult.OK)
                {
                    NElementInfo elementInfo = (NElementInfo)m_TreeView.SelectedItem.Tag;
                    elementInfo.Attributes.Set(nameTextBox.Text, valueTextBox.Text);
                    UpdateTreeViewItemText(m_TreeView.SelectedItem);

                    if (m_RemoveAttributeButton.Enabled == false)
                    {
                        m_RemoveAttributeButton.Enabled = true;
                    }
                }
            };

            dialog.Open();
        }
Beispiel #5
0
        protected override NWidget CreateExampleContent()
        {
            m_Shadow = new NShadow(new NColor(160, 160, 160), 20, 20);

            string[] names = new string[]
            {
                "Line", "Polyline", "Rectangle", "Ellipse", "Triangle", "Quad", "Polygon", "Graphics Path"
            };

            PaintPrimitiveDelegate[] delegates = new PaintPrimitiveDelegate[]
            {
                new PaintPrimitiveDelegate(PaintLine),
                new PaintPrimitiveDelegate(PaintPolyline),
                new PaintPrimitiveDelegate(PaintRectangle),
                new PaintPrimitiveDelegate(PaintEllipse),
                new PaintPrimitiveDelegate(PaintTriangle),
                new PaintPrimitiveDelegate(PaintQuadrangle),
                new PaintPrimitiveDelegate(PaintPolygon),
                new PaintPrimitiveDelegate(PaintPath),
            };

            int count = delegates.Length;

            // Create a table panel to hold the canvases and the labels
            m_Table = new NTableFlowPanel();
            m_Table.HorizontalPlacement = ENHorizontalPlacement.Left;
            m_Table.VerticalPlacement   = ENVerticalPlacement.Top;
            m_Table.Padding             = new NMargins(30);
            m_Table.HorizontalSpacing   = 30;
            m_Table.VerticalSpacing     = 30;
            m_Table.MaxOrdinal          = 4;

            for (int i = 0; i < count; i++)
            {
                NStackPanel stack = new NStackPanel();
                m_Table.Add(stack);
                stack.VerticalSpacing = 5;

                // Create a canvas to draw in
                NCanvas canvas = new NCanvas();
                canvas.PreferredSize  = new NSize(defaultCanvasWidth, defaultCanvasHeight);
                canvas.Tag            = delegates[i];
                canvas.BackgroundFill = new NColorFill(NColor.White);
                canvas.PrePaint      += new Function <NCanvasPaintEventArgs>(OnCanvasPrePaint);
                stack.Add(canvas);

                // Create a label for the geometry primitive's name
                NLabel label = new NLabel(names[i]);
                label.HorizontalPlacement = ENHorizontalPlacement.Center;
                stack.Add(label);
            }

            // The table must be scrollable
            NScrollContent scroll = new NScrollContent();

            scroll.Content = m_Table;
            return(scroll);
        }
        protected override NWidget CreateExampleContent()
        {
            // Create a table panel to hold the canvases and the labels
            m_Table = new NTableFlowPanel();
            m_Table.HorizontalPlacement = ENHorizontalPlacement.Left;
            m_Table.VerticalPlacement   = ENVerticalPlacement.Top;
            m_Table.Padding             = new NMargins(30);
            m_Table.HorizontalSpacing   = 30;
            m_Table.VerticalSpacing     = 30;
            m_Table.MaxOrdinal          = 2;

            string[] texts = new string[]
            {
                "Two Gradient Stops, Horizontal Gradient Axis",
                "Five Gradient Stops, Vertical Gradient Axis",
                "Gradient Axis Angle = 45deg, Mapping Mode = ZoomToFill",
                "Gradient Axis Angle = 45deg, Mapping Mode = Stretch"
            };

            NLinearGradientFill[] fills = new NLinearGradientFill[]
            {
                GradientWithTwoStops(),
                GradientWithFiveStops(),
                GradientInZoomToFillMode(),
                GradientInStretchMode(),
            };

            // Add a canvas for each demonstrated gradient
            for (int i = 0; i < fills.Length; i++)
            {
                NStackPanel stack = new NStackPanel();
                m_Table.Add(stack);
                stack.Direction = ENHVDirection.TopToBottom;
                stack.FillMode  = ENStackFillMode.First;
                stack.FitMode   = ENStackFitMode.First;

                // Create a widget with the proper filling
                NCanvas canvas = new NCanvas();
                canvas.PreferredSize = new NSize(defaultCanvasWidth, defaultCanvasHeight);
                canvas.Tag           = fills[i];
                stack.Add(canvas);
                canvas.PrePaint += new Function <NCanvasPaintEventArgs>(OnCanvasPrePaint);

                // Create a label with the corresponding name
                NLabel label = new NLabel(texts[i]);
                stack.Add(label);
                label.HorizontalPlacement = ENHorizontalPlacement.Center;
            }

            // The table must be scrollable
            NScrollContent scroll = new NScrollContent();

            scroll.Content = m_Table;
            return(scroll);
        }
Beispiel #7
0
        /// <summary>
        /// Creates a table panel, which is the content of a group.
        /// </summary>
        /// <param name="owner"></param>
        /// <param name="borderColor"></param>
        /// <returns></returns>
        private NTableFlowPanel CreateTablePanel(NXmlElement owner, NColor borderColor)
        {
            int maxRows;

            if (TryGetInt(owner, "maxRows", out maxRows) == false)
            {
                maxRows = defaultMaxRows;
            }

            // Create a table flow panel for the items
            NTableFlowPanel table = new NTableFlowPanel();

            table.UniformWidths     = ENUniformSize.Max;
            table.UniformHeights    = ENUniformSize.Max;
            table.ColFillMode       = ENStackFillMode.Equal;
            table.Direction         = ENHVDirection.TopToBottom;
            table.HorizontalSpacing = ItemHorizontalSpacing;
            table.VerticalSpacing   = ItemVerticalSpacing;
            table.MaxOrdinal        = maxRows;

            // Create the items and add them to the table panel
            string categoryNamespace = GetNamespace(owner);

            int childCount = owner.ChildrenCount;

            for (int i = 0; i < childCount; i++)
            {
                NXmlElement child = owner.GetChildAt(i) as NXmlElement;
                if (child == null)
                {
                    continue;
                }

                switch (child.Name)
                {
                case "tile":
                    table.Add(CreateTile(child, categoryNamespace));
                    break;

                case "group":
                    table.Add(CreateGroup(child, borderColor));
                    break;

                case "label":
                    table.Add(CreateLabel(child));
                    break;

                default:
                    throw new Exception("New examples XML tag?");
                }
            }

            return(table);
        }
Beispiel #8
0
        protected override NWidget CreateExampleContent()
        {
            m_TablePanel                 = new NTableFlowPanel();
            m_TablePanel.Border          = NBorder.CreateFilledBorder(NColor.Red);
            m_TablePanel.BorderThickness = new NMargins(1);

            for (int i = 1; i <= 16; i++)
            {
                m_TablePanel.Add(new NButton("Button " + i.ToString()));
            }

            return(m_TablePanel);
        }
Beispiel #9
0
        private NPairBox CreateSearchAndContacts()
        {
            m_SearchBox = CreateSearchBox();
            m_SearchBox.VerticalPlacement = ENVerticalPlacement.Center;

            NTableFlowPanel contactsPanel = CreateContactsPanel();

            contactsPanel.HorizontalPlacement = ENHorizontalPlacement.Right;

            NPairBox pairBox = new NPairBox(m_SearchBox, contactsPanel);

            pairBox.Spacing = NDesign.HorizontalSpacing;
            return(pairBox);
        }
Beispiel #10
0
        protected override NWidget CreateExampleContent()
        {
            // Create a table layout panel
            NTableFlowPanel table = new NTableFlowPanel();

            table.MaxOrdinal        = 3;
            table.HorizontalSpacing = 10;
            table.VerticalSpacing   = 10;
            table.ColFillMode       = ENStackFillMode.Equal;
            table.ColFitMode        = ENStackFitMode.Equal;
            table.RowFitMode        = ENStackFitMode.Equal;
            table.RowFillMode       = ENStackFillMode.Equal;
            table.UniformWidths     = ENUniformSize.Max;
            table.UniformHeights    = ENUniformSize.Max;

            // Create widgets to demonstrate the different background types
            table.Add(CreateWidget("Solid Background", new NColorFill(NColor.PapayaWhip)));
            table.Add(CreateWidget("Hatch Background", new NHatchFill(ENHatchStyle.Cross, NColor.Red, NColor.PapayaWhip)));
            table.Add(CreateWidget("Gradient Background", new NStockGradientFill(ENGradientStyle.FromCenter, ENGradientVariant.Variant1, NColor.Red, NColor.PapayaWhip)));
            table.Add(CreateWidget("Predefined Advanced Gradient", NAdvancedGradientFill.Create(ENAdvancedGradientColorScheme.Fire1, 5)));

            NAdvancedGradientFill agFill = new NAdvancedGradientFill();

            agFill.BackgroundColor = NColor.Black;
            agFill.Points.Add(new NAdvancedGradientPoint(NColor.Green, NAngle.Zero, 0.5f, 0.5f, 0.2f, ENAdvancedGradientPointShape.Line));
            agFill.Points.Add(new NAdvancedGradientPoint(NColor.Green, new NAngle(90, NUnit.Degree), 0.5f, 0.5f, 0.2f, ENAdvancedGradientPointShape.Line));
            agFill.Points.Add(new NAdvancedGradientPoint(NColor.White, NAngle.Zero, 0.5f, 0.5f, 0.5f, ENAdvancedGradientPointShape.Circle));
            table.Add(CreateWidget("Custom Advanced Gradient", agFill));

            NImageFill imageFill = new NImageFill(NResources.Image__24x24_Shortcuts_png);

            imageFill.TextureMapping = new NAlignTextureMapping();
            table.Add(CreateWidget("Normal Image Background", imageFill));

            imageFill = new NImageFill(NResources.Image__24x24_Shortcuts_png);
            imageFill.TextureMapping = new NAlignTextureMapping();
            table.Add(CreateWidget("Fit Image Background", imageFill));

            imageFill = new NImageFill(NResources.Image__24x24_Shortcuts_png);
            imageFill.TextureMapping = new NStretchTextureMapping();
            table.Add(CreateWidget("Stretched Image Background", imageFill));

            imageFill = new NImageFill(NResources.Image__24x24_Shortcuts_png);
            imageFill.TextureMapping = new NTileTextureMapping();
            table.Add(CreateWidget("Tiled Image Background", imageFill));

            return(table);
        }
Beispiel #11
0
        protected override NWidget CreateExampleContent()
        {
            m_SymbolsTable = new NTableFlowPanel();
            m_SymbolsTable.BackgroundFill    = new NColorFill(NColor.White);
            m_SymbolsTable.HorizontalSpacing = NDesign.HorizontalSpacing * 3;
            m_SymbolsTable.VerticalSpacing   = NDesign.VerticalSpacing * 3;
            m_SymbolsTable.Direction         = ENHVDirection.LeftToRight;
            m_SymbolsTable.MaxOrdinal        = 4;
            m_SymbolsTable.Padding           = new NMargins(NDesign.HorizontalSpacing, NDesign.VerticalSpacing,
                                                            NDesign.HorizontalSpacing * 6, NDesign.VerticalSpacing);

            NScrollContent scrollContent = new NScrollContent(m_SymbolsTable);

            scrollContent.HorizontalPlacement = ENHorizontalPlacement.Left;
            return(scrollContent);
        }
Beispiel #12
0
        protected override NWidget CreateExampleContent()
        {
            // Get the fill styles
            ENHatchStyle[] hatches = NEnum.GetValues <ENHatchStyle>();
            int            count   = hatches.Length;

            // Create a table layout panel
            m_Table = new NTableFlowPanel();
            m_Table.HorizontalPlacement = ENHorizontalPlacement.Left;
            m_Table.VerticalPlacement   = ENVerticalPlacement.Top;
            m_Table.Padding             = new NMargins(30);
            m_Table.HorizontalSpacing   = 30;
            m_Table.VerticalSpacing     = 30;
            m_Table.MaxOrdinal          = 6;

            // Add widgets with the proper filling and names to the panel

            for (int i = 0; i < count; i++)
            {
                NStackPanel stack = new NStackPanel();
                m_Table.Add(stack);
                stack.Direction = ENHVDirection.TopToBottom;
                stack.FillMode  = ENStackFillMode.First;
                stack.FitMode   = ENStackFitMode.First;

                // Create a widget with the proper filling
                NCanvas canvas = new NCanvas();
                canvas.PreferredSize = new NSize(defaultCanvasWidth, defaultCanvasHeight);
                canvas.Tag           = new NHatchFill(hatches[i], defaultForegroundColor, defaultBackgroundColor);
                stack.Add(canvas);
                canvas.PrePaint += new Function <NCanvasPaintEventArgs>(OnCanvasPrePaint);

                // Create a label with the corresponding name
                NLabel label = new NLabel(hatches[i].ToString());
                stack.Add(label);
                label.HorizontalPlacement = ENHorizontalPlacement.Center;
            }

            // The table must be scrollable
            NScrollContent scroll = new NScrollContent();

            scroll.Content = m_Table;
            return(scroll);
        }
        protected override NWidget CreateExampleContent()
        {
            // Create the gradient fills
            NFill[]  fills;
            string[] texts;

            int columnCount = CreateFillsAndDescriptions(out fills, out texts);

            // Create a table panel to hold the canvases and the labels
            m_Table = new NTableFlowPanel();
            m_Table.HorizontalPlacement = ENHorizontalPlacement.Left;
            m_Table.VerticalPlacement   = ENVerticalPlacement.Top;
            m_Table.Padding             = new NMargins(30);
            m_Table.HorizontalSpacing   = 30;
            m_Table.VerticalSpacing     = 30;
            m_Table.MaxOrdinal          = columnCount;

            for (int i = 0; i < fills.Length; i++)
            {
                NStackPanel stack = new NStackPanel();
                m_Table.Add(stack);
                stack.Direction = ENHVDirection.TopToBottom;
                stack.FillMode  = ENStackFillMode.First;
                stack.FitMode   = ENStackFitMode.First;

                // Create a widget with the proper filling
                NCanvas canvas = new NCanvas();
                canvas.PreferredSize = new NSize(defaultCanvasWidth, defaultCanvasHeight);
                canvas.Tag           = fills[i];
                stack.Add(canvas);
                canvas.PrePaint += new Function <NCanvasPaintEventArgs>(OnCanvasPrePaint);

                // Create a label with the corresponding name
                NLabel label = new NLabel(texts[i]);
                stack.Add(label);
                label.HorizontalPlacement = ENHorizontalPlacement.Center;
            }

            // The table must be scrollable
            NScrollContent scroll = new NScrollContent();

            scroll.Content = m_Table;
            return(scroll);
        }
        protected override NWidget CreateExampleContent()
        {
            m_ScrollContent = new NScrollContent();
            m_ScrollContent.HorizontalPlacement = ENHorizontalPlacement.Left;
            m_ScrollContent.VerticalPlacement   = ENVerticalPlacement.Top;
            m_ScrollContent.Border          = NBorder.CreateFilledBorder(NColor.Red);
            m_ScrollContent.BorderThickness = new NMargins(1);
            m_ScrollContent.PreferredSize   = new NSize(300, 250);

            // Create a table with some buttons
            NTableFlowPanel table = new NTableFlowPanel();

            table.MaxOrdinal = 10;
            for (int i = 1; i <= 150; i++)
            {
                table.Add(new NButton("Button " + i.ToString()));
            }

            m_ScrollContent.Content = table;
            return(m_ScrollContent);
        }
        protected override NWidget CreateExampleContent()
        {
            // Create a table panel to hold the canvases and the labels
            m_Table = new NTableFlowPanel();
            m_Table.HorizontalPlacement = ENHorizontalPlacement.Left;
            m_Table.VerticalPlacement   = ENVerticalPlacement.Top;
            m_Table.Padding             = new NMargins(30);
            m_Table.HorizontalSpacing   = 30;
            m_Table.VerticalSpacing     = 30;
            m_Table.MaxOrdinal          = 4;

            ENAdvancedGradientColorScheme[] predefinedGradientSchemes = NEnum.GetValues <ENAdvancedGradientColorScheme>();

            for (int i = 0; i < predefinedGradientSchemes.Length; i++)
            {
                NStackPanel stack = new NStackPanel();
                m_Table.Add(stack);
                stack.Direction = ENHVDirection.TopToBottom;
                stack.FillMode  = ENStackFillMode.First;
                stack.FitMode   = ENStackFitMode.First;

                // Create a widget with the proper filling
                NCanvas canvas = new NCanvas();
                canvas.PreferredSize = new NSize(defaultCanvasWidth, defaultCanvasHeight);
                canvas.Tag           = NAdvancedGradientFill.Create(predefinedGradientSchemes[i], 0);
                stack.Add(canvas);
                canvas.PrePaint += new Function <NCanvasPaintEventArgs>(OnCanvasPrePaint);

                // Create a label with the corresponding name
                NLabel label = new NLabel(predefinedGradientSchemes[i].ToString());
                stack.Add(label);
                label.HorizontalPlacement = ENHorizontalPlacement.Center;
            }

            // The table must be scrollable
            NScrollContent scroll = new NScrollContent();

            scroll.Content = m_Table;
            return(scroll);
        }
        protected override NWidget CreateExampleContent()
        {
            NTableFlowPanel table = new NTableFlowPanel();

            table.HorizontalSpacing = 10;
            table.VerticalSpacing   = 10;
            table.MaxOrdinal        = 3;

            table.Add(CreateGroupBox("Buttons", CreateButtons()));
            table.Add(CreateGroupBox("List Box", CreateListBox()));
            table.Add(CreateGroupBox("Tree View", CreateTreeView()));
            table.Add(CreateGroupBox("Drop Down Edits", CreateDropDownEdits()));
            table.Add(CreateGroupBox("Tab", CreateTab()));
            table.Add(CreateGroupBox("Range Based", CreateRangeBased()));

            // Create the document box
            m_DocumentBox = new NDocumentBox();
            m_DocumentBox.HorizontalPlacement = ENHorizontalPlacement.Left;
            m_DocumentBox.Border          = NBorder.CreateFilledBorder(NColor.Red);
            m_DocumentBox.BorderThickness = new NMargins(1);
            m_DocumentBox.Surface         = new NDocumentBoxSurface(table);

            return(m_DocumentBox);
        }
        protected override NWidget CreateExampleContent()
        {
            NList <string> imageNames = NImageDecodingExampleHelper.GetImageNames("GifSuite", "gif");

            NTableFlowPanel table = new NTableFlowPanel();

            table.HorizontalPlacement = ENHorizontalPlacement.Left;
            table.VerticalPlacement   = ENVerticalPlacement.Top;
            table.Padding             = new NMargins(30);
            table.HorizontalSpacing   = 30;
            table.VerticalSpacing     = 30;
            table.MaxOrdinal          = 2;

            int rowCount = imageNames.Count;

            for (int i = 0; i < rowCount; i++)
            {
                NLabel nameLabel = new NLabel(imageNames[i]);
                nameLabel.MaxWidth = 200;

                NEmbeddedResourceImageSource imgSrc = new NEmbeddedResourceImageSource(new NEmbeddedResourceRef(NResources.Instance, imageNames[i]));
                imgSrc.AnimateFrames = true;

                NImageBox novImageBox = new NImageBox(new NImage(imgSrc));
                novImageBox.ImageMapping = new NAlignTextureMapping(ENHorizontalAlignment.Center, ENVerticalAlignment.Center);

                table.Add(nameLabel);
                table.Add(novImageBox);
            }

            // The table must be scrollable
            NScrollContent scroll = new NScrollContent();

            scroll.Content = table;
            return(scroll);
        }
        protected override NWidget CreateExampleContent()
        {
            // Create a table panel to hold the canvases and the labels
            m_Table = new NTableFlowPanel();
            m_Table.HorizontalPlacement = ENHorizontalPlacement.Left;
            m_Table.VerticalPlacement   = ENVerticalPlacement.Top;
            m_Table.Padding             = new NMargins(30);
            m_Table.HorizontalSpacing   = 30;
            m_Table.VerticalSpacing     = 30;
            m_Table.MaxOrdinal          = 4;

            string[] names = new string[]
            {
                "Rectangle",
                "Rounded Rectangle",
                "Ellipse",
                "Ellipse Segment",
                "Elliptical Arc",
                "Pie",
                "Circle",
                "Circle Segment",
                "Triangle",
                "Quad",
                "Polygon",
                "Line Segment",
                "Polyline",
                "Cubic Bezier",
                "Nurbs Curve",
                "Path with Multiple Figures"
            };

            NGraphicsPath[] paths = CreatePaths(defaultCanvasWidth, defaultCanvasHeight);

            int count = paths.Length;

            for (int i = 0; i < count; i++)
            {
                NStackPanel stack = new NStackPanel();
                m_Table.Add(stack);
                stack.VerticalSpacing = 5;

                // Create a canvas to draw the graphics path in
                NCanvas canvas = new NCanvas();
                canvas.PreferredSize  = new NSize(defaultCanvasWidth, defaultCanvasHeight);
                canvas.Tag            = paths[i];
                canvas.PrePaint      += new Function <NCanvasPaintEventArgs>(OnCanvasPrePaint);
                canvas.BackgroundFill = new NColorFill(NColor.LightGreen);
                stack.Add(canvas);

                // Create a label for the geometry primitive's name
                NLabel label = new NLabel(names[i]);
                label.HorizontalPlacement = ENHorizontalPlacement.Center;
                stack.Add(label);
            }

            // The table must be scrollable
            NScrollContent scroll = new NScrollContent();

            scroll.Content = m_Table;
            return(scroll);
        }
Beispiel #19
0
        protected override NWidget CreateExampleContent()
        {
            // Create a table layout panel
            NTableFlowPanel table = new NTableFlowPanel();

            table.Padding           = new NMargins(10);
            table.BackgroundFill    = new NColorFill(NColor.White);
            table.MaxOrdinal        = 3;
            table.HorizontalSpacing = 10;
            table.VerticalSpacing   = 10;
            table.ColFillMode       = ENStackFillMode.Equal;
            table.ColFitMode        = ENStackFitMode.Equal;
            table.RowFitMode        = ENStackFitMode.Equal;
            table.RowFillMode       = ENStackFillMode.None;
            table.UniformWidths     = ENUniformSize.Max;
            table.UniformHeights    = ENUniformSize.Max;

            // add some predefined borders
            // 3D Borders
            NUIThemeColorMap map = new NUIThemeColorMap(ENUIThemeScheme.WindowsClassic);

            table.Add(CreateBorderedWidget("3D Border",
                                           NBorder.Create3DBorder(NColor.Green.Lighten().Lighten(), NColor.Green.Lighten(), NColor.Green.Darken(), NColor.Green)
                                           ));
            table.Add(CreateBorderedWidget("Raised Border (using Theme Colors)",
                                           NBorder.CreateRaised3DBorder(map)
                                           ));
            table.Add(CreateBorderedWidget("Sunken Border (using Theme Colors)",
                                           NBorder.CreateSunken3DBorder(map)
                                           ));

            // Filled Borders
            table.Add(CreateBorderedWidget("Solid Color",
                                           NBorder.CreateFilledBorder(NColor.Red)
                                           ));
            table.Add(CreateBorderedWidget("Solid Color With Rounded Corners",
                                           NBorder.CreateFilledBorder(NColor.Blue, 10, 13)
                                           ));
            table.Add(CreateBorderedWidget("Gradient Filling With Outline",
                                           NBorder.CreateFilledBorder(NFill.CreatePredefined(ENPredefinedFillPattern.GradientVertical, NColor.Red, NColor.Blue), new NStroke(1, NColor.Green), new NStroke(1, NColor.Green))
                                           ));

            // Outer Outline Borders
            table.Add(CreateBorderedWidget("Outer Outline Border",
                                           NBorder.CreateOuterOutlineBorder(new NStroke(1, NColor.Red, ENDashStyle.Dash))
                                           ));
            table.Add(CreateBorderedWidget("Outer Outline Border with Rounding",
                                           NBorder.CreateOuterOutlineBorder(new NStroke(1, NColor.Red, ENDashStyle.Dash), 10)
                                           ));
            table.Add(CreateBorderedWidget("Outer Outline Border",
                                           NBorder.CreateOuterOutlineBorder(new NStroke(1, NColor.Red, ENDashStyle.Dash))
                                           ));
            table.Add(CreateBorderedWidget("Outer Outline Border with Rounding",
                                           NBorder.CreateOuterOutlineBorder(new NStroke(1, NColor.Red, ENDashStyle.Dash), 10)
                                           ));

            // Inner Outline Borders
            table.Add(CreateBorderedWidget("Inner Outline Border",
                                           NBorder.CreateInnerOutlineBorder(new NStroke(1, NColor.Red, ENDashStyle.Dash))
                                           ));
            table.Add(CreateBorderedWidget("Inner Outline Border with Rounding",
                                           NBorder.CreateInnerOutlineBorder(new NStroke(1, NColor.Green, ENDashStyle.Dash), 10)
                                           ));
            table.Add(CreateBorderedWidget("Inner Outline Border",
                                           NBorder.CreateInnerOutlineBorder(new NStroke(1, NColor.Green, ENDashStyle.Dash))
                                           ));
            table.Add(CreateBorderedWidget("Inner Outline Border with Rounding",
                                           NBorder.CreateInnerOutlineBorder(new NStroke(1, NColor.Green, ENDashStyle.Dash), 10)
                                           ));

            // Double border
            table.Add(CreateBorderedWidget("Double Border",
                                           NBorder.CreateDoubleBorder(NColor.Blue)
                                           ));

            table.Add(CreateBorderedWidget("Double Border with Two Colors",
                                           NBorder.CreateDoubleBorder(NColor.Blue, NColor.Red)
                                           ));

            table.Add(CreateBorderedWidget("Double Border with Two Colors and Rounding",
                                           NBorder.CreateDoubleBorder(NColor.Blue, NColor.Red, 10, 12)
                                           ));

            // Two color borders
            table.Add(CreateBorderedWidget("Two Colors Border",
                                           NBorder.CreateTwoColorBorder(NColor.Blue, NColor.Red)
                                           ));

            table.Add(CreateBorderedWidget("Two Colors Border with Rounding",
                                           NBorder.CreateTwoColorBorder(NColor.Blue, NColor.Red, 10, 12)
                                           ));

            // Three color borders
            table.Add(CreateBorderedWidget("Three Colors Border",
                                           NBorder.CreateThreeColorBorder(NColor.Red, NColor.Green, NColor.Blue)
                                           ));

            table.Add(CreateBorderedWidget("Three Colors Border with Rounding",
                                           NBorder.CreateThreeColorBorder(NColor.Red, NColor.Green, NColor.Blue, 10, 12)
                                           ));

            return(table);
        }
Beispiel #20
0
        protected override NWidget CreateExampleContent()
        {
            // Create a table panel to hold the canvases and the labels
            m_Table = new NTableFlowPanel();
            m_Table.HorizontalPlacement = ENHorizontalPlacement.Left;
            m_Table.VerticalPlacement   = ENVerticalPlacement.Top;
            m_Table.Padding             = new NMargins(30);
            m_Table.HorizontalSpacing   = 30;
            m_Table.VerticalSpacing     = 30;
            m_Table.MaxOrdinal          = 3;

            string[] texts = new string[]
            {
                "Azure",
                "Flow",
                "Bulb",
                "Eclipse",
                "The Eye",
                "Medusa",
                "Kaleidoscope",
                "Reactor",
                "Green"
            };

            // Create the advanced gradients
            NAdvancedGradientFill[] fills = new NAdvancedGradientFill[]
            {
                AzureLight,
                Flow,
                Bulb,
                Eclipse,
                TheEye,
                Medusa,
                Kaleidoscope,
                Reactor,
                Green
            };

            // Add a canvas for each demonstrated gradient
            for (int i = 0; i < fills.Length; i++)
            {
                NStackPanel stack = new NStackPanel();
                m_Table.Add(stack);
                stack.Direction = ENHVDirection.TopToBottom;
                stack.FillMode  = ENStackFillMode.First;
                stack.FitMode   = ENStackFitMode.First;

                // Create a widget with the proper filling
                NCanvas canvas = new NCanvas();
                canvas.PreferredSize = new NSize(defaultCanvasWidth, defaultCanvasHeight);
                canvas.Tag           = fills[i];
                stack.Add(canvas);
                canvas.PrePaint += new Function <NCanvasPaintEventArgs>(OnCanvasPrePaint);

                // Create a label with the corresponding name
                NLabel label = new NLabel(texts[i]);
                stack.Add(label);
                label.HorizontalPlacement = ENHorizontalPlacement.Center;
            }

            // The table must be scrollable
            NScrollContent scroll = new NScrollContent();

            scroll.Content = m_Table;
            return(scroll);
        }
Beispiel #21
0
            /// <summary>
            /// Creates the widget that represents the current state of the shopping cart.
            /// </summary>
            /// <param name="example"></param>
            /// <returns></returns>
            public NWidget CreateWidget(NWidgetHostingExample example)
            {
                if (Items.Count == 0)
                {
                    return(new NLabel("The Shopping Cart is Empty"));
                }

                const double spacing = 10;

                // create the grand total label
                NLabel grandTotalLabel = new NLabel(GetGrandTotal().ToString("0.00"));

                // items table
                NTableFlowPanel tableFlowPanel = new NTableFlowPanel();

                tableFlowPanel.HorizontalSpacing = spacing;
                tableFlowPanel.VerticalSpacing   = spacing;
                tableFlowPanel.MaxOrdinal        = 5;

                // add headers
                tableFlowPanel.Add(new NLabel("Name"));
                tableFlowPanel.Add(new NLabel("Quantity"));
                tableFlowPanel.Add(new NLabel("Price"));
                tableFlowPanel.Add(new NLabel("Total"));
                tableFlowPanel.Add(new NLabel());

                for (int i = 0; i < Items.Count; i++)
                {
                    NShoppingCartItem item = Items[i];

                    // name
                    NLabel nameLabel  = new NLabel(item.Name);
                    NLabel priceLabel = new NLabel(item.Price.ToString("0.00"));
                    NLabel totalLabel = new NLabel(item.GetTotal().ToString("0.00"));

                    // quantity
                    NNumericUpDown quantityNud = new NNumericUpDown();
                    quantityNud.Value         = item.Quantity;
                    quantityNud.DecimalPlaces = 0;
                    quantityNud.Minimum       = 0;
                    quantityNud.ValueChanged += delegate(NValueChangeEventArgs args) {
                        item.Quantity        = (int)((NNumericUpDown)args.TargetNode).Value;
                        totalLabel.Text      = item.GetTotal().ToString("0.00");
                        grandTotalLabel.Text = GetGrandTotal().ToString("0.00");
                    };

                    NButton deleteButton = new NButton("Delete");
                    deleteButton.Click += delegate(NEventArgs args){
                        DeleteItem(item, example);
                    };

                    tableFlowPanel.Add(nameLabel);
                    tableFlowPanel.Add(quantityNud);
                    tableFlowPanel.Add(priceLabel);
                    tableFlowPanel.Add(totalLabel);
                    tableFlowPanel.Add(deleteButton);
                }

                // add grand total
                tableFlowPanel.Add(new NLabel("Grand Total"));
                tableFlowPanel.Add(new NLabel());
                tableFlowPanel.Add(new NLabel());
                tableFlowPanel.Add(grandTotalLabel);
                tableFlowPanel.Add(new NLabel());

                return(tableFlowPanel);
            }
        protected override NWidget CreateExampleContent()
        {
            string[] colHeadings = new string[]
            {
                "Image",
                "Description",
                "Decoded with NOV Decoders",
                "Decoded with Native Decoders"
            };

            int colCount = colHeadings.Length;

            NTableFlowPanel table = new NTableFlowPanel();

            table.HorizontalPlacement = ENHorizontalPlacement.Left;
            table.VerticalPlacement   = ENVerticalPlacement.Top;
            table.Padding             = new NMargins(30);
            table.HorizontalSpacing   = 30;
            table.VerticalSpacing     = 30;
            table.MaxOrdinal          = colCount;

            NList <string>        imageNames   = NImageDecodingExampleHelper.GetImageNames("JpegSuite", "jpg");
            NMap <string, string> descriptions = NImageDecodingExampleHelper.LoadDescriptions(NResources.String_JpegSuite_txt);

            for (int i = 0; i < colCount; i++)
            {
                NLabel label = new NLabel(colHeadings[i]);
                label.Font = new NFont(NFontDescriptor.DefaultSansFamilyName, 9, ENFontStyle.Bold);
                table.Add(label);
            }

            int rowCount = imageNames.Count;

            for (int i = 0; i < rowCount; i++)
            {
                string resourceName = imageNames[i];
                string description  = NImageDecodingExampleHelper.GetImageDescription(descriptions, resourceName);

                NLabel nameLabel = new NLabel(resourceName);
                nameLabel.MaxWidth = 200;

                NLabel descriptionLabel = new NLabel(description);
                descriptionLabel.MaxWidth     = 200;
                descriptionLabel.TextWrapMode = ENTextWrapMode.WordWrap;

                NImage    novImage    = NImageDecodingExampleHelper.LoadImage(resourceName, ENCodecPreference.OnlyNOV);
                NImageBox novImageBox = new NImageBox(novImage);
                novImageBox.ImageMapping = new NAlignTextureMapping(ENHorizontalAlignment.Center, ENVerticalAlignment.Center);

                NImage    nativeImage    = NImageDecodingExampleHelper.LoadImage(resourceName, ENCodecPreference.PreferNative);
                NImageBox nativeImageBox = new NImageBox(nativeImage);
                nativeImageBox.ImageMapping = new NAlignTextureMapping(ENHorizontalAlignment.Center, ENVerticalAlignment.Center);

                table.Add(nameLabel);
                table.Add(descriptionLabel);
                table.Add(novImageBox);
                table.Add(nativeImageBox);
            }

            // The table must be scrollable
            NScrollContent scroll = new NScrollContent();

            scroll.Content = table;
            return(scroll);
        }
Beispiel #23
0
        protected override NWidget CreateExampleContent()
        {
            // create the host
            NStackPanel stack = new NStackPanel();

            stack.VerticalSpacing = 2;

            NGroupBox contentGroupBox = new NGroupBox("Content");

            stack.Add(contentGroupBox);

            NStackPanel contentStack = new NStackPanel();

            contentStack.VerticalSpacing = 2;
            contentGroupBox.Content      = contentStack;

            NWidget textTooltip = CreateDemoElement("Text tooltip");

            textTooltip.Tooltip = new NTooltip("Tooltip text");
            contentStack.Add(textTooltip);

            NWidget imageTooltip = CreateDemoElement("Image tooltip");

            imageTooltip.Tooltip = new NTooltip(NResources.Image__48x48_Book_png);
            contentStack.Add(imageTooltip);

            NWidget     richTooltip        = CreateDemoElement("Rich tooltip");
            NStackPanel richTooltipContent = new NStackPanel();

            richTooltipContent.Add(new NLabel("The tooltip can contain any type of Nevron Open Vision Content"));
            richTooltipContent.Add(new NImageBox(NResources.Image__48x48_Book_png));
            richTooltip.Tooltip = new NTooltip(richTooltipContent);
            contentStack.Add(richTooltip);

            NWidget dynamicContentTooltip = CreateDemoElement("Dynamic content");

            dynamicContentTooltip.Tooltip = new NDynamicContentTooltip();
            contentStack.Add(dynamicContentTooltip);

            NGroupBox behaviorGroupBox = new NGroupBox("Behavior");

            stack.Add(behaviorGroupBox);

            NStackPanel behaviorStack = new NStackPanel();

            behaviorStack.VerticalSpacing = 2;
            behaviorGroupBox.Content      = behaviorStack;

            NWidget followMouse = CreateDemoElement("Follow mouse");

            followMouse.Tooltip             = new NTooltip("I am following the mouse");
            followMouse.Tooltip.FollowMouse = true;
            behaviorStack.Add(followMouse);

            NWidget instantShowTooltip = CreateDemoElement("Shown instantly");

            instantShowTooltip.Tooltip = new NTooltip("I was shown instantly");
            instantShowTooltip.Tooltip.FirstShowDelay = 0;
            instantShowTooltip.Tooltip.NextShowDelay  = 0;
            behaviorStack.Add(instantShowTooltip);

            NWidget doNotCloseOnClick = CreateDemoElement("Do not close on click");

            doNotCloseOnClick.Tooltip = new NTooltip("I am not closed on click");
            doNotCloseOnClick.Tooltip.CloseOnMouseDown = false;
            behaviorStack.Add(doNotCloseOnClick);

            NGroupBox positionGroupBox = new NGroupBox("Position");

            stack.Add(positionGroupBox);

            NTableFlowPanel positionTable = new NTableFlowPanel();

            positionGroupBox.Content = positionTable;

            positionTable.HorizontalSpacing = 2;
            positionTable.VerticalSpacing   = 2;
            positionTable.Direction         = ENHVDirection.LeftToRight;
            positionTable.MaxOrdinal        = 3;

            foreach (ENTooltipPosition pos in NEnum.GetValues(typeof(ENTooltipPosition)))
            {
                NWidget posElement = CreateDemoElement(pos.ToString());
                posElement.Tooltip = new NTooltip(pos.ToString());

                posElement.Tooltip.FirstShowDelay = 0;
                posElement.Tooltip.NextShowDelay  = 0;
                posElement.Tooltip.Position       = pos;
                posElement.Tooltip.FollowMouse    = true;
                posElement.Tooltip.ShowDuration   = -1;
                positionTable.Add(posElement);
            }

            return(stack);
        }
        protected override NWidget CreateExampleContent()
        {
            // Create a table layout panel
            m_Table = new NTableFlowPanel();
            m_Table.HorizontalPlacement = ENHorizontalPlacement.Left;
            m_Table.VerticalPlacement   = ENVerticalPlacement.Top;
            m_Table.Padding             = new NMargins(30);
            m_Table.HorizontalSpacing   = 30;
            m_Table.VerticalSpacing     = 30;
            m_Table.MaxOrdinal          = 4;

            string[] names = new string[]
            {
                "Align",
                "Fit and Align",
                "Fixed",
                "Stretch",
                "Stretch X, Align Y",
                "Stretch Y, Align X",
                "Tile"
            };

            NTextureMapping[] mappings = new NTextureMapping[]
            {
                new NAlignTextureMapping(ENHorizontalAlignment.Left, ENVerticalAlignment.Top),
                new NFitAndAlignTextureMapping(ENHorizontalAlignment.Center, ENVerticalAlignment.Center),
                new NFixedTextureMapping(NMultiLength.NewPercentage(10), ENHorizontalAlignment.Left, NMultiLength.NewPercentage(10), ENVerticalAlignment.Top),
                new NStretchTextureMapping(),
                new NStretchXAlignYTextureMapping(ENVerticalAlignment.Bottom, ENTileMode.None),
                new NStretchYAlignXTextureMapping(ENHorizontalAlignment.Right, ENTileMode.None),
                new NTileTextureMapping()
            };

            // Add widgets with the proper filling and names to the panel
            for (int i = 0; i < mappings.Length; i++)
            {
                NStackPanel stack = new NStackPanel();
                m_Table.Add(stack);
                stack.Direction = ENHVDirection.TopToBottom;
                stack.FillMode  = ENStackFillMode.First;
                stack.FitMode   = ENStackFitMode.First;

                // Create a widget with the proper filling
                NCanvas canvas = new NCanvas();
                canvas.PreferredSize = new NSize(defaultCanvasWidth, defaultCanvasHeight);
                NImageFill fill = new NImageFill(NResources.Image_Artistic_Plane_png);
                fill.TextureMapping = mappings[i];
                canvas.Tag          = fill;
                stack.Add(canvas);
                canvas.PrePaint += new Function <NCanvasPaintEventArgs>(OnCanvasPrePaint);

                // Create a label with the corresponding name
                NLabel label = new NLabel(names[i]);
                stack.Add(label);
                label.HorizontalPlacement = ENHorizontalPlacement.Center;
            }

            // The table must be scrollable
            NScrollContent scroll = new NScrollContent();

            scroll.Content = m_Table;
            return(scroll);
        }