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 TextNDropTestDialog() : base("TextField and DropList Test", 200, 200, 320, 200) { girdLayout = new GirdLayout(4, 1); girdLayout.Right = 16; girdLayout.Left = 16; girdLayout.Top = 8; girdLayout.Bottom = 8; girdLayout.Spacer = 4; girdLayout.SetHorizontalAlignment(1, 0, EHAlignment.HLeft); girdLayout.SetHorizontalAlignment(2, 0, EHAlignment.HCenter); girdLayout.SetHorizontalAlignment(3, 0, EHAlignment.HRight); closeButton = new Button("Close"); //textField=new TextField(160); dropList = new DropList(); option1 = new DropListItem("Option one"); option2 = new DropListItem("Option Two"); option3 = new DropListItem("Option Three"); dropList.Add(option1); dropList.Add(option2); dropList.Add(option3); textLabel = new Label("Text input here:"); optionLabel = new Label("Drop List test:"); Layout = girdLayout; Add(textLabel); //Add(textField); Add(optionLabel); Add(dropList); Add(closeButton); Pack(); closeButton.MouseReleasedEvent += new MouseReleasedHandler(closeButton_MouseReleasedEvent); }
public ScrollPanelTestDialog() : base("Scroll Panel Test", 400, 400, 320, 240) { girdLayout=new GirdLayout(2,1); girdLayout.Right = 16; girdLayout.Left = 16; girdLayout.Top = 8; girdLayout.Bottom = 8; girdLayout.Spacer = 4; girdLayout.SetHorizontalAlignment(1,0, EHAlignment.HRight); closeButton=new Button("Close"); panel=new ScrollPanel(); Layout = girdLayout; Add(panel); Add(closeButton); 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); }
/* //-------------------- Test GL.Color3((byte)255, (byte)0, (byte)0); GL.PolygonMode(MaterialFace.Front, PolygonMode.Line); GL.Begin(BeginMode.Quads); GL.Vertex2(testX, testY); GL.Vertex2(testX, testH); GL.Vertex2(testW, testH); GL.Vertex2(testW, testY); GL.End(); GL.PolygonMode(MaterialFace.Front, PolygonMode.Fill);*/ public override void PaintButton(Button component) { Position origin = UI.Instance.GetOrigin(); 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); 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); 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); break; } } component.textFont.PosX = (int)(component.Position.X + component.Left + origin.X + 2); component.textFont.PosY = (int)(component.Top + origin.Y + component.Position.Y - 2); component.textFont.Render(true); }
public override Size GetButtonPreferedSize(Button component) { UI.Instance.CurrentTheme.defaultTextFont.MeasureString(component.Text, out w, out h); return new Size(component.Right + component.Left + (uint)w, 19); }
public abstract void PaintButton(Button component);
public abstract Size GetButtonPreferedSize(Button component);
private static void AddButtonsToForm(MessageBox msgBoxFrm, MessageBoxButtons buttons) { // Rectangle screenRectangle = msgBoxFrm.RectangleToScreen(msgBoxFrm.ClientRectangle); int titleHeight = 0;// screenRectangle.Top - msgBoxFrm.Top; // var t = Type.GetType("Mono.Runtime"); // if ((t != null)) // titleHeight = 25; switch (buttons) { case MessageBoxButtons.OK: var but = new Button("OK"); but.MousePressedEvent += delegate { _state = DialogResult.OK; msgBoxFrm.Close(); }; msgBoxFrm.Add(but); break; case MessageBoxButtons.YesNo: var butyes = new Button("Yes"); butyes.MousePressedEvent += delegate { _state = DialogResult.Yes; msgBoxFrm.Close(); }; msgBoxFrm.Add(butyes); var butno = new Button("No"); butno.MousePressedEvent += delegate { _state = DialogResult.No; msgBoxFrm.Close(); }; msgBoxFrm.Add(butno); break; default: throw new NotImplementedException("Only MessageBoxButtons.OK and YesNo supported at this time"); } }
public ProgressNSliderTestDialog() : base("Progress and Slider Test", 150, 150, 320, 200) { /* borderLayout=new BorderLayout(16,16,16,16,8); borderLayout.SouthHAlignment = EHorizontalAlignment.HRight; closeButton=new Button("Close"); closeButton.LayoutProperty = EArea.South; valueLabel=new Label("Value:0%"); valueLabel.LayoutProperty = EArea.North; centerPanel=new Panel(); centerGirdLayout=new GirdLayout(2,1); centerPanel.Layout = centerGirdLayout; horizontalPBar=new ProgressBar(0.0f,100.0f,0.0f); horizontalSBar=new SlideBar(0.0f,100.0f,0.0f); centerPanel.Add(horizontalPBar); centerPanel.Add(horizontalSBar); centerPanel.LayoutProperty = EArea.Center; centerPanel.Pack(); verticalPBar=new ProgressBar(0.0f,100.0f,0.0f, ETypeOrientation.Vertical); verticalSBar=new SlideBar(0.0f,100.0f,0.0f, ETypeOrientation.Vertical); verticalPBar.LayoutProperty = EArea.East; verticalSBar.LayoutProperty = EArea.East; Add(closeButton); Add(valueLabel); Add(centerPanel); Add(verticalPBar); Add(verticalSBar); Layout = borderLayout; Pack(); */ 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.LayoutProperty = EArea.South; valueLabel = new Label("Value: 0%"); valueLabel.LayoutProperty = EArea.North; horizontalPBar = new ProgressBar(0.0f, 100.0f, ETypeOrientation.Horizontal); horizontalSBar = new SlideBar(0.0f, 100.0f, ETypeOrientation.Horizontal); Button button1 = new Button("button1"); Button button2 = new Button("button2"); Add(valueLabel); Add(horizontalPBar); Add(horizontalSBar); //Add(button1); //Add(button2); Add(closeButton); Layout = girdLayout; Pack(); horizontalSBar.Slider.DragMovedEvent += new DragMovedHandler(Slider_DragMovedEvent); closeButton.MouseReleasedEvent += new MouseReleasedHandler(closeButton_MouseReleasedEvent); }
public MultipleLayoutTestDialog() : base("MultipleLayout Test", 350, 350, 400, 180) { girdLayout=new GirdLayout(1,2); girdLayout.Right = 16; girdLayout.Left = 16; girdLayout.Top = 8; girdLayout.Bottom = 8; girdLayout.Spacer = 4; flowLayout=new FlowLayout(2,2,2,2,4); TheLabel=new Label("The"); TheLabel.SetDrawBackground(true); quickLabel=new Label("quick"); quickLabel.SetDrawBackground(true); brownLabel=new Label("brown"); brownLabel.SetDrawBackground(true); foxLabel=new Label("Fox"); foxLabel.SetDrawBackground(true); jumpsLabel=new Label("jumps"); jumpsLabel.SetDrawBackground(true); overLabel=new Label("over"); overLabel.SetDrawBackground(true); theLabel=new Label("a"); theLabel.SetDrawBackground(true); lazyDogLabel=new Label("lazy dog."); lazyDogLabel.SetDrawBackground(true); flowPanel=new Panel(); flowPanel.Layout = flowLayout; flowPanel.Add(TheLabel); flowPanel.Add(quickLabel); flowPanel.Add(brownLabel); flowPanel.Add(foxLabel); flowPanel.Add(jumpsLabel); flowPanel.Add(overLabel); flowPanel.Add(theLabel); flowPanel.Add(lazyDogLabel); flowPanel.Pack(); borderLayout=new BorderLayout(2,2,2,2,4); closeButton=new Button("Close"); closeButton.LayoutProperty = EArea.South; northLabel=new Label("North"); northLabel.HorizontalStyle = EElementStyle.Stretch; northLabel.SetDrawBackground(true); northLabel.LayoutProperty = EArea.North; southLabel=new Label("South"); southLabel.HorizontalStyle = EElementStyle.Stretch; southLabel.SetDrawBackground(true); southLabel.LayoutProperty = EArea.South; westLabel=new Label("West"); westLabel.VerticalStyle = EElementStyle.Stretch; westLabel.SetDrawBackground(true); westLabel.LayoutProperty = EArea.West; eastLabel=new Label("East"); eastLabel.VerticalStyle = EElementStyle.Stretch; eastLabel.SetDrawBackground(true); eastLabel.LayoutProperty = EArea.East; centerLabel=new Label("Center"); centerLabel.HorizontalStyle = EElementStyle.Stretch; centerLabel.VerticalStyle = EElementStyle.Stretch; centerLabel.SetDrawBackground(true); centerLabel.LayoutProperty = EArea.Center; borderPanel=new Panel(); borderPanel.Layout = borderLayout; borderPanel.Add(northLabel); borderPanel.Add(southLabel); borderPanel.Add(closeButton); borderPanel.Add(westLabel); borderPanel.Add(eastLabel); borderPanel.Add(centerLabel); borderPanel.Pack(); Layout = girdLayout; Add(flowPanel); Add(borderPanel); Pack(); closeButton.MouseReleasedEvent += new MouseReleasedHandler(closeButton_MouseReleasedEvent); }