public BlockingScreen(View messageView, ButtonDelegate buttonDelegate = null)
        {
            AllowsDrawPrevious = true;
            AllowsUpdatePrevious = true;

            m_delegate = buttonDelegate;

            View contentView = new RectView(0, 0, 366, 182, Color.Black, Color.White);
            contentView.x = 0.5f * width;
            contentView.y = 0.5f * height;
            contentView.alignX = contentView.alignY = View.ALIGN_CENTER;

            messageView.x = 0.5f * contentView.width;
            messageView.y = 0.5f * contentView.height;
            messageView.alignX = messageView.alignY = View.ALIGN_CENTER;
            contentView.AddView(messageView);

            Button cancelButton = new TempButton("Cancel");
            cancelButton.x = 0.5f * contentView.width;
            cancelButton.y = contentView.height - 12;
            cancelButton.alignX = View.ALIGN_CENTER;
            cancelButton.alignY = View.ALIGN_MAX;
            cancelButton.buttonDelegate = CancelButtonDelegate;
            SetCancelButton(cancelButton);

            contentView.AddView(cancelButton);

            AddView(contentView);
        }
        public FieldDataView(FieldData data, Style style)
            : base(style.width, style.height)
        {
            AddView(new RectView(0, 0, width, height, Color.Gray, Color.Black));

            float iw = style.iw;
            float ih = style.ih;

            RectView rect = new RectView(0.5f * (width - iw), 0.5f * (height - ih), iw, ih, Color.Green, Color.Green);
            AddView(rect);

            float cw = iw / data.GetWidth();
            float ch = ih / data.GetHeight();

            for (int y = 0; y < data.GetHeight(); ++y)
            {
                for (int x = 0; x < data.GetWidth(); ++x)
                {
                    FieldBlocks block = data.Get(x, y);
                    Color color;

                    switch (block)
                    {
                        case FieldBlocks.Brick:
                            color = COLOR_BRICK;
                            break;
                        case FieldBlocks.Solid:
                            color = COLOR_SOLID;
                            break;

                        default:
                            continue;
                    }

                    float cx = x * cw;
                    float cy = y * ch;

                    rect.AddView(new RectView(cx, cy, cw, ch, color, color));
                }
            }
        }
        public DialogPopup(DialogPopupDelegate popupDelegate, String title, String message, PopupButton cancelButton, params PopupButton[] buttons)
        {
            this.popupDelegate = popupDelegate;

            AddView(new RectView(0, 0, width, height, new Color(0.0f, 0.0f, 0.0f, 0.25f), Color.Black));

            RectView frameView = new RectView(0, 0, 0.75f * width, 0, new Color(0.0f, 0.0f, 0.0f, 0.75f), Color.Black);

            View content = new View();
            content.width = frameView.width - 2 * 50;
            content.alignX = content.alignY = View.ALIGN_CENTER;

            Font font = Helper.fontSystem;

            // title
            TextView titleView = new TextView(font, title);
            titleView.alignX = titleView.parentAlignX = View.ALIGN_CENTER;
            content.AddView(titleView);

            // message
            TextView messageView = new TextView(font, message, (int)content.width);
            messageView.alignX = messageView.parentAlignX = View.ALIGN_CENTER;
            content.AddView(messageView);

            // buttons
            Button button = new TempButton(cancelButton.title);
            button.id = (int)cancelButton.id;
            button.buttonDelegate = OnButtonPress;
            button.alignX = View.ALIGN_CENTER;
            button.parentAlignX = View.ALIGN_CENTER;
            SetCancelButton(button);

            content.AddView(button);

            content.LayoutVer(10);
            content.ResizeToFitViewsVer();

            frameView.AddView(content);

            frameView.ResizeToFitViewsVer(20, 20);
            frameView.alignX = frameView.alignY = frameView.parentAlignX = frameView.parentAlignY = View.ALIGN_CENTER;
            AddView(frameView);

            content.x = 0.5f * frameView.width;
            content.y = 0.5f * frameView.height;
        }