Example #1
0
        internal static float GetMaxBoundsWidth(InvalidationManagerClient obj)
        {
            // explicit trumps explicitMax trumps Number.MAX_VALUE.
            float maxWidth = obj.ExplicitMaxWidth ?? DEFAULT_MAX_WIDTH;

            return maxWidth;
        }
Example #2
0
        /// <summary>
        /// Initializes the plugin
        /// </summary>
        /// <param name="component"></param>
        public void Initialize(InvalidationManagerClient component)
        {
            if (_initialized)
                return;

            _initialized = true;

            //Debug.Log("TabManager init");
            _component = (Component) component;

            ITabManagerClient tabManagerClient = component as ITabManagerClient;
            if (null == tabManagerClient)
                return;

            _components = TabChildren ?? tabManagerClient.GetTabChildren(); // gets all focusable children

            if (null == _circularTabs) // if not set on plugin
                _circularTabs = tabManagerClient.CircularTabs;

            if (null == _circularArrows) // if not set on plugin
                _circularArrows = tabManagerClient.CircularArrows;
            
            if (_components.Count > 0)
                _component.AddEventListener(KeyboardEvent.KEY_DOWN, KeyDownHandler, Phases); // subscribe to keys
        }
Example #3
0
        internal static float GetMaxBoundsHeight(InvalidationManagerClient obj)
        {
            // explicit trumps explicitMax trumps Number.MAX_VALUE.
            float maxHeight = obj.ExplicitMaxHeight ?? DEFAULT_MAX_HEIGHT;

            return(maxHeight);
        }
Example #4
0
        internal static float GetMaxBoundsHeight(InvalidationManagerClient obj)
        {
            // explicit trumps explicitMax trumps Number.MAX_VALUE.
            float maxHeight = obj.ExplicitMaxHeight ?? DEFAULT_MAX_HEIGHT;

            return maxHeight;
        }
Example #5
0
        internal static float GetMaxBoundsWidth(InvalidationManagerClient obj)
        {
            // explicit trumps explicitMax trumps Number.MAX_VALUE.
            float maxWidth = obj.ExplicitMaxWidth ?? DEFAULT_MAX_WIDTH;

            return(maxWidth);
        }
Example #6
0
// ReSharper disable UnusedMethodReturnValue.Local
        private InvalidationManagerClient RemoveChild(InvalidationManagerClient client, int level)
// ReSharper restore UnusedMethodReturnValue.Local
        {
            //var priority = (level >= -1) ? level : client.NestLevel;
            var priority = (level >= 0) ? level : client.NestLevel; // 20120229

            _bin = _priorityBins.ContainsKey(priority) ? _priorityBins[priority] : null;

            if (null != _bin && _bin.Items.Contains(client))
            {
                _bin.Items.Remove(client);
                _bin.Length--;

                if (0 == _bin.Length)
                {
                    _pool.Put(_bin);
                    _priorityBins.Remove(priority);
                }

                Generation++;

                return(client);
            }

            return(null);
        }
Example #7
0
        public void Initialize(InvalidationManagerClient component)
        {
            Debug.Log("Draggable Initialize: _dragHandle: " + _dragHandle);

            if (_initialized)
            {
                return;
            }

            _initialized = true;

            _component = (Component)component;

            // subscribe to CAPTURE PHASE component events

            _constraintMode = null == _dragHandle;
            //Debug.Log("Constrain mode: " + _constraintMode);

            //if (null != _dragHandle && _dragHandle is InvalidationManagerClient)
            //    ((InvalidationManagerClient)_dragHandle).SetStyle("cursor", "move");

            DisplayObject target = _dragHandle ?? _component;

            target.AddEventListener(MouseEvent.MOUSE_MOVE, ComponentMouseMoveHandler, /*EventPhase.Capture | */ EventPhase.Target); // NOTE: Target phase must be present because of the simple components
            target.AddEventListener(MouseEvent.MOUSE_OUT, ComponentMouseOutHandler, /*EventPhase.Capture | */ EventPhase.Target);
            target.AddEventListener(MouseEvent.MOUSE_DOWN, ComponentMouseDownHandler, /*EventPhase.Capture | */ EventPhase.Target);
            target.AddEventListener(FrameworkEvent.REMOVE, ComponentRemovedHandler);
        }
Example #8
0
        public void Initialize(InvalidationManagerClient component)
        {
            Debug.Log("Draggable Initialize: _dragHandle: " + _dragHandle);

            if (_initialized)
                return;

            _initialized = true;

            _component = (Component) component;
            
            // subscribe to CAPTURE PHASE component events

            _constraintMode = null == _dragHandle;
            //Debug.Log("Constrain mode: " + _constraintMode);

            //if (null != _dragHandle && _dragHandle is InvalidationManagerClient)
            //    ((InvalidationManagerClient)_dragHandle).SetStyle("cursor", "move");

            DisplayObject target = _dragHandle ?? _component;

            target.AddEventListener(MouseEvent.MOUSE_MOVE, ComponentMouseMoveHandler, /*EventPhase.Capture | */EventPhase.Target); // NOTE: Target phase must be present because of the simple components
            target.AddEventListener(MouseEvent.MOUSE_OUT, ComponentMouseOutHandler, /*EventPhase.Capture | */EventPhase.Target);
            target.AddEventListener(MouseEvent.MOUSE_DOWN, ComponentMouseDownHandler, /*EventPhase.Capture | */EventPhase.Target);
            target.AddEventListener(FrameworkEvent.REMOVE, ComponentRemovedHandler);
        }
Example #9
0
        public InvalidationManagerClient RemoveLargestChild(InvalidationManagerClient client)
        {
            var max = _maxPriority;
            var min = client.NestLevel; // _minPriority;

            while (min <= max)
            {
                PriorityBin bin = null;

                if (_priorityBins.ContainsKey(max) && _priorityBins[max].Length > 0)
                {
                    bin = _priorityBins[max];
                }

                if (null != bin && bin.Length > 0)
                {
                    if (max == client.NestLevel)
                    {
                        // If the current level we're searching matches that of our
                        // client, no need to search the entire list, just check to see
                        // if the client exists in the queue (it would be the only item
                        // at that nestLevel).
                        if (bin.Items.Contains(client))
                        {
                            RemoveChild(client, max);
                            return(client);
                        }
                    }
                    else
                    {
                        foreach (InvalidationManagerClient obj in bin.Items)
                        {
                            if (/*obj is Component && */ Contains(client, obj))
                            {
                                RemoveChild(obj /* as IInvalidationManagerClient*/, max);
                                return(obj);
                            }
                        }
                    }

                    max--;
                }

                else
                {
                    if (max == _maxPriority)
                    {
                        _maxPriority--;
                    }
                    max--;
                    if (max < min)
                    {
                        break;
                    }
                }
            }

            return(null);
        }
Example #10
0
 protected void HandleUpdateCompletePendingFlag(InvalidationManagerClient obj)
 {
     if (!obj.UpdateFlag)
     {
         _updateCompleteQueue.AddObject(obj, obj.NestLevel);
         obj.UpdateFlag = true;
     }
 }
Example #11
0
 protected void HandleUpdateCompletePendingFlag(InvalidationManagerClient obj)
 {
     if (!obj.UpdateFlag)
     {
         _updateCompleteQueue.AddObject(obj, obj.NestLevel);
         obj.UpdateFlag = true;
     }
 }
Example #12
0
        public InvalidationManagerClient RemoveSmallestChild(InvalidationManagerClient client)
        {
            var min = client.NestLevel;

            while (min <= _maxPriority)
            {
                //var bin = _priorityBins[min];

                if (_priorityBins.ContainsKey(min) && _priorityBins[min].Length > 0)
                {
                    PriorityBin bin = _priorityBins[min];
                    //}

                    //if (null != bin && bin.Length > 0)
                    //{
                    if (min == client.NestLevel)
                    {
                        // If the current level we're searching matches that of our
                        // client, no need to search the entire list, just check to see
                        // if the client exists in the queue (it would be the only item
                        // at that nestLevel).
                        if (bin.Items.Contains(client))
                        {
                            RemoveChild(client, min);
                            return(client);
                        }
                    }
                    else
                    {
                        foreach (InvalidationManagerClient obj in bin.Items)
                        {
                            if (/*obj is DisplayListMember && */ Contains(/*(IChildList)*/ client, /*(DisplayListMember)*/ obj))
                            {
                                RemoveChild(obj /* as IInvalidationManagerClient*/, min);
                                return(obj);
                            }
                        }
                    }

                    min++;
                }

                else
                {
                    if (min == _minPriority)
                    {
                        _minPriority++;
                    }
                    min++;
                    if (min > _maxPriority)
                    {
                        break;
                    }
                }
            }

            return(null);
        }
Example #13
0
        public void Invalidate(InvalidationManagerClient obj, bool invalidateClientFlag)
        {
            /*if (_targetLevel <= obj.NestLevel)
                invalidateClientFlag = true;*/

            Queue.AddObject(obj, obj.NestLevel);
            Invalid = true;
            InvalidClient = invalidateClientFlag;
        }
Example #14
0
        public void Invalidate(InvalidationManagerClient obj, bool invalidateClientFlag)
        {
            /*if (_targetLevel <= obj.NestLevel)
             *  invalidateClientFlag = true;*/

            Queue.AddObject(obj, obj.NestLevel);
            Invalid       = true;
            InvalidClient = invalidateClientFlag;
        }
Example #15
0
        public void Initialize(InvalidationManagerClient component)
        {
            if (_initialized)
                return;

            _initialized = true;
            //Debug.Log("DialogCloseOnEsc init");
            _dialog = (Dialog) component;
            _dialog.AddEventListener(KeyboardEvent.KEY_UP, KeyUpHandler, Phases);
        }
Example #16
0
        public void Initialize(InvalidationManagerClient component)
        {
            if (_initialized)
            {
                return;
            }

            _initialized = true;
            //Debug.Log("DialogCloseOnEsc init");
            _dialog = (Dialog)component;
            _dialog.AddEventListener(KeyboardEvent.KEY_UP, KeyUpHandler, Phases);
        }
Example #17
0
        internal static void SetLayoutBoundsSize(InvalidationManagerClient obj, float?width, float?height)
        {
            if (null == width)
            {
                width = GetPreferredBoundsWidth(obj);
            }
            if (null == height)
            {
                height = GetPreferredBoundsHeight(obj);
            }

            obj.SetActualSize((float)width, (float)height);
        }
Example #18
0
        /// <summary>
        /// Constructor
        /// </summary>
        public ProgramaticStyle(InvalidationManagerClient client)
        {
            _client = client;
            _style  = new GUIStyle();

            _normal    = new GUIStyleState();
            _onNormal  = new GUIStyleState();
            _hover     = new GUIStyleState();
            _active    = new GUIStyleState();
            _focused   = new GUIStyleState();
            _onHover   = new GUIStyleState();
            _onActive  = new GUIStyleState();
            _onFocused = new GUIStyleState();
        }
Example #19
0
        internal void AddObject(InvalidationManagerClient obj, int priority)
        {
            //Debug.Log(string.Format("AddObject [{0}; {1}]", obj, priority));

            if (_maxPriority < _minPriority)
            {
                _minPriority = priority;
                _maxPriority = priority;
            }
            else
            {
                if (priority < _minPriority)
                {
                    _minPriority = priority;
                }
                if (priority > _maxPriority)
                {
                    _maxPriority = priority;
                }
            }

            _bin = _priorityBins.ContainsKey(priority) ? _priorityBins[priority] : null;

            if (null == _bin)
            {
                // If no hash exists for the specified priority, create one.
                //_bin = new PriorityBin(); // TODO: Use ObjectPool of PriorityBins (but not very important)
                _bin = _pool.Get(); // here

                _bin.Length = 0;    // 20120229
                _bin.Items.Clear();
                //_bin.Reset(); // testing 20120421

                _priorityBins[priority] = _bin;
                _bin.Items.Add(obj);
                _bin.Length++;
            }
            else
            {
                // If we don't already hold the obj in the specified hash, add it
                // and update our item count.
                if (!_bin.Items.Contains(obj))
                {
                    _bin.Items.Add(obj);
                    _bin.Length++;
                }
            }

            Generation++;
        }
Example #20
0
        /// <summary>
        /// Constructor
        /// </summary>
        public ProgramaticStyle(InvalidationManagerClient client)
        {
            _client = client;
            _style = new GUIStyle();

            _normal = new GUIStyleState();
            _onNormal = new GUIStyleState();
            _hover = new GUIStyleState();
            _active = new GUIStyleState();
            _focused = new GUIStyleState();
            _onHover = new GUIStyleState();
            _onActive = new GUIStyleState();
            _onFocused = new GUIStyleState();
        }
Example #21
0
        internal InvalidationManagerClient RemoveSmallest()
        {
            _obj = null;

            if (_minPriority <= _maxPriority)
            {
                PriorityBin bin = _priorityBins.ContainsKey(_minPriority) ? _priorityBins[_minPriority] : null;

                while (null == bin || 0 == bin.Length)
                {
                    _minPriority++;
                    if (_minPriority > _maxPriority)
                    {
                        return(null);
                    }

                    bin = _priorityBins.ContainsKey(_minPriority) ? _priorityBins[_minPriority] : null;
                }

                // Remove the item with largest priority from our priority queue.
                // Must use a for loop here since we're removing a specific item
                // from a 'Dictionary' (no means of directly indexing).
                //foreach (object obj in bin.Items)
                //{
                //    _obj = obj as IInvalidationManagerClient;
                //    RemoveChild(_obj, _minPriority);
                //    break;
                //}
                if (bin.Items.Count > 0)
                {
                    _obj = bin.Items[0] /* as IInvalidationManagerClient*/;
                    RemoveChild(_obj, _minPriority);
                }

                bin = _priorityBins.ContainsKey(_minPriority) ? _priorityBins[_minPriority] : null;
                while (null == bin || 0 == bin.Length)
                {
                    _minPriority++;
                    if (_minPriority > _maxPriority)
                    {
                        break;
                    }

                    bin = _priorityBins.ContainsKey(_minPriority) ? _priorityBins[_minPriority] : null;
                }
            }

            return(_obj);
        }
Example #22
0
 public static float GetMinBoundsWidth(InvalidationManagerClient obj)
 {
     float minWidth;
     if (null != obj.ExplicitMinWidth)
     {
         minWidth = (float) obj.ExplicitMinWidth;
     }
     else
     {
         //minWidth = null == obj.MeasuredMinWidth ? 0 : obj.MeasuredMinWidth;
         minWidth = obj.MeasuredMinWidth; // TODO: eventual bug here
         if (null != obj.ExplicitMaxWidth)
             minWidth = Math.Min(minWidth, (float)obj.ExplicitMaxWidth);
     }
     return minWidth;
 }
        public void Initialize(InvalidationManagerClient component)
        {
            if (_initialized)
                return;

            _initialized = true;

            _component = (Component) component;

            // subscribe to CAPTURE PHASE component events

            // listening for mouse move over the component border
            _component.AddEventListener(MouseEvent.MOUSE_OVER, MouseOverHandler, EventPhase.Capture | EventPhase.Target); // NOTE: Target phase must be present because of the simple components
            
            // listening for mouse out to remove the overlay
            _component.AddEventListener(MouseEvent.MOUSE_OUT, MouseOutHandler, EventPhase.Capture | EventPhase.Target);
        }
Example #24
0
        internal void AddObject(InvalidationManagerClient obj, int priority)
        {
            //Debug.Log(string.Format("AddObject [{0}; {1}]", obj, priority));

            if (_maxPriority < _minPriority)
            {
                _minPriority = priority;
                _maxPriority = priority;
            }
            else
            {
                if (priority < _minPriority)
                    _minPriority = priority;
                if (priority > _maxPriority)
                    _maxPriority = priority;
            }
            
            _bin = _priorityBins.ContainsKey(priority) ? _priorityBins[priority] : null;

            if (null == _bin)
            {
                // If no hash exists for the specified priority, create one.
                //_bin = new PriorityBin(); // TODO: Use ObjectPool of PriorityBins (but not very important)
                _bin = _pool.Get(); // here
                
                _bin.Length = 0; // 20120229
                _bin.Items.Clear();
                //_bin.Reset(); // testing 20120421

                _priorityBins[priority] = _bin;
                _bin.Items.Add(obj);
                _bin.Length++;
            }
            else
            {
                // If we don't already hold the obj in the specified hash, add it
                // and update our item count.
                if (!_bin.Items.Contains(obj))
                {
                    _bin.Items.Add(obj);
                    _bin.Length++;
                }
            }

            Generation++;
        }
Example #25
0
        public void Initialize(InvalidationManagerClient component)
        {
            if (_initialized)
                return;

            _initialized = true;
            _component = (Component) component;

            // subscribe to TARGET PHASE component events
            _component.AddEventListener(LoadingEvent.START, StartHandler, EventPhase.Target);
            _component.AddEventListener(LoadingEvent.PROGRESS, ProgressHandler, EventPhase.Target);
            _component.AddEventListener(LoadingEvent.END, EndHandler, EventPhase.Target);
            _component.AddEventListener(LoadingEvent.ERROR, ErrorHandler, EventPhase.Target);

            //if (null == AnimationId)
            //    AnimationId = AnimationId;
        }
Example #26
0
        protected virtual void ChildAdded(DisplayListMember child)
        {
            InvalidationManagerClient imc = child as InvalidationManagerClient;

            if (null == imc)
            {
                return;
            }

            if (!imc.Initialized)
            {
                child.Initialize();
            }
            else // already created, but changed parent
            {
                child.PropagateStage();
            }
        }
Example #27
0
        internal InvalidationManagerClient RemoveLargest()
        {
            _obj = null;

            if (_minPriority <= _maxPriority)
            {
                PriorityBin bin = _priorityBins.ContainsKey(_maxPriority) ? _priorityBins[_maxPriority] : null;

                while (null == bin || 0 == bin.Length)
                {
                    _maxPriority--;
                    if (_maxPriority < _minPriority)
                        return null;
                    bin = _priorityBins.ContainsKey(_maxPriority) ? _priorityBins[_maxPriority] : null;
                }

                // Remove the item with largest priority from our priority queue.
                // Must use a for loop here since we're removing a specific item
                // from a 'Dictionary' (no means of directly indexing).
                //foreach (object obj in bin.Items)
                //{
                //    _obj = obj as IInvalidationManagerClient;
                //    RemoveChild(_obj, _maxPriority);
                //    break;
                //}
                if (bin.Items.Count > 0)
                {
                    _obj = bin.Items[0]/* as IInvalidationManagerClient*/;
                    RemoveChild(_obj, _maxPriority);
                }

                bin = _priorityBins.ContainsKey(_maxPriority) ? _priorityBins[_maxPriority] : null;
                while (null == bin || 0 == bin.Length)
                {
                    _maxPriority--;
                    if (_maxPriority < _minPriority)
                        break;
                    bin = _priorityBins.ContainsKey(_maxPriority) ? _priorityBins[_maxPriority] : null;
                }
            }

            return _obj;
        }
		private void AdditionalPropertyHandler(InvalidationManagerClient target)
		{
			/*if (!_done)
				return;*/

			//Debug.Log("Executing _invalidateClientPropertiesFlag handler for: " + target);
			if (_propertyInvalidator.InvalidClient)
			{
				// did any properties get invalidated while validating size?
				_obj = _propertyInvalidator.Queue.RemoveSmallestChild(target);
				if (null != _obj)
				{
					// re-queue it. we'll pull it at the beginning of the loop
					_propertyInvalidator.Queue.AddObject(target, target.NestLevel);
					_done = false;
					//break;
				}
			}
		}
Example #29
0
        public static float GetMinBoundsHeight(InvalidationManagerClient obj)
        {
            // explicit trumps explicitMin trumps measuredMin.
            // measuredMin is restricted by explicitMax.
            float minHeight;
            if (null != obj.ExplicitMinHeight)
            {
                minHeight = (float) obj.ExplicitMinHeight;
            }
            else
            {
                //minHeight = isNaN(obj.measuredMinHeight) ? 0 : obj.measuredMinHeight;
                minHeight = obj.MeasuredMinHeight;
                if (null != obj.ExplicitMaxHeight)
                    minHeight = Math.Min(minHeight, (float)obj.ExplicitMaxHeight);
            }

            return minHeight;
        }
        internal void InvalidateDisplayList(InvalidationManagerClient obj)
        {
#if DEBUG
            {
                if (DebugMode)
                {
                    InvalidationHelper.Log("InvalidateDisplayList", obj);
                }
            }
#endif
            if (!_displayListInvalidator.Invalid)
            {
                CheckSignal();
            }

            _invalidateClientDisplayListFlag = _targetLevel <= obj.NestLevel;

            _displayListInvalidator.Invalidate(obj, _invalidateClientDisplayListFlag);
        }
        internal void InvalidateEventQueue(InvalidationManagerClient obj)
        {
#if DEBUG
            {
                if (DebugMode)
                {
                    InvalidationHelper.Log("InvalidateEventQueue", obj);
                }
            }
#endif
            if (!_eventInvalidator.Invalid)
            {
                CheckSignal();
            }

            _invalidateClientEventsFlag = _targetLevel <= obj.NestLevel;

            _eventInvalidator.Invalidate(obj, _invalidateClientEventsFlag);
        }
Example #32
0
        public void Initialize(InvalidationManagerClient component)
        {
            if (_initialized)
            {
                return;
            }

            _initialized = true;

            _component = (Component)component;

            // subscribe to CAPTURE PHASE component events

            // listening for mouse move over the component border
            _component.AddEventListener(MouseEvent.MOUSE_OVER, MouseOverHandler, EventPhase.Capture | EventPhase.Target); // NOTE: Target phase must be present because of the simple components

            // listening for mouse out to remove the overlay
            _component.AddEventListener(MouseEvent.MOUSE_OUT, MouseOutHandler, EventPhase.Capture | EventPhase.Target);
        }
        internal void InvalidateProperties(InvalidationManagerClient obj)
        {
#if DEBUG
            {
                if (DebugMode)
                {
                    InvalidationHelper.Log("InvalidateProperties", obj);
                }
            }
#endif
            if (!_propertyInvalidator.Invalid)
            {
                CheckSignal();
            }

            _invalidateClientPropertiesFlag = _targetLevel <= obj.NestLevel;

            _propertyInvalidator.Invalidate(obj, _invalidateClientPropertiesFlag);
        }
Example #34
0
        public void Initialize(InvalidationManagerClient component)
        {
            if (_initialized)
            {
                return;
            }

            _initialized = true;
            _component   = (Component)component;

            // subscribe to TARGET PHASE component events
            _component.AddEventListener(LoadingEvent.START, StartHandler, EventPhase.Target);
            _component.AddEventListener(LoadingEvent.PROGRESS, ProgressHandler, EventPhase.Target);
            _component.AddEventListener(LoadingEvent.END, EndHandler, EventPhase.Target);
            _component.AddEventListener(LoadingEvent.ERROR, ErrorHandler, EventPhase.Target);

            //if (null == AnimationId)
            //    AnimationId = AnimationId;
        }
        private void AdditionalPropertyHandler(InvalidationManagerClient target)
        {
            /*if (!_done)
             *      return;*/

            //Debug.Log("Executing _invalidateClientPropertiesFlag handler for: " + target);
            if (_propertyInvalidator.InvalidClient)
            {
                // did any properties get invalidated while validating size?
                _obj = _propertyInvalidator.Queue.RemoveSmallestChild(target);
                if (null != _obj)
                {
                    // re-queue it. we'll pull it at the beginning of the loop
                    _propertyInvalidator.Queue.AddObject(target, target.NestLevel);
                    _done = false;
                    //break;
                }
            }
        }
Example #36
0
        public static float GetMinBoundsWidth(InvalidationManagerClient obj)
        {
            float minWidth;

            if (null != obj.ExplicitMinWidth)
            {
                minWidth = (float)obj.ExplicitMinWidth;
            }
            else
            {
                //minWidth = null == obj.MeasuredMinWidth ? 0 : obj.MeasuredMinWidth;
                minWidth = obj.MeasuredMinWidth; // TODO: eventual bug here
                if (null != obj.ExplicitMaxWidth)
                {
                    minWidth = Math.Min(minWidth, (float)obj.ExplicitMaxWidth);
                }
            }
            return(minWidth);
        }
Example #37
0
        public void Initialize(InvalidationManagerClient component)
        {
            if (_initialized)
                return;

            _initialized = true;

            _component = (Component) component;

            _component.OptimizeMeasureCalls = false;

            // subscribe to CAPTURE PHASE component events
            // listening for mouse move over the component border
            //_component.AddEventListener(MouseEvent.MOUSE_MOVE, IdleMouseMoveHandler, EventPhase.Capture | EventPhase.Target, EventPriority.CURSOR_MANAGEMENT); // NOTE: Target phase must be present because of the simple components
            _component.AddEventListener(MouseEvent.ROLL_OVER, IdleRollOverHandler, EventPhase.Capture | EventPhase.Target); //, EventPriority.CURSOR_MANAGEMENT); // NOTE: Target phase must be present because of the simple components
            _component.AddEventListener(MouseEvent.ROLL_OUT, IdleRollOutHandler, EventPhase.Capture | EventPhase.Target); //, EventPriority.CURSOR_MANAGEMENT); // NOTE: Target phase must be present because of the simple components

            //// listening for mouse click just to cancel it if being over the border
            //// TODO: implement priority and use the highest one
            //_component.AddEventListener(MouseEvent.CLICK, ClickHandler, EventPhase.Capture | EventPhase.Target);
        }
Example #38
0
        public static float GetMinBoundsHeight(InvalidationManagerClient obj)
        {
            // explicit trumps explicitMin trumps measuredMin.
            // measuredMin is restricted by explicitMax.
            float minHeight;

            if (null != obj.ExplicitMinHeight)
            {
                minHeight = (float)obj.ExplicitMinHeight;
            }
            else
            {
                //minHeight = isNaN(obj.measuredMinHeight) ? 0 : obj.measuredMinHeight;
                minHeight = obj.MeasuredMinHeight;
                if (null != obj.ExplicitMaxHeight)
                {
                    minHeight = Math.Min(minHeight, (float)obj.ExplicitMaxHeight);
                }
            }

            return(minHeight);
        }
Example #39
0
        public void Initialize(InvalidationManagerClient component)
        {
            if (_initialized)
            {
                return;
            }

            _initialized = true;

            _component = (Component)component;

            _component.OptimizeMeasureCalls = false;

            // subscribe to CAPTURE PHASE component events
            // listening for mouse move over the component border
            //_component.AddEventListener(MouseEvent.MOUSE_MOVE, IdleMouseMoveHandler, EventPhase.Capture | EventPhase.Target, EventPriority.CURSOR_MANAGEMENT); // NOTE: Target phase must be present because of the simple components
            _component.AddEventListener(MouseEvent.ROLL_OVER, IdleRollOverHandler, EventPhase.Capture | EventPhase.Target); //, EventPriority.CURSOR_MANAGEMENT); // NOTE: Target phase must be present because of the simple components
            _component.AddEventListener(MouseEvent.ROLL_OUT, IdleRollOutHandler, EventPhase.Capture | EventPhase.Target);   //, EventPriority.CURSOR_MANAGEMENT); // NOTE: Target phase must be present because of the simple components

            //// listening for mouse click just to cancel it if being over the border
            //// TODO: implement priority and use the highest one
            //_component.AddEventListener(MouseEvent.CLICK, ClickHandler, EventPhase.Capture | EventPhase.Target);
        }
        internal void InvalidateTransform(InvalidationManagerClient obj)
        {
            //InvalidationHelper.Log("InvalidateTransform", obj);
#if DEBUG
            {
                if (DebugMode)
                {
                    InvalidationHelper.Log("InvalidateTransform", obj);
                }
            }
#endif
            if (!_transformInvalidator.Invalid)
            {
                CheckSignal();
            }

            _invalidateClientTransformFlag = _targetLevel <= obj.NestLevel;

            //if (((InvalidationManagerClient)obj).Id == "btn")
            //    InvalidationHelper.Log("InvalidateTransform", obj);

            _transformInvalidator.Invalidate(obj, _invalidateClientTransformFlag);
        }
Example #41
0
        /// <summary>
        /// Initializes the plugin
        /// </summary>
        /// <param name="component"></param>
        public void Initialize(InvalidationManagerClient component)
        {
            if (_initialized)
            {
                return;
            }

            _initialized = true;

            //Debug.Log("TabManager init");
            _component = (Component)component;

            ITabManagerClient tabManagerClient = component as ITabManagerClient;

            if (null == tabManagerClient)
            {
                return;
            }

            _components = TabChildren ?? tabManagerClient.GetTabChildren(); // gets all focusable children

            if (null == _circularTabs)                                      // if not set on plugin
            {
                _circularTabs = tabManagerClient.CircularTabs;
            }

            if (null == _circularArrows) // if not set on plugin
            {
                _circularArrows = tabManagerClient.CircularArrows;
            }

            if (_components.Count > 0)
            {
                _component.AddEventListener(KeyboardEvent.KEY_DOWN, KeyDownHandler, Phases); // subscribe to keys
            }
        }
Example #42
0
 internal static float GetBoundsYAtSize(InvalidationManagerClient obj, float? width, float? height)
 {
     // explicit trumps explicitMax trumps Number.MAX_VALUE.
     //return GetMaxBoundsHeight(obj);
     return obj.Y;
 }
Example #43
0
        public void Validate(ref InvalidationManagerClient currentObject)
        {
#if DEBUG
            {
                if (DebugMode)
                {
                    Debug.Log("SizeInvalidator -> Validate");
                }
            }
#endif
            //_currentObject = currentObject;

            // Keep traversing the invalidatePropertiesQueue until we've reached the end.
            // More elements may get added to the queue while we're in this loop, or a
            // a recursive call to this function may remove elements from the queue while
            // we're in this loop.
            InvalidationManagerClient obj = Queue.RemoveLargest();

            while (null != obj)
            {
                //Debug.Log("InvalidationManager calling validateProperties() on " + obj);

                //CONFIG::performanceInstrumentation

                #region Debug

#if DEBUG
                {
                    if (DebugMode)
                    {
                        _start = DateTime.Now;
                    }
                }
#endif

                #endregion


                //if (obj is ComboBox)
                //    Debug.Log("validating combo: " + obj);

                //if (-1 != obj.NestLevel)
                //{
                currentObject = obj;
                obj.ValidateSize(false);
                //obj.ValidateSize(!(currentObject is Container)); // added 20121212. ComboBox didn't measure when in designer application (its children were never measured, because it is not a container)
                //obj.ValidateSize(true);
                HandleUpdateCompletePendingFlag(obj);
                //}

                #region Debug

#if DEBUG
                {
                    if (DebugMode)
                    {
                        var end = DateTime.Now.Subtract(_start);
                        InvalidationHelper.Log("ValidateSize", obj);
                        Debug.Log(string.Format("SizeInvalidator -> Validated in {0} ms", end.Milliseconds));
                    }
                }
#endif

                #endregion


                obj = Queue.RemoveLargest();
            }

            if (Queue.IsEmpty())
            {
                // trace("Properties Queue is empty");

                Invalid = false;

                /*_systemManager.DispatchEvent(
                 *  new Event("validateSizeComplete"));*/
            }
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="target"></param>
        /// <param name="skipDisplayList"></param>
        public void ValidateClient(InvalidationManagerClient target, bool skipDisplayList = false)
        {
            InvalidationManagerClient lastCurrentObject = _currentObject;

            int oldTargetLevel = _targetLevel;

            if (MaxHDepth == _targetLevel)
            {
                _targetLevel = target.NestLevel;
            }

            _done = false;

            while (!_done)
            {
                // assume we won't find anything
                _done = true;

                /**
                 * 1) Validate properties
                 * */
                _propertyInvalidator.ValidateClient(target, ref _currentObject);

                /**
                 * 2) Validate size
                 * */
                //InvalidationHelper.Log("## Validate size", target);
                _sizeInvalidator.ValidateClient(target, ref _currentObject);

                /**
                 * 3) Validate display list
                 * */
                if (!skipDisplayList)
                {
                    _displayListInvalidator.ValidateClient(target, ref _currentObject);
                }

                /**
                 * 4) Validate transforms
                 * */
                _transformInvalidator.ValidateClient(target, ref _currentObject);                 // moved 20130807

                /**
                 * 5) Validate events
                 * */
                _eventInvalidator.ValidateClient(target, ref _currentObject);
            }

            if (MaxHDepth == oldTargetLevel)
            {
                _targetLevel = MaxHDepth;
                if (!skipDisplayList)
                {
                    _obj = _updateCompleteQueue.RemoveLargestChild(target);
                    while (null != _obj)
                    {
                        if (!_obj.Initialized)
                        {
                            _obj.Initialized = true;
                        }

                        if (_obj.HasEventListener(FrameworkEvent.UPDATE_COMPLETE))
                        {
                            _obj.DispatchEvent(new FrameworkEvent(FrameworkEvent.UPDATE_COMPLETE));
                        }
                        _obj.UpdateFlag = false;
                        _obj            = _updateCompleteQueue.RemoveLargestChild(target);
                    }
                }
            }

            _currentObject = lastCurrentObject;
        }
Example #45
0
        //private void RemoveHandler(Event e)
        //{
        //    DisplayObject popup = e.Target as DisplayObject;
        //    if (null != popup)
        //    {
        //        popup.RemoveEventListener(MouseEvent.MOUSE_DOWN_OUTSIDE, RemoveHandler);
        //        popup.RemoveEventListener(MouseEvent.MOUSE_WHEEL_OUTSIDE, RemoveHandler);
        //        TerminatePopup(popup);
        //    }
        //    if (_popups.Count == 0 && SystemManager.Instance.HasEventListener(ResizeEvent.RESIZE))
        //        SystemManager.Instance.RemoveEventListener(ResizeEvent.RESIZE, RemoveHandler);
        //}

        //private static void TerminatePopup(DisplayObject popup)
        //{
        //    //Debug.Log("TerminatePopup");

        //    var dlm = popup as DisplayListMember;

        //    if (null != dlm)
        //    {
        //        Instance.RemovePopup(dlm);
        //        // TODO: SystemManager.Instance.RemoveEventListener(ResizeEvent.RESIZE, ...);
        //        dlm.Dispose();
        //    }
        //}

        #endregion

        #region Add

        /// <summary>
        /// Adds a popup to popup stage
        /// </summary>
        /// <param name="popup">A popup to add</param>
        /// <param name="options">Popup options</param>
        public void AddPopup(DisplayListMember popup, params PopupOption[] options)
        {
            Event e = new Event(OPENING, popup, false, true); // cancelable

            DispatchEvent(e);

            if (e.Canceled)
            {
                return;
            }

            if (IsDefaultPrevented(OPENING))
            {
                return;
            }

            if (_popups.Contains(popup))
            {
                return;
            }
#if DEBUG
            if (DebugMode)
            {
                Debug.Log("AddPopup");
            }
#endif

            DisplayObjectContainer parent = null;
            bool  modal      = true;
            bool  centered   = true;
            bool  keepCenter = false;
            bool  removeOnMouseDownOutside  = false;
            bool  removeOnMouseWheelOutside = false;
            bool  removeOnScreenResize      = false;
            bool  autoFocus           = true;
            bool  focusPreviousOnHide = true;
            Stage stage = _stage;

            bool visibleFlag = popup.Visible;
            popup.Visible = false;

            int len = options.Length;
            for (int i = 0; i < len; i++)
            {
                PopupOption option = options[i];
                switch (option.Type)
                {
                case PopupOptionType.Parent:
                    parent = (DisplayObjectContainer)option.Value;
                    break;

                case PopupOptionType.Modal:
                    modal = (bool)option.Value;
                    break;

                case PopupOptionType.Centered:
                    centered = (bool)option.Value;
                    break;

                case PopupOptionType.KeepCenter:
                    keepCenter = (bool)option.Value;
                    break;

                case PopupOptionType.RemoveOnMouseDownOutside:
                    removeOnMouseDownOutside = (bool)option.Value;
                    break;

                case PopupOptionType.RemoveOnMouseWheelOutside:
                    removeOnMouseWheelOutside = (bool)option.Value;
                    break;

                case PopupOptionType.RemoveOnScreenResize:
                    removeOnScreenResize = (bool)option.Value;
                    break;

                case PopupOptionType.AutoFocus:
                    autoFocus = (bool)option.Value;
                    break;

                case PopupOptionType.FocusPreviousOnHide:
                    focusPreviousOnHide = (bool)option.Value;
                    break;

                case PopupOptionType.Stage:
                    //Debug.Log("Exotic stage: " + option.Value);
                    stage = (Stage)option.Value;
                    break;

                default:
                    throw new Exception("Unknown option");
                }
            }

            _popups.Add(popup);

            if (null == parent)
            {
                parent = stage;
            }

            DisplayListMember overlay   = null;
            Group             popupRoot = null;

            InvalidationManagerClient imc = popup as InvalidationManagerClient;
            Component comp = popup as Component;
            if (null != comp)
            {
                comp.IsPopUp = true;
            }

            if (modal)
            {
                overlay = (DisplayListMember)Activator.CreateInstance(ModalOverlayType);
                overlay.AddEventListener(MouseEvent.MOUSE_DOWN, OnOverlayMouseDown);

                // we are packing both the overlay and the popup to into an aditional container
                popupRoot = new Group();
                stage.AddChild(popupRoot);

                // BUG BUG BUG! If we do _stage.AddChild(popupRoot); AFTER the children are added, we get a null exception
                // this is the major problem when adding children, started appearing since 10.1.2012
                // solved. This had to to with the creationcomplete method, which has to be run after the complete invalidation pass

                popupRoot.AddChild(overlay);
                popupRoot.AddChild(popup);

                // popup has been added to popup stage
                // invalidation methods have been called upon the addition
                // now we want to run measure (to validate dimensions)
                // because we want to center the popup
                // now, the absolute layout won't do it on his own
                //overlay.Bounds = (Rectangle)parent.Bounds.Clone();

                overlay.Width  = PopupManagerStage.Instance.Width;
                overlay.Height = PopupManagerStage.Instance.Height;

                /*var client = overlay as InvalidationManagerClient;
                 * if (client != null)
                 * {
                 *  /*var imc2 = client;
                 *  imc2.SetActualSize(
                 *      PopupManagerStage.Instance.Width,
                 *      PopupManagerStage.Instance.Height/*,
                 *      Math.Max(imc2.GetExplicitOrMeasuredWidth(), imc2.MinWidth),
                 *      Math.Max(imc2.GetExplicitOrMeasuredHeight(), imc2.MinHeight)#2#
                 *  );#1#
                 *  client.Width = PopupManagerStage.Instance.Width;
                 *  client.Height = PopupManagerStage.Instance.Height;
                 *  //imc2.InvalidateTransform();
                 * }
                 * else
                 * {
                 *  overlay.X = parent.X;
                 *  overlay.Y = parent.Y;
                 *  /*overlay.X = parent.X;
                 *  overlay.Y = parent.Y;#1#
                 * }*/
            }
            else
            {
                stage.AddChild(popup);
            }

            if (null != imc)
            {
                //InvalidationManager.Instance.ValidateClient(imc, true);
                imc.ValidateNow();
                //Debug.Log(string.Format("imc.Width:{0}, imc.Height:{1}", imc.Width, imc.Height));
                //Debug.Log(string.Format("imc.GetExplicitOrMeasuredWidth():{0}, imc.GetExplicitOrMeasuredHeight():{1}", imc.GetExplicitOrMeasuredWidth(), imc.GetExplicitOrMeasuredHeight()));
                //imc.SetActualSize(imc.GetExplicitOrMeasuredWidth(), imc.GetExplicitOrMeasuredHeight());

                imc.SetActualSize(
                    Math.Min(Math.Max(imc.GetExplicitOrMeasuredWidth(), imc.MinWidth), imc.MaxWidth),
                    Math.Min(Math.Max(imc.GetExplicitOrMeasuredHeight(), imc.MinHeight), imc.MaxHeight)
                    );
            }

            var descriptor = new PopupDescriptor(parent, overlay, popupRoot)
            {
                Popup      = popup,
                PopupRoot  = modal ? popupRoot : popup,
                Owner      = parent,
                Modal      = modal,
                Centered   = centered,
                KeepCenter = keepCenter,
                RemoveOnMouseDownOutside  = removeOnMouseDownOutside,
                RemoveOnMouseWheelOutside = removeOnMouseWheelOutside,
                RemoveOnScreenResize      = removeOnScreenResize,
                FocusPreviousOnHide       = focusPreviousOnHide,
                Stage = stage
            };

            _descriptors.Add(popup, descriptor);

            if (centered)
            {
                CenterPopUp(popup);
            }

            InteractiveComponent ic = popup as InteractiveComponent;
            if (autoFocus && null != ic)
            {
                ic.SetFocus(); // TEMP disabled, 2.1.2012.
                //FocusManager.Instance.SetFocus(ic);

                /*ic.Defer(delegate
                 * {
                 *  //ic.SetFocus();
                 *  FocusManager.Instance.SetFocus(ic);
                 * }, 1);*/
            }


            // connect if not connected
            if (_descriptors.Count > 0)
            {
                SystemManager.Instance.ResizeSignal.Connect(ResizeSlot);
                SystemManager.Instance.MouseDownSignal.Connect(MouseDownSlot);
                SystemManager.Instance.RightMouseDownSignal.Connect(MouseDownSlot);
                SystemManager.Instance.MiddleMouseDownSignal.Connect(MouseDownSlot);
                SystemManager.Instance.MouseWheelSignal.Connect(MouseWheelSlot);

                // subscribe to stage to see if some component has been mouse-downed
                // NOTE: some components (i.e. window close button) could cancel the event, this is by design

                // note: it is safe ta call it multiple times, it is checked internally
                stage.AddEventListener(MouseEvent.MOUSE_DOWN, MouseDownHandler);
            }
            else
            {
                SystemManager.Instance.ResizeSignal.Disconnect(ResizeSlot);
                SystemManager.Instance.MouseDownSignal.Disconnect(MouseDownSlot);
                SystemManager.Instance.RightMouseDownSignal.Disconnect(MouseDownSlot);
                SystemManager.Instance.MiddleMouseDownSignal.Disconnect(MouseDownSlot);
                SystemManager.Instance.MouseWheelSignal.Disconnect(MouseWheelSlot);

                //MouseEventDispatcher.Instance.RemoveEventListener(MouseEvent.MOUSE_DOWN, MouseDownHandler);
                stage.RemoveEventListener(MouseEvent.MOUSE_DOWN, MouseDownHandler);
            }

            // NOTE: This is needed when having effects because of the flicker (?):
            //descriptor.PopupRoot.SkipRender(100);

            // bring the popup root to front
            descriptor.PopupRoot.BringToFront();

            popup.Visible = visibleFlag;

            DispatchEvent(new Event(OPEN, popup));
        }
		/// <summary>
		/// 
		/// </summary>
		/// <param name="target"></param>
		/// <param name="skipDisplayList"></param>
		public void ValidateClient(InvalidationManagerClient target, bool skipDisplayList = false)
		{
			InvalidationManagerClient lastCurrentObject = _currentObject;
			
			int oldTargetLevel = _targetLevel;

			if (MaxHDepth == _targetLevel)
				_targetLevel = target.NestLevel;

			_done = false;

			while (!_done)
			{
				// assume we won't find anything
				_done = true;

				/**
				 * 1) Validate properties
				 * */
				_propertyInvalidator.ValidateClient(target, ref _currentObject);

				/**
				 * 2) Validate size
				 * */
				//InvalidationHelper.Log("## Validate size", target);
				_sizeInvalidator.ValidateClient(target, ref _currentObject);

				/**
				 * 3) Validate display list
				 * */
				if (!skipDisplayList)
					_displayListInvalidator.ValidateClient(target, ref _currentObject);

				/**
				 * 4) Validate transforms
				 * */
				_transformInvalidator.ValidateClient(target, ref _currentObject); // moved 20130807

				/**
				 * 5) Validate events
				 * */
				_eventInvalidator.ValidateClient(target, ref _currentObject);
			}

			if (MaxHDepth == oldTargetLevel)
			{
				_targetLevel = MaxHDepth;
				if (!skipDisplayList)
				{
					_obj = _updateCompleteQueue.RemoveLargestChild(target);
					while (null != _obj)
					{
						if (!_obj.Initialized)
							_obj.Initialized = true;

						if (_obj.HasEventListener(FrameworkEvent.UPDATE_COMPLETE))
							_obj.DispatchEvent(new FrameworkEvent(FrameworkEvent.UPDATE_COMPLETE));
						_obj.UpdateFlag = false;
						_obj = _updateCompleteQueue.RemoveLargestChild(target);
					}
				}
			}

			_currentObject = lastCurrentObject;
		}
        public void ValidateClient(InvalidationManagerClient target, ref InvalidationManagerClient currentObject)
        {
#if DEBUG
            {
                if (DebugMode)
                    Debug.Log("DisplayListInvalidator -> ValidateClient");
            }
#endif

            //IInvalidationManagerClient lastCurrentObject = _currentObject;

            //int i = 0;
            //bool done = false;
            //int oldTargetLevel = _targetLevel;

            //while (!done)
            //{
            //    done = true;


                // Keep traversing the invalidatePropertiesQueue until we've reached the end.
                // More elements may get added to the queue while we're in this loop, or a
                // a recursive call to this function may remove elements from the queue while
                // we're in this loop.
                InvalidationManagerClient obj = Queue.RemoveSmallestChild(target);

                while (null != obj)
                {
                    //Debug.Log("InvalidationManager calling validateProperties() on " + obj);

                    #region Debug

#if DEBUG
                    {
                        if (DebugMode)
                            _start = DateTime.Now;
                    }
#endif

                    #endregion

                    if (-1 != obj.NestLevel)
                    {
                        currentObject = obj;
                        obj.ValidateDisplayList();
                        HandleUpdateCompletePendingFlag(obj);
                    }

                    // process additional handlers
                    if (AdditionalHandlers.Count > 0)
                    {
                        foreach (AdditionalHandler handler in AdditionalHandlers)
                            handler(target);
                    }

                    #region Debug

#if DEBUG
                    {
                        if (DebugMode)
                        {
                            var end = DateTime.Now.Subtract(_start);
                            InvalidationHelper.Log("ValidateDisplayList", obj);
                            Debug.Log(string.Format("DisplayListInvalidator -> Validated in {0} ms", end.Milliseconds));
                        }
                    }
#endif

                    #endregion

                    // Once we start, don't stop.
                    obj = Queue.RemoveSmallestChild(target);
                }

                if (Queue.IsEmpty())
                {
                    // trace("Properties Queue is empty");

                    Invalid = false;
                    InvalidClient = false;
                    
                    /*_systemManager.DispatchEvent(
                        new Event("validatePropertiesComplete"));*/
                }

            //}

            //_currentObject = lastCurrentObject;
        }
Example #48
0
// ReSharper disable UnusedMethodReturnValue.Local
        private InvalidationManagerClient RemoveChild(InvalidationManagerClient client, int level)
// ReSharper restore UnusedMethodReturnValue.Local
        {
            //var priority = (level >= -1) ? level : client.NestLevel;
            var priority = (level >= 0) ? level : client.NestLevel; // 20120229

            _bin = _priorityBins.ContainsKey(priority) ? _priorityBins[priority] : null;

            if (null != _bin && _bin.Items.Contains(client))
            {   
                _bin.Items.Remove(client);
                _bin.Length--;

                if (0 == _bin.Length){
                    _pool.Put(_bin);
                    _priorityBins.Remove(priority);
                }

                Generation++;

                return client;
            }
            
            return null;
        }
Example #49
0
        public InvalidationManagerClient RemoveSmallestChild(InvalidationManagerClient client)
        {
            var min = client.NestLevel;

            while (min <= _maxPriority)
            {
                //var bin = _priorityBins[min];

                if (_priorityBins.ContainsKey(min) && _priorityBins[min].Length > 0)
                {
                    PriorityBin bin = _priorityBins[min];
                //}

                //if (null != bin && bin.Length > 0)
                //{
                    if (min == client.NestLevel)
                    {
                        // If the current level we're searching matches that of our
                        // client, no need to search the entire list, just check to see
                        // if the client exists in the queue (it would be the only item
                        // at that nestLevel).
                        if (bin.Items.Contains(client))
                        {
                            RemoveChild(client, min);
                            return client;
                        }
                    }
                    else
                    {
                        foreach (InvalidationManagerClient obj in bin.Items)
                        {
                            if (/*obj is DisplayListMember && */Contains(/*(IChildList)*/client, /*(DisplayListMember)*/obj))
                            {
                                RemoveChild(obj/* as IInvalidationManagerClient*/, min);
                                return obj;
                            }
                        }
                    }

                    min++;
                }

                else
                {
                    if (min == _minPriority)
                        _minPriority++;
                    min++;
                    if (min > _maxPriority)
                        break;
                }
            }

            return null;
        }
Example #50
0
        public InvalidationManagerClient RemoveLargestChild(InvalidationManagerClient client)
        {
            var max = _maxPriority;
            var min = client.NestLevel; // _minPriority;

            while (min <= max)
            {
                PriorityBin bin = null;

                if (_priorityBins.ContainsKey(max) && _priorityBins[max].Length > 0)
                {
                    bin = _priorityBins[max];
                }
                
                if (null != bin && bin.Length > 0)
                {
                    if (max == client.NestLevel)
                    {
                        // If the current level we're searching matches that of our
                        // client, no need to search the entire list, just check to see
                        // if the client exists in the queue (it would be the only item
                        // at that nestLevel).
                        if (bin.Items.Contains(client))
                        {
                            RemoveChild(client, max);
                            return client;
                        }
                    }
                    else
                    {
                        foreach (InvalidationManagerClient obj in bin.Items)
                        {
                            if (/*obj is Component && */Contains(client, obj))
                            {
                                RemoveChild(obj/* as IInvalidationManagerClient*/, max);
                                return obj;
                            }
                        }
                    }

                    max--;
                }

                else
                {
                    if (max == _maxPriority)
                        _maxPriority--;
                    max--;
                    if (max < min)
                        break;
                }
            }

            return null;
        }
Example #51
0
 internal static float GetLayoutBoundsWidth(InvalidationManagerClient obj)
 {
     return obj.Width;
 }
Example #52
0
        internal static void SetLayoutBoundsSize(InvalidationManagerClient obj, float? width, float? height)
        {
            if (null == width)
                width = GetPreferredBoundsWidth(obj);
            if (null == height)
                height = GetPreferredBoundsHeight(obj);

            obj.SetActualSize((float) width, (float) height);
        }
Example #53
0
 internal static float GetLayoutBoundsHeight(InvalidationManagerClient obj)
 {
     return obj.Height;
 }
Example #54
0
 internal static float GetPreferredBoundsHeight(InvalidationManagerClient obj)
 {
     return obj.GetExplicitOrMeasuredHeight();
 }
        /*public bool Invalid { get; private set; }*/

        public void Validate(ref InvalidationManagerClient currentObject)
        {
#if DEBUG
            {
                if (DebugMode)
                    Debug.Log("DisplayListInvalidator -> Validate");
            }
#endif
            //_currentObject = currentObject;

            // Keep traversing the invalidatePropertiesQueue until we've reached the end.
            // More elements may get added to the queue while we're in this loop, or a
            // a recursive call to this function may remove elements from the queue while
            // we're in this loop.
            InvalidationManagerClient obj = Queue.RemoveSmallest();

            while (null != obj)
            {
                //Debug.Log("InvalidationManager calling validateProperties() on " + obj);

                //if (obj is LoadingMaskAnimator)
                //    Debug.Log("Validating display list for: " + obj);

                //CONFIG::performanceInstrumentation
#if DEBUG
                {
                    if (DebugMode)
                        _start = DateTime.Now;
                }
#endif

                //if (-1 != obj.NestLevel)
                //{
                    currentObject = obj;
                    obj.ValidateDisplayList();
                    HandleUpdateCompletePendingFlag(obj);
                //}

                //CONFIG::performanceInstrumentation
#if DEBUG
                {
                    if (DebugMode)
                    {
                        var end = DateTime.Now.Subtract(_start);
                        InvalidationHelper.Log("ValidateDisplayList", obj);
                        Debug.Log(string.Format("DisplayListInvalidator -> Validated in {0} ms", end.Milliseconds));
                    }
                }
#endif

                // Once we start, don't stop.
                obj = Queue.RemoveSmallest();
            }

            if (Queue.IsEmpty())
            {
                // trace("Properties Queue is empty");

                Invalid = false;

                /*_systemManager.DispatchEvent(
                    new Event("validateDisplayListComplete"));*/
            }
        }
        //private int _measureCount;
        private void DoValidate()
        {
            if (_propertyInvalidator.Invalid)
            {
                _propertyInvalidator.Validate(ref _currentObject);
            }

            if (_sizeInvalidator.Invalid)
            {
                //Debug.Log("_styleInvalidator.Invalid: " + _styleInvalidator.Invalid);
                //Debug.Log("*** Measuring: " + _measureCount++);
                _sizeInvalidator.Validate(ref _currentObject);
            }

            if (_displayListInvalidator.Invalid)
            {
                _displayListInvalidator.Validate(ref _currentObject);
            }

            if (_transformInvalidator.Invalid)
            {
                _transformInvalidator.Validate(ref _currentObject);
            }

            if (_eventInvalidator.Invalid)
            {
                _eventInvalidator.Validate(ref _currentObject);
            }

            if (_propertyInvalidator.Invalid ||
                _transformInvalidator.Invalid ||
                _sizeInvalidator.Invalid ||
                _displayListInvalidator.Invalid ||
                _eventInvalidator.Invalid)
            {
                // do nothing (attachListeners(systemManager);)
            }
            else
            {
                InvalidationManagerClient obj = _updateCompleteQueue.RemoveLargest();
                while (null != obj)
                {
                    if (!obj.Initialized /* && obj.InternalStructureBuilt*/)
                    {
#if DEBUG
                        {
                            if (DebugMode)
                            {
                                InvalidationHelper.Log("Creation complete", obj);
                            }
                        }
#endif
                        // Most important: setting the initialized property here
                        // after all the initial VALIDATION cycles
                        obj.Initialized = true;
                    }
                    if (obj.HasEventListener(FrameworkEvent.UPDATE_COMPLETE))
                    {
                        obj.DispatchEvent(new FrameworkEvent(FrameworkEvent.UPDATE_COMPLETE));
                    }
                    obj.UpdateFlag = false;
                    obj            = _updateCompleteQueue.RemoveLargest();
                }

                //Debug.Log("updateComplete");

                /**
                 * We are emmiting the update complete signal here
                 * The listeners of this signal are connected for one shot only
                 * They internally reset their ForceLayout flags etc.
                 * */
                UpdateCompleteSignal.Emit();
            }
        }
		internal void InvalidateDisplayList(InvalidationManagerClient obj)
		{
#if DEBUG
			{
				if (DebugMode)
					InvalidationHelper.Log("InvalidateDisplayList", obj);
			}
#endif
			if (!_displayListInvalidator.Invalid)
				CheckSignal();

			_invalidateClientDisplayListFlag = _targetLevel <= obj.NestLevel;

			_displayListInvalidator.Invalidate(obj, _invalidateClientDisplayListFlag);
		}
Example #58
0
 internal static void SetLayoutBoundsPosition(InvalidationManagerClient obj, float x, float y)
 {
     obj.Move(x, y);
 }
Example #59
0
 /// <summary>
 /// Constructor
 /// </summary>
 public ProgramaticStyle(InvalidationManagerClient invalidationManagerClient, GUIStyle style)
     : this(invalidationManagerClient)
 {
     _style = style;
 }
		internal void InvalidateEventQueue(InvalidationManagerClient obj)
		{
#if DEBUG
			{
				if (DebugMode)
					InvalidationHelper.Log("InvalidateEventQueue", obj);
			}
#endif
			if (!_eventInvalidator.Invalid)
				CheckSignal();

			_invalidateClientEventsFlag = _targetLevel <= obj.NestLevel;

			_eventInvalidator.Invalidate(obj, _invalidateClientEventsFlag);
		}