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 override Size GetDropListItemPreferedSize(DropListItem component) { UI.Instance.CurrentTheme.defaultTextFont.MeasureString(component.Text, out w, out h); return new Size(component.Right + component.Left + (uint)w, 20); }
public override void PaintDropListItem(DropListItem component) { Position origin= UI.Instance.GetOrigin(); if(component.GetStatus()== EButtonStatus.Hover) { GL.Color3((byte)175, (byte)200, (byte)28); GL.Begin(BeginMode.Quads); GL.Vertex2(origin.X + component.Position.X, origin.Y + component.Position.Y); GL.Vertex2(origin.X + component.Position.X + component.Size.width, origin.Y + component.Position.Y); GL.Vertex2(origin.X + component.Position.X + component.Size.width, origin.Y+component.Position.Y+component.Size.height); GL.Vertex2(origin.X + component.Position.X, origin.Y + component.Position.Y + component.Size.height); GL.End(); } GL.Color3(0, 0, 0); component.textFont.PosX = (int)(component.Position.X + component.Left + origin.X); component.textFont.PosY = (int)(component.Top + origin.Y + component.Position.Y - 2); component.textFont.Render(true); }
public abstract void PaintDropListItem(DropListItem component);
public void SetSelection(DropListItem selected) { SelectedItem = selected; }
public abstract Size GetDropListItemPreferedSize(DropListItem component);
public void SetSelection(int index) { SelectedItem = ItemList_[index]; }
public void Add(DropListItem item) { ItemList_.Add(item); Size = GetPreferedSize(); }
public void SetSelection(DropListItem selected) { SelectedItem = selected; }
public void SetSelection(int index) { SelectedItem = ItemList_[index]; }
public void Add(DropListItem item) { ItemList_.Add(item); Size = GetPreferedSize(); }