Пример #1
0
        /// <summary>
        /// Creates a tree view item.
        /// </summary>
        /// <param name="text"></param>
        /// <param name="icon"></param>
        /// <returns></returns>
        private NTreeViewItem CreateTreeViewItem(string text, NImage icon)
        {
            NStackPanel stack = new NStackPanel();

            stack.Direction         = ENHVDirection.LeftToRight;
            stack.HorizontalSpacing = 3;

            if (icon != null)
            {
                NImageBox imageBox = new NImageBox(icon);
                imageBox.HorizontalPlacement = ENHorizontalPlacement.Center;
                imageBox.VerticalPlacement   = ENVerticalPlacement.Center;

                stack.Add(imageBox);
            }

            if (!string.IsNullOrEmpty(text))
            {
                NLabel label = new NLabel(text);
                label.VerticalPlacement = ENVerticalPlacement.Center;
                stack.Add(label);
            }

            NTreeViewItem item = new NTreeViewItem(stack);

            item.Margins = new NMargins(0, 5);

            return(item);
        }
Пример #2
0
        /// <summary>
        /// Creates an accordion section.
        /// </summary>
        /// <param name="image"></param>
        /// <param name="text"></param>
        /// <param name="content"></param>
        /// <param name="expanded"></param>
        /// <param name="stack"></param>
        /// <returns></returns>
        private NExpandableSection CreateAccordionSection(NImage image, string text, NWidget content, bool expanded, NStackPanel stack)
        {
            NExpandableSection section = new NExpandableSection();

            section.Expanded = expanded;

            // create the content of the header.
            NPairBox headerContent = new NPairBox();

            headerContent.Spacing       = 7.0;
            headerContent.BoxesRelation = ENPairBoxRelation.Box1BeforeBox2;
            headerContent.Margins       = new NMargins(7.0, 0);
            NImageBox imageBox = new NImageBox(image);
            NLabel    label    = new NLabel(text);

            headerContent.Box1     = imageBox;
            headerContent.Box2     = label;
            section.Header.Content = headerContent;

            // set section content
            section.Content = content;

            // add section to the accordion stack
            stack.Add(section);

            return(section);
        }
Пример #3
0
 protected override NWidget CreateExampleContent()
 {
     m_ImageBox = new NImageBox();
     m_ImageBox.HorizontalPlacement = ENHorizontalPlacement.Center;
     m_ImageBox.VerticalPlacement   = ENVerticalPlacement.Center;
     return(m_ImageBox);
 }
Пример #4
0
        private NListBoxItem CreateDetailedListBoxItem(int index)
        {
            NDockPanel dock = new NDockPanel();

            dock.HorizontalSpacing = 3;
            dock.Padding           = new NMargins(0, 2, 0, 2);

            // Add the image
            string imageName = ImageNames[index % ImageNames.Length];
            NImage icon      = new NImage(new NEmbeddedResourceRef(NResources.Instance, "RIMG__24x24_" + imageName + "_png"));

            NImageBox imageBox = new NImageBox(icon);

            imageBox.HorizontalPlacement = ENHorizontalPlacement.Center;
            imageBox.VerticalPlacement   = ENVerticalPlacement.Center;
            NDockLayout.SetDockArea(imageBox, ENDockArea.Left);

            dock.Add(imageBox);

            // Add the title
            NLabel titleLabel = new NLabel("Item " + index.ToString());

            titleLabel.Font = new NFont(NFontDescriptor.DefaultSansFamilyName, 10, ENFontStyle.Bold);
            NDockLayout.SetDockArea(titleLabel, ENDockArea.Top);
            dock.AddChild(titleLabel);

            // Add the description
            NLabel descriptionLabel = new NLabel("This is item " + index.ToString() + "'s description.");

            NDockLayout.SetDockArea(descriptionLabel, ENDockArea.Center);
            dock.AddChild(descriptionLabel);

            return(new NListBoxItem(dock));
        }
Пример #5
0
        private NRibbonTabPage CreateInsertPage()
        {
            NRibbonTabPage page = new NRibbonTabPage("Insert");

            // The "Page" group
            NRibbonGroup group = new NRibbonGroup("Page");

            group.Icon = NResources.Image_Ribbon_16x16_cover_page_png;

            NRibbonCollapsiblePanel panel = new NRibbonCollapsiblePanel();

            group.Items.Add(panel);

            NRibbonButton button = new NRibbonButton("Cover Page");

            button.LargeImage = NResources.Image_Ribbon_32x32_cover_page_png;
            button.SmallImage = NResources.Image_Ribbon_16x16_cover_page_png;
            panel.Add(button);

            NImageBox imageBox = new NImageBox(NResources.Image_Ribbon_16x16_character_bold_small_png);

            button            = new NRibbonButton("Blank Page");
            button.LargeImage = NResources.Image_Ribbon_32x32_page_png;
            button.SmallImage = NResources.Image_Ribbon_16x16_page_png;
            panel.Add(button);

            button            = new NRibbonButton("Page Break");
            button.LargeImage = NResources.Image_Ribbon_32x32_page_break_png;
            button.SmallImage = NResources.Image_Ribbon_16x16_page_break_png;
            panel.Add(button);

            page.Groups.Add(group);

            return(page);
        }
Пример #6
0
        /// <summary>
        /// Creates the platforms stack panel, placed in the footer.
        /// </summary>
        /// <returns></returns>
        private NStackPanel CreatePlatformsStack()
        {
            NStackPanel stack = new NStackPanel();

            stack.Direction           = ENHVDirection.LeftToRight;
            stack.HorizontalPlacement = ENHorizontalPlacement.Center;
            stack.HorizontalSpacing   = IconSpacing;

            INIterator <NKeyValuePair <string, byte[]> > iter = EmfDecompressor.GetImageIterator();

            while (iter.MoveNext())
            {
                string name = iter.Current.Key;
                if (name.StartsWith("Platform", StringComparison.Ordinal))
                {
                    // Add an image box with the current metafile image
                    NImageBox imageBox = new NImageBox(new NBytesImageSource(iter.Current.Value));
                    imageBox.Tag = name;

                    int index = GetPlatformIndex(stack, name);
                    stack.Insert(index, imageBox);
                }
            }

            return(stack);
        }
Пример #7
0
        /// <summary>
        /// Creates the product groups stack panel.
        /// </summary>
        /// <param name="root"></param>
        /// <returns></returns>
        private NStackPanel CreateProductGroupsStack(NXmlElement root)
        {
            NMap <string, NStackPanel> stackMap = new NMap <string, NStackPanel>();

            // Create the main stack
            NStackPanel mainStack = new NStackPanel();

            mainStack.Direction = ENHVDirection.LeftToRight;
            mainStack.Margins   = new NMargins(0, LaneSpacing * 2);

            // Create a stack panel for each license groups and add it to the main stack
            int count = root.ChildrenCount;

            for (int i = 0; i < count; i++)
            {
                NXmlElement categoryElement = root.GetChildAt(i) as NXmlElement;
                if (categoryElement == null)
                {
                    continue;
                }

                string license = categoryElement.GetAttributeValue("license");

                NStackPanel licenseGroupStack;
                if (!stackMap.TryGet(license, out licenseGroupStack))
                {
                    // A stack panel for the license group not found, so create one
                    licenseGroupStack = CreateProductGroupStack();
                    stackMap.Add(license, licenseGroupStack);

                    // Create a stack for the current group and its name
                    NStackPanel stack = new NStackPanel();
                    stack.Direction = ENHVDirection.TopToBottom;

                    // 1. Add the license group stack
                    stack.Add(licenseGroupStack);

                    // 2. Add the bracket
                    NColor  color   = NColor.Parse(categoryElement.GetAttributeValue("color"));
                    NWidget bracket = CreateLicenseGroupBracket(color);
                    stack.Add(bracket);

                    // 3. Add the label
                    NLabel label = new NLabel(license);
                    label.HorizontalPlacement = ENHorizontalPlacement.Center;
                    label.TextFill            = new NColorFill(color);
                    label.Font = new NFont(NFontDescriptor.DefaultSansFamilyName, InfoFontSize);
                    stack.Add(label);

                    mainStack.Add(stack);
                }

                // Create an image box for the current category
                NImageBox imageBox = CreateImageBox(categoryElement);
                licenseGroupStack.Add(imageBox);
            }

            return(mainStack);
        }
        protected override NWidget CreateExampleContent()
        {
            // Create an image box
            m_ImageBox                     = new NImageBox(NResources.Image_SampleImage_png);
            m_ImageBox.Border              = NBorder.CreateFilledBorder(NColor.Red);
            m_ImageBox.BorderThickness     = new NMargins(1);
            m_ImageBox.HorizontalPlacement = ENHorizontalPlacement.Left;
            m_ImageBox.VerticalPlacement   = ENVerticalPlacement.Top;

            return(m_ImageBox);
        }
Пример #9
0
 private NMenuItem CreateMenuItem(string text, NImage image)
 {
     if (image == null)
     {
         return(new NMenuItem(text));
     }
     else
     {
         NImageBox imageBox = new NImageBox(image);
         imageBox.HorizontalPlacement = Layout.ENHorizontalPlacement.Center;
         imageBox.VerticalPlacement   = Layout.ENVerticalPlacement.Center;
         return(new NMenuItem(imageBox, text));
     }
 }
Пример #10
0
        private NTreeViewItem CreateTreeViewItem(string text, bool hasCheckBox, bool image)
        {
            if (hasCheckBox == false && image == false)
            {
                NTreeViewItem item = new NTreeViewItem(text);
                item.Tag = text;
                return(item);
            }

            NStackPanel stack = new NStackPanel();

            stack.Direction         = ENHVDirection.LeftToRight;
            stack.HorizontalSpacing = 3;

            if (hasCheckBox)
            {
                NCheckBox checkBox = new NCheckBox();
                checkBox.VerticalPlacement = ENVerticalPlacement.Center;
                stack.Add(checkBox);
            }

            if (image)
            {
                string[] imageNames = new string[] { "Calendar", "Contacts", "Folders", "Journal", "Mail", "Notes", "Shortcuts", "Tasks" };
                int      index      = m_Random.Next(imageNames.Length);
                string   imageName  = imageNames[index];

                NImage icon = new NImage(new NEmbeddedResourceRef(NResources.Instance, "RIMG__16x16_" + imageName + "_png"));

                NImageBox imageBox = new NImageBox(icon);
                imageBox.HorizontalPlacement = ENHorizontalPlacement.Center;
                imageBox.VerticalPlacement   = ENVerticalPlacement.Center;

                stack.Add(imageBox);
            }

            NLabel label = new NLabel(text);

            label.VerticalPlacement = ENVerticalPlacement.Center;
            stack.Add(label);

            NTreeViewItem treeViewItem = new NTreeViewItem(stack);

            treeViewItem.Tag              = text;
            treeViewItem.ExpandedChanged += new Function <NValueChangeEventArgs>(OnTreeViewItemExpandedChanged);

            return(treeViewItem);
        }
Пример #11
0
        private NCheckableMenuItem CreateCheckableMenuItem(string text, NImage image)
        {
            NCheckableMenuItem item = new NCheckableMenuItem(text);

            item.CheckedChanging += item_CheckedChanging;
            item.CheckedChanged  += item_CheckedChanged;

            if (image != null)
            {
                NImageBox imageBox = new NImageBox(image);
                imageBox.HorizontalPlacement = Layout.ENHorizontalPlacement.Center;
                imageBox.VerticalPlacement   = Layout.ENVerticalPlacement.Center;
                item.Header  = imageBox;
                item.Content = new NLabel(text);
            }

            return(item);
        }
Пример #12
0
        private void OnCountryDataBindingCreateItemNode(NCreateItemNodeEventArgs <NComboBoxItem, NCountry> args)
        {
            NCountry country = args.Item;

            // Create a stack panel
            NStackPanel stack = new NStackPanel();

            stack.Padding = new NMargins(3);
            stack.Tag     = country;

            // Create the flag image box and the country name label
            NLabel countryLabel = new NLabel(country.Name);

            countryLabel.VerticalPlacement = ENVerticalPlacement.Center;
            countryLabel.Font = new NFont(NFontDescriptor.DefaultSansFamilyName, 10, ENFontStyle.Bold);

            NImageBox imageBox = new NImageBox(country.Flag);

            imageBox.VerticalPlacement   = ENVerticalPlacement.Center;
            imageBox.HorizontalPlacement = ENHorizontalPlacement.Left;

            NPairBox pairBox = new NPairBox(imageBox, countryLabel);

            pairBox.Spacing = 3;
            stack.Add(pairBox);

            // Create the capital label
            NLabel capitalLabel = new NLabel("Capital: " + country.Capital);

            stack.Add(capitalLabel);

            // Create the currency label
            NLabel currencyLabel = new NLabel("Currency: " + country.CurrencyName + ", " +
                                              country.CurrencyCode);

            stack.Add(currencyLabel);

            // Create a combo box item to host the created widget
            NComboBoxItem comboBoxItem = new NComboBoxItem(stack);

            comboBoxItem.Text = country.Name;
            args.Node         = comboBoxItem;
        }
            /// <summary>
            /// Creates a custom appointment edit dialog.
            /// </summary>
            /// <returns></returns>
            public override NTopLevelWindow CreateEditDialog()
            {
                NSchedule schedule = (NSchedule)GetFirstAncestor(NSchedule.NScheduleSchema);
                NWindow   window   = schedule != null ? schedule.OwnerWindow : null;

                // Create a dialog window
                NTopLevelWindow dialog = NApplication.CreateTopLevelWindow(NWindow.GetFocusedWindowIfNull(window));

                dialog.SetupDialogWindow("Appointment with Image Editor", true);

                NStackPanel stack = new NStackPanel();

                stack.FillMode = ENStackFillMode.Last;
                stack.FitMode  = ENStackFitMode.Last;

                // Add an image box with the image
                NImageBox imageBox = new NImageBox((NImage)NSystem.SafeDeepClone(Image));

                stack.Add(imageBox);

                // Add property editors for some of the appointment properties
                NDesigner designer = NDesigner.GetDesigner(this);
                NList <NPropertyEditor> editors = designer.CreatePropertyEditors(this,
                                                                                 SubjectProperty,
                                                                                 StartProperty,
                                                                                 EndProperty);

                for (int i = 0; i < editors.Count; i++)
                {
                    stack.Add(editors[i]);
                }

                // Add a button strip with OK and Cancel buttons
                NButtonStrip buttonStrip = new NButtonStrip();

                buttonStrip.InitOKCancelButtonStrip();
                stack.Add(buttonStrip);

                dialog.Content = new NUniSizeBoxGroup(stack);

                return(dialog);
            }
Пример #14
0
        private NListBoxItem CreateListBoxItem(int index, bool hasCheckBox, bool hasImage)
        {
            string text = "Item " + index.ToString();

            if (hasCheckBox == false && hasImage == false)
            {
                return(new NListBoxItem(text));
            }

            NStackPanel stack = new NStackPanel();

            stack.Direction         = ENHVDirection.LeftToRight;
            stack.HorizontalSpacing = 3;

            if (hasCheckBox)
            {
                NCheckBox checkBox = new NCheckBox();
                checkBox.VerticalPlacement = ENVerticalPlacement.Center;
                stack.Add(checkBox);
            }

            if (hasImage)
            {
                string imageName = ImageNames[index % ImageNames.Length];
                NImage icon      = new NImage(new NEmbeddedResourceRef(NResources.Instance, "RIMG__16x16_" + imageName + "_png"));

                NImageBox imageBox = new NImageBox(icon);
                imageBox.HorizontalPlacement = ENHorizontalPlacement.Center;
                imageBox.VerticalPlacement   = ENVerticalPlacement.Center;

                stack.Add(imageBox);
            }

            NLabel label = new NLabel(text);

            label.VerticalPlacement = ENVerticalPlacement.Center;
            stack.Add(label);

            return(new NListBoxItem(stack));
        }
Пример #15
0
            public override NWidget CreateWidget(NCountry country)
            {
                // Create a dock panel
                NStackPanel stack = new NStackPanel();

                stack.Padding = new NMargins(3);
                stack.Tag     = country;

                // Create the flag image box and the country name label
                NLabel countryLabel = new NLabel(country.Name);

                countryLabel.VerticalPlacement = ENVerticalPlacement.Center;
                countryLabel.Font = new NFont(NFontDescriptor.DefaultSansFamilyName, 10, ENFontStyle.Bold);

                NImageBox imageBox = new NImageBox((NImage)NSystem.SafeDeepClone(country.Flag));

                imageBox.VerticalPlacement   = ENVerticalPlacement.Center;
                imageBox.HorizontalPlacement = ENHorizontalPlacement.Left;

                NPairBox pairBox = new NPairBox(imageBox, countryLabel);

                pairBox.Spacing = 3;
                stack.Add(pairBox);

                // Create the capital label
                NLabel capitalLabel = new NLabel("Capital: " + country.Capital);

                stack.Add(capitalLabel);

                // Create the currency label
                NLabel currencyLabel = new NLabel("Currency: " + country.CurrencyName + ", " +
                                                  country.CurrencyCode);

                stack.Add(currencyLabel);

                return(stack);
            }
Пример #16
0
        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);
        }
Пример #17
0
        /// <summary>
        /// Called by a NHttpRequest when it has been completed.
        /// </summary>
        /// <param name="response"></param>
        private void OnRequestCompleted(NUriRequest request, NUriResponse response)
        {
            NHttpRequest  httpRequest  = (NHttpRequest)request;
            NHttpResponse httpResponse = (NHttpResponse)response;

            // update the list box item
            UpdateRequestListBoxItem(httpRequest, httpResponse);

            // update the response content holder
            switch (response.Status)
            {
            case ENAsyncResponseStatus.Aborted:
                // request has been aborted by the user -> do nothing.
                break;

            case ENAsyncResponseStatus.Failed:
                // request has failed -> fill content with an error message
                m_ResponseContentHolder.Content = new NLabel("Request for URI: " + request.Uri.ToString() + " failed. Error was: " + response.ErrorException.ToString());
                break;

            case ENAsyncResponseStatus.Succeeded:
                // request succeded -> fill content with the response content
                try
                {
                    // get the Content-Type Http Header field, and split it to portions
                    // NOTE: the Content-Type is a multi value field. Values are seperated with the ';' char
                    string   contentType  = httpResponse.HeaderFields[NHttpHeaderFieldName.ContentType];
                    string[] contentTypes = contentType.Split(new char[] { ';' });

                    // normalize content type values (trim and make lower case)
                    for (int i = 0; i < contentTypes.Length; i++)
                    {
                        contentTypes[i] = contentTypes[i].Trim();
                        contentTypes[i] = contentTypes[i].ToLower();
                    }

                    // the first part of the content type is the mime type of the content
                    switch (contentTypes[0])
                    {
                    case "image/png":
                    case "image/jpeg":
                    case "image/bmp":
                        NImage    image    = new NImage(new NBytesImageSource(response.Data));
                        NImageBox imageBox = new NImageBox(image);
                        m_ResponseContentHolder.Content = new NScrollContent(imageBox);
                        break;

                    case "text/html":
                    case "application/json":
                        string charSet = (contentTypes.Length >= 1? contentTypes[1]: "charset=utf-8");
                        string html    = "";
                        switch (charSet)
                        {
                        case "charset=utf-8":
                            html = Nevron.Nov.Text.NEncoding.UTF8.GetString(response.Data);
                            break;

                        default:
                            html = Nevron.Nov.Text.NEncoding.UTF8.GetString(response.Data);
                            break;
                        }

                        NTextBox textBox = new NTextBox();
                        textBox.Text = html;
                        m_ResponseContentHolder.Content = textBox;
                        break;

                    default:
                        break;
                    }
                }
                catch (Exception ex)
                {
                    m_ResponseContentHolder.Content = new NLabel("Request for URI: " + request.Uri.ToString() + " decoding failed. Error was: " + ex.Message.ToString());
                }
                break;
            }
        }
        protected override NWidget CreateExampleContent()
        {
            // create a view and get its grid
            m_View = new NTableGridView();
            NTableGrid grid = m_View.Grid;

            // bind the grid to the data source
            grid.DataSource = NDummyDataSource.CreatePersonsDataSource();

            // configure the master grid
            grid.AllowEdit = false;

            // assign some icons to the columns
            for (int i = 0; i < grid.Columns.Count; i++)
            {
                NDataColumn dataColumn = grid.Columns[i] as NDataColumn;
                if (dataColumn == null)
                {
                    continue;
                }

                NImage image = null;
                switch (dataColumn.FieldName)
                {
                case "Name":
                    image = NResources.Image__16x16_Contacts_png;
                    break;

                case "Gender":
                    image = NResources.Image__16x16_Gender_png;
                    break;

                case "Birthday":
                    image = NResources.Image__16x16_Birthday_png;
                    break;

                case "Country":
                    image = NResources.Image__16x16_Globe_png;
                    break;

                case "Phone":
                    image = NResources.Image__16x16_Phone_png;
                    break;

                case "Email":
                    image = NResources.Image__16x16_Mail_png;
                    break;

                default:
                    continue;
                }

                // NOTE: The CreateHeaderContentDelegate is invoked whenever the Title changes or the UpdateHeaderContent() is called.
                // you can use this event to create custom column header content
                dataColumn.CreateHeaderContentDelegate = delegate(NColumn theColumn)
                {
                    NPairBox pairBox = new NPairBox(image, theColumn.Title, ENPairBoxRelation.Box1BeforeBox2);
                    pairBox.Spacing = 2;
                    return(pairBox);
                };
                dataColumn.UpdateHeaderContent();
            }

            // create the custom detail that creates a widget displaying information about the row.
            // NOTE: The widget is created by the OnCustomDetailCreateWidget event handler.
            NMasterDetails masterDetails = grid.MasterDetails;

            NCustomDetail customDetail = new NCustomDetail();

            masterDetails.Details.Add(customDetail);

            customDetail.CreateWidgetDelegate = delegate(NCustomDetailCreateWidgetArgs arg)
            {
                // get information about the data source row
                string    name     = (string)arg.DataSource.GetValue(arg.RowIndex, "Name");
                ENGender  gender   = (ENGender)arg.DataSource.GetValue(arg.RowIndex, "Gender");
                DateTime  birthday = (DateTime)arg.DataSource.GetValue(arg.RowIndex, "Birthday");
                ENCountry country  = (ENCountry)arg.DataSource.GetValue(arg.RowIndex, "Country");
                string    phone    = (string)arg.DataSource.GetValue(arg.RowIndex, "Phone");
                string    email    = (string)arg.DataSource.GetValue(arg.RowIndex, "Email");

                // display the information as a widget
                NPairBox namePair     = new NPairBox("Name:", name);
                NPairBox genderPair   = new NPairBox("Gender:", gender.ToString());
                NPairBox birthdayPair = new NPairBox("Birthday:", birthday.ToString());
                NPairBox countryPair  = new NPairBox("Country:", country.ToString());
                NPairBox phonePair    = new NPairBox("Phone:", phone.ToString());
                NPairBox emailPair    = new NPairBox("Email:", email.ToString());

                NImageBox image = new NImageBox();
                switch (gender)
                {
                case ENGender.Male:
                    image.Image = Nevron.Nov.Examples.NResources.Image__256x256_MaleIcon_jpg;
                    break;

                case ENGender.Female:
                    image.Image = Nevron.Nov.Examples.NResources.Image__256x256_FemaleIcon_jpg;
                    break;

                default:
                    break;
                }

                NStackPanel infoStack = new NStackPanel();
                infoStack.VerticalSpacing = 2.0d;
                infoStack.Add(namePair);
                infoStack.Add(genderPair);
                infoStack.Add(birthdayPair);
                infoStack.Add(countryPair);
                infoStack.Add(phonePair);
                infoStack.Add(emailPair);

                NDockPanel dock = new NDockPanel();
                dock.Add(image, ENDockArea.Left);
                dock.Add(infoStack, ENDockArea.Center);

                // assign the widget to the event arguments.
                return(dock);
            };

            return(m_View);
        }
Пример #19
0
        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);
        }
Пример #20
0
        private NWidget CreateRasterDemo()
        {
            NStackPanel rasterStack = new NStackPanel();

            rasterStack.FillMode = ENStackFillMode.Last;
            rasterStack.FitMode  = ENStackFitMode.Last;

            // create the controls that demonstrate how to place image content on the clipboard
            {
                NGroupBox setRastersGroupBox = new NGroupBox("Setting images on the clipboard");
                rasterStack.Add(setRastersGroupBox);

                NStackPanel setRastersStack = new NStackPanel();
                setRastersStack.Direction  = ENHVDirection.LeftToRight;
                setRastersGroupBox.Content = setRastersStack;

                for (int i = 0; i < 3; i++)
                {
                    NPairBox pair = new NPairBox();

                    switch (i)
                    {
                    case 0:
                        pair.Box1 = new NImageBox(NResources.Image__48x48_Book_png);
                        break;

                    case 1:
                        pair.Box1 = new NImageBox(NResources.Image__48x48_Clock_png);
                        break;

                    case 2:
                        pair.Box1 = new NImageBox(NResources.Image__48x48_Darts_png);
                        break;
                    }

                    pair.Box2 = new NLabel("Set me on the clipboard");
                    pair.Box2.HorizontalPlacement = ENHorizontalPlacement.Center;
                    pair.BoxesRelation            = ENPairBoxRelation.Box1AboveBox2;

                    NButton setRasterButton = new NButton(pair);
                    setRasterButton.Tag    = i;
                    setRasterButton.Click += new Function <NEventArgs>(OnSetRasterButtonClick);
                    setRastersStack.Add(setRasterButton);
                }
            }

            // create the controls that demonstrate how to get image content from the clipboard
            {
                NGroupBox getRastersGroupBox = new NGroupBox("Getting images from the clipboard");
                rasterStack.Add(getRastersGroupBox);

                NStackPanel getRastersStack = new NStackPanel();
                getRastersStack.FillMode   = ENStackFillMode.Last;
                getRastersStack.FitMode    = ENStackFitMode.Last;
                getRastersGroupBox.Content = getRastersStack;

                m_ImageBox                 = new NImageBox();
                m_ImageBox.Margins         = new NMargins(10);
                m_ImageBox.Border          = NBorder.CreateFilledBorder(NColor.Black);
                m_ImageBox.BorderThickness = new NMargins(1);
                m_ImageBox.Visibility      = ENVisibility.Hidden;

                NButton getRasterButton = new NButton("Get image from the clipboard");
                getRasterButton.HorizontalPlacement = ENHorizontalPlacement.Left;
                getRasterButton.Click += new Function <NEventArgs>(OnGetRasterButtonClick);
                getRastersStack.Add(getRasterButton);

                NScrollContent scrollContent = new NScrollContent();
                scrollContent.BackgroundFill = new NHatchFill(ENHatchStyle.LargeCheckerBoard, NColor.Gray, NColor.LightGray);
                scrollContent.Content        = m_ImageBox;
                scrollContent.NoScrollHAlign = ENNoScrollHAlign.Left;
                scrollContent.NoScrollVAlign = ENNoScrollVAlign.Top;
                getRastersStack.Add(scrollContent);
            }

            return(rasterStack);
        }