Commits

Anonymous committed 20b3c54

Added more stylable elements to dropdownlist.

Comments (0)

Files changed (1)

Gui/Menu/DropDownList.cs

             set { normalColor = value; }
         }
 
+        int borderWidth = 0;
+        public int BorderWidth
+        {
+            get { return borderWidth; }
+            set { borderWidth = value; }
+        }
+
+        RGBA_Bytes borderColor;
+        public RGBA_Bytes BorderColor
+        {
+            get { return borderColor; }
+            set { borderColor = value; }
+        }
+
         RGBA_Bytes hoverColor;
         public RGBA_Bytes HoverColor
         {
             mainControlText.AutoExpandBoundsToText = true;
             mainControlText.VAnchor = UI.VAnchor.ParentBottom;
             mainControlText.HAnchor = UI.HAnchor.ParentLeft;
+            mainControlText.Margin= new BorderDouble(right: 30);
             AddChild(mainControlText);
             FitToChildren();
 
             NormalColor = normalColor;
             HoverColor = hoverColor;
             BackgroundColor = normalColor;
+            BorderColor = RGBA_Bytes.White;
+            
+           
         }
 
         void DropDownList_MouseLeave(object sender, EventArgs e)
         public override void OnDraw(Graphics2D graphics2D)
         {
             base.OnDraw(graphics2D);
+            this.DrawBorder(graphics2D);
+            this.DrawDirectionalArrow(graphics2D);
+        }
 
+        private void DrawDirectionalArrow(Graphics2D graphics2D)
+        {
             PathStorage littleArrow = new PathStorage();
             if (this.MenuDirection == Direction.Down)
             {
                 littleArrow.LineTo(4, 0);
                 littleArrow.LineTo(0, -5);
             }
+            else if (this.MenuDirection == Direction.Up)
+            {
+                littleArrow.MoveTo(-4, -5);
+                littleArrow.LineTo(4, -5);
+                littleArrow.LineTo(0, 0);
+            }
             else
             {
-                littleArrow.MoveTo(-4, 0);
-                littleArrow.LineTo(4, 0);
-                littleArrow.LineTo(0, 5);
+                throw new NotImplementedException("Pulldown direction has not been implemented");
             }
-            graphics2D.Render(littleArrow, LocalBounds.Right - 10, LocalBounds.Bottom + Height * 3 / 4, TextColor);
-            //graphics2D.Line(LocalBounds.Left, LocalBounds.Bottom, LocalBounds.Right, LocalBounds.Top, RGBA_Bytes.Red);
-            //graphics2D.Line(LocalBounds.Left, LocalBounds.Top, LocalBounds.Right, LocalBounds.Bottom, RGBA_Bytes.Red);
+            graphics2D.Render(littleArrow, LocalBounds.Right - 8, LocalBounds.Top - 4, borderColor);
+        }
+
+        private void DrawBorder(Graphics2D graphics2D)
+        {
+            RectangleDouble Bounds = LocalBounds;
+            RoundedRect borderRect = new RoundedRect(this.LocalBounds, 0);
+            Stroke strokeRect = new Stroke(borderRect, borderWidth);
+            graphics2D.Render(strokeRect, borderColor);
         }
 
         public MenuItem AddItem(string name, string value = null)