// Token: 0x06005925 RID: 22821 RVA: 0x0018A2E0 File Offset: 0x001884E0
        private bool AllowHandleKeyEvent(FocusNavigationDirection direction)
        {
            if (!this.IsSelected)
            {
                return(false);
            }
            DependencyObject dependencyObject = Keyboard.FocusedElement as DependencyObject;

            if (dependencyObject != null)
            {
                DependencyObject dependencyObject2 = UIElementHelper.PredictFocus(dependencyObject, direction);
                if (dependencyObject2 != dependencyObject)
                {
                    while (dependencyObject2 != null)
                    {
                        TreeViewItem treeViewItem = dependencyObject2 as TreeViewItem;
                        if (treeViewItem == this)
                        {
                            return(false);
                        }
                        if (treeViewItem != null || dependencyObject2 is TreeView)
                        {
                            return(true);
                        }
                        dependencyObject2 = KeyboardNavigation.GetParent(dependencyObject2);
                    }
                }
            }
            return(true);
        }
示例#2
0
        private static bool IsVisible(DependencyObject element)
        {
            while (element != null)
            {
                Visibility  visibility;
                UIElement   uiElem   = element as UIElement;
                UIElement3D uiElem3D = element as UIElement3D;

                if (uiElem != null)

                {
                    visibility = uiElem.Visibility;
                }
                else
                {
                    visibility = uiElem3D.Visibility;
                }

                if (visibility != Visibility.Visible)
                {
                    return(false);
                }

                element = UIElementHelper.GetUIParent(element);
            }

            return(true);
        }
示例#3
0
        private static UIElement GetTarget(DependencyObject o)
        {
            UIElement uIElement = o as UIElement;

            if (uIElement == null)
            {
                ContentElement contentElement = o as ContentElement;
                if (contentElement != null)
                {
                    DependencyObject dependencyObject = PopupControlService.FindContentElementParent(contentElement);
                    uIElement = (dependencyObject as UIElement);
                    if (uIElement == null)
                    {
                        UIElement3D uIElement3D = dependencyObject as UIElement3D;
                        if (uIElement3D != null)
                        {
                            uIElement = UIElementHelper.GetContainingUIElement2D(uIElement3D);
                        }
                    }
                }
                else
                {
                    UIElement3D uIElement3D2 = o as UIElement3D;
                    if (uIElement3D2 != null)
                    {
                        uIElement = UIElementHelper.GetContainingUIElement2D(uIElement3D2);
                    }
                }
            }
            return(uIElement);
        }
示例#4
0
        /// <summary>
        /// Removes a handler for the <see cref="E:TwistedLogik.Ultraviolet.UI.Presentation.Input.FocusManager.LostFocus"/>
        /// attached event from the specified element.
        /// </summary>
        /// <param name="element">The element from which to remove the handler.</param>
        /// <param name="handler">The handler to remove from the specified element.</param>
        public static void RemoveLostFocusHandler(DependencyObject element, UpfRoutedEventHandler handler)
        {
            Contract.Require(element, nameof(element));
            Contract.Require(handler, nameof(handler));

            UIElementHelper.RemoveHandler(element, LostFocusEvent, handler);
        }
示例#5
0
        private bool AllowHandleKeyEvent(FocusNavigationDirection direction)
        {
            if (!IsSelected)
            {
                return(false);
            }

            DependencyObject currentFocus = Keyboard.FocusedElement as DependencyObject;

            if (currentFocus != null)
            {
                DependencyObject predict = UIElementHelper.PredictFocus(currentFocus, direction);
                if (predict != currentFocus)
                {
                    while (predict != null)
                    {
                        TreeViewItem item = predict as TreeViewItem;
                        if (item == this)
                        {
                            return(false); // There is a focusable item in the header
                        }
                        else if ((item != null) || (predict is TreeView))
                        {
                            return(true);
                        }

                        predict = KeyboardNavigation.GetParent(predict);
                    }
                }
            }

            return(true);
        }
        private void CommentButton_Click(object sender, RoutedEventArgs e)
        {
            //The comment button will go into or out of the Comment Box
            var button = sender as UIElement;

            if (button != null)
            {
                var textbox = UIElementHelper.FindNear <TextBox>(button);
                if (textbox != null)
                {
                    if (textbox.IsVisible)
                    {
                        if (textbox.IsFocused)
                        {
                            button.Focus();
                            RaiseFocusChanged(new RoutedEventArgs());
                        }
                        else
                        {
                            textbox.Focus();
                            textbox.CaretIndex = textbox.Text.Length;
                            RaiseFocusChanged(new RoutedEventArgs());
                        }
                    }
                }
            }
        }
        /// <summary>
        /// Focus on a textbox, and hint scrolling to the Grid containing that TextBox
        /// </summary>
        /// <param name="sender">TextBox to focus on</param>
        private void FocusOnTextbox(object sender)
        {
            var textbox = sender as TextBox;

            if (textbox != null)
            {
                System.Threading.Tasks.Task.Factory.StartNew(() =>
                {
                    System.Threading.Thread.Sleep(100);
                    this.Dispatcher.BeginInvoke(new Action(() =>
                    {
                        if (textbox.IsVisible)
                        {
                            textbox.Focus();
                            textbox.CaretIndex = textbox.Text.Length;

                            var parentGrid = UIElementHelper.FindParentOf <Grid>(textbox);
                            if (parentGrid != null)
                            {
                                var position = parentGrid.TranslatePoint(new Point(0, 0), this);
                                if (ScrollHint != null)
                                {
                                    ScrollHint(this, new IcdListScrollHintEventArgs(position.Y));
                                }
                            }
                        }
                    }));
                });
            }
        }
示例#8
0
        /// <summary>
        ///     Returns the UIElement target
        /// </summary>
        private static UIElement GetTarget(DependencyObject o)
        {
            UIElement uie = o as UIElement;

            if (uie == null)
            {
                ContentElement ce = o as ContentElement;
                if (ce != null)
                {
                    DependencyObject ceParent = FindContentElementParent(ce);

                    // attempt to cast to a UIElement
                    uie = ceParent as UIElement;
                    if (uie == null)
                    {
                        // target can't be a UIElement3D - so get the nearest containing UIElement
                        UIElement3D uie3D = ceParent as UIElement3D;
                        if (uie3D != null)
                        {
                            uie = UIElementHelper.GetContainingUIElement2D(uie3D);
                        }
                    }
                }
                else
                {
                    // it wasn't a UIElement or ContentElement, try one last cast to UIElement3D
                    // target can't be a UIElement3D - so get the nearest containing UIElement
                    UIElement3D uie3D = o as UIElement3D;

                    if (uie3D != null)
                    {
                        uie = UIElementHelper.GetContainingUIElement2D(uie3D);
                    }
                }
            }

            return(uie);
        }
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            Initialize(property);
            --EditorGUI.indentLevel;
            using (var check = new EditorGUI.ChangeCheckScope())
            {
                if (m_MaskedSourceNames == null)
                {
                    m_MaskedSourceNames = EnumHelper.MaskOutEnumNames <ImageSource>((int)m_SupportedSources);
                }

                var index = EnumHelper.GetMaskedIndexFromEnumValue <ImageSource>(m_Source.intValue, (int)m_SupportedSources);
                index = EditorGUILayout.Popup(new GUIContent("Camera", "The camera to use for the recording."), index, m_MaskedSourceNames);

                if (check.changed)
                {
                    m_Source.intValue = EnumHelper.GetEnumValueFromMaskedIndex <ImageSource>(index, (int)m_SupportedSources);
                }
            }

            if ((ImageSource)m_Source.intValue == ImageSource.TaggedCamera)
            {
                ++EditorGUI.indentLevel;
                EditorGUILayout.PropertyField(m_CameraTag, Styles.TagLabel);
                --EditorGUI.indentLevel;
            }

            var outputDimensions = new int[2];

            outputDimensions[0] = m_OutputWidth.intValue;
            outputDimensions[1] = m_OutputHeight.intValue;

            if (UIElementHelper.MultiIntField(Styles.OutputLabel, Styles.DimensionLabels, outputDimensions))
            {
                m_OutputWidth.intValue  = outputDimensions[0];
                m_OutputHeight.intValue = outputDimensions[1];
            }

            var cubeMapWidth = new int[1];

            cubeMapWidth[0]     = m_CubeMapSz.intValue;
            outputDimensions[1] = m_OutputHeight.intValue;

            if (UIElementHelper.MultiIntField(Styles.CubeMapLabel, Styles.CubeDimensionLabel, cubeMapWidth))
            {
                m_CubeMapSz.intValue = cubeMapWidth[0];
            }

            EditorGUILayout.Space();

            EditorGUILayout.PropertyField(m_RenderStereo, Styles.StereoLabel);

            ++EditorGUI.indentLevel;
            using (new EditorGUI.DisabledScope(!m_RenderStereo.boolValue))
            {
                EditorGUILayout.PropertyField(m_StereoSeparation, Styles.StereoSeparationLabel);
            }
            --EditorGUI.indentLevel;

            EditorGUILayout.Space();
            EditorGUILayout.PropertyField(m_FlipFinalOutput, Styles.FlipVerticalLabel);
            ++EditorGUI.indentLevel;
        }
示例#10
0
 /// <summary>
 /// Adds a handler for the <see cref="E:Ultraviolet.Presentation.Controls.Primitives.Selector.Unselected"/>
 /// attached event to the specified element.
 /// </summary>
 /// <param name="element">The element to which to add the event handler.</param>
 /// <param name="handler">The event handler to add to the element.</param>
 public static void AddUnselectedHandler(DependencyObject element, UpfRoutedEventHandler handler)
 {
     UIElementHelper.AddHandler(element, UnselectedEvent, handler);
 }
示例#11
0
 /// <summary>
 /// Removes a handler for the <see cref="E:Ultraviolet.Presentation.Controls.Primitives.Selector.Selected"/>
 /// attached event from the specified element.
 /// </summary>
 /// <param name="element">The element from which to remove the event handler.</param>
 /// <param name="handler">The event handler to remove from the element.</param>
 public static void RemoveSelectedHandler(DependencyObject element, UpfRoutedEventHandler handler)
 {
     UIElementHelper.RemoveHandler(element, SelectedEvent, handler);
 }
示例#12
0
        /// <summary>
        /// Removes a handler for the <see cref="E:TwistedLogik.Ultraviolet.UI.Presentation.Controls.ToolTipService.ToolTipClosing"/>
        /// attached event from the specified element.
        /// </summary>
        /// <param name="element">The element from which to remove the handler.</param>
        /// <param name="handler">The handler to remove from the specified element.</param>
        public static void RemoveToolTipClosingHandler(DependencyObject element, UpfToolTipEventHandler handler)
        {
            Contract.Require(element, nameof(element));

            UIElementHelper.RemoveHandler(element, ToolTipClosingEvent, handler);
        }
示例#13
0
        /// <summary>
        /// Adds a handler for the <see cref="E:TwistedLogik.Ultraviolet.UI.Presentation.Controls.ToolTipService.ToolTipOpening"/>
        /// attached event to the specified element.
        /// </summary>
        /// <param name="element">The element to which to add the handler.</param>
        /// <param name="handler">The handler to add to the specified element.</param>
        public static void AddToolTipOpeningHandler(DependencyObject element, UpfToolTipEventHandler handler)
        {
            Contract.Require(element, nameof(element));

            UIElementHelper.AddHandler(element, ToolTipOpeningEvent, handler);
        }