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(); }
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; }
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); }
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"); }
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); }
/// <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); }
/// <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); }
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; }
/// <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); }
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, }); }
/// <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; }
public GameScreen(Rectangle area, Componate parent) : base(area, parent) { _internalRender = false; }
/// <summary> /// add a new componate to this current componate /// </summary> /// <param name="componate"></param> public Componate AddComponate(Componate componate) { Componates.Add(componate); return(componate); }
public ProgressBar(Rectangle area, Componate parentcomponate) : base(area, parentcomponate) { }
public SpreedSheet(Rectangle area, Componate parentcomponate, List <string> titles, List <int> titleWidths) : base(area, parentcomponate) { Titles = new Row(titles); _rowWidths = titleWidths; }
/// <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 = ""; }
public Book(Rectangle area, Componate parentcomponate) : base(area, parentcomponate) { this._internalRender = false; // BgColourPrimary = Color.Red; AddPage("Page 1"); }
public Divider(int y, Componate parent) : base(new Rectangle(10, y, parent.Area.Width, 4), parent) { Units = parent.Units; }
/// <summary> /// a basic text box /// </summary> /// <param name="area"></param> /// <param name="parent"></param> public TickBox(Rectangle area, Componate parent) : base(area, parent) { Text = ""; }
/// <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; }
public Divider(Rectangle area, Componate parent) : base(area, parent) { }
public FloatingListMenu(int height, Componate parentcomponate) : base(new Rectangle(0, 0, 100, height), parentcomponate) { _visible = false; Active = false; }
public static Rectangle GetPercentageForRequiredPixels(Rectangle requiredPixels, Componate componate) { throw new Exception("Not implmented"); return(new Rectangle()); }
public Button(Rectangle area, Componate parentcomponate, string text = "") : base(area, parentcomponate) { Text = text; }
public ScrollableComponate(Rectangle area, Componate parentcomponate) : base(area, parentcomponate) { }
public static Componate Add(Componate componate) { Componates.Add(componate); return(Componates[Componates.Count - 1]); }