public override object EditValue(ITypeDescriptorContext context,
                                         IServiceProvider provider,
                                         object value)
        {
            if ((context == null) || (provider == null))
            {
                return(base.EditValue(context, provider, value));
            }

            // Access the Property Browser's UI display service
            IWindowsFormsEditorService editorService =
                (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));

            if (editorService == null)
            {
                return(base.EditValue(context, provider, value));
            }

            // Create an instance of the UI editor form
            IReportItem iri = context.Instance as IReportItem;

            if (iri == null)
            {
                return(base.EditValue(context, provider, value));
            }
            PropertyReportItem pre = iri.GetPRI();

            string[]           names;
            PropertyBackground pb = value as PropertyBackground;

            if (pb != null)
            {
                names = pb.Names;
            }
            else
            {
                PropertyBackgroundImage pbi = value as PropertyBackgroundImage;
                if (pbi == null)
                {
                    return(base.EditValue(context, provider, value));
                }
                names = pbi.Names;
            }

            using (SingleCtlDialog scd = new SingleCtlDialog(pre.DesignCtl, pre.Draw, pre.Nodes,
                                                             SingleCtlTypeEnum.BackgroundCtl, names))
            {
                // Display the UI editor dialog
                if (editorService.ShowDialog(scd) == DialogResult.OK)
                {
                    // Return the new property value from the UI editor form
                    return(new PropertyBackground(pre));
                }

                return(base.EditValue(context, provider, value));
            }
        }
        internal PropertyBackground(PropertyReportItem ri, params string[] names)
        {
            pri = ri;
            _names = names;

            // now build the array used to get/set values
            _subitems = new string[names.Length + 2];
            int i = 0;
            foreach (string s in names)
                _subitems[i++] = s;

            _subitems[i++] = "Style";
        }
        public override object EditValue(ITypeDescriptorContext context,
                                         IServiceProvider provider,
                                         object value)
        {
            if ((context == null) || (provider == null))
            {
                return(base.EditValue(context, provider, value));
            }

            // Access the Property Browser's UI display service
            IWindowsFormsEditorService editorService =
                (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));

            if (editorService == null)
            {
                return(base.EditValue(context, provider, value));
            }

            // Create an instance of the UI editor form
            IReportItem iri = context.Instance as IReportItem;

            if (iri == null)
            {
                return(base.EditValue(context, provider, value));
            }
            PropertyReportItem pre = iri.GetPRI();

            PropertyAction pa = value as PropertyAction;

            if (pa == null)
            {
                return(base.EditValue(context, provider, value));
            }

            SingleCtlDialog scd = new SingleCtlDialog(pre.DesignCtl, pre.Draw, pre.Nodes, SingleCtlTypeEnum.InteractivityCtl, null);

            try
            {
                // Display the UI editor dialog
                if (editorService.ShowDialog(scd) == DialogResult.OK)
                {
                    // Return the new property value from the UI editor form
                    return(new PropertyAction(pre));
                }
            }
            finally
            {
                scd.Dispose();
            }
            return(base.EditValue(context, provider, value));
        }
        internal PropertyBackground(PropertyReportItem ri, params string[] names)
        {
            pri    = ri;
            _names = names;

            // now build the array used to get/set values
            _subitems = new string[names.Length + 2];
            int i = 0;

            foreach (string s in names)
            {
                _subitems[i++] = s;
            }

            _subitems[i++] = "Style";
        }
Example #5
0
        /// <summary>
        /// Our main function.  We display the vertices of a FunkyButton as properties by creating
        /// PropertyDescriptors for each one.
        /// </summary>
        /// <param name="context"></param>
        /// <param name="component"></param>
        /// <param name="attrs"></param>
        /// <returns></returns>
        public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object component, Attribute[] attrs)
        {
            PropertyReportItem pri = component as PropertyReportItem;

            // we can get things besides PropertyReportItems here.  Since we want our Point types
            // to be expandable, the PropertyGrid will still ask this PropertyTab for the properties of
            // points, so we default to the standard way of getting properties from other types of objects.
            //
            if (pri == null)
            {
                TypeConverter tc = TypeDescriptor.GetConverter(component);
                if (tc != null)
                {
                    return(tc.GetProperties(context, component, attrs));
                }
                else
                {
                    return(TypeDescriptor.GetProperties(component, attrs));
                }
            }

            _pri = pri;
            XmlNode tnode = _pri.TableNode;

            // Get the collection of properties
            PropertyDescriptorCollection pdc = new PropertyDescriptorCollection(null);

            if (tnode == null) // return empty if no table
            {
                return(pdc);
            }

            PropertyDescriptorCollection bProps =
                TypeDescriptor.GetProperties(_pri, true);

            // For each property use a property descriptor of our own that is able to
            // be globalized
            foreach (PropertyDescriptor p in bProps)
            {
                if (p.Category != "Table")
                {
                    continue;
                }
                pdc.Add(p);
            }
            return(pdc);
        }
        public override object EditValue(ITypeDescriptorContext context,
                                         IServiceProvider provider,
                                         object value)
        {
            if ((context == null) || (provider == null))
            {
                return(base.EditValue(context, provider, value));
            }

            // Access the Property Browser's UI display service
            IWindowsFormsEditorService editorService =
                (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));

            if (editorService == null)
            {
                return(base.EditValue(context, provider, value));
            }

            // Create an instance of the UI editor form
            IReportItem iri = context.Instance as IReportItem;

            if (iri == null)
            {
                return(base.EditValue(context, provider, value));
            }
            PropertyReportItem pri = iri.GetPRI();

            PropertyExpr pe = value as PropertyExpr;

            if (pe == null)
            {
                return(base.EditValue(context, provider, value));
            }

            using (DialogExprEditor de = new DialogExprEditor(pri.Draw, pe.Expression, pri.Node))
            {
                // Display the UI editor dialog
                if (editorService.ShowDialog(de) == DialogResult.OK)
                {
                    // Return the new property value from the UI editor form
                    return(new PropertyExpr(de.Expression));
                }

                return(base.EditValue(context, provider, value));
            }
        }
        internal PropertyAppearance(PropertyReportItem ri, params string[] names)
        {
            pri = ri;
            _names = names;

            // now build the array used to get/set values
            if (names != null)
            {
                _subitems = new string[names.Length + 2];
                int i = 0;
                foreach (string s in names)
                    _subitems[i++] = s;

                _subitems[i++] = "Style";
            }
            else
                _subitems = new string[] { "Style", "" };
        }
Example #8
0
        public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
        {
            PropertyReportItem pr = context.Instance as PropertyReportItem;

            if (pr == null)
            {
                return(base.GetStandardValues(context));
            }

            // Populate with the list of datasets
            ArrayList ar = new ArrayList();

            ar.Add("");         // add an empty string to the collection
            object[] dsn = pr.Draw.DataSetNames;
            if (dsn != null)
            {
                ar.AddRange(dsn);
            }
            return(new StandardValuesCollection(ar));
        }
        internal PropertyBackgroundImage(PropertyReportItem ri, string[] names)
        {
            pri    = ri;
            _names = names;
            if (names == null)
            {
                _subitems = new string[] { "Style", "BackgroundImage", "" };
            }
            else
            {
                // now build the array used to get/set values
                _subitems = new string[names.Length + 3];
                int i = 0;
                foreach (string s in names)
                {
                    _subitems[i++] = s;
                }

                _subitems[i++] = "Style";
                _subitems[i++] = "BackgroundImage";
            }
        }
        internal PropertyAppearance(PropertyReportItem ri, params string[] names)
        {
            pri    = ri;
            _names = names;

            // now build the array used to get/set values
            if (names != null)
            {
                _subitems = new string[names.Length + 2];
                int i = 0;
                foreach (string s in names)
                {
                    _subitems[i++] = s;
                }

                _subitems[i++] = "Style";
            }
            else
            {
                _subitems = new string[] { "Style", "" }
            };
        }
 internal PropertyPadding(PropertyReportItem pri)
 {
     _pri = pri;
     _names = null;
     _subitems = new string[] { "Style", "" };
 }
Example #12
0
 internal PropertySize(PropertyReportItem pri, string h, string w)
 {
     _pri = pri;
     _h   = h;
     _w   = w;
 }
 internal PropertySize(PropertyReportItem pri, string h, string w)
 {
     _pri = pri;
     _h = h;
     _w = w;
 }
 internal PropertyBackground(PropertyReportItem ri)
 {
     pri = ri;
     _names = null;
     _subitems = new string[] { "Style", "" };
 }
 internal PropertyLocation(PropertyReportItem pri, string x, string y)
 {
     _pri = pri;
     _left = x;
     _top = y;
 }
Example #16
0
 internal PropertyPadding(PropertyReportItem pri)
 {
     _pri      = pri;
     _names    = null;
     _subitems = new string[] { "Style", "" };
 }
 internal PropertySorting(PropertyReportItem ri)
 {
     pri = ri;
 }
 internal PropertyVisibility(PropertyReportItem ri)
 {
     pri = ri;
 }
 internal PropertySorting(PropertyReportItem ri)
 {
     pri = ri;
 }
 internal PropertyAction(PropertyReportItem ri)
 {
     pri = ri;
 }
 internal PropertyAppearance(PropertyReportItem ri)
 {
     pri       = ri;
     _names    = null;
     _subitems = new string[] { "Style", "" };
 }
 internal PropertyAppearance(PropertyReportItem ri)
 {
     pri = ri;
     _names = null;
     _subitems = new string[] { "Style", "" };
 }
 internal PropertyBackground(PropertyReportItem ri)
 {
     pri       = ri;
     _names    = null;
     _subitems = new string[] { "Style", "" };
 }
Example #24
0
 internal PropertyGrouping(PropertyReportItem ri)
 {
     pri = ri;
 }
 internal PropertyGrouping(PropertyReportItem ri)
 {
     pri = ri;
 }
 internal PropertyFilters(PropertyReportItem ri)
 {
     pri = ri;
 }
Example #27
0
        /// <summary>
        /// The Table contains a PropertyReportItem
        /// </summary>
        /// <param name="o"></param>
        /// <returns></returns>
        public override bool CanExtend(object o)
        {
            PropertyReportItem pri = o as PropertyReportItem;

            return(!(pri == null || pri.TableNode == null));
        }
 internal PropertyVisibility(PropertyReportItem ri)
 {
     pri = ri;
 }
 internal PropertyAction(PropertyReportItem ri)
 {
     pri = ri;
 }
 internal PropertyFilters(PropertyReportItem ri)
 {
     pri = ri;
 }
        public override object EditValue(ITypeDescriptorContext context,
                                         IServiceProvider provider,
                                         object value)
        {
            if ((context == null) || (provider == null))
            {
                return(base.EditValue(context, provider, value));
            }

            // Access the Property Browser's UI display service
            IWindowsFormsEditorService editorService =
                (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));

            if (editorService == null)
            {
                return(base.EditValue(context, provider, value));
            }

            // Create an instance of the UI editor form
            IReportItem iri = context.Instance as IReportItem;

            if (iri == null)
            {
                return(base.EditValue(context, provider, value));
            }
            PropertyReportItem pri = iri.GetPRI();

            PropertyTable pt = value as PropertyTable;

            if (pt == null)
            {
                return(base.EditValue(context, provider, value));
            }

            //SingleCtlDialog scd = new SingleCtlDialog(pri.DesignCtl, pri.Draw, pri.Nodes, SingleCtlTypeEnum.BorderCtl, pb.Names);
            DesignCtl     dc = pri.DesignCtl;
            DesignXmlDraw dp = dc.DrawCtl;

            if (dp.SelectedCount != 1)
            {
                return(base.EditValue(context, provider, value));
            }
            XmlNode riNode = dp.SelectedList[0];
            XmlNode table  = dp.GetTableFromReportItem(riNode);

            if (table == null)
            {
                return(base.EditValue(context, provider, value));
            }
            XmlNode tc = dp.GetTableColumn(riNode);
            XmlNode tr = dp.GetTableRow(riNode);

            List <XmlNode> ar = new List <XmlNode>();             // need to put this is a list for dialog to handle

            ar.Add(table);
            dc.UndoObject.StartUndoGroup("Table Dialog");
            using (PropertyDialog pd = new PropertyDialog(dp, ar, PropertyTypeEnum.ReportItems, tc, tr))
            {
                // Display the UI editor dialog
                DialogResult dr = editorService.ShowDialog(pd);
                dc.UndoObject.EndUndoGroup(pd.Changed || dr == DialogResult.OK);
                if (pd.Changed || dr == DialogResult.OK)
                {
                    dp.Invalidate();
                    return(new PropertyTable(dp, dc, pt.Nodes));
                }

                return(base.EditValue(context, provider, value));
            }
        }
        internal PropertyBackgroundImage(PropertyReportItem ri, string[] names)
        {
            pri = ri;
            _names = names;
            if (names == null)
            {
                _subitems = new string[] { "Style", "BackgroundImage", "" };
            }
            else
            {
                // now build the array used to get/set values
                _subitems = new string[names.Length + 3];
                int i = 0;
                foreach (string s in names)
                    _subitems[i++] = s;

                _subitems[i++] = "Style";
                _subitems[i++] = "BackgroundImage";
            }
        }
 internal PropertyLocation(PropertyReportItem pri, string x, string y)
 {
     _pri  = pri;
     _left = x;
     _top  = y;
 }
        /// <summary>
        /// Our main function.  We display the vertices of a FunkyButton as properties by creating
        /// PropertyDescriptors for each one.
        /// </summary>
        /// <param name="context"></param>
        /// <param name="component"></param>
        /// <param name="attrs"></param>
        /// <returns></returns>
        public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object component, Attribute[] attrs)
        {
            PropertyReportItem pri = component as PropertyReportItem;

            // we can get things besides PropertyReportItems here.  Since we want our Point types
            // to be expandable, the PropertyGrid will still ask this PropertyTab for the properties of
            // points, so we default to the standard way of getting properties from other types of objects.
            //
            if (pri == null)
            {

                TypeConverter tc = TypeDescriptor.GetConverter(component);
                if (tc != null)
                {
                    return tc.GetProperties(context, component, attrs);
                }
                else
                {
                    return TypeDescriptor.GetProperties(component, attrs);
                }
            }

            _pri = pri;
            XmlNode tnode = _pri.TableNode;

            // Get the collection of properties
            PropertyDescriptorCollection pdc = new PropertyDescriptorCollection(null);

            if (tnode == null) // return empty if no table
                return pdc;

            PropertyDescriptorCollection bProps =
                              TypeDescriptor.GetProperties(_pri, true);

            // For each property use a property descriptor of our own that is able to 
            // be globalized
            foreach (PropertyDescriptor p in bProps)
            {
                if (p.Category != "Table")
                    continue;
                pdc.Add(p);
            }
            return pdc;

        }