CrabUI
Loading...
Searching...
No Matches
CUIPages.cs
1using System;
2using System.Collections.Generic;
3using System.Linq;
4
5using Barotrauma;
6using Microsoft.Xna.Framework;
7using Microsoft.Xna.Framework.Input;
8using Microsoft.Xna.Framework.Graphics;
9
10namespace CrabUI
11{
12 /// <summary>
13 /// Container for other components
14 /// Can have only 1 child
15 /// Sets component as it's only child when you open it (as a page)
16 /// </summary>
17 public class CUIPages : CUIComponent
18 {
19 public CUIComponent OpenedPage;
20
21 public bool IsOpened(CUIComponent p) => OpenedPage == p;
22
23 /// <summary>
24 /// Adds page as its only child
25 /// </summary>
26 /// <param name="page"></param>
27 public void Open(CUIComponent page)
28 {
29 RemoveAllChildren();
30 Append(page);
31 page.Relative = new CUINullRect(0, 0, 1, 1);
32 OpenedPage = page;
33 }
34
35 public CUIPages() : base()
36 {
37 BackgroundColor = Color.Transparent;
38 Border.Color = Color.Transparent;
39 CullChildren = false;
40 }
41 }
42}
Base class for all components.
virtual CUIComponent Append(CUIComponent child, string name=null, [CallerMemberName] string memberName="")
Adds children to the end of the list.
Color BackgroundColor
Color of BackgroundSprite, default is black If you're using custom sprite and don't see it make sur...
bool CullChildren
if child rect doesn't intersect with parent it won't be drawn and won't consume fps It also sets Hi...
Container for other components Can have only 1 child Sets component as it's only child when you o...
Definition CUIPages.cs:18
void Open(CUIComponent page)
Adds page as its only child.
Definition CUIPages.cs:27
Rectangle with float?
Definition CUIRect.cs:104