Exemple #1
0
        private void OnShowDesignerButtonClicked(NEventArgs args)
        {
            NEditor       editor = NDesigner.GetDesigner(m_ComboBox).CreateInstanceEditor(m_ComboBox);
            NEditorWindow window = NApplication.CreateTopLevelWindow <NEditorWindow>();

            window.Editor = editor;
            window.Open();
        }
Exemple #2
0
        /// <summary>
        /// Called when the Show Application StyleSheets is clicked - shows the NApplicaiton.
        /// </summary>
        /// <param name="arg1"></param>
        void OnShowApplicationStyleSheetsClick(NEventArgs arg1)
        {
            NDesigner designer = NDesigner.GetDesigner(NApplication.Desktop.OwnerDocument.StyleSheets);
            NEditor   editor   = designer.CreateInstanceEditor(NApplication.Desktop.OwnerDocument.StyleSheets);

            NEditorWindow window = new NEditorWindow();

            window.RemoveFromParentOnClose = true;
            window.Editor = editor;

            NApplication.Desktop.Windows.Add(window);
            window.Open();
        }
Exemple #3
0
        protected override NWidget CreateExampleControls()
        {
            NStackPanel stack = (NStackPanel)base.CreateExampleControls();

            NDrawing drawing    = m_DrawingDocument.Content;
            NPage    activePage = drawing.ActivePage;

            NEditor editor = NDesigner.GetDesigner(activePage.LineJumps).CreateStateEditor(activePage.LineJumps);

            stack.Add(editor);

            return(stack);
        }
        protected override NWidget CreateExampleControls()
        {
            NEditor fillEditor = NDesigner.GetDesigner(NFill.NFillSchema).CreatePropertyEditor(this, FillProperty);

            // Stroke color
            m_StrokeColorBox = new NColorBox();
            m_StrokeColorBox.SelectedColor         = m_Stroke.Color;
            m_StrokeColorBox.SelectedColorChanged += new Function <NValueChangeEventArgs>(OnStrokeColorBoxSelectedColorChanged);

            // Stroke width
            m_StrokeWidthCombo = new NComboBox();
            for (int i = 0; i < 6; i++)
            {
                m_StrokeWidthCombo.Items.Add(new NComboBoxItem(i.ToString()));
            }
            m_StrokeWidthCombo.SelectedIndex         = 1;
            m_StrokeWidthCombo.SelectedIndexChanged += new Function <NValueChangeEventArgs>(OnStrokeWidthComboSelectedIndexChanged);

            // Canvas width editor
            m_CanvasWidthUpDown               = new NNumericUpDown();
            m_CanvasWidthUpDown.Minimum       = 100;
            m_CanvasWidthUpDown.Maximum       = 350;
            m_CanvasWidthUpDown.Value         = defaultCanvasWidth;
            m_CanvasWidthUpDown.Step          = 1;
            m_CanvasWidthUpDown.DecimalPlaces = 0;
            m_CanvasWidthUpDown.ValueChanged += new Function <NValueChangeEventArgs>(OnNumericUpDownValueChanged);

            // Canvas height editor
            m_CanvasHeightUpDown               = new NNumericUpDown();
            m_CanvasHeightUpDown.Minimum       = 100;
            m_CanvasHeightUpDown.Maximum       = 350;
            m_CanvasHeightUpDown.Value         = defaultCanvasHeight;
            m_CanvasHeightUpDown.Step          = 1;
            m_CanvasHeightUpDown.DecimalPlaces = 0;
            m_CanvasHeightUpDown.ValueChanged += new Function <NValueChangeEventArgs>(OnNumericUpDownValueChanged);

            NStackPanel stack = new NStackPanel();

            stack.FillMode = ENStackFillMode.None;
            stack.FitMode  = ENStackFitMode.None;
            stack.Add(fillEditor);
            stack.Add(NPairBox.Create("Stroke Color:", m_StrokeColorBox));
            stack.Add(NPairBox.Create("Stroke Width:", m_StrokeWidthCombo));
            stack.Add(NPairBox.Create("Canvas Width:", m_CanvasWidthUpDown));
            stack.Add(NPairBox.Create("Canvas Height:", m_CanvasHeightUpDown));

            return(new NUniSizeBoxGroup(stack));
        }
        private void OnButtonClick(NEventArgs args)
        {
            NButton button = args.TargetNode as NButton;

            if (button == null)
            {
                return;
            }

            NDesigner     designer = (NDesigner)button.Tag;
            NEditor       editor   = designer.CreateInstanceEditor(m_Node);
            NEditorWindow window   = NApplication.CreateTopLevelWindow <NEditorWindow>();

            window.Editor = editor;
            window.Modal  = false;
            window.Open();
        }
        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);
        }