public CheckNRadioTestDialog() : base("Check And Radio Test", 100, 100, 320, 200) { girdLayout = new GirdLayout(4, 2); girdLayout.SetHorizontalAlignment(0, 0, EHAlignment.HCenter); girdLayout.SetHorizontalAlignment(1, 0, EHAlignment.HCenter); girdLayout.SetHorizontalAlignment(2, 0, EHAlignment.HCenter); girdLayout.SetHorizontalAlignment(3, 0, EHAlignment.HCenter); girdLayout.SetHorizontalAlignment(0, 1, EHAlignment.HCenter); girdLayout.SetHorizontalAlignment(1, 1, EHAlignment.HCenter); girdLayout.SetHorizontalAlignment(2, 1, EHAlignment.HCenter); girdLayout.SetHorizontalAlignment(3, 1, EHAlignment.HCenter); girdLayout.SetVerticalAlignment(0, 0, EVAlignment.VCenter); girdLayout.SetVerticalAlignment(1, 0, EVAlignment.VCenter); girdLayout.SetVerticalAlignment(2, 0, EVAlignment.VCenter); girdLayout.SetVerticalAlignment(3, 0, EVAlignment.VCenter); girdLayout.SetVerticalAlignment(0, 1, EVAlignment.VCenter); girdLayout.SetVerticalAlignment(1, 1, EVAlignment.VCenter); girdLayout.SetVerticalAlignment(2, 1, EVAlignment.VCenter); girdLayout.SetVerticalAlignment(3, 1, EVAlignment.VCenter); girdLayout.Right = 16; girdLayout.Left = 16; girdLayout.Top = 8; girdLayout.Bottom = 8; girdLayout.Spacer = 4; closeButton = new Button("Close"); checkButton1 = new CheckButton("Check 1"); checkButton2 = new CheckButton("Check 2"); checkButton3 = new CheckButton("Check 3"); radioGroup = new RadioGroup(); radioButton1 = new RadioButton("Radio 1", radioGroup); radioButton2 = new RadioButton("Radio 2", radioGroup); radioButton3 = new RadioButton("Radio 3", radioGroup); spacer = new Spacer(ESpacerType.Fit); Add(checkButton1); Add(radioButton1); Add(checkButton2); Add(radioButton2); Add(checkButton3); Add(radioButton3); Add(spacer); Add(closeButton); Layout = girdLayout; Pack(); closeButton.MouseReleasedEvent += new MouseReleasedHandler(closeButton_MouseReleasedEvent); }
public DialogTestDialog() : base("Dialog Test", 500, 500, 260, 180) { girdLayout = new GirdLayout(4, 1); girdLayout.SetHorizontalAlignment(0, 0, EHAlignment.HLeft); girdLayout.SetHorizontalAlignment(1, 0, EHAlignment.HCenter); girdLayout.SetHorizontalAlignment(2, 0, EHAlignment.HCenter); girdLayout.SetHorizontalAlignment(3, 0, EHAlignment.HRight); girdLayout.Right = 16; girdLayout.Left = 16; girdLayout.Top = 8; girdLayout.Bottom = 8; girdLayout.Spacer = 4; closeButton = new Button("Close"); //closeButton.HorizontalStyle = EElementStyle.Stretch; dragAble = new CheckButton("Dragable", true); SizeAble = new CheckButton("Resizable", true); label = new Label("This is a modal dialog."); Layout = girdLayout; Add(label); Add(dragAble); Add(SizeAble); Add(closeButton); Pack(); closeButton.MouseReleasedEvent += new MouseReleasedHandler(closeButton_MouseReleasedEvent); dragAble.MousePressedEvent += new MousePressedHandler(dragAble_MousePressedEvent); SizeAble.MousePressedEvent += new MousePressedHandler(SizeAble_MousePressedEvent); }
public override void PaintCheckButton(CheckButton component) { Position origin = UI.Instance.GetOrigin(); SubImage checkStatus = null; if (component.Check == true) { checkStatus = checkButtonOn; } else { checkStatus = checkButtonOff; } switch (component.GetStatus()) { case EButtonStatus.Normal: { GL.Enable(EnableCap.Texture2D); GL.Color3(1f, 1f, 1f); buttonNormalLeft.Paint(origin.X + component.Position.X, origin.Y + component.Position.Y, origin.X + component.Position.X + 4, origin.Y + component.Position.Y + 19); buttonNormalRight.Paint(origin.X + component.Position.X + component.Size.width - 4, origin.Y + component.Position.Y, origin.X + component.Position.X + component.Size.width, origin.Y + component.Position.Y + 19); GL.Disable(EnableCap.Texture2D); GL.Color3((byte)55, (byte)67, (byte)65); GL.Begin(BeginMode.Quads); GL.Vertex2(origin.X + component.Position.X + 4, origin.Y + component.Position.Y); GL.Vertex2(origin.X + component.Position.X + component.Size.width - 4, origin.Y + component.Position.Y); GL.Vertex2(origin.X + component.Position.X + component.Size.width - 4, origin.Y + component.Position.Y + 19); GL.Vertex2(origin.X + component.Position.X + 4, origin.Y + component.Position.Y + 19); GL.End(); GL.Color3((byte)137, (byte)155, (byte)145); component.textFont.PosX = (int)(component.Position.X + component.Left + origin.X + 15); component.textFont.PosY = (int)(component.Top + origin.Y + component.Position.Y - 4); component.textFont.Render(true); GL.Enable(EnableCap.Texture2D); GL.Color3(1f, 1f, 1f); checkStatus.Paint(origin.X + component.Position.X + component.Left, origin.Y + component.Position.Y + component.Top, origin.X + component.Position.X + component.Left + 11, origin.Y + component.Position.Y + component.Top + 11); break; } case EButtonStatus.Hover: { GL.Enable(EnableCap.Texture2D); GL.Color3(1f, 1f, 1f); buttonHoverLeft.Paint(origin.X + component.Position.X, origin.Y + component.Position.Y, origin.X + component.Position.X + 4, origin.Y + component.Position.Y + 19); buttonHoverRight.Paint(origin.X + component.Position.X + component.Size.width - 4, origin.Y + component.Position.Y, origin.X + component.Position.X + component.Size.width, origin.Y + component.Position.Y + 19); GL.Disable(EnableCap.Texture2D); GL.Color3((byte)175, (byte)200, (byte)28); GL.Begin(BeginMode.Quads); GL.Vertex2(origin.X + component.Position.X + 4, origin.Y + component.Position.Y); GL.Vertex2(origin.X + component.Position.X + component.Size.width - 4, origin.Y + component.Position.Y); GL.Vertex2(origin.X + component.Position.X + component.Size.width - 4, origin.Y + component.Position.Y + 19); GL.Vertex2(origin.X + component.Position.X + 4, origin.Y + component.Position.Y + 19); GL.End(); GL.Color3(0, 0, 0); component.textFont.PosX = (int)(component.Position.X + component.Left + origin.X + 15); component.textFont.PosY = (int)(component.Top + origin.Y + component.Position.Y - 4); component.textFont.Render(true); GL.Enable(EnableCap.Texture2D); GL.Color3(1f, 1f, 1f); checkStatus.Paint(origin.X + component.Position.X + component.Left, origin.Y + component.Position.Y + component.Top, origin.X + component.Position.X + component.Left + 11, origin.Y + component.Position.Y + component.Top + 11); break; } case EButtonStatus.Pressed: { GL.Enable(EnableCap.Texture2D); GL.Color3(1f, 1f, 1f); buttonNormalLeft.Paint(origin.X + component.Position.X, origin.Y + component.Position.Y, origin.X + component.Position.X + 4, origin.Y + component.Position.Y + 19); buttonNormalRight.Paint(origin.X + component.Position.X + component.Size.width - 4, origin.Y + component.Position.Y, origin.X + component.Position.X + component.Size.width, origin.Y + component.Position.Y + 19); GL.Disable(EnableCap.Texture2D); GL.Color3((byte)55, (byte)67, (byte)65); GL.Begin(BeginMode.Quads); GL.Vertex2(origin.X + component.Position.X + 4, origin.Y + component.Position.Y); GL.Vertex2(origin.X + component.Position.X + component.Size.width - 4, origin.Y + component.Position.Y); GL.Vertex2(origin.X + component.Position.X + component.Size.width - 4, origin.Y + component.Position.Y + 19); GL.Vertex2(origin.X + component.Position.X + 4, origin.Y + component.Position.Y + 19); GL.End(); GL.Color3(0, 0, 0); component.textFont.PosX = (int)(component.Position.X + component.Left + origin.X + 15); component.textFont.PosY = (int)(component.Top + origin.Y + component.Position.Y - 4); component.textFont.Render(true); GL.Enable(EnableCap.Texture2D); GL.Color3(1f, 1f, 1f); checkStatus.Paint(origin.X + component.Position.X + component.Left, origin.Y + component.Position.Y + component.Top, origin.X + component.Position.X + component.Left + 11, origin.Y + component.Position.Y + component.Top + 11); break; } } }
public override Size GetCheckButtonPreferedSize(CheckButton component) { UI.Instance.CurrentTheme.defaultTextFont.MeasureString(component.Text, out w, out h); return new Size(component.Right + component.Left + (uint)w + 15, 19); }
public abstract void PaintCheckButton(CheckButton component);
public abstract Size GetCheckButtonPreferedSize(CheckButton component);