protected internal override void ExecuteDefaultAction(EventBase evt)
        {
            // no call to base.ExecuteDefaultAction(evt):
            // - we dont want mouse click to directly give focus to IMGUIContainer:
            //   they should be handled by IMGUI and if an IMGUI control grabs the
            //   keyboard, the IMGUIContainer will gain focus via FocusController.SyncIMGUIFocus.
            // - same thing for tabs: IMGUI should handle them.
            // - we dont want to set the PseudoState.Focus flag on IMGUIContainer.
            //   They are focusable, but only for the purpose of focusing their children.

            // Here, we set flags that will be acted upon in DoOnGUI(), since we need to change IMGUI state.

            if (evt.GetEventTypeId() == BlurEvent.TypeId())
            {
                BlurEvent     be = evt as BlurEvent;
                VisualElement relatedTargetElement = be.relatedTarget as VisualElement;
                // To mimic IMGUI behavior, we only want to clear GUIUtility.keyboardControl
                // when there is something else actually taking focus (canGrabFocus == true)
                // or when the clicked element is the top level IMGUIContainer (relatedTargetElement.parent == panel.visualTree).
                if (relatedTargetElement != null && (be.relatedTarget.canGrabFocus || relatedTargetElement.parent == panel.visualTree))
                {
                    lostFocus = true;
                }
            }
            else if (evt.GetEventTypeId() == FocusEvent.TypeId())
            {
                FocusEvent fe = evt as FocusEvent;
                receivedFocus        = true;
                focusChangeDirection = fe.direction;
            }
        }
Ejemplo n.º 2
0
        protected internal override void ExecuteDefaultAction(EventBase evt)
        {
            base.ExecuteDefaultAction(evt);

            if (evt.GetEventTypeId() == MouseOverEvent.TypeId() || evt.GetEventTypeId() == MouseOutEvent.TypeId())
            {
                UpdateCursorStyle(evt.GetEventTypeId());
            }
            else if (evt.GetEventTypeId() == MouseEnterEvent.TypeId())
            {
                pseudoStates |= PseudoStates.Hover;
            }
            else if (evt.GetEventTypeId() == MouseLeaveEvent.TypeId())
            {
                pseudoStates &= ~PseudoStates.Hover;
            }
            else if (evt.GetEventTypeId() == BlurEvent.TypeId())
            {
                pseudoStates = pseudoStates & ~PseudoStates.Focus;
            }
            else if (evt.GetEventTypeId() == FocusEvent.TypeId())
            {
                pseudoStates = pseudoStates | PseudoStates.Focus;
            }
        }
Ejemplo n.º 3
0
        protected internal override void ExecuteDefaultAction(EventBase evt)
        {
            base.ExecuteDefaultAction(evt);

            if (isDelayed && evt.GetEventTypeId() == BlurEvent.TypeId())
            {
                value = text;
            }
        }
Ejemplo n.º 4
0
        protected internal override void ExecuteDefaultAction(EventBase evt)
        {
            base.ExecuteDefaultAction(evt);

            if (!isDelayed || evt.GetEventTypeId() == BlurEvent.TypeId())
            {
                SetValueAndNotify(text);
            }
        }
Ejemplo n.º 5
0
        protected internal override void ExecuteDefaultAction(EventBase evt)
        {
            // no call to base.ExecuteDefaultAction(evt):
            // - we dont want mouse click to directly give focus to IMGUIContainer:
            //   they should be handled by IMGUI and if an IMGUI control grabs the
            //   keyboard, the IMGUIContainer will gain focus via FocusController.SyncIMGUIFocus.
            // - same thing for tabs: IMGUI should handle them.
            // - we dont want to set the PseudoState.Focus flag on IMGUIContainer.
            //   They are focusable, but only for the purpose of focusing their children.

            // Here, we set flags that will be acted upon in DoOnGUI(), since we need to change IMGUI state.
            if (evt.GetEventTypeId() == BlurEvent.TypeId())
            {
                // A lost focus event is ... a lost focus event.
                // The specific handling of the IMGUI will be done in the DoOnGUI() above...
                lostFocus = true;
            }
            else if (evt.GetEventTypeId() == FocusEvent.TypeId())
            {
                FocusEvent fe = evt as FocusEvent;
                receivedFocus        = true;
                focusChangeDirection = fe.direction;
            }
            else if (evt.GetEventTypeId() == DetachFromPanelEvent.TypeId())
            {
                if (elementPanel != null)
                {
                    elementPanel.IMGUIContainersCount--;
                }
            }
            else if (evt.GetEventTypeId() == AttachToPanelEvent.TypeId())
            {
                if (elementPanel != null)
                {
                    elementPanel.IMGUIContainersCount++;
                }
            }
        }