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; }
private void CloseEvent(ButtonWidget button) { Parent.RemoveChild(this); }