示例#1
0
 public IconPresenter(IIcon IIConObj,string Name)
 {
     if (IIConObj != null)
     {
         objIIcon = IIConObj;
     }
     controlName = Name;
 }
        private static string ButtonBuilder(HtmlHelper helper, string innerHtml, IElement element, Relation relation, IIcon icon, object attributes)
        {
            SystemButtonBuilder buttonBuilder = new SystemButtonBuilder();
            buttonBuilder.SetIcon(icon);
            buttonBuilder.SetElement(new ButtonElement());
            buttonBuilder.SetRelation(relation);

            return buttonBuilder.CreateButton(innerHtml, "", attributes).ToString();
        }
 public CustomTypefaceSpan(IIcon icon, Typeface type, Single iconSizePx, Single iconSizeRatio, Int32 iconColor, System.Boolean rotate, System.Boolean baselineAligned)
 {
     _rotate = rotate;
     _baselineAligned = baselineAligned;
     _icon = icon.Character.ToString();
     _type = type;
     _iconSizePx = iconSizePx;
     _iconSizeRatio = iconSizeRatio;
     _iconColor = iconColor;
     _rotationStartTime = SystemClock.CurrentThreadTimeMillis();
 }
示例#4
0
文件: Icon.cs 项目: hultqvist/Eto
		public Icon (Assembly asm, string resourceName) : base(Generator.Current, typeof(IIcon))
		{
			inner = (IIcon)Handler;
			if (asm == null)
				asm = Assembly.GetCallingAssembly ();
			using (var stream = asm.GetManifestResourceStream (resourceName)) {
				if (stream == null)
					throw new ResourceNotFoundException (asm, resourceName);
				inner.Create (stream);
			}
		}
示例#5
0
 /// <summary>
 /// Finds the Typeface to apply for a given icon.
 /// </summary>
 /// <param name="icon">The icon for which you need the typeface.</param>
 /// <returns>
 ///     The font descriptor which contains info about the typeface to apply, or null
 ///     if the icon cannot be found. In that case, check that you properly added the modules
 ///     using <see cref="With(IIconModule)"/> prior to calling this method.
 /// </returns>
 public static IIconModule FindModuleOf(IIcon icon)
 {
     foreach (var module in Modules)
     {
         if (module.HasIcon(icon))
         {
             return module;
         }
     }
     return null;
 }
 public CustomTypefaceSpan(IIcon icon, Typeface type,
     float iconSizePx, float iconSizeRatio, int iconColor,
     bool rotate, bool baselineAligned)
 {
     this.rotate = rotate;
     this.baselineAligned = baselineAligned;
     this.icon = icon.Character.ToString();
     this.type = type;
     this.iconSizePx = iconSizePx;
     this.iconSizeRatio = iconSizeRatio;
     this.iconColor = iconColor;
     this.rotationStartTime = DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond;
 }
 private void Init(Context context, IIcon icon)
 {
     _context = context;
     _icon = icon;
     _paint = new TextPaint();
     var module = Iconize.FindModuleOf(icon);
     if (module == null)
     {
         throw new Java.Lang.IllegalStateException("Unable to find the module associated " +
                 "with icon " + icon.Key + ", have you registered the module " +
                 "you are trying to use with Iconize.With(...) in your Application?");
     }
     _paint.SetTypeface(module.GetTypeface(context));
     _paint.SetStyle(Paint.Style.Fill);
     _paint.TextAlign = Paint.Align.Center;
     _paint.UnderlineText = false;
     _paint.Color = global::Android.Graphics.Color.Black;
     _paint.AntiAlias = true;
 }
        public void AddIcon(IIcon icon, int pos)
        {
            if (pos >= CellCount)
            {
                RowCount += 1;
                for (int i = 0; i < ColumnCount; i++)
                {
                    IconStack_Realtime.Add(null);
                    IconStack_LastChanged.Add(null);
                    IconStack_LastCommitted.Add(null);
                }

                this.Height += IconSize.Y;
                GridCalculator.PanelHeight += IconSize.Y;

                GridCalculator.RowCount = RowCount;
                GridCalculator.ColumnCount = ColumnCount;
            }

            // TODO:: sanity check that position is within bounds
            // TODO:: sanity check that IIcon is a UIElement
            UIElement iconUIElement = icon as UIElement;
            iconUIElement.SetValue(Canvas.ZIndexProperty, 0);
            this.Children.Add(iconUIElement);

            IconStack_Realtime[pos] = icon;
            IconStack_LastChanged[pos] = icon;
            IconStack_LastCommitted[pos] = icon;

            int position = GetIconStackPosition(icon);
            Point canvasPosition = GridCalculator.GetPosition(position);
            UIElement iconElement = icon as UIElement;

            // we do an initial render transform so that later when we animate it no exception is thrown
            TransformGroup tg = TransitionHelper.GetTransformGroupForXYOffset(canvasPosition.X, canvasPosition.Y, 1.00D, 1.00D);
            iconElement.RenderTransform = tg;

            iconUIElement.MouseLeftButtonDown += new MouseButtonEventHandler(iconUIElement_MouseLeftButtonDown);
            iconUIElement.MouseLeftButtonUp += new MouseButtonEventHandler(iconUIElement_MouseLeftButtonUp);
            iconUIElement.MouseMove += new MouseEventHandler(iconUIElement_MouseMove);
            iconUIElement.Drop += new DragEventHandler(iconUIElement_Drop);
        }
示例#9
0
 private void Init(Context context, IIcon icon)
 {
     this.context = context;
     this.icon = icon;
     paint = new TextPaint();
     IconFontDescriptorWrapper descriptor = Iconify.FindTypefaceOf(icon);
     if (descriptor == null)
     {
         throw new IllegalStateException("Unable to find the module associated " +
                 "with icon " + icon.Key + ", have you registered the module " +
                 "you are trying to use with Iconify.with(...) in your Application?");
     }
     paint.SetTypeface(descriptor.GetTypeface(context));
     paint.SetStyle(Paint.Style.Fill);
     paint.TextAlign = Paint.Align.Center;
     paint.UnderlineText = false;
     paint.Color = new Android.Graphics.Color(0, 0, 0);
     //paint.Color = Color.Black;
     paint.AntiAlias = true;
 }
        public CustomAttributedString(IIcon icon, UIFont font, Single iconSizePx, Single iconSizeRatio, UIColor iconColor, Boolean rotate, Boolean baselineAligned)
        {
            _rotate = rotate;
            _baselineAligned = baselineAligned;
            _icon = icon.Character.ToString();
            _font = font;
            _iconSizePx = iconSizePx;
            _iconSizeRatio = iconSizeRatio;
            _iconColor = iconColor;
            _rotationStartTime = DateTime.Now.Ticks;

            var opt = new UIStringAttributes
            {
                Font = font
            };
            if (baselineAligned == true)
                opt.BaselineOffset = 0f;
            if (iconColor != UIColor.DarkTextColor)
                opt.ForegroundColor = iconColor;
        }
示例#11
0
 public static IconFontDescriptorWrapper FindTypefaceOf(IIcon icon)
 {
     return iconFontDescriptors.FirstOrDefault(iconFontDescriptor => iconFontDescriptor.HasIcon(icon));
 }
示例#12
0
 public IconAdapter(IIcon[] icons)
 {
     _icons = icons;
 }
示例#13
0
 public Boolean HasIcon(IIcon icon)
 {
     return _icons.Values.Contains(icon);
 }
        private int FindFirstBlankSpotIndex(List<IIcon> iconStack, IIcon mouseCapturedIcon, int index)
        {
            // TODO:: optimize this query
            var blankQuery = from icon in iconStack
                             where IsSpotBlank(iconStack, mouseCapturedIcon, iconStack.IndexOf(icon))
                             orderby iconStack.IndexOf(icon) ascending
                             select iconStack.IndexOf(icon);

            if (blankQuery.Count() > 0)
                return blankQuery.First();

            return -1;
        }
示例#15
0
		/// <summary>
		/// Initializes a new instance of the Icon class with the specified handler
		/// </summary>
		/// <param name="generator">Generator for this widget</param>
		/// <param name="handler">Handler for the icon backend</param>
		public Icon (Generator generator, IIcon handler) : base(generator, handler)
		{
		}
 public bool HasIcon(IIcon icon)
 {
     return iconsByKey.Any(p => p.Value == icon);
 }
示例#17
0
文件: Icon.cs 项目: hultqvist/Eto
		public Icon (Stream stream) : base(Generator.Current, typeof(IIcon))
		{
			inner = (IIcon)Handler;
			inner.Create (stream);
		}
示例#18
0
 public void ChangeCmdIcon(IIcon icon) {
     if (_cmdIcon != null) {
         _cmdIcon.Set(icon.Filename);
         _cmdIcon.Color = icon.Color;
         //D.Log("{0} Icon color is {1}.", Presenter.FullName, icon.Color.GetName());
         return;
     }
     //D.Warn("Attempting to change a null {0} to {1}.", typeof(CommandTrackingSprite).Name, icon.Filename);
 }
示例#19
0
 /// <summary>
 /// To the NS image.
 /// </summary>
 /// <param name="icon">The icon.</param>
 /// <param name="size">The size.</param>
 /// <returns></returns>
 public static NSImage ToNSImage(this IIcon icon, nfloat size) => ToNSImageWithColor(icon, size, NSColor.Black.CGColor);
 public static string LinkButton(this HtmlHelper helper, string innerHtml, Relation relation, IIcon icon, object attributes)
 {
     return Link(helper, innerHtml, relation, icon, attributes);
 }
        private void UpdateIconStack_MakeBlankSpotAtIndex(List<IIcon> iconStack, IIcon mouseCapturedIcon, int index)
        {
            // we are going to consider a blank position a spot in the icon stack which is null,
            // or a spot in the stack which is the captured icon itself (since when it is picked up that
            // spot is empty (even if it isnt in the stack array)

            // first make sure that the spot requested isn't already blank, if so then there's nothing to do
            if (IsSpotBlank(iconStack, mouseCapturedIcon, index))
                return;

            // find the closest blank spot
            int closestBlankSpotIndex = FindFirstBlankSpotIndex(iconStack, mouseCapturedIcon, index);

            if (closestBlankSpotIndex == iconStack.IndexOf(mouseCapturedIcon))
            {
                iconStack.RemoveAt(closestBlankSpotIndex);
                iconStack.Insert(index, mouseCapturedIcon);
            }
            else
            {
                iconStack.RemoveAt(closestBlankSpotIndex);
                iconStack.Insert(index, null);
            }
        }
        private void UpdateIconStack(ref List<IIcon> iconStack, IIcon mouseCapturedIcon, CellPosition mouseCellPosition)
        {
            // if the cell spot is empty then find where this icon was before,
            // remove it, and put it into the new position in the stack
            int cellIndex = GridCalculator.GetIndexFromCell(mouseCellPosition);
            if (iconStack[cellIndex] == null)
            {
                int removeIndex = iconStack.IndexOf(mouseCapturedIcon);
                iconStack[removeIndex] = null;
                iconStack[cellIndex] = mouseCapturedIcon;

                ContractAndPadStack(ref iconStack);
            }
            else // .. the cell position isn't empty, so make a blank spot here
            {
                UpdateIconStack_MakeBlankSpotAtIndex(iconStack, mouseCapturedIcon, cellIndex);
                iconStack[cellIndex] = mouseCapturedIcon;

                ContractAndPadStack(ref iconStack);
            }
        }
 private bool IsSpotBlank(List<IIcon> iconStack, IIcon mouseCapturedIcon, int index)
 {
     return (iconStack[index] == null || iconStack[index] == mouseCapturedIcon);
 }
 private int GetIconStackPosition(IIcon icon)
 {
     return IconStack_Realtime.IndexOf(icon);
 }
示例#25
0
 public void ChangeFleetIcon(IIcon icon, GameColor color) {
     _fleetIcon = icon;
     _fleetIconSprite.spriteName = icon.Filename;
     _fleetIconSprite.color = color.ToUnityColor();
 }
示例#26
0
文件: Icon.cs 项目: hultqvist/Eto
		public Icon (IIcon inner) : base(Generator.Current, inner)
		{
			this.inner = inner;
		}
示例#27
0
 /// <summary>
 /// Create an <see cref="IconDrawable"/>.
 /// </summary>
 /// <param name="context">Your activity or application context.</param>
 /// <param name="icon">The icon you want this drawable to display.</param>
 public IconDrawable(Context context, IIcon icon)
 {
     Init(context, icon);
 }
示例#28
0
文件: Icon.cs 项目: hultqvist/Eto
		public Icon (string fileName) : base(Generator.Current, typeof(IIcon))
		{
			inner = (IIcon)Handler;
			inner.Create (fileName);
		}
示例#29
0
 private void AssessFleetIcon() {
     //TODO evaluate Composition
     switch (PlayerIntelLevel) {
         case IntelLevel.Nil:
             _fleetIcon = _iconFactory.MakeInstance<FleetIcon>(IconSection.Base, IconSelectionCriteria.None);
             _fleetIconSprite.color = GameColor.Clear.ToUnityColor();    //TODO None should be a completely transparent icon
             break;
         case IntelLevel.Unknown:
             _fleetIcon = _iconFactory.MakeInstance<FleetIcon>(IconSection.Base, IconSelectionCriteria.Unknown);
             _fleetIconSprite.color = GameColor.White.ToUnityColor();    // may be clear from prior setting
             break;
         case IntelLevel.OutOfDate:
             _fleetIcon = _iconFactory.MakeInstance<FleetIcon>(IconSection.Base, IconSelectionCriteria.Unknown);
             _fleetIconSprite.color = Data.Owner.Color.ToUnityColor();
             break;
         case IntelLevel.LongRangeSensors:
             _fleetIcon = _iconFactory.MakeInstance<FleetIcon>(IconSection.Base, IconSelectionCriteria.Level5);
             _fleetIconSprite.color = Data.Owner.Color.ToUnityColor();
             break;
         case IntelLevel.ShortRangeSensors:
         case IntelLevel.Complete:
             var selectionCriteria = new IconSelectionCriteria[] { IconSelectionCriteria.Level5, IconSelectionCriteria.Science, IconSelectionCriteria.Colony, IconSelectionCriteria.Troop };
             _fleetIcon = _iconFactory.MakeInstance<FleetIcon>(IconSection.Base, selectionCriteria);
             _fleetIconSprite.color = Data.Owner.Color.ToUnityColor();
             break;
         case IntelLevel.None:
         default:
             throw new NotImplementedException(ErrorMessages.UnanticipatedSwitchValue.Inject(PlayerIntelLevel));
     }
     _fleetIconSprite.spriteName = _fleetIcon.Filename;
     D.Log("IntelLevel is {2}, changing {0} to {1}.", typeof(FleetIconIdentity).Name, _fleetIcon.Filename, PlayerIntelLevel.GetValueName());
 }
 public override IProjectIcon CreateProjectIcon(IIcon icon, IIconColor color, ISize size, string density) =>
 new GoogleUWPProjectIcon(icon, color, size, density);
示例#31
0
文件: Icon.cs 项目: majorsilence/Eto
		/// <summary>
		/// Initializes a new instance of the Icon class with the specified handler
		/// </summary>
		/// <param name="generator">Generator for this widget</param>
		/// <param name="handler">Handler for the icon backend</param>
		public Icon (Generator generator, IIcon handler) : base(generator, handler)
		{
			this.handler = handler;
		}
示例#32
0
 /// <summary>
 /// Determines whether the specified icon is in the set.
 /// </summary>
 /// <param name="icon">The icon.</param>
 /// <returns></returns>
 public Boolean HasIcon(IIcon icon)
 {
     return(_icons.Values.Contains(icon));
 }
 private static string Link(HtmlHelper helper, string innerHtml, Relation relation, IIcon icon, object attributes)
 {
     return ButtonBuilder(helper, innerHtml, new LinkElement(), relation, icon, attributes);
 }