Example #1
0
        protected override PropertyManagerPageTextBlockControl CreateControl(
            IPropertyManagerPageLabel swCtrl, IAttributeSet atts, IMetadata[] metadata,
            SwPropertyManagerPageHandler handler, short height, IPropertyManagerPageLabel label)
        {
            if (height != -1)
            {
                swCtrl.Height = height;
            }

            var fontStyle = FontStyle_e.Default;
            var font      = "";
            var textColor = default(KnownColor?);

            if (atts.Has <ControlOptionsAttribute>())
            {
                textColor = atts.Get <ControlOptionsAttribute>().TextColor;
            }

            if (atts.Has <TextBlockOptionsAttribute>())
            {
                var style = atts.Get <TextBlockOptionsAttribute>();

                swCtrl.Style = (int)style.TextAlignment;

                fontStyle = style.FontStyle;
                font      = style.Font;

                swCtrl.SetLabelOptions(fontStyle, font, textColor);
            }

            return(new PropertyManagerPageTextBlockControl(atts.Id, atts.Tag, swCtrl, fontStyle, font, textColor, handler, label, metadata));
        }
Example #2
0
        private swAddGroupBoxOptions_e GetGroupOptions(IAttributeSet atts, IMetadata[] metadata, out IMetadata toggleMetadata)
        {
            GroupBoxOptions_e opts = 0;

            if (atts.Has <IGroupBoxOptionsAttribute>())
            {
                opts = atts.Get <IGroupBoxOptionsAttribute>().Options;
            }

            var swOpts = swAddGroupBoxOptions_e.swGroupBoxOptions_Visible;

            if (!opts.HasFlag(GroupBoxOptions_e.Collapsed))
            {
                swOpts |= swAddGroupBoxOptions_e.swGroupBoxOptions_Expanded;
            }

            if (atts.Has <ICheckableGroupBoxAttribute>())
            {
                var checkAtt = atts.Get <ICheckableGroupBoxAttribute>();

                swOpts        |= swAddGroupBoxOptions_e.swGroupBoxOptions_Checkbox;
                toggleMetadata = metadata?.FirstOrDefault(m => object.Equals(m.Tag, checkAtt.ToggleMetadataTag));

                if (toggleMetadata == null)
                {
                    throw new NullReferenceException($"Failed to find the metadata to drive group toggle: '{checkAtt.ToggleMetadataTag}'");
                }
            }
            else
            {
                toggleMetadata = null;
            }

            return(swOpts);
        }
        protected override PropertyManagerPageComboBoxControl <TVal> CreateControl(
            IPropertyManagerPageCombobox swCtrl, IAttributeSet atts, IMetadata[] metadata,
            SwPropertyManagerPageHandler handler, short height, IPropertyManagerPageLabel label)
        {
            if (height != -1)
            {
                swCtrl.Height = height;
            }

            if (atts.Has <ComboBoxOptionsAttribute>())
            {
                var opts = atts.Get <ComboBoxOptionsAttribute>();

                if (opts.Style != 0)
                {
                    swCtrl.Style = (int)opts.Style;
                }
            }

            m_Helper.ParseItems(m_SwApp, atts, metadata, out bool isStatic, out ItemsControlItem[] staticItems, out IMetadata srcMetadata);

            var ctrl = new PropertyManagerPageComboBoxControl <TVal>(atts.Id, atts.Tag, swCtrl, handler, srcMetadata, label, atts.ContextType, isStatic, staticItems, metadata);

            return(ctrl);
        }
Example #4
0
        protected override PropertyManagerPageNumberBoxControl CreateControl(
            IPropertyManagerPageNumberbox swCtrl, IAttributeSet atts, IMetadata[] metadata,
            SwPropertyManagerPageHandler handler, short height, IPropertyManagerPageLabel label)
        {
            if (height != -1)
            {
                swCtrl.Height = height;
            }

            if (atts.Has <NumberBoxOptionsAttribute>())
            {
                var style = atts.Get <NumberBoxOptionsAttribute>();

                if (style.Style != 0)
                {
                    swCtrl.Style = (int)style.Style;
                }

                if (style.Units != 0)
                {
                    swCtrl.SetRange2((int)style.Units, style.Minimum, style.Maximum,
                                     style.Inclusive, style.Increment, style.FastIncrement, style.SlowIncrement);
                }
            }

            return(new PropertyManagerPageNumberBoxControl(atts.Id, atts.Tag, swCtrl, handler, label, metadata));
        }
        protected override PropertyManagerPageComboBoxControl <TVal> CreateControl(
            IPropertyManagerPageCombobox swCtrl, IAttributeSet atts, IMetadata metadata,
            SwPropertyManagerPageHandler handler, short height)
        {
            if (height != -1)
            {
                swCtrl.Height = height;
            }

            var selDefVal = false;

            if (atts.Has <ComboBoxOptionsAttribute>())
            {
                var opts = atts.Get <ComboBoxOptionsAttribute>();

                if (opts.Style != 0)
                {
                    swCtrl.Style = (int)opts.Style;
                }

                selDefVal = opts.SelectDefaultValue;
            }

            var ctrl = new PropertyManagerPageComboBoxControl <TVal>(atts.Id, atts.Tag, selDefVal, swCtrl, handler, metadata);

            ctrl.Items = m_Helper.GetItems(m_SwApp, atts);
            return(ctrl);
        }
        protected override PropertyManagerPageSelectionBoxControl CreateControl(
            IPropertyManagerPageSelectionbox swCtrl, IAttributeSet atts, IMetadata metadata,
            SwPropertyManagerPageHandler handler, short height)
        {
            swCtrl.SingleEntityOnly = !(typeof(IList).IsAssignableFrom(atts.ContextType));

            if (height == -1)
            {
                height = 20;
            }

            swCtrl.Height = height;

            ISelectionCustomFilter customFilter = null;

            var filters = SelectionBoxConstructorHelper.GetDefaultFilters(atts);

            bool focusOnOpen = false;

            if (atts.Has <SelectionBoxOptionsAttribute>())
            {
                var selAtt = atts.Get <SelectionBoxOptionsAttribute>();

                if (selAtt.Style != 0)
                {
                    swCtrl.Style = (int)selAtt.Style;
                }

                if (selAtt.SelectionColor != 0)
                {
                    swCtrl.SetSelectionColor(true, (int)selAtt.SelectionColor);
                }

                if (selAtt.Filters?.Any() == true)
                {
                    filters = selAtt.Filters;
                }

                swCtrl.Mark = selAtt.SelectionMark;

                focusOnOpen = selAtt.Focused;

                if (selAtt.CustomFilter != null)
                {
                    customFilter = Activator.CreateInstance(selAtt.CustomFilter) as ISelectionCustomFilter;

                    if (customFilter == null)
                    {
                        throw new InvalidCastException(
                                  $"Specified custom filter of type {selAtt.CustomFilter.FullName} cannot be cast to {typeof(ISelectionCustomFilter).FullName}");
                    }
                }
            }

            swCtrl.SetSelectionFilters(filters.Select(f => (swSelectType_e)f).ToArray());

            return(new PropertyManagerPageSelectionBoxControl(m_SwApp, atts.Id, atts.Tag,
                                                              swCtrl, handler, atts.ContextType, customFilter, focusOnOpen));
        }
        protected override PropertyManagerPageSelectionBoxControl CreateControl(
            IPropertyManagerPageSelectionbox swCtrl, IAttributeSet atts, SwPropertyManagerPageHandler handler, short height)
        {
            swCtrl.SingleEntityOnly = !(typeof(IList).IsAssignableFrom(atts.BoundType));

            if (height == -1)
            {
                height = 20;
            }

            swCtrl.Height = height;

            ISelectionCustomFilter customFilter = null;

            SelectType_e[] filters = null;

            if (atts.Has <SelectionBoxOptionsAttribute>())
            {
                var selAtt = atts.Get <SelectionBoxOptionsAttribute>();

                if (selAtt.Style != 0)
                {
                    swCtrl.Style = (int)selAtt.Style;
                }

                if (selAtt.SelectionColor != 0)
                {
                    swCtrl.SetSelectionColor(true, ConvertColor(selAtt.SelectionColor));
                }

                if (selAtt.Filters != null)
                {
                    filters = selAtt.Filters;
                }

                swCtrl.Mark = selAtt.SelectionMark;

                if (selAtt.CustomFilter != null)
                {
                    customFilter = Activator.CreateInstance(selAtt.CustomFilter) as ISelectionCustomFilter;

                    if (customFilter == null)
                    {
                        throw new InvalidCastException(
                                  $"Specified custom filter of type {selAtt.CustomFilter.FullName} cannot be cast to {typeof(ISelectionCustomFilter).FullName}");
                    }
                }
            }
            else
            {
                filters = GetDefaultFilters(atts, out customFilter);
            }

            swCtrl.SetSelectionFilters(filters);

            return(new PropertyManagerPageSelectionBoxControl(m_SwApp, atts.Id, atts.Tag,
                                                              swCtrl, handler, atts.BoundType, customFilter));
        }
        protected override PropertyManagerPageListBoxControl CreateControl(
            IPropertyManagerPageListbox swCtrl, IAttributeSet atts, IMetadata[] metadata,
            SwPropertyManagerPageHandler handler, short height, IPropertyManagerPageLabel label)
        {
            if (height <= 0)
            {
                height = 50;
            }

            swCtrl.Height = height;

            int  style     = 0;
            bool sortItems = false;

            if (atts.Has <ListBoxOptionsAttribute>())
            {
                var opts = atts.Get <ListBoxOptionsAttribute>();

                if (opts.Style != 0)
                {
                    style = (int)opts.Style;

                    if (opts.Style.HasFlag(ListBoxStyle_e.Sorted))
                    {
                        sortItems = true;
                        style    -= (int)ListBoxStyle_e.Sorted;
                    }
                }
            }

            var isMultiSelect = (atts.ContextType.IsEnum &&
                                 atts.ContextType.GetCustomAttribute <FlagsAttribute>() != null) ||
                                typeof(IList).IsAssignableFrom(atts.ContextType);

            if (isMultiSelect)
            {
                style = style + (int)swPropMgrPageListBoxStyle_e.swPropMgrPageListBoxStyle_MultipleItemSelect;
            }

            swCtrl.Style = style;

            m_Helper.ParseItems(m_SwApp, atts, metadata, out bool isStatic, out ItemsControlItem[] staticItems, out IMetadata srcMetadata);

            var ctrl = new PropertyManagerPageListBoxControl(atts.Id, atts.Tag, swCtrl, atts.ContextType, isMultiSelect,
                                                             handler, srcMetadata, label, atts.ContextType, metadata);

            if (isStatic)
            {
                if (sortItems)
                {
                    staticItems = staticItems.OrderBy(i => i.DisplayName).ToArray();
                }

                ctrl.Items = staticItems;
            }

            return(ctrl);
        }
Example #9
0
        private IPageElementConstructor <TGroup, TPage> FindConstructor(Type type, IAttributeSet atts)
        {
            if (atts == null)
            {
                throw new ArgumentNullException(nameof(atts));
            }

            IPageElementConstructor <TGroup, TPage> constr = null;

            if (atts.Has <ISpecificConstructorAttribute>())
            {
                var constrType = atts.Get <ISpecificConstructorAttribute>().ConstructorType;

                var constrs = m_SpecificConstructors.Where(c => constrType.IsAssignableFrom(c.Key));

                if (constrs.Count() == 1)
                {
                    constr = constrs.First().Value;
                }
                else if (!constrs.Any())
                {
                    throw new ConstructorNotFoundException(type, "Specific constructor is not registered");
                }
                else
                {
                    throw new ConstructorNotFoundException(type, "Too many constructors registered");
                }
            }
            else
            {
                if (!m_DefaultConstructors.TryGetValue(type, out constr))
                {
                    constr = m_DefaultConstructors.FirstOrDefault(
                        t => t.Key.IsAssignableFrom(type)).Value;

                    if (constr == null)
                    {
                        foreach (var specType in SpecialTypes.FindMathingSpecialTypes(type))
                        {
                            if (m_SpecialTypeConstructors.TryGetValue(specType, out constr))
                            {
                                break;
                            }
                        }
                    }
                }
            }

            if (constr != null)
            {
                return(constr);
            }
            else
            {
                throw new ConstructorNotFoundException(type);
            }
        }
        protected override PropertyManagerPageBitmapEx CreateControl(
            IPropertyManagerPageBitmap swCtrl, IAttributeSet atts, THandler handler, short height)
        {
            Size?size = null;

            if (atts.Has <BitmapOptionsAttribute>())
            {
                var opts = atts.Get <BitmapOptionsAttribute>();
                size = opts.Size;
            }

            return(new PropertyManagerPageBitmapEx(m_IconsConv, atts.Id, atts.Tag, size, swCtrl, handler));
        }
Example #11
0
        protected override PropertyManagerPageBitmapControl CreateControl(
            IPropertyManagerPageBitmap swCtrl, IAttributeSet atts, IMetadata[] metadata,
            SwPropertyManagerPageHandler handler, short height, IPropertyManagerPageLabel label)
        {
            Size?size = null;

            if (atts.Has <BitmapOptionsAttribute>())
            {
                var opts = atts.Get <BitmapOptionsAttribute>();
                size = opts.Size;
            }

            return(new PropertyManagerPageBitmapControl(m_IconsConv, atts.Id, atts.Tag, size, swCtrl, handler, label, metadata));
        }
Example #12
0
        private swAddGroupBoxOptions_e GetGroupOptions(IAttributeSet atts)
        {
            GroupBoxOptions_e opts = 0;

            if (atts.Has <IGroupBoxOptionsAttribute>())
            {
                opts = atts.Get <IGroupBoxOptionsAttribute>().Options;
            }

            var swOpts = swAddGroupBoxOptions_e.swGroupBoxOptions_Visible;

            if (!opts.HasFlag(GroupBoxOptions_e.Collapsed))
            {
                swOpts |= swAddGroupBoxOptions_e.swGroupBoxOptions_Expanded;
            }

            if (atts.Has <ICheckableGroupBoxAttribute>())
            {
                swOpts |= swAddGroupBoxOptions_e.swGroupBoxOptions_Checkbox;
            }

            return(swOpts);
        }
Example #13
0
        private ControlOptionsAttribute GetControlOptions(IAttributeSet atts)
        {
            ControlOptionsAttribute opts;

            if (atts.Has <ControlOptionsAttribute>())
            {
                opts = atts.Get <ControlOptionsAttribute>();
            }
            else
            {
                opts = new ControlOptionsAttribute();
            }

            return(opts);
        }
        protected override PropertyManagerPageOptionBoxControl CreateControl(
            PropertyManagerPageOptionBox swCtrl, IAttributeSet atts, SwPropertyManagerPageHandler handler, short height)
        {
            var options = EnumExtension.GetEnumFields(atts.BoundType);

            if (atts.Has <OptionBoxOptionsAttribute>())
            {
                var style = atts.Get <OptionBoxOptionsAttribute>();

                if (style.Style != 0)
                {
                    swCtrl.Style = (int)style.Style;
                }
            }

            return(new PropertyManagerPageOptionBoxControl(atts.Id, atts.Tag, swCtrl, options.Keys.ToList().AsReadOnly(), handler));
        }
        protected override PropertyManagerPageLabelEx CreateControl(IPropertyManagerPageLabel swCtrl, IAttributeSet atts, THandler handler, short height)
        {
            if (height != -1)
            {
                swCtrl.Height = height;
            }

            if (atts.Has <LabelOptionsAttribute>())
            {
                var style = atts.Get <ComboBoxOptionsAttribute>();
                if (style.Style != 0)
                {
                    swCtrl.Style = (int)style.Style;
                }
            }

            return(new PropertyManagerPageLabelEx(swCtrl, atts.Id, atts.Tag, handler));
        }
Example #16
0
        protected override PropertyManagerPageTextBoxControl CreateControl(
            IPropertyManagerPageTextbox swCtrl, IAttributeSet atts, SwPropertyManagerPageHandler handler, short height)
        {
            if (height != -1)
            {
                swCtrl.Height = height;
            }

            if (atts.Has <TextBoxOptionsAttribute>())
            {
                var style = atts.Get <TextBoxOptionsAttribute>();

                if (style.Style != 0)
                {
                    swCtrl.Style = (int)style.Style;
                }
            }

            return(new PropertyManagerPageTextBoxControl(atts.Id, atts.Tag, swCtrl, handler));
        }
        protected override PropertyManagerPageComboBoxControl <TVal> CreateControl(
            IPropertyManagerPageCombobox swCtrl, IAttributeSet atts, SwPropertyManagerPageHandler handler, short height)
        {
            if (height != -1)
            {
                swCtrl.Height = height;
            }

            if (atts.Has <ComboBoxOptionsAttribute>())
            {
                var style = atts.Get <ComboBoxOptionsAttribute>();

                if (style.Style != 0)
                {
                    swCtrl.Style = (int)style.Style;
                }
            }

            var ctrl = new PropertyManagerPageComboBoxControl <TVal>(atts.Id, atts.Tag, swCtrl, handler);

            ctrl.Items = GetItems(atts);
            return(ctrl);
        }
        protected override PropertyManagerPageComboBoxEx CreateControl(
            IPropertyManagerPageCombobox swCtrl, IAttributeSet atts, THandler handler, short height)
        {
            var items = Helper.GetEnumFields(atts.BoundType);

            swCtrl.AddItems(items.Values.ToArray());

            if (height != -1)
            {
                swCtrl.Height = height;
            }

            if (atts.Has <ComboBoxOptionsAttribute>())
            {
                var style = atts.Get <ComboBoxOptionsAttribute>();

                if (style.Style != 0)
                {
                    swCtrl.Style = (int)style.Style;
                }
            }

            return(new PropertyManagerPageComboBoxEx(atts.Id, atts.Tag, swCtrl, items.Keys.ToList().AsReadOnly(), handler));
        }
Example #19
0
        private void AssignControlAttributes(TControlSw ctrl, ControlOptionsAttribute opts, IAttributeSet atts)
        {
            var swCtrl = ctrl as IPropertyManagerPageControl;

            if (opts.BackgroundColor != 0)
            {
                swCtrl.BackgroundColor = ConvertColor(opts.BackgroundColor);
            }

            if (opts.TextColor != 0)
            {
                swCtrl.TextColor = ConvertColor(opts.TextColor);
            }

            if (opts.Left != -1)
            {
                swCtrl.Left = opts.Left;
            }

            if (opts.Top != -1)
            {
                swCtrl.Top = opts.Top;
            }

            if (opts.Width != -1)
            {
                swCtrl.Width = opts.Width;
            }

            if (opts.ResizeOptions != 0)
            {
                swCtrl.OptionsForResize = (int)opts.ResizeOptions;
            }

            ControlIcon icon = null;

            var commonIcon = atts.BoundMemberInfo?.TryGetAttribute <IconAttribute>()?.Icon;

            if (commonIcon != null)
            {
                icon = new ControlIcon(commonIcon);
            }

            if (atts.Has <ControlAttributionAttribute>())
            {
                var attribution = atts.Get <ControlAttributionAttribute>();

                if (attribution.StandardIcon != 0)
                {
                    swCtrl.SetStandardPictureLabel((int)attribution.StandardIcon);
                }
                //else if (attribution.Icon != null)
                //{
                //    icon = attribution.Icon;
                //}
            }

            if (icon != null)
            {
                var icons = m_IconConv.ConvertIcon(icon);
                var res   = swCtrl.SetPictureLabelByName(icons[0], icons[1]);
                Debug.Assert(res);
            }
        }
        private bool AddLabelIfNeeded(object host, IAttributeSet atts, ref int numberOfUsedIds, out IPropertyManagerPageLabel label)
        {
            if (atts.Has <LabelAttribute>())
            {
                numberOfUsedIds++;

                var id = atts.Id + numberOfUsedIds - 1;

                var labelAtt = atts.Get <LabelAttribute>();

                var legacy = !m_App.IsVersionNewerOrEqual(SwVersion_e.Sw2014, 1);

                var type  = swPropertyManagerPageControlType_e.swControlType_Label;
                var align = (swPropertyManagerPageControlLeftAlign_e)labelAtt.Align;
                var opts  = swAddControlOptions_e.swControlOptions_Enabled | swAddControlOptions_e.swControlOptions_SmallGapAbove | swAddControlOptions_e.swControlOptions_Visible;

                switch (host)
                {
                case IPropertyManagerPage2 page:
                    if (!legacy)
                    {
                        label = (IPropertyManagerPageLabel)page.AddControl2(id, (short)type, labelAtt.Caption,
                                                                            (short)align, (short)opts, atts.Description);
                    }
                    else
                    {
                        label = (IPropertyManagerPageLabel)page.AddControl(id, (short)type, labelAtt.Caption,
                                                                           (short)align, (short)opts, atts.Description);
                    }
                    break;

                case IPropertyManagerPageTab tab:
                    if (!legacy)
                    {
                        label = (IPropertyManagerPageLabel)tab.AddControl2(id, (short)type, labelAtt.Caption,
                                                                           (short)align, (short)opts, atts.Description);
                    }
                    else
                    {
                        label = (IPropertyManagerPageLabel)tab.AddControl(id, (short)type, labelAtt.Caption,
                                                                          (short)align, (short)opts, atts.Description);
                    }
                    break;

                case IPropertyManagerPageGroup group:
                    if (!legacy)
                    {
                        label = (IPropertyManagerPageLabel)group.AddControl2(id, (short)type, labelAtt.Caption,
                                                                             (short)align, (short)opts, atts.Description);
                    }
                    else
                    {
                        label = (IPropertyManagerPageLabel)group.AddControl(id, (short)type, labelAtt.Caption,
                                                                            (short)align, (short)opts, atts.Description);
                    }
                    break;

                default:
                    throw new NotSupportedException("Host is not supported");
                }

                label.Caption = labelAtt.Caption;

                label.SetLabelOptions(labelAtt.FontStyle, "", null);

                return(true);
            }
            else
            {
                label = null;
                return(false);
            }
        }
 public bool Has <TAtt>() where TAtt : Xarial.VPages.Framework.Base.IAttribute
 {
     return(m_BaseAttSet.Has <TAtt>());
 }
 public bool Has <TAtt>() where TAtt : XCad.UI.PropertyPage.Base.IAttribute
 {
     return(m_BaseAttSet.Has <TAtt>());
 }
Example #23
0
        protected override PropertyManagerPagePage Create(IAttributeSet atts)
        {
            int err = -1;

            swPropertyManagerPageOptions_e opts;

            TitleIcon titleIcon = null;

            IconAttribute commIconAtt;

            if (atts.ContextType.TryGetAttribute(out commIconAtt))
            {
                if (commIconAtt.Icon != null)
                {
                    titleIcon = new TitleIcon(commIconAtt.Icon);
                }
            }

            if (atts.Has <PageOptionsAttribute>())
            {
                var optsAtt = atts.Get <PageOptionsAttribute>();

                //TODO: implement conversion
                opts = (swPropertyManagerPageOptions_e)optsAtt.Options;
            }
            else
            {
                //TODO: implement conversion
                opts = (swPropertyManagerPageOptions_e)(PageOptions_e.OkayButton | PageOptions_e.CancelButton);
            }

            var helpLink     = "";
            var whatsNewLink = "";

            if (atts.Has <HelpAttribute>())
            {
                var helpAtt = atts.Get <HelpAttribute>();

                if (!string.IsNullOrEmpty(helpAtt.WhatsNewLink))
                {
                    if (!opts.HasFlag(swPropertyManagerPageOptions_e.swPropertyManagerOptions_WhatsNew))
                    {
                        opts |= swPropertyManagerPageOptions_e.swPropertyManagerOptions_WhatsNew;
                    }
                }

                helpLink     = helpAtt.HelpLink;
                whatsNewLink = helpAtt.WhatsNewLink;
            }

            var page = m_App.CreatePropertyManagerPage(atts.Name,
                                                       (int)opts,
                                                       m_Handler, ref err) as IPropertyManagerPage2;

            if (titleIcon != null)
            {
                var iconPath = m_IconsConv.ConvertIcon(titleIcon).First();
                page.SetTitleBitmap2(iconPath);
            }

            if (atts.Has <MessageAttribute>())
            {
                var msgAtt = atts.Get <MessageAttribute>();
                page.SetMessage3(msgAtt.Text, (int)msgAtt.Visibility,
                                 (int)msgAtt.Expanded, msgAtt.Caption);
            }
            else if (!string.IsNullOrEmpty(atts.Description))
            {
                page.SetMessage3(atts.Description, (int)swPropertyManagerPageMessageVisibility.swMessageBoxVisible,
                                 (int)swPropertyManagerPageMessageExpanded.swMessageBoxExpand, "");
            }

            return(new PropertyManagerPagePage(page, m_Handler, m_App, helpLink, whatsNewLink));
        }
Example #24
0
        private void AssignControlAttributes(TControlSw ctrl, ControlOptionsAttribute opts, IAttributeSet atts)
        {
            var swCtrl = ctrl as IPropertyManagerPageControl;

            if (opts.BackgroundColor != 0)
            {
                swCtrl.BackgroundColor = ConvertColor(opts.BackgroundColor);
            }

            if (opts.TextColor != 0)
            {
                swCtrl.TextColor = ConvertColor(opts.TextColor);
            }

            if (opts.Left != -1)
            {
                swCtrl.Left = opts.Left;
            }

            if (opts.Top != -1)
            {
                swCtrl.Top = opts.Top;
            }

            if (opts.Width != -1)
            {
                swCtrl.Width = opts.Width;
            }

            if (opts.ResizeOptions != 0)
            {
                swCtrl.OptionsForResize = (int)opts.ResizeOptions;
            }

            ControlIcon icon = null;

            var commonIcon = atts.BoundMemberInfo?.TryGetAttribute <IconAttribute>()?.Icon;

            if (commonIcon != null)
            {
                icon = new ControlIcon(IconsConverter.FromXImage(commonIcon));
            }

            var hasIcon = false;

            if (atts.Has <StandardControlIconAttribute>())
            {
                var attribution = atts.Get <StandardControlIconAttribute>();

                if (attribution.Label != 0)
                {
                    hasIcon = true;
                    swCtrl.SetStandardPictureLabel((int)attribution.Label);
                }
            }

            if (icon != null)
            {
                hasIcon = true;
                var icons = m_IconConv.ConvertIcon(icon);
                var res   = swCtrl.SetPictureLabelByName(icons[0], icons[1]);
                Debug.Assert(res);
            }

            if (!hasIcon)
            {
                var defIcon = GetDefaultBitmapLabel(atts);

                if (defIcon.HasValue)
                {
                    swCtrl.SetStandardPictureLabel((int)defIcon.Value);
                }
            }
        }