Esempio 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();
        }
Esempio 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;
        }
Esempio 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);
        }
Esempio 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");
        }
Esempio 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);
        }
Esempio 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);
 }
Esempio 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);
        }
Esempio 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;
        }
Esempio 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);
        }
Esempio 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,
            });
        }
Esempio 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;
 }
Esempio n. 12
0
 public GameScreen(Rectangle area, Componate parent) : base(area, parent)
 {
     _internalRender = false;
 }
Esempio 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);
 }
Esempio n. 14
0
 public ProgressBar(Rectangle area, Componate parentcomponate) : base(area, parentcomponate)
 {
 }
Esempio n. 15
0
 public SpreedSheet(Rectangle area, Componate parentcomponate, List <string> titles, List <int> titleWidths) : base(area, parentcomponate)
 {
     Titles     = new Row(titles);
     _rowWidths = titleWidths;
 }
Esempio 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 = "";
 }
Esempio n. 17
0
 public Book(Rectangle area, Componate parentcomponate) : base(area, parentcomponate)
 {
     this._internalRender = false;
     // BgColourPrimary = Color.Red;
     AddPage("Page 1");
 }
Esempio n. 18
0
 public Divider(int y, Componate parent) : base(new Rectangle(10, y, parent.Area.Width, 4), parent)
 {
     Units = parent.Units;
 }
Esempio 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 = "";
 }
Esempio 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;
 }
Esempio n. 21
0
 public Divider(Rectangle area, Componate parent) : base(area, parent)
 {
 }
Esempio n. 22
0
 public FloatingListMenu(int height, Componate parentcomponate) :
     base(new Rectangle(0, 0, 100, height), parentcomponate)
 {
     _visible = false;
     Active   = false;
 }
Esempio n. 23
0
 public static Rectangle GetPercentageForRequiredPixels(Rectangle requiredPixels, Componate componate)
 {
     throw new Exception("Not implmented");
     return(new Rectangle());
 }
Esempio n. 24
0
 public Button(Rectangle area, Componate parentcomponate, string text = "") : base(area, parentcomponate)
 {
     Text = text;
 }
Esempio n. 25
0
 public ScrollableComponate(Rectangle area, Componate parentcomponate) : base(area, parentcomponate)
 {
 }
Esempio n. 26
0
 public static Componate Add(Componate componate)
 {
     Componates.Add(componate);
     return(Componates[Componates.Count - 1]);
 }