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 void SetDropped(DropList dropped, int rx, int ry) { Dropped = dropped; position.X = currentX - rx; position.Y = currentY - ry + 22; size.width = 0; size.height = 0; uint spacer = Dropped.Spacer; List<DropListItem> itemList = Dropped.ItemList; int tempY = (int)Dropped.Top; foreach (DropListItem iter in itemList) { Size perfectSize = iter.GetPreferedSize(); iter.Position.X = (int)Dropped.Left; iter.Position.Y = tempY; size.width = Math.Max(perfectSize.width, size.width); size.height += spacer + perfectSize.height; tempY += (int)(perfectSize.height + spacer); } foreach (DropListItem iter in itemList) { iter.Size.width = size.width; } size.width += Dropped.Left + Dropped.Right; size.height += Dropped.Top + Dropped.Bottom - spacer; }
public override void PaintDropList(DropList component) { Position origin = UI.Instance.GetOrigin(); float x1=origin.X+component.Position.X; float x2=origin.X+component.Position.X+4; float x3=origin.X+component.Position.X+component.Size.width-4; float x4=origin.X+component.Position.X+component.Size.width; float y1=origin.Y+component.Position.Y; float y2=origin.Y+component.Position.Y+component.Size.height; GL.Enable(EnableCap.Texture2D); GL.Color3(1f, 1f, 1f); progressBarLeft.Paint(x1, y1, x2, y2); progressBarRight.Paint(x3,y1,x4,y2); GL.Disable(EnableCap.Texture2D); GL.Color3((byte)79, (byte)91, (byte)84); GL.Begin(BeginMode.Quads); GL.Vertex2(x2, y1); GL.Vertex2(x3, y1); GL.Vertex2(x3, y2); GL.Vertex2(x2, y2); GL.End(); DropListItem selected = component.SelectedItem; if(selected != null) { GL.Color3(0, 0, 0); selected.textFont.PosX = (int)(component.Position.X + component.Left + origin.X); selected.textFont.PosY = (int)(component.Top + origin.Y + component.Position.Y - 2); selected.textFont.Render(true); } }
public abstract void PaintDropList(DropList component);