Exemple #1
0
        protected override NWidget CreateExampleControls()
        {
            NStackPanel stack = new NStackPanel();

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

            // properties
            NProperty[]             properties = new NProperty[] { NAccordion.ShowSymbolProperty };
            NList <NPropertyEditor> editors    = NDesigner.GetDesigner(m_Accordion).CreatePropertyEditors(m_Accordion, properties);

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

            // create the events list box
            m_EventsLog = new NExampleEventsLog();
            stack.Add(m_EventsLog);

            return(stack);
        }
        protected override NWidget CreateExampleControls()
        {
            NStackPanel stack = new NStackPanel();

            // Create the property editors
            NList <NPropertyEditor> editors = NDesigner.GetDesigner(m_Barcode).CreatePropertyEditors(
                m_Barcode,
                NLinearBarcode.HorizontalPlacementProperty,
                NLinearBarcode.VerticalPlacementProperty,
                NLinearBarcode.BackgroundFillProperty,
                NLinearBarcode.TextFillProperty,
                NLinearBarcode.SizeModeProperty,
                NLinearBarcode.ScaleProperty
                );

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

            return(new NUniSizeBoxGroup(stack));
        }
        protected override NWidget CreateExampleControls()
        {
            NStackPanel stack = new NStackPanel();

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

            // create the palette select combo box
            NComboBox paletteComboBox = new NComboBox();

            paletteComboBox.Items.Add(new NComboBoxItem(ENColorPaletteType.MicrosoftPaint));
            paletteComboBox.Items.Add(new NComboBoxItem(ENColorPaletteType.MicrosoftOffice2003));
            paletteComboBox.Items.Add(new NComboBoxItem(ENColorPaletteType.MicrosoftOffice2007));
            paletteComboBox.Items.Add(new NComboBoxItem(ENColorPaletteType.WebSafe));
            paletteComboBox.SelectedIndex         = 2;
            paletteComboBox.SelectedIndexChanged += new Function <NValueChangeEventArgs>(OnPaletteComboBoxSelectedIndexChanged);
            stack.Add(new NPairBox("Palette:", paletteComboBox, true));

            // add come property editors
            NList <NPropertyEditor> editors = NDesigner.GetDesigner(m_ColorBox).CreatePropertyEditors(
                m_ColorBox,
                NColorBox.EnabledProperty,
                NColorBox.ShowMoreColorsButtonProperty,
                NColorBox.ShowOpacitySliderInDialogProperty,
                NColorBox.SelectedColorProperty
                );

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

            // create the events log
            m_EventsLog = new NExampleEventsLog();
            stack.Add(m_EventsLog);

            return(new NUniSizeBoxGroup(stack));
        }
Exemple #4
0
        private NGroupBox CreatePropertiesGroupBox()
        {
            NStackPanel             propertiesStack = new NStackPanel();
            NList <NPropertyEditor> editors         = NDesigner.GetDesigner(m_ListBox).CreatePropertyEditors(m_ListBox,
                                                                                                             NListBox.EnabledProperty,
                                                                                                             NListBox.HorizontalPlacementProperty,
                                                                                                             NListBox.VerticalPlacementProperty,
                                                                                                             NListBox.HScrollModeProperty,
                                                                                                             NListBox.VScrollModeProperty,
                                                                                                             NListBox.NoScrollHAlignProperty,
                                                                                                             NListBox.NoScrollVAlignProperty,
                                                                                                             NListBox.IntegralVScrollProperty
                                                                                                             );

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

            NGroupBox propertiesGroupBox = new NGroupBox("Properties", new NUniSizeBoxGroup(propertiesStack));

            return(propertiesGroupBox);
        }
        protected override NWidget CreateExampleControls()
        {
            NStackPanel stack = new NStackPanel();

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

            // create the palette select combo box
            NComboBox paletteComboBox = new NComboBox();

            paletteComboBox.Items.Add(new NComboBoxItem(ENColorPaletteType.MicrosoftPaint));
            paletteComboBox.Items.Add(new NComboBoxItem(ENColorPaletteType.MicrosoftOffice2003));
            paletteComboBox.Items.Add(new NComboBoxItem(ENColorPaletteType.MicrosoftOffice2007));
            paletteComboBox.Items.Add(new NComboBoxItem(ENColorPaletteType.WebSafe));
            paletteComboBox.SelectedIndex         = 0;
            paletteComboBox.SelectedIndexChanged += OnPaletteComboBoxSelectedIndexChanged;
            stack.Add(new NPairBox("Palette:", paletteComboBox, true));

            // add some property editors
            NList <NPropertyEditor> editors = NDesigner.GetDesigner(m_PaletteColorPicker).CreatePropertyEditors(
                m_PaletteColorPicker,
                NPaletteColorPicker.EnabledProperty,
                NPaletteColorPicker.CyclicKeyboardNavigationProperty,
                NPaletteColorPicker.SelectedIndexProperty
                );

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

            // create the events log
            m_EventsLog = new NExampleEventsLog();
            stack.Add(m_EventsLog);

            return(new NUniSizeBoxGroup(stack));
        }
Exemple #6
0
        protected override NWidget CreateExampleControls()
        {
            NStackPanel stack = new NStackPanel();

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

            // Create the properties group box
            NStackPanel             propertiesStack = new NStackPanel();
            NList <NPropertyEditor> editors         = NDesigner.GetDesigner(m_ListBox).CreatePropertyEditors(m_ListBox,
                                                                                                             NListBox.EnabledProperty,
                                                                                                             NListBox.HorizontalPlacementProperty,
                                                                                                             NListBox.VerticalPlacementProperty
                                                                                                             );

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

            NPropertyEditor editor = NDesigner.GetDesigner(m_ListBox.Selection).CreatePropertyEditor(m_ListBox.Selection,
                                                                                                     NListBoxSelection.ModeProperty);
            NLabel label = (NLabel)editor.GetDescendants(new NInstanceOfSchemaFilter(NLabel.NLabelSchema))[0];

            label.Text = "Selection Mode:";
            propertiesStack.Add(editor);

            NGroupBox propertiesGroupBox = new NGroupBox("Properties", new NUniSizeBoxGroup(propertiesStack));

            stack.Add(propertiesGroupBox);

            // Create the events log
            m_EventsLog = new NExampleEventsLog();
            stack.Add(m_EventsLog);

            return(stack);
        }
        private NGroupBox CreatePropertiesGroupBox()
        {
            NStackPanel propertiesStack = new NStackPanel();

            NList <NPropertyEditor> editors = NDesigner.GetDesigner(m_NavigationBar).CreatePropertyEditors(m_NavigationBar,
                                                                                                           NNavigationBar.EnabledProperty,
                                                                                                           NNavigationBar.HorizontalPlacementProperty,
                                                                                                           NNavigationBar.VerticalPlacementProperty,
                                                                                                           NNavigationBar.VisibleHeadersCountProperty,
                                                                                                           NNavigationBar.HeadersPaddingProperty,
                                                                                                           NNavigationBar.HeadersSpacingProperty,
                                                                                                           NNavigationBar.IconsPaddingProperty,
                                                                                                           NNavigationBar.IconsSpacingProperty
                                                                                                           );

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

            NGroupBox propertiesGroupBox = new NGroupBox("Properties", new NUniSizeBoxGroup(propertiesStack));

            return(propertiesGroupBox);
        }
        protected override NWidget CreateExampleControls()
        {
            NList <NPropertyEditor> editors = NDesigner.GetDesigner(m_MenuBar).CreatePropertyEditors(
                m_MenuBar,
                NMenuBar.OrientationProperty,
                NMenuBar.OpenPopupsOnMouseInProperty,
                NMenuBar.ClosePopupsOnMouseOutProperty
                );

            NStackPanel stack = new NStackPanel();

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

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

            m_EventsLog = new NExampleEventsLog();
            stack.Add(m_EventsLog);
            NTrace.WriteLine("Create Menu Example Controls");
            return(new NUniSizeBoxGroup(stack));
        }
Exemple #9
0
        protected override NWidget CreateExampleControls()
        {
            NList <NPropertyEditor> editors = NDesigner.GetDesigner(m_ColorPicker).CreatePropertyEditors(
                m_ColorPicker,
                NSBColorPicker.UpdateWhileDraggingProperty,
                NSBColorPicker.SelectedColorProperty,
                NSBColorPicker.SBSelectorRadiusPercentProperty
                );

            NStackPanel stack = new NStackPanel();

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

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

            m_EventsLog = new NExampleEventsLog();
            stack.Add(m_EventsLog);

            return(new NUniSizeBoxGroup(stack));
        }
        protected override NWidget CreateExampleControls()
        {
            m_Layout.Changed += OnLayoutChanged;

            NStackPanel stack = (NStackPanel)base.CreateExampleControls();

            // property editor
            NEditor editor = NDesigner.GetDesigner(m_Layout).CreateInstanceEditor(m_Layout);

            stack.Add(new NGroupBox("Properties", editor));

            NButton arrangeButton = new NButton("Arrange Diagram");

            arrangeButton.Click += OnArrangeButtonClick;
            stack.Add(arrangeButton);

            // items stack
            NStackPanel itemsStack = new NStackPanel();

            if ((m_Layout is NBoxLayout) && !(m_Layout is NDockLayout))
            {
                // NOTE: For Cells layout we provide the user with the ability to add shapes with different sizes so that he/she can test the layouts
                NButton addSmallItemButton = new NButton("Add Small Shape");
                addSmallItemButton.Click += new Function <NEventArgs>(OnAddSmallItemButtonClick);
                itemsStack.Add(addSmallItemButton);

                NButton addLargeItemButton = new NButton("Add Large Shape");
                addLargeItemButton.Click += new Function <NEventArgs>(OnAddLargeItemButtonClick);
                itemsStack.Add(addLargeItemButton);

                NButton addRandomItemButton = new NButton("Add Random Shape");
                addRandomItemButton.Click += new Function <NEventArgs>(OnAddRandomItemButtonClick);
                itemsStack.Add(addRandomItemButton);

                NButton removeAllItemsButton = new NButton("Remove All Shapes");
                removeAllItemsButton.Click += new Function <NEventArgs>(OnRemoveAllItemsButtonClick);
                itemsStack.Add(removeAllItemsButton);
            }
            else if (m_Layout is NTreeLayout)
            {
                // NOTE: For Tree layouts we provide the user with the ability to generate random tree diagrams so that he/she can test the layouts
                NButton randomTree1Button = new NButton("Random Tree (max 6 levels, max 3 branch nodes)");
                randomTree1Button.Click += OnRandomTree1ButtonClick;
                itemsStack.Add(randomTree1Button);

                NButton randomTree2Button = new NButton("Random Tree (max 8 levels, max 2 branch nodes)");
                randomTree2Button.Click += OnRandomTree2ButtonClick;
                itemsStack.Add(randomTree2Button);
            }
            else if ((m_Layout is NGraphLayout) && !(m_Layout is NBarycenterGraphLayout))
            {
                // NOTE: For Graph layouts we provide the user with the ability to generate random graph diagrams so that he/she can test the layouts
                NButton randomGraph1Button = new NButton("Random Graph (10 vertices, 15 edges)");
                randomGraph1Button.Click += OnRandomGraph1ButtonClick;
                itemsStack.Add(randomGraph1Button);

                NButton randomGraph2Button = new NButton("Random Graph (20 vertices, 30 edges)");
                randomGraph2Button.Click += OnRandomGraph2ButtonClick;
                itemsStack.Add(randomGraph2Button);
            }
            else
            {
                // NOTE: Not any of the predefined cases -> create custom controls
                CreateItemsControls(itemsStack);
            }

            stack.Add(new NGroupBox("Items", itemsStack));

            return(stack);
        }
Exemple #11
0
        protected override NWidget CreateExampleContent()
        {
            // Create and initialize a top level window
            m_Window       = new NTopLevelWindow();
            m_Window.Title = "Top Level Window";
            m_Window.RemoveFromParentOnClose   = true;
            m_Window.AllowXResize              = true;
            m_Window.AllowYResize              = true;
            m_Window.PreferredSize             = new NSize(300, 300);
            m_Window.QueryManualStartPosition += new Function <NEventArgs>(OnWindowQueryManualStartPosition);
            m_Window.Closed += new Function <NEventArgs>(OnWindowClosed);

            // Create the top level window's content
            NStackPanel stack = new NStackPanel();

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

            NLabel label = new NLabel("This is a top level window.");

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

            NButton closeButton = new NButton("Close");

            closeButton.HorizontalPlacement = ENHorizontalPlacement.Center;
            closeButton.Click += new Function <NEventArgs>(OnCloseButtonClick);
            stack.Add(closeButton);
            m_Window.Content = stack;

            // Create example content
            m_SettingsStack = new NStackPanel();
            m_SettingsStack.HorizontalPlacement = ENHorizontalPlacement.Left;

            NList <NPropertyEditor> editors = NDesigner.GetDesigner(m_Window).CreatePropertyEditors(m_Window,
                                                                                                    NTopLevelWindow.TitleProperty,
                                                                                                    NTopLevelWindow.StartPositionProperty,
                                                                                                    NTopLevelWindow.XProperty,
                                                                                                    NTopLevelWindow.YProperty,
                                                                                                    NStylePropertyEx.ExtendedLookPropertyEx,

                                                                                                    NTopLevelWindow.ModalProperty,
                                                                                                    NTopLevelWindow.ShowInTaskbarProperty,
                                                                                                    NTopLevelWindow.ShowTitleBarProperty,
                                                                                                    NTopLevelWindow.ShowControlBoxProperty,

                                                                                                    NTopLevelWindow.AllowMinimizeProperty,
                                                                                                    NTopLevelWindow.AllowMaximizeProperty,
                                                                                                    NTopLevelWindow.AllowXResizeProperty,
                                                                                                    NTopLevelWindow.AllowYResizeProperty
                                                                                                    );

            // Change the text of the extended look property editor
            label      = (NLabel)editors[4].GetFirstDescendant(new NInstanceOfSchemaFilter(NLabel.NLabelSchema));
            label.Text = "Extended Look:";

            // Add the created property editors to the stack
            for (int i = 0, count = editors.Count; i < count; i++)
            {
                m_SettingsStack.Add(editors[i]);
            }

            // Create a button that opens the window
            NButton openWindowButton = new NButton("Open Window...");

            openWindowButton.Content.HorizontalPlacement = ENHorizontalPlacement.Center;
            openWindowButton.Click += new Function <NEventArgs>(OnOpenWindowButtonClick);
            m_SettingsStack.Add(openWindowButton);

            return(new NUniSizeBoxGroup(m_SettingsStack));
        }
        protected override NWidget CreateExampleControls()
        {
            NStackPanel stack = new NStackPanel();

            // properties stack
            NList <NPropertyEditor> editors = NDesigner.GetDesigner(m_DockPanel).CreatePropertyEditors(
                m_DockPanel,
                NDockPanel.EnabledProperty,
                NDockPanel.HorizontalPlacementProperty,
                NDockPanel.VerticalPlacementProperty,
                NDockPanel.VerticalSpacingProperty,
                NDockPanel.HorizontalSpacingProperty,
                NDockPanel.UniformWidthsProperty,
                NDockPanel.UniformHeightsProperty);

            NStackPanel propertiesStack = new NStackPanel();

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

            stack.Add(new NGroupBox("Properties", new NUniSizeBoxGroup(propertiesStack)));

            // items stack
            NStackPanel itemsStack = new NStackPanel();

            m_DockAreaCombo = new NComboBox();
            m_DockAreaCombo.Items.Add(new NComboBoxItem("Left"));
            m_DockAreaCombo.Items.Add(new NComboBoxItem("Top"));
            m_DockAreaCombo.Items.Add(new NComboBoxItem("Right"));
            m_DockAreaCombo.Items.Add(new NComboBoxItem("Bottom"));
            m_DockAreaCombo.Items.Add(new NComboBoxItem("Center"));
            m_DockAreaCombo.SelectedIndex = 1;
            NLabel dockAreaLabel = new NLabel("Dock Area:");

            dockAreaLabel.VerticalPlacement = ENVerticalPlacement.Center;
            itemsStack.Add(new NPairBox(dockAreaLabel, m_DockAreaCombo, true));

            NButton addSmallItemButton = new NButton("Add Small Item");

            addSmallItemButton.Click += new Function <NEventArgs>(OnAddSmallItemButtonClick);
            itemsStack.Add(addSmallItemButton);

            NButton addLargeItemButton = new NButton("Add Large Item");

            addLargeItemButton.Click += new Function <NEventArgs>(OnAddLargeItemButtonClick);
            itemsStack.Add(addLargeItemButton);

            NButton addRandomItemButton = new NButton("Add Random Item");

            addRandomItemButton.Click += new Function <NEventArgs>(OnAddRandomItemButtonClick);
            itemsStack.Add(addRandomItemButton);

            NButton removeAllItemsButton = new NButton("Remove All Items");

            removeAllItemsButton.Click += new Function <NEventArgs>(OnRemoveAllItemsButtonClick);
            itemsStack.Add(removeAllItemsButton);

            stack.Add(new NGroupBox("Items", itemsStack));
            return(new NUniSizeBoxGroup(stack));
        }
Exemple #13
0
        protected override NWidget CreateExampleControls()
        {
            NStackPanel stack = new NStackPanel();

            // default gridlines
            {
                NStackPanel pstack = new NStackPanel();
                pstack.VerticalSpacing = 2;

                NList <NPropertyEditor> editors = NDesigner.GetDesigner(m_GridView.Grid).CreatePropertyEditors(
                    m_GridView.Grid,
                    NGrid.HorizontalGridlinesStrokeProperty,
                    NGrid.VerticalGridlinesStrokeProperty
                    );

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

                stack.Add(new NGroupBox("Grid Gridlines", new NUniSizeBoxGroup(pstack)));
            }

            // column gridlines
            {
                NStackPanel pstack = new NStackPanel();
                pstack.VerticalSpacing = 2;

                NList <NPropertyEditor> editors = NDesigner.GetDesigner(NColumnCollection.NColumnCollectionSchema).CreatePropertyEditors(
                    m_GridView.Grid.Columns,
                    NColumnCollection.VisibleProperty,
                    NColumnCollection.TopGridlineStrokeProperty,
                    NColumnCollection.BottomGridlineStrokeProperty,
                    NColumnCollection.VerticalGridlinesStrokeProperty
                    );

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

                stack.Add(new NGroupBox("Columns Properties", new NUniSizeBoxGroup(pstack)));
            }

            // row headers gridlines
            {
                NStackPanel pstack = new NStackPanel();
                pstack.VerticalSpacing = 2;

                NList <NPropertyEditor> editors = NDesigner.GetDesigner(NRowHeaderCollection.NRowHeaderCollectionSchema).CreatePropertyEditors(
                    m_GridView.Grid.RowHeaders,
                    NRowHeaderCollection.VisibleProperty,
                    NRowHeaderCollection.LeftGridlineStrokeProperty,
                    NRowHeaderCollection.RightGridlineStrokeProperty,
                    NRowHeaderCollection.HorizontalGridlinesStrokeProperty
                    );

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

                stack.Add(new NGroupBox("Row Headers Properties", new NUniSizeBoxGroup(pstack)));
            }


            return(stack);
        }
Exemple #14
0
        protected override NWidget CreateExampleControls()
        {
            NStackPanel stack = new NStackPanel();

            // font families
            m_FontFamiliesComboBox = new NComboBox();

            string[] fontFamilies  = NApplication.FontService.InstalledFontsMap.FontFamilies;
            int      selectedIndex = 0;

            for (int i = 0; i < fontFamilies.Length; i++)
            {
                m_FontFamiliesComboBox.Items.Add(new NComboBoxItem(fontFamilies[i]));

                if (fontFamilies[i] == NFontDescriptor.DefaultSansFamilyName)
                {
                    selectedIndex = i;
                }
            }

            m_FontFamiliesComboBox.SelectedIndex         = selectedIndex;
            m_FontFamiliesComboBox.SelectedIndexChanged += new Function <NValueChangeEventArgs>(OnFontStyleChanged);
            stack.Add(m_FontFamiliesComboBox);

            // font sizes
            stack.Add(new NLabel("Font Size:"));
            m_FontSizeComboBox = new NComboBox();
            for (int i = 5; i < 72; i++)
            {
                m_FontSizeComboBox.Items.Add(new NComboBoxItem(i.ToString()));
            }

            m_FontSizeComboBox.SelectedIndex         = 4;
            m_FontSizeComboBox.SelectedIndexChanged += new Function <NValueChangeEventArgs>(OnFontStyleChanged);
            stack.Add(m_FontSizeComboBox);

            // add style controls
            m_BoldCheckBox                 = new NCheckBox();
            m_BoldCheckBox.Content         = new NLabel("Bold");
            m_BoldCheckBox.CheckedChanged += new Function <NValueChangeEventArgs>(OnFontStyleChanged);
            stack.Add(m_BoldCheckBox);

            m_ItalicCheckBox                 = new NCheckBox();
            m_ItalicCheckBox.Content         = new NLabel("Italic");
            m_ItalicCheckBox.CheckedChanged += new Function <NValueChangeEventArgs>(OnFontStyleChanged);
            stack.Add(m_ItalicCheckBox);

            m_UnderlineCheckBox                 = new NCheckBox();
            m_UnderlineCheckBox.Content         = new NLabel("Underline");
            m_UnderlineCheckBox.CheckedChanged += new Function <NValueChangeEventArgs>(OnFontStyleChanged);
            stack.Add(m_UnderlineCheckBox);

            m_StrikeTroughCheckBox                 = new NCheckBox();
            m_StrikeTroughCheckBox.Content         = new NLabel("Strikethrough");
            m_StrikeTroughCheckBox.CheckedChanged += new Function <NValueChangeEventArgs>(OnFontStyleChanged);
            stack.Add(m_StrikeTroughCheckBox);

            // properties
            NList <NPropertyEditor> editors = NDesigner.GetDesigner(m_TextBox).CreatePropertyEditors(
                m_TextBox,
                NTextBox.EnabledProperty,
                NTextBox.ReadOnlyProperty,
                NTextBox.MultilineProperty,
                NTextBox.WordWrapProperty,
                NTextBox.AlwaysShowSelectionProperty,
                NTextBox.AlwaysShowCaretProperty,
                NTextBox.AcceptsTabProperty,
                NTextBox.AcceptsEnterProperty,
                NTextBox.ShowCaretProperty,
                NTextBox.HorizontalPlacementProperty,
                NTextBox.VerticalPlacementProperty,
                NTextBox.TextAlignProperty,
                NTextBox.DirectionProperty,
                NTextBox.HScrollModeProperty,
                NTextBox.VScrollModeProperty,
                NTextBox.CharacterCasingProperty,
                NTextBox.PasswordCharProperty,
                NTextBox.HintProperty,
                NTextBox.HintFillProperty
                );

            NStackPanel propertiesStack = new NStackPanel();

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

            stack.Add(new NGroupBox("Properties", new NUniSizeBoxGroup(propertiesStack)));

            // make sure font style is updated
            OnFontStyleChanged(null);

            return(stack);
        }
Exemple #15
0
        protected override NWidget CreateExampleControls()
        {
            NStackPanel stack = new NStackPanel();

            m_SampleTextComboBox = new NComboBox();

            for (int i = 0; i < 2; i++)
            {
                m_SampleTextComboBox.Items.Add(new NComboBoxItem("Sample " + i.ToString()));
            }

            m_SampleTextComboBox.SelectedIndexChanged += new Function <NValueChangeEventArgs>(OnSampleTextChanged);
            m_SampleTextComboBox.SelectedIndex         = 0;

            stack.Add(new NLabel("Sample Text:"));
            stack.Add(m_SampleTextComboBox);

            // font families
            stack.Add(new NLabel("Font Family:"));
            m_FontFamiliesComboBox = new NComboBox();

            string[] fontFamilies  = NApplication.FontService.InstalledFontsMap.FontFamilies;
            int      selectedIndex = 0;

            for (int i = 0; i < fontFamilies.Length; i++)
            {
                m_FontFamiliesComboBox.Items.Add(new NComboBoxItem(fontFamilies[i]));

                if (fontFamilies[i] == NFontDescriptor.DefaultSansFamilyName)
                {
                    selectedIndex = i;
                }
            }

            m_FontFamiliesComboBox.SelectedIndex         = selectedIndex;
            m_FontFamiliesComboBox.SelectedIndexChanged += new Function <NValueChangeEventArgs>(OnFontStyleChanged);
            stack.Add(m_FontFamiliesComboBox);

            // font sizes
            stack.Add(new NLabel("Font Size:"));
            m_FontSizeComboBox = new NComboBox();
            for (int i = 5; i < 72; i++)
            {
                m_FontSizeComboBox.Items.Add(new NComboBoxItem(i.ToString()));
            }

            m_FontSizeComboBox.SelectedIndex         = 4;
            m_FontSizeComboBox.SelectedIndexChanged += new Function <NValueChangeEventArgs>(OnFontStyleChanged);
            stack.Add(m_FontSizeComboBox);

            // add style controls
            m_BoldCheckBox                 = new NCheckBox();
            m_BoldCheckBox.Content         = new NLabel("Bold");
            m_BoldCheckBox.CheckedChanged += new Function <NValueChangeEventArgs>(OnFontStyleChanged);
            stack.Add(m_BoldCheckBox);

            m_ItalicCheckBox                 = new NCheckBox();
            m_ItalicCheckBox.Content         = new NLabel("Italic");
            m_ItalicCheckBox.CheckedChanged += new Function <NValueChangeEventArgs>(OnFontStyleChanged);
            stack.Add(m_ItalicCheckBox);

            m_UnderlineCheckBox                 = new NCheckBox();
            m_UnderlineCheckBox.Content         = new NLabel("Underline");
            m_UnderlineCheckBox.CheckedChanged += new Function <NValueChangeEventArgs>(OnFontStyleChanged);
            stack.Add(m_UnderlineCheckBox);

            m_StrikeThroughCheckBox                 = new NCheckBox();
            m_StrikeThroughCheckBox.Content         = new NLabel("Strikethrough");
            m_StrikeThroughCheckBox.CheckedChanged += new Function <NValueChangeEventArgs>(OnFontStyleChanged);
            stack.Add(m_StrikeThroughCheckBox);

            // properties
            NList <NPropertyEditor> editors = NDesigner.GetDesigner(m_Label).CreatePropertyEditors(
                m_Label,
                NLabel.EnabledProperty,
                NLabel.HorizontalPlacementProperty,
                NLabel.VerticalPlacementProperty,
                NLabel.TextAlignmentProperty,
                NLabel.TextWrapModeProperty
                );

            NStackPanel propertiesStack = new NStackPanel();

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

            // make sure font style is updated
            OnFontStyleChanged(null);

            stack.Add(new NGroupBox("Properties", new NUniSizeBoxGroup(propertiesStack)));
            return(stack);
        }