public PropertyManagerPageCheckBoxControl(int id, object tag,
                                           IPropertyManagerPageCheckbox checkBox,
                                           SwPropertyManagerPageHandler handler, IPropertyManagerPageLabel label, IMetadata[] metadata)
     : base(checkBox, id, tag, handler, label, metadata)
 {
     m_Handler.CheckChanged += OnCheckChanged;
 }
 public PropertyManagerPageComboBoxControl(int id, object tag,
                                           IPropertyManagerPageCombobox comboBox, ReadOnlyCollection <Enum> values,
                                           SwPropertyManagerPageHandler handler) : base(comboBox, id, tag, handler)
 {
     m_Values = values;
     m_Handler.ComboBoxChanged += OnComboBoxChanged;
 }
Ejemplo n.º 3
0
 public PropertyManagerPageOptionBoxControl(int id, object tag,
                                            PropertyManagerPageOptionBox optionBox, ReadOnlyCollection <Enum> values,
                                            SwPropertyManagerPageHandler handler) : base(optionBox, id, tag, handler)
 {
     m_Values = values;
     m_Handler.OptionChecked += OnOptionChecked;
 }
Ejemplo n.º 4
0
 internal PropertyManagerPageTextBoxControl(int id, object tag,
                                            IPropertyManagerPageTextbox textBox,
                                            SwPropertyManagerPageHandler handler, IPropertyManagerPageLabel label, IMetadata[] metadata)
     : base(textBox, id, tag, handler, label, metadata)
 {
     m_Handler.TextChanged += OnTextChanged;
 }
Ejemplo n.º 5
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));
        }
Ejemplo n.º 6
0
        protected override PropertyManagerPageBitmapButtonControl CreateControl(
            IPropertyManagerPageBitmapButton swCtrl, IAttributeSet atts, SwPropertyManagerPageHandler handler, short height)
        {
            var bmpAtt = atts.Get <BitmapButtonAttribute>();

            if (bmpAtt.StandardIcon.HasValue)
            {
                swCtrl.SetStandardBitmaps((int)bmpAtt.StandardIcon.Value);
            }
            else
            {
                var bmpWidth  = bmpAtt.Width;
                var bmpHeight = bmpAtt.Height;

                var icon = bmpAtt.Icon ?? Defaults.Icon;

                if (m_App.IsVersionNewerOrEqual(Enums.SwVersion_e.Sw2016))
                {
                    var icons = m_IconsConv.ConvertIcon(new BitmapButtonHighResIcon(icon, bmpWidth, bmpHeight));

                    var imgList     = icons.Take(6).ToArray();
                    var maskImgList = icons.Skip(6).ToArray();
                    swCtrl.SetBitmapsByName3(imgList, maskImgList);
                }
                else
                {
                    var icons = m_IconsConv.ConvertIcon(new BitmapButtonIcon(icon, bmpWidth, bmpHeight));

                    swCtrl.SetBitmapsByName2(icons[0], icons[1]);
                }
            }

            return(new PropertyManagerPageBitmapButtonControl(atts.Id, atts.Tag, swCtrl, handler));
        }
Ejemplo n.º 7
0
 public PropertyManagerPageBitmapButtonControl(int id, object tag,
                                               IPropertyManagerPageBitmapButton bmpButton,
                                               SwPropertyManagerPageHandler handler, IPropertyManagerPageLabel label, IMetadata[] metadata)
     : base(bmpButton, id, tag, handler, label, metadata)
 {
     m_Handler.ButtonPressed += OnButtonPressed;
 }
 internal PropertyManagerPageGroupBase(int id, object tag, SwPropertyManagerPageHandler handler,
                                       ISldWorks app, PropertyManagerPagePage parentPage) : base(id, tag)
 {
     Handler    = handler;
     App        = app;
     ParentPage = parentPage;
 }
        protected override PropertyManagerPageButtonControl CreateControl(
            IPropertyManagerPageButton swCtrl, IAttributeSet atts, SwPropertyManagerPageHandler handler, short height)
        {
            swCtrl.Caption = atts.Name;

            return(new PropertyManagerPageButtonControl(atts.Id, atts.Tag, swCtrl, handler));
        }
Ejemplo n.º 10
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));
        }
Ejemplo n.º 11
0
 public PropertyManagerPageComboBoxControl(int id, object tag, bool selDefVal,
                                           IPropertyManagerPageCombobox comboBox,
                                           SwPropertyManagerPageHandler handler, IMetadata metadata) : base(id, tag, comboBox, handler, metadata)
 {
     m_SelectDefaultValue       = selDefVal;
     m_Handler.ComboBoxChanged += OnComboBoxChanged;
 }
        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);
        }
Ejemplo n.º 13
0
 public PropertyManagerPageNumberBoxControl(int id, object tag,
                                            IPropertyManagerPageNumberbox numberBox,
                                            SwPropertyManagerPageHandler handler, IPropertyManagerPageLabel label, IMetadata[] metadata)
     : base(numberBox, id, tag, handler, label, metadata)
 {
     m_Handler.NumberChanged += OnNumberChanged;
 }
        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);
        }
        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));
        }
Ejemplo n.º 16
0
        internal PropertyManagerPageConstructor(ISldWorks app, IIconsCreator iconsConv, SwPropertyManagerPageHandler handler)
        {
            m_App       = app;
            m_IconsConv = iconsConv;

            m_Handler = handler;
            handler.Init(m_App);
        }
Ejemplo n.º 17
0
 public PropertyManagerPageListBoxControl(int id, object tag,
                                          IPropertyManagerPageListbox listBox, Type targetType, bool isMultiSel,
                                          SwPropertyManagerPageHandler handler, IMetadata metadata) : base(id, tag, listBox, handler, metadata)
 {
     m_IsMultiSelect           = isMultiSel;
     m_TargetType              = targetType;
     m_Handler.ListBoxChanged += OnListBoxChanged;
 }
Ejemplo n.º 18
0
 protected PropertyManagerPageBaseControl(TSwControl ctrl, int id, object tag,
                                          SwPropertyManagerPageHandler handler, IPropertyManagerPageLabel label, IMetadata[] metadata)
     : base(id, tag, metadata)
 {
     SwSpecificControl = ctrl;
     m_Handler         = handler;
     m_Label           = label;
 }
Ejemplo n.º 19
0
        protected override PropertyManagerPageCheckBoxControl CreateControl(
            IPropertyManagerPageCheckbox swCtrl, IAttributeSet atts, IMetadata metadata,
            SwPropertyManagerPageHandler handler, short height)
        {
            swCtrl.Caption = atts.Name;

            return(new PropertyManagerPageCheckBoxControl(atts.Id, atts.Tag, swCtrl, handler));
        }
Ejemplo n.º 20
0
        protected override PropertyManagerPageButtonControl CreateControl(
            IPropertyManagerPageButton swCtrl, IAttributeSet atts, IMetadata[] metadata,
            SwPropertyManagerPageHandler handler, short height, IPropertyManagerPageLabel label)
        {
            swCtrl.Caption = atts.Name;

            return(new PropertyManagerPageButtonControl(atts.Id, atts.Tag, swCtrl, handler, label, metadata));
        }
Ejemplo n.º 21
0
 public PropertyManagerPageBitmapControl(IconsConverter iconsConv,
                                         int id, object tag, Size?size,
                                         IPropertyManagerPageBitmap bitmap,
                                         SwPropertyManagerPageHandler handler) : base(bitmap, id, tag, handler)
 {
     m_Size      = size.HasValue ? size.Value : new Size(18, 18);
     m_IconsConv = iconsConv;
 }
Ejemplo n.º 22
0
 internal PropertyManagerPageCustomControl(int id, object tag,
                                           IPropertyManagerPageWindowFromHandle wndFromHandler,
                                           SwPropertyManagerPageHandler handler, Func <IXCustomControl> controlFact) : base(wndFromHandler, id, tag, handler)
 {
     m_Handler.CustomControlCreated += OnCustomControlCreated;
     m_Handler.Opening += OnPageOpening;
     m_ControlFact      = controlFact;
 }
Ejemplo n.º 23
0
 public PropertyManagerPageOptionBoxControl(int id, object tag,
                                            PropertyManagerPageOptionBox optionBox, ReadOnlyCollection <Enum> values,
                                            SwPropertyManagerPageHandler handler, IPropertyManagerPageLabel label, IMetadata[] metadata)
     : base(optionBox, id, tag, handler, label, metadata)
 {
     m_Values = values;
     m_Handler.OptionChecked += OnOptionChecked;
 }
Ejemplo n.º 24
0
 internal PropertyManagerPageCustomControl(int id, object tag,
                                           IPropertyManagerPageWindowFromHandle wndFromHandler,
                                           SwPropertyManagerPageHandler handler, IXCustomControl control) : base(wndFromHandler, id, tag, handler)
 {
     m_Handler.CustomControlCreated += OnCustomControlCreated;
     m_Control = control;
     m_Control.DataContextChanged += OnDataContextChanged;
 }
        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);
        }
        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));
        }
Ejemplo n.º 27
0
 public PropertyManagerPageListBoxControl(int id, object tag,
                                          IPropertyManagerPageListbox listBox, Type targetType, bool isMultiSel,
                                          SwPropertyManagerPageHandler handler, IMetadata srcMetadata, IPropertyManagerPageLabel label, Type specificItemType, IMetadata[] metadata)
     : base(id, tag, listBox, handler, srcMetadata, label, specificItemType, metadata)
 {
     m_IsMultiSelect           = isMultiSel;
     m_TargetType              = targetType;
     m_Handler.ListBoxChanged += OnListBoxChanged;
 }
Ejemplo n.º 28
0
 internal PropertyManagerPageTextBlockControl(int id, object tag,
                                              IPropertyManagerPageLabel textBlock, FontStyle_e fontStyle, string font, KnownColor?textColor,
                                              SwPropertyManagerPageHandler handler, IPropertyManagerPageLabel label, IMetadata[] metadata)
     : base(textBlock, id, tag, handler, label, metadata)
 {
     m_FontStyle = fontStyle;
     m_Font      = font;
     m_TextColor = textColor;
 }
        internal SwMacroFeatureEditor(ISwApplication app, Type defType, SwPropertyManagerPageHandler handler,
                                      CustomFeatureParametersParser paramsParser, IServiceProvider svcProvider,
                                      CreateDynamicControlsDelegate createDynCtrlHandler)
            : base(app, defType, paramsParser, svcProvider)
        {
            m_Handler = handler;

            InitPage(createDynCtrlHandler);
        }
 public PropertyManagerPageBitmapControl(IIconsCreator iconsConv,
                                         int id, object tag, Size?size,
                                         IPropertyManagerPageBitmap bitmap,
                                         SwPropertyManagerPageHandler handler, IPropertyManagerPageLabel label, IMetadata[] metadata)
     : base(bitmap, id, tag, handler, label, metadata)
 {
     m_Size      = size.HasValue ? size.Value : new Size(36, 36);
     m_IconsConv = iconsConv;
 }