Ejemplo n.º 1
0
            public void CreateLineLayers()
            {
                lineContainer             = CALayer.Create();
                lineContainer.AnchorPoint = new PointF(0, 0);
                lineContainer.Bounds      = new RectangleF(0, 0, 640, 480);

                lineLayers = new List <CALayer> ();
                foreach (string l in lines)
                {
                    CALayer layer;
                    if (l.Trim() == "")
                    {
                        layer = null;
                    }
                    else
                    {
                        layer = GuiUtil.ComposeText(l, fnt, pal, 640 /*Painter.SCREEN_RES_X*/ - X_OFFSET * 2, -1, 4);
                    }
                    lineLayers.Add(layer);
                    if (layer != null)
                    {
                        lineContainer.AddSublayer(layer);
                    }
                }
            }
Ejemplo n.º 2
0
        protected virtual CALayer CreateLayer()
        {
            switch (Type)
            {
            case ElementType.DefaultButton:
            case ElementType.Button:
            case ElementType.ButtonWithoutBorder:
                return(GuiUtil.ComposeText(Text, Font, palette, Width, Height,
                                           sensitive ? 4 : 24));

            default:
                return(null);
            }
        }
Ejemplo n.º 3
0
        protected override CALayer CreateLayer()
        {
            if (calc_width)
            {
                CALayer textLayer = GuiUtil.ComposeText(Text, Font, Palette, -1, -1, Sensitive ? 4 : 24);

                textLayer.AnchorPoint = new PointF(0, 0);

                Width  = (ushort)textLayer.Bounds.Width;
                Height = (ushort)textLayer.Bounds.Height;

                return(textLayer);
            }
            else
            {
                /* this is wrong */
                CALayer layer = CALayer.Create();
                layer.Bounds = new RectangleF(0, 0, Width, Height);

                CALayer textLayer = GuiUtil.ComposeText(Text, Font, Palette, Width, Height,
                                                        Sensitive ? 4 : 24);

                float x = 0;
                if (Type == ElementType.LabelRightAlign)
                {
                    x += Width - textLayer.Bounds.Width;
                }
                else if (Type == ElementType.LabelCenterAlign)
                {
                    x += (Width - textLayer.Bounds.Width) / 2;
                }

                textLayer.AnchorPoint = new PointF(0, 0);
                textLayer.Position    = new PointF(x, 0);

                layer.AddSublayer(textLayer);

                return(layer);
            }
        }