コード例 #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();
        }
コード例 #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;
        }
コード例 #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);
        }
コード例 #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");
        }
コード例 #5
0
ファイル: Book.cs プロジェクト: Mattlekim/RiddlersoftLib
        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);
        }
コード例 #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);
 }
コード例 #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);
        }
コード例 #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;
        }
コード例 #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);
        }
コード例 #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,
            });
        }
コード例 #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;
 }
コード例 #12
0
 public GameScreen(Rectangle area, Componate parent) : base(area, parent)
 {
     _internalRender = false;
 }
コード例 #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);
 }
コード例 #14
0
 public ProgressBar(Rectangle area, Componate parentcomponate) : base(area, parentcomponate)
 {
 }
コード例 #15
0
 public SpreedSheet(Rectangle area, Componate parentcomponate, List <string> titles, List <int> titleWidths) : base(area, parentcomponate)
 {
     Titles     = new Row(titles);
     _rowWidths = titleWidths;
 }
コード例 #16
0
ファイル: TickBox.cs プロジェクト: Mattlekim/RiddlersoftLib
 /// <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 = "";
 }
コード例 #17
0
ファイル: Book.cs プロジェクト: Mattlekim/RiddlersoftLib
 public Book(Rectangle area, Componate parentcomponate) : base(area, parentcomponate)
 {
     this._internalRender = false;
     // BgColourPrimary = Color.Red;
     AddPage("Page 1");
 }
コード例 #18
0
ファイル: Dividercs.cs プロジェクト: Mattlekim/RiddlersoftLib
 public Divider(int y, Componate parent) : base(new Rectangle(10, y, parent.Area.Width, 4), parent)
 {
     Units = parent.Units;
 }
コード例 #19
0
ファイル: TickBox.cs プロジェクト: Mattlekim/RiddlersoftLib
 /// <summary>
 /// a basic text box
 /// </summary>
 /// <param name="area"></param>
 /// <param name="parent"></param>
 public TickBox(Rectangle area, Componate parent) : base(area, parent)
 {
     Text = "";
 }
コード例 #20
0
ファイル: TextBox.cs プロジェクト: Mattlekim/RiddlersoftLib
 /// <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;
 }
コード例 #21
0
ファイル: Dividercs.cs プロジェクト: Mattlekim/RiddlersoftLib
 public Divider(Rectangle area, Componate parent) : base(area, parent)
 {
 }
コード例 #22
0
 public FloatingListMenu(int height, Componate parentcomponate) :
     base(new Rectangle(0, 0, 100, height), parentcomponate)
 {
     _visible = false;
     Active   = false;
 }
コード例 #23
0
 public static Rectangle GetPercentageForRequiredPixels(Rectangle requiredPixels, Componate componate)
 {
     throw new Exception("Not implmented");
     return(new Rectangle());
 }
コード例 #24
0
ファイル: Button.cs プロジェクト: Mattlekim/RiddlersoftLib
 public Button(Rectangle area, Componate parentcomponate, string text = "") : base(area, parentcomponate)
 {
     Text = text;
 }
コード例 #25
0
 public ScrollableComponate(Rectangle area, Componate parentcomponate) : base(area, parentcomponate)
 {
 }
コード例 #26
0
 public static Componate Add(Componate componate)
 {
     Componates.Add(componate);
     return(Componates[Componates.Count - 1]);
 }