public MyGuiControls(IMyGuiControlsOwner owner) { m_owner = owner; m_controls = new ObservableCollection <MyGuiControlBase>(); m_controlsByName = new Dictionary <string, MyGuiControlBase>(); m_visibleControls = new List <MyGuiControlBase>(); m_controls.CollectionChanged += OnPrivateCollectionChanged; m_refreshVisibleControls = true; }
protected MyGuiScreenBase GetTopMostOwnerScreen() { try { IMyGuiControlsOwner currentOwner = Owner; while (!(currentOwner is MyGuiScreenBase)) { currentOwner = ((MyGuiControlBase)currentOwner).Owner; } return(currentOwner as MyGuiScreenBase); } catch (NullReferenceException) { MyLog.Default.WriteLine("NullReferenceException in " + DebugNamePath + " trying to reach top most owner."); return(null); } }
protected static void SetOwner(MyGuiControlBase control, IMyGuiControlsOwner owner) { control.Owner = owner; }