Beispiel #1
0
        public Window(double x, double y, double width, double height, string lable)
        {
            m_X = x;
            m_Y = y;
            m_width = width;
            m_height = height;
            Affine transform = GetTransform();
            transform.Translate(x, y);
            SetTransform(transform);
            caption = new TextWidget(lable, 0, height - 15, 7);
            caption.TextColor = new RGBA_Bytes(255, 255, 255);
            closeButton = new ButtonWidget(width - 15, height - 15, "X", 7, 1, 1, 5);
            closeButton.ButtonClick += CloseEvent;
            AddChild(caption);
            AddChild(closeButton);

            TextPadding = 1;
            BorderWidth = 2;
            BorderRadius = 5;

            double totalExtra = BorderWidth + TextPadding;
            m_Bounds.Left = x - totalExtra;
            m_Bounds.Bottom = y - totalExtra;
            m_Bounds.Right = x + width + totalExtra;
            m_Bounds.Top = y + height + totalExtra;
        }
Beispiel #2
0
        public ButtonWidget(double x, double y, string lable,
			double textHeight, double textPadding, double borderWidth, double borderRadius)
        {
            m_X = x;
            m_Y = y;
            Affine transform = GetTransform();
            transform.Translate(x, y);
            SetTransform(transform);
            m_ButtonText = new TextWidget(lable, 0, 0, textHeight);
            AddChild(m_ButtonText);

            TextPadding = textPadding;
            BorderWidth = borderWidth;
            BorderRadius = borderRadius;

            double totalExtra = BorderWidth + TextPadding;
            m_Bounds.Left = x - totalExtra;
            m_Bounds.Bottom = y - totalExtra;
            m_Bounds.Right = x + m_ButtonText.Width + totalExtra;
            m_Bounds.Top = y + m_ButtonText.Height + totalExtra;
        }