Example #1
0
        public OvalGrid()
        {
            var colinfo = new Dimension_Steady(100000, 120, false);
            var rowinfo = new Dimension_Steady(100000, 80, false);

            var padding4   = new ValuePerCell_Steady <Padding?> (new Padding(5));
            var fill_blue  = new ValuePerCell_Steady <CGColor> (UIColor.Blue.CGColor);
            var fill_white = new ValuePerCell_Steady <CGColor> (UIColor.White.CGColor);

            var dec_oval = new DrawCell_Fill(
                fill_blue,
                new DrawCell_Chain_Padding(
                    padding4,
                    new DrawCell_Fill(
                        fill_white,
                        new DrawCell_Chain_Padding(
                            padding4,
                            new DrawCell_Oval(UIColor.Purple.CGColor)
                            )
                        )
                    )
                );

            Main = new MainPanel(
                colinfo,
                rowinfo,
                new DrawVisible_Adapter_DrawCell <CGContext>(dec_oval)
                );
        }
Example #2
0
        public Demo_GradientCells()
        {
            var colinfo = new Dimension_Steady(COUNT, SIZE, false);
            var rowinfo = new Dimension_Steady(COUNT, SIZE, false);

            var colors = new ValuePerCell_FromDelegates <CrossGraphics.Color> (get_value);

            var dec = new DrawCell_Fill(colors);

            Main = new MainPanel(
                colinfo,
                rowinfo,
                new DrawVisible_Adapter_DrawCell <IGraphics>(dec)
                );
        }
Example #3
0
        public A1Wraparound(int cols, int rows, bool wrap_col, bool wrap_row)
        {
            var colinfo = new Dimension_Steady(cols, SIZE, wrap_col);
            var rowinfo = new Dimension_Steady(rows, SIZE, wrap_row);

            var padding1   = new ValuePerCell_Steady <Padding?> (new Padding(1, 1, 1, 1));
            var fill_white = new ValuePerCell_Steady <CrossGraphics.Color> (CrossGraphics.Colors.White);

            IDrawCell <IGraphics> dec_text = new DrawCell_Text(
                new ValuePerCell_FromDelegates <string>(myutil.get_delegate()),
                new ValuePerCell_Steady <MyTextFormat> (
                    new MyTextFormat {
                TextFont  = CrossGraphics.Font.SystemFontOfSize((int)(SIZE / 3)),
                TextColor = CrossGraphics.Colors.Black,
                HorizontalTextAlignment = CrossGraphics.TextAlignment.Center,
                VerticalTextAlignment   = CrossGraphics.TextAlignment.Center,
            })
                );

            IDrawVisible <IGraphics> dv;

                        #if false
            // this approach uses one layer containing a chain
            // that cache-pad-fill-text

            IDrawEachCell dec = new DrawEachCell_Chain_Padding(
                padding1,
                new DrawEachCell_Fill(
                    fill_white,
                    dec_text
                    )
                );

            dec = new DrawEachCell_Chain_Cache(dec, colinfo, rowinfo);

            dv = new DrawVisibleCells_DrawEachCellAdapter(dec);
                        #else
            // this approach uses two layers, one is pad-fill,
            // and the other is cache-text

            IDrawCell <IGraphics> dec_bg = new DrawCell_Chain_Padding(
                padding1,
                new DrawCell_Fill(
                    fill_white
                    )
                );

            //dec_bg = new DrawEachCell_Chain_Cache (dec_bg, colinfo, rowinfo);

            //dec_text = new DrawEachCell_Chain_Cache (dec_text, colinfo, rowinfo);

                        #if false
            dv = new DrawVisibleCells_Layers(new IDrawVisibleCells[] {
                new DrawVisibleCells_DrawEachCellAdapter(dec_bg),
                new DrawVisibleCells_DrawEachCellAdapter(dec_text),
            });
                        #else
            IDrawCell <IGraphics> dec_layers = new DrawCell_Chain_Layers(new IDrawCell <IGraphics>[] {
                dec_bg,
                dec_text,
            });

            dec_layers = new DrawCell_Chain_Cache(dec_layers, colinfo, rowinfo);

            dv = new DrawVisible_Adapter_DrawCell <IGraphics>(dec_layers);
                        #endif
                        #endif

            Main = new MainPanel(
                colinfo,
                rowinfo,
                dv
                );
            Main.SingleTap += (object sender, CellCoords e) => {
                // TODO trigger a redraw
            };

            var fill_gray = new ValuePerCell_Steady <CrossGraphics.Color> (CrossGraphics.Colors.Gray);

            var frozen_textfmt = new ValuePerCell_Steady <MyTextFormat> (
                new MyTextFormat {
                TextFont  = CrossGraphics.Font.BoldSystemFontOfSize((int)(SIZE / 3)),
                TextColor = CrossGraphics.Colors.Black,
                HorizontalTextAlignment = CrossGraphics.TextAlignment.Center,
                VerticalTextAlignment   = CrossGraphics.TextAlignment.Center,
            });

            Func <FrozenColumnsPanel> f_c = () =>
                                            new FrozenColumnsPanel(
                new Dimension_Steady(1, SIZE, false),
                rowinfo,
                new DrawVisible_Adapter_DrawCell <IGraphics>(
                    new DrawCell_Chain_Padding(
                        padding1,
                        new DrawCell_Fill(
                            fill_gray,
                            new DrawCell_Text(
                                new ValuePerCell_RowNumber(),
                                frozen_textfmt
                                )
                            )
                        )
                    )
                );
            Left  = f_c();
            Right = f_c();

            Func <FrozenRowsPanel> f_r = () =>
                                         new FrozenRowsPanel(
                colinfo,
                new Dimension_Steady(1, SIZE, false),
                new DrawVisible_Adapter_DrawCell <IGraphics>(
                    new DrawCell_Chain_Padding(
                        padding1,
                        new DrawCell_Fill(
                            fill_gray,
                            new DrawCell_Text(
                                new ValuePerCell_ColumnLetters(),
                                frozen_textfmt
                                )
                            )
                        )
                    )
                );
            Top    = f_r();
            Bottom = f_r();
        }