Esempio n. 1
0
        public T AddChild <T>(T child) where T : Widget
        {
            if (child == null)
            {
                this.LogError("Child must not be null.");
                return(null);
            }

            try {
                OnAddChild(child);
                Children.Add(child);
                if (child.IsOverlay)
                {
                    RootContainer root = Root ?? child.Root;
                    if (root != null)
                    {
                        root.RegisterOverlay(child);
                    }
                }
            } catch (Exception ex) {
                ex.LogError();
            }

            return((T)child);
        }
Esempio n. 2
0
        /***
         * [System.ComponentModel.Browsable(false)]
         * internal string _FontTag;
         * [System.ComponentModel.Browsable(false)]
         * internal string _IconFontTag;
         ***/

        protected override void CleanupManagedResources()
        {
            m_Parent    = null;
            m_Root      = null;
            ContextMenu = null;
            base.CleanupManagedResources();
        }
Esempio n. 3
0
        public void RefreshCursor()
        {
            RootContainer root = Root;

            if (root != null)
            {
                root.CTX.SetCursor(Cursor);
            }
        }
Esempio n. 4
0
        protected override void OnRootChanged()
        {
            if (IsDisposed)
            {
                return;
            }
            base.OnRootChanged();
            RootContainer root = Root;

            for (int i = 0; i < Children.Count; i++)
            {
                Children [i].Root = root;
            }
        }
Esempio n. 5
0
 public virtual void Invalidate(int frames = 0)
 {
     if (IsLayoutSuspended)
     {
         return;
     }
     if (InvalidateOnHeartBeat)
     {
         invalidateFlag = true;
     }
     else
     {
         RootContainer root = Root;
         if (root != null)
         {
             root.Invalidate(frames);
         }
     }
 }
Esempio n. 6
0
        public virtual void RemoveChild(Widget child)
        {
            if (child == null)
            {
                return;
            }

            try {
                // cleanup all necessary entries from the Root Container
                RootContainer root = Root ?? child.Root;
                if (root != null)
                {
                    root.RemoveWidget(child);
                }
                if (Children.Remove(child))
                {
                    OnChildRemoved(child);
                }
            } catch (Exception ex) {
                ex.LogError();
            }
        }
Esempio n. 7
0
        /// <summary>
        /// This scales the control,
        /// Call after setting your properties
        /// </summary>
        protected virtual void OnParentChanged()
        {
            if (IsDisposed)
            {
                return;
            }

            if (Parent != null)
            {
                RootContainer root = Parent.Root ?? Parent as RootContainer;
                if (root != null)
                {
                    Root = root;
                }

                ResetCachedLayout();
                Parent.ResetCachedLayout();
            }
            else
            {
                Root = null;
            }
        }
Esempio n. 8
0
 public MenuManager(RootContainer root)
 {
     Root     = root;
     Observer = new Observer <EventMessage> (OnNext, OnError, OnCompleted);
     root.Subscribe(Observer);
 }