Ejemplo 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);
        }
Ejemplo 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();
        }
Ejemplo n.º 3
0
        public void RefreshCursor()
        {
            RootContainer root = Root;

            if (root != null)
            {
                root.CTX.SetCursor(Cursor);
            }
        }
Ejemplo 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;
            }
        }
Ejemplo 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);
         }
     }
 }
Ejemplo 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();
            }
        }
Ejemplo 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;
            }
        }
Ejemplo n.º 8
0
 public MenuManager(RootContainer root)
 {
     Root     = root;
     Observer = new Observer <EventMessage> (OnNext, OnError, OnCompleted);
     root.Subscribe(Observer);
 }