Esempio n. 1
0
        /// <summary>
        /// Update all the managed widgets according to the input devices states.
        /// </summary>
        /// <param name="gameTime">game time reference</param>
        public void Update(Stopwatch gameTime)
        {
            /// Dispatch the hovering events.
            Widget receiver = PickWidget(myCursor.Position);
            if (myHoveredWidget != receiver)
            {
                if (myHoveredWidget != null)
                {
                    HoverEndEvent evt = new HoverEndEvent();

                    // the old owner of the focus can refuse the lost of the focus.
                    myHoveredWidget.OnEvent(evt);

                    if (evt.Accepted)
                        myHoveredWidget.OnHoverEndEvent(evt);
                }

                myHoveredWidget = receiver;
                if (receiver != null)
                {
                    HoverEvent evt = new HoverEvent();

                    // the old owner of the focus can refuse the lost of the focus.
                    receiver.OnEvent(evt);

                    if (evt.Accepted)
                        receiver.OnHoverEvent(evt);
                }
            }

            foreach (Widget widget in myManagedWidgets)
            {
                UpdateEvent raisedEvent = new UpdateEvent(gameTime);
                widget.OnEvent(raisedEvent);

                if (raisedEvent.Accepted)
                    widget.OnUpdate(raisedEvent);
            }
        }
Esempio n. 2
0
 /// <summary>
 /// Raised when the widgets update is beginning.
 /// </summary>
 /// <param name="beginUpdateEvent">raised event</param>
 public virtual void OnUpdate(UpdateEvent beginUpdateEvent)
 {
     foreach (Widget child in myChildrenWidgets)
         child.OnUpdate(beginUpdateEvent);
 }