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 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)); }
protected override PropertyManagerPageSelectionBoxEx CreateControl( IPropertyManagerPageSelectionbox swCtrl, IAttributeSet atts, THandler handler, short height) { var selAtt = atts.Get <SelectionBoxAttribute>(); swCtrl.SetSelectionFilters(selAtt.Filters); swCtrl.Mark = selAtt.SelectionMark; swCtrl.SingleEntityOnly = !(typeof(IList).IsAssignableFrom(atts.BoundType)); ISelectionCustomFilter customFilter = null; 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}"); } } if (height == -1) { height = 20; } swCtrl.Height = height; if (atts.Has <SelectionBoxOptionsAttribute>()) { var style = atts.Get <SelectionBoxOptionsAttribute>(); if (style.Style != 0) { swCtrl.Style = (int)style.Style; } if (style.SelectionColor != 0) { swCtrl.SetSelectionColor(true, ConvertColor(style.SelectionColor)); } } return(new PropertyManagerPageSelectionBoxEx(m_App, atts.Id, atts.Tag, swCtrl, handler, atts.BoundType, customFilter)); }
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 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)); }
internal void ParseItems(IXApplication app, IAttributeSet atts, IMetadata[] metadata, out bool isStatic, out ItemsControlItem[] staticItems, out IMetadata itemsSourceMetadata) { if (atts.ContextType.IsEnum) { var items = EnumExtension.GetEnumFields(atts.ContextType); staticItems = items.Select(i => new ItemsControlItem() { DisplayName = i.Value, Value = i.Key }).ToArray(); isStatic = true; itemsSourceMetadata = null; } else { var customItemsAtt = atts.Get <ItemsSourceControlAttribute>(); if (customItemsAtt.StaticItems?.Any() == true) { staticItems = customItemsAtt .StaticItems.Select(i => new ItemsControlItem(i)).ToArray(); isStatic = true; itemsSourceMetadata = null; } else if (customItemsAtt.CustomItemsProvider != null) { itemsSourceMetadata = null; if (customItemsAtt.Dependencies?.Any() != true) { var provider = customItemsAtt.CustomItemsProvider; staticItems = provider.ProvideItems(app, new IControl[0]).Select(i => new ItemsControlItem(i)).ToArray(); isStatic = true; } else { isStatic = false; staticItems = null; } } else if (customItemsAtt.ItemsSource != null) { isStatic = false; staticItems = null; itemsSourceMetadata = metadata?.FirstOrDefault(m => object.Equals(m.Tag, customItemsAtt.ItemsSource)); if (itemsSourceMetadata == null) { throw new NullReferenceException($"Failed to find the items source metadata property: {customItemsAtt.ItemsSource}"); } } else { throw new NotSupportedException("Items source is not specified"); } } }
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)); }
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 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); }
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)); }
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)); }
private ControlOptionsAttribute GetControlOptions(IAttributeSet atts) { ControlOptionsAttribute opts; if (atts.Has <ControlOptionsAttribute>()) { opts = atts.Get <ControlOptionsAttribute>(); } else { opts = new ControlOptionsAttribute(); } return(opts); }
protected override PropertyManagerPageCustomControl CreateControl( IPropertyManagerPageWindowFromHandle swCtrl, IAttributeSet atts, IMetadata[] metadata, SwPropertyManagerPageHandler handler, short height, IPropertyManagerPageLabel label) { if (height <= 0) { height = 50; } swCtrl.Height = height; var ctrlType = atts.Get <CustomControlAttribute>().ControlType; return(new PropertyManagerPageCustomControl(ctrlType, atts.Id, atts.Tag, swCtrl, handler, new PropertyPageControlCreator <object>(swCtrl), label, metadata)); }
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 PropertyManagerPageCustomControl CreateControl( IPropertyManagerPageWindowFromHandle swCtrl, IAttributeSet atts, IMetadata metadata, SwPropertyManagerPageHandler handler, short height) { if (height <= 0) { height = 50; } swCtrl.Height = height; var ctrlType = atts.Get <CustomControlAttribute>().ControlType; //var ctrlFact = new Func<IXCustomControl>(() => // CustomControlHelperOld.HostControl(ctrlType, // (c, h, t, _) => // { // if (swCtrl.SetWindowHandlex64(h.Handle.ToInt64())) // { // if (c is IXCustomControl) // { // return (IXCustomControl)c; // } // else // { // if (c is System.Windows.FrameworkElement) // { // return new WpfCustomControl((System.Windows.FrameworkElement)c, h); // } // throw new NotSupportedException($"'{c.GetType()}' must implement '{typeof(IXCustomControl).FullName}' or inherit '{typeof(System.Windows.FrameworkElement).FullName}'"); // } // } // else // { // throw new NetControlHostException(h.Handle); // } // }, // (p, t, _) => // { // throw new NotImplementedException("ActiveX controls are not implemented yet"); // })); return(new PropertyManagerPageCustomControl(ctrlType, atts.Id, atts.Tag, swCtrl, handler, new PropertyPageControlCreator <object>(swCtrl))); }
internal ItemsControlItem[] GetItems(IXApplication app, IAttributeSet atts) { if (atts.ContextType.IsEnum) { var items = EnumExtension.GetEnumFields(atts.ContextType); return(items.Select(i => new ItemsControlItem() { DisplayName = i.Value, Value = i.Key }).ToArray()); } else { var customItemsAtt = atts.Get <ItemsSourceControlAttribute>(); List <object> items = null; if (customItemsAtt.StaticItems != null) { items = customItemsAtt.StaticItems.ToList(); } else if (customItemsAtt.CustomItemsProvider != null) { var provider = customItemsAtt.CustomItemsProvider; var depsCount = customItemsAtt.Dependencies?.Length; //TODO: dependency controls cannot be loaded at this stage as binding is not yet loaded - need to sort this out //Not very critical at this stage as provide items wil be called as part ResolveState for dependent controls //For now just add a note in the documentation for this behavior items = provider.ProvideItems(app, new IControl[depsCount.Value])?.ToList(); } else if (customItemsAtt.ItemsSource != null) { //this will be resolved dynamically items = new List <object>(); } if (items == null) { items = new List <object>(); } return(items.Select(i => new ItemsControlItem(i)).ToArray()); } }
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)); }
protected override PropertyManagerPageCustomControl CreateControl( IPropertyManagerPageWindowFromHandle swCtrl, IAttributeSet atts, SwPropertyManagerPageHandler handler, short height) { if (height <= 0) { height = 50; } swCtrl.Height = height; var ctrlType = atts.Get <CustomControlAttribute>().ControlType; var ctrlFact = new Func <IXCustomControl>(() => CustomControlHelper.HostControl(ctrlType, (c, h, t, _) => { if (swCtrl.SetWindowHandlex64(h.Handle.ToInt64())) { if (c is IXCustomControl) { return((IXCustomControl)c); } else { if (c is System.Windows.FrameworkElement) { return(new WpfCustomControl((System.Windows.FrameworkElement)c, h)); } throw new NotSupportedException($"'{c.GetType()}' must implement '{typeof(IXCustomControl).FullName}' or inherit '{typeof(System.Windows.FrameworkElement).FullName}'"); } } else { throw new NetControlHostException(h.Handle); } }, (p, t, _) => { throw new NotImplementedException("ActiveX controls are not implemented yet"); })); return(new PropertyManagerPageCustomControl(atts.Id, atts.Tag, swCtrl, handler, ctrlFact)); }
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); }
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); }
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)); }
protected override ItemsControlItem[] GetItems(IAttributeSet atts) { var customItemsAtt = atts.Get <CustomItemsAttribute>(); var provider = customItemsAtt.CustomItemsProvider; var depsCount = customItemsAtt.Dependencies?.Length; //TODO: dependency controls cannot be loaded at this stage as binding is not yet loaded - need to sort this out //Not very critical at this stage as provide items wil be called as part ResolveState for dependent controls //For now just add a note in the documentation for this behavior var items = provider.ProvideItems(m_SwApp, new IControl[depsCount.Value])?.ToList(); if (items == null) { items = new List <object>(); } return(items.Select(i => new ItemsControlItem() { DisplayName = i.ToString(), Value = i }).ToArray()); }
public TAtt Get <TAtt>() where TAtt : Xarial.VPages.Framework.Base.IAttribute { return(m_BaseAttSet.Get <TAtt>()); }
public TAtt Get <TAtt>() where TAtt : XCad.UI.PropertyPage.Base.IAttribute { return(m_BaseAttSet.Get <TAtt>()); }
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)); }
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); } } }
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); } }