Exemplo n.º 1
0
        public static void LoadContent(ContentManager content)
        {
            XIcon      = null;
            BackGround = new Texture2D(_device, 1, 1);
            BackGround.SetData <Color>(new Color[] { Color.White });

            Componate.Initalize(BackGround, XIcon, _device, content);

            Content = content;
            LoadMsgBox();
        }
Exemplo n.º 2
0
        public Slider(Rectangle area, int maxValue = 100, int minValue = 0,
                      Componate parentcomponate    = null,
                      Orentation orentation        = Orentation.Horizontal) : base(area, parentcomponate)
        {
            MaxValue = maxValue;
            MinValue = minValue;

            MouseTouch.OnLeftMouseDown    += OnMouseDownEvent;
            MouseTouch.OnLeftMouseRelease += OnMouseReleaseEvent;

            CurrentPercentage = 0;
            CurrentValue      = 0;
            _orentation       = orentation;
        }
Exemplo n.º 3
0
        public ListBox(Rectangle area, Componate parentcomponate, List <string> items, bool collapsible) : base(area, parentcomponate)
        {
            List <ListBoxItem> newitems = new List <ListBoxItem>();

            Collapsible        = collapsible;
            _collapsibleHeight = area.Height;

            for (int i = 0; i < items.Count; i++)
            {
                newitems.Add(new ListBoxItem(items[i], Font));
            }

            _items.AddRange(newitems);
        }
Exemplo n.º 4
0
        public static T FindComponateById <T>(string name) where T : Componate
        {
            Componate c = FindComponateById(name);

            if (c == null)
            {
                return(null);
            }
            if (c is T)
            {
                return(c as T);
            }

            throw new Exception("T is wrong type");
        }
Exemplo n.º 5
0
        public override Componate FindComponateById(string name)
        {
            Componate result = base.FindComponateById(name);

            if (result == null)
            {
                foreach (Page p in Pages)
                {
                    result = p.FindComponateById(name);
                    if (result != null)
                    {
                        return(result);
                    }
                }
            }
            return(result);
        }
Exemplo n.º 6
0
 /// <summary>
 /// trys to hide the componate with the given id
 /// </summary>
 /// <param name="id">the id of the componate to hide</param>
 public static bool HideComponate(string id)
 {
     for (int i = 0; i < Componates.Count; i++)
     {
         if (Componates[i].id == id)
         {
             Componate cm = Componates[i];
             cm.DeActivate();
             return(true);
         }
         else
         if (Componates[i].HideComponate(id))
         {
             return(true);
         }
     }
     return(false);
 }
Exemplo n.º 7
0
        /// <summary>
        /// finds a compoante using the given id
        /// </summary>
        /// <param name="name">the id of the compoant to show</param>
        /// <returns></returns>
        public virtual Componate FindComponateById(string name)
        {
            for (int i = 0; i < Componates.Count; i++)
            {
                if (Componates[i].id == name)
                {
                    return(Componates[i]);
                }
                else
                {
                    Componate returnValue = Componates[i].FindComponateById(name);
                    if (returnValue != null)
                    {
                        return(returnValue);
                    }
                }
            }

            return(null);
        }
Exemplo n.º 8
0
        private int _openHeight; //the maximum amount of heigh that there is for the menu

        public DropDownMenu(Vector2 pos, List <string> buttons, Componate parent) : base(new Rectangle((int)pos.X, (int)pos.Y, 0, 0), parent)
        {
            Font          = Fonts.VerySmall;
            ButtonHeight  = Convert.ToInt32(Fonts.VerySmall.MeasureString("qwertyuiopasdfghjklzxcvbnm").Y); //the the maximum possible width of any text on the button
            ButtonHeight += 4;                                                                              //add buffer

            int buttonWidth = 0;

            for (int i = 0; i < buttons.Count; i++)
            {
                if (Font.MeasureString(buttons[i]).X > buttonWidth)
                {
                    buttonWidth = Convert.ToInt32(Font.MeasureString(buttons[i]).X); //find the longes button text
                }
            }
            buttonWidth += 10; //add buffer to the lenght

            int buttonaddpos = 0;
            foreach (string b in buttons)
            {
                Items.Add(new Button(new Rectangle(0, buttonaddpos, buttonWidth, ButtonHeight), this)
                {
                    Text = b,
                    id   = "_ddmo_" + b,
                    Font = Font,
                });
                buttonaddpos += ButtonHeight;
            }
            _areaOriginal = new Rectangle((int)pos.X, (int)pos.Y, buttonWidth, ButtonHeight);
            _openHeight   = buttonaddpos;
            if (parent != null)
            {
                _areaCurrent = new Rectangle(_areaOriginal.X + parent.Area.X, _areaOriginal.Y + parent.Area.Y, _areaOriginal.Width, _areaOriginal.Height);
            }
            else
            {
                _areaCurrent = _areaOriginal;
            }
            Open = false;
        }
Exemplo n.º 9
0
        /// <summary>
        /// finds a compoante using the given id
        /// </summary>
        /// <param name="name">the id of the compoant to show</param>
        /// <returns></returns>
        public static Componate FindComponateById(string name)
        {
            for (int i = 0; i < Componates.Count; i++)
            {
                if (Componates[i].id == name)
                {
                    return(Componates[i]);
                }
                else
                {
                    Componate returnValue = Componates[i].FindComponateById(name);
                    if (returnValue != null)
                    {
                        return(returnValue);
                    }
                }
            }

#if DEBUG
            throw new Exception($"Componate {name} not found");
#endif
            return(null);
        }
Exemplo n.º 10
0
        public FileDialog(Rectangle area, Componate parentcomponate) : base(area, parentcomponate)
        {
            Visible = false;
            Active  = false;

            AddComponate(new ListBox(new Rectangle(1, 11, 98, 77), this, null)
            {
                Units          = MesurementUnit.Percentage,
                id             = "filelist",
                OnItemSelected = FileList_OnItemClicked
            });

            AddComponate(new Button(new Rectangle(85, 89, 14, 10), this)
            {
                Units       = MesurementUnit.Percentage,
                id          = "ok",
                Text        = "Load",
                OnLeftClick = Bnt_On_Ok_Clicked,
            });

            AddComponate(new Button(new Rectangle(69, 89, 14, 10), this)
            {
                Units       = MesurementUnit.Percentage,
                id          = "cancel",
                Text        = "Cancel",
                CloseParent = true,
            });

            AddComponate(new TextBox(new Rectangle(1, 89, 66, 10), this)
            {
                Units        = MesurementUnit.Percentage,
                id           = "txtfile",
                Text         = "",
                OnKeyPressed = Txt_On_Key_Pressed,
            });
        }
Exemplo n.º 11
0
 /// <summary>
 /// overides the current partent with a new one
 /// </summary>
 /// <param name="newParent">the new parent class</param>
 public void SetParent(Componate newParent)
 {
     _parent = newParent;
 }
Exemplo n.º 12
0
 public GameScreen(Rectangle area, Componate parent) : base(area, parent)
 {
     _internalRender = false;
 }
Exemplo n.º 13
0
 /// <summary>
 /// add a new componate to this current componate
 /// </summary>
 /// <param name="componate"></param>
 public Componate AddComponate(Componate componate)
 {
     Componates.Add(componate);
     return(componate);
 }
Exemplo n.º 14
0
 public ProgressBar(Rectangle area, Componate parentcomponate) : base(area, parentcomponate)
 {
 }
Exemplo n.º 15
0
 public SpreedSheet(Rectangle area, Componate parentcomponate, List <string> titles, List <int> titleWidths) : base(area, parentcomponate)
 {
     Titles     = new Row(titles);
     _rowWidths = titleWidths;
 }
Exemplo n.º 16
0
 /// <summary>
 /// a basic text box
 /// </summary>
 /// <param name="area"></param>
 /// <param name="parent"></param>
 public TickBox(Vector2 pos, Componate parent) : base(new Rectangle((int)pos.X, (int)pos.Y, 25, 25), parent)
 {
     Text = "";
 }
Exemplo n.º 17
0
 public Book(Rectangle area, Componate parentcomponate) : base(area, parentcomponate)
 {
     this._internalRender = false;
     // BgColourPrimary = Color.Red;
     AddPage("Page 1");
 }
Exemplo n.º 18
0
 public Divider(int y, Componate parent) : base(new Rectangle(10, y, parent.Area.Width, 4), parent)
 {
     Units = parent.Units;
 }
Exemplo n.º 19
0
 /// <summary>
 /// a basic text box
 /// </summary>
 /// <param name="area"></param>
 /// <param name="parent"></param>
 public TickBox(Rectangle area, Componate parent) : base(area, parent)
 {
     Text = "";
 }
Exemplo n.º 20
0
 /// <summary>
 /// a basic text box
 /// </summary>
 /// <param name="area"></param>
 /// <param name="parent"></param>
 public TextBox(Rectangle area, Componate parent) : base(area, parent)
 {
     Text = "";
     TextColourPrimary = Color.Black;
 }
Exemplo n.º 21
0
 public Divider(Rectangle area, Componate parent) : base(area, parent)
 {
 }
Exemplo n.º 22
0
 public FloatingListMenu(int height, Componate parentcomponate) :
     base(new Rectangle(0, 0, 100, height), parentcomponate)
 {
     _visible = false;
     Active   = false;
 }
Exemplo n.º 23
0
 public static Rectangle GetPercentageForRequiredPixels(Rectangle requiredPixels, Componate componate)
 {
     throw new Exception("Not implmented");
     return(new Rectangle());
 }
Exemplo n.º 24
0
 public Button(Rectangle area, Componate parentcomponate, string text = "") : base(area, parentcomponate)
 {
     Text = text;
 }
Exemplo n.º 25
0
 public ScrollableComponate(Rectangle area, Componate parentcomponate) : base(area, parentcomponate)
 {
 }
Exemplo n.º 26
0
 public static Componate Add(Componate componate)
 {
     Componates.Add(componate);
     return(Componates[Componates.Count - 1]);
 }