Ejemplo n.º 1
0
        private NNumberPropertyEditor CreateEditor(NProperty property, double step, double min, double max, int decimalPlaces)
        {
            NNumberPropertyEditor editor = (NNumberPropertyEditor)CreateEditor(property);
            NSimpleNode           node   = (NSimpleNode)editor.EditedNode;

            if (Double.IsNaN(step) == false)
            {
                editor.Step = step;
            }

            if (Double.IsNaN(min) == false)
            {
                editor.Minimum = min;
            }

            if (Double.IsNaN(max) == false)
            {
                editor.Maximum = max;
            }

            if (decimalPlaces != -1 && editor is NFloatingNumberPropertyEditor)
            {
                ((NFloatingNumberPropertyEditor)editor).DecimalPlaces = decimalPlaces;
            }

            // Ensure the value is in the range [min, max]
            double value = Convert.ToDouble(node.GetValue(property));

            if (value < min)
            {
                node.SetValue(property, Convert.ChangeType(editor.Minimum, property.DomType.Type, CultureInfo.InvariantCulture));
            }
            if (value > max)
            {
                node.SetValue(property, Convert.ChangeType(editor.Maximum, property.DomType.Type, CultureInfo.InvariantCulture));
            }

            return(editor);
        }
Ejemplo n.º 2
0
        protected override NWidget CreateExampleContent()
        {
            NTab tab = new NTab();

            m_SimpleNode = new NSimpleNode();

            // Primitive types
            tab.TabPages.Add(CreateBooleanPage());
            tab.TabPages.Add(CreateInt32Page());
            tab.TabPages.Add(CreateInt64Page());
            tab.TabPages.Add(CreateUInt32Page());
            tab.TabPages.Add(CreateSinglePage());
            tab.TabPages.Add(CreateDoublePage());
            tab.TabPages.Add(CreateEnumPage());

            // Nevron types
            tab.TabPages.Add(CreateAnglePage());
            tab.TabPages.Add(CreateColorPage());
            tab.TabPages.Add(CreateGraphicsCorePage());
            tab.TabPages.Add(CreateTextPage());

            return(tab);
        }