コード例 #1
0
 /// <summary>
 /// Writes the attached property OverflowMode to the given element.
 /// </summary>
 /// <param name="element">The element to which to write the attached property.</param>
 /// <param name="mode">The property value to set</param>
 public static void SetOverflowMode(DependencyObject element, OverflowMode mode)
 {
     if (element == null)
     {
         throw new ArgumentNullException("element");
     }
     element.SetValue(OverflowModeProperty, mode);
 }
コード例 #2
0
        private static bool IsValidOverflowMode(object o)
        {
            OverflowMode value = (OverflowMode)o;

            return(value == OverflowMode.AsNeeded ||
                   value == OverflowMode.Always ||
                   value == OverflowMode.Never);
        }
コード例 #3
0
 public static void SetOverflowMode(DependencyObject element, OverflowMode mode)
 {
     NoesisGUI_PINVOKE.ToolBar_SetOverflowMode(DependencyObject.getCPtr(element), (int)mode);
     if (NoesisGUI_PINVOKE.SWIGPendingException.Pending)
     {
         throw NoesisGUI_PINVOKE.SWIGPendingException.Retrieve();
     }
 }
コード例 #4
0
 /// <summary>
 /// Sets the local value of the OverflowMode attached property.
 /// </summary>
 /// <param name="dependencyObject">The target Object for the value.</param>
 /// <param name="overflowMode">The OverflowMode setting for this Object.</param>
 public static void SetOverflowMode(DependencyObject dependencyObject, OverflowMode overflowMode)
 {
     // Validate the target and set the attached property.
     if (dependencyObject == null)
     {
         throw new ArgumentNullException("dependencyObject");
     }
     dependencyObject.SetValue(GadgetBar.OverflowModeProperty, overflowMode);
 }
コード例 #5
0
        public static OverflowMode GetOverflowMode(DependencyObject element)
        {
            OverflowMode ret = (OverflowMode)NoesisGUI_PINVOKE.ToolBar_GetOverflowMode(DependencyObject.getCPtr(element));

            if (NoesisGUI_PINVOKE.SWIGPendingException.Pending)
            {
                throw NoesisGUI_PINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
コード例 #6
0
ファイル: ToolBar.cs プロジェクト: aienabled/Managed
 public static void SetOverflowMode(DependencyObject element, OverflowMode mode)
 {
     if (element == null)
     {
         throw new ArgumentNullException("element");
     }
     {
         NoesisGUI_PINVOKE.ToolBar_SetOverflowMode(DependencyObject.getCPtr(element), (int)mode);
     }
 }
コード例 #7
0
ファイル: ToolBar.cs プロジェクト: aienabled/Managed
 public static OverflowMode GetOverflowMode(DependencyObject element)
 {
     if (element == null)
     {
         throw new ArgumentNullException("element");
     }
     {
         OverflowMode ret = (OverflowMode)NoesisGUI_PINVOKE.ToolBar_GetOverflowMode(DependencyObject.getCPtr(element));
         return(ret);
     }
 }
コード例 #8
0
        /// <summary>
        /// Determines if the given value represents a valid state of this property.
        /// </summary>
        /// <param name="value">The state that should be used.</param>
        /// <returns>True if the state is valid, otherwise false.</returns>
        protected override Boolean IsValid(CSSValue value)
        {
            OverflowMode mode;

            if (value is CSSIdentifierValue && modes.TryGetValue(((CSSIdentifierValue)value).Value, out mode))
                _mode = mode;
            else if (value != CSSValue.Inherit)
                return false;

            return true;
        }
コード例 #9
0
        /// <summary>
        /// Determines if the given value represents a valid state of this property.
        /// </summary>
        /// <param name="value">The state that should be used.</param>
        /// <returns>True if the state is valid, otherwise false.</returns>
        protected override Boolean IsValid(CSSValue value)
        {
            OverflowMode mode;

            if (modes.TryGetValue(value, out mode))
            {
                _mode = mode;
                return(true);
            }

            return(false);
        }
コード例 #10
0
        /// <summary>
        /// Creates a new blank machine state with the given parameters
        /// </summary>
        /// <param name="size">The size of the new memory buffer to use</param>
        /// <param name="mode">The overflow mode to use in the new instance</param>
        /// <param name="clear">Indicates whether or not to clear the allocated memory area</param>
        private TuringMachineState(int size, OverflowMode mode, bool clear)
        {
            _Buffer = ArrayPool <ushort> .Shared.Rent(size);

            Size = size;
            Mode = mode;

            if (clear)
            {
                _Buffer.AsSpan(0, size).Clear();
            }
        }
コード例 #11
0
ファイル: Script.cs プロジェクト: kevinmiles/Brainf_ckSharp
 /// <summary>
 /// Creates a new <see cref="Script"/> instance with the specified parameters
 /// </summary>
 /// <param name="stdin">The stdin buffer to feed the script</param>
 /// <param name="stdout">The expected stdout buffer for the script</param>
 /// <param name="memorySize">The memory size to use to run the script</param>
 /// <param name="overflowMode">The overflow mode to use to run the script</param>
 /// <param name="source">The source code of the script</param>
 public Script(
     string stdin,
     string stdout,
     int memorySize,
     OverflowMode overflowMode,
     string source)
 {
     Stdin        = stdin;
     Stdout       = stdout;
     MemorySize   = memorySize;
     OverflowMode = overflowMode;
     Source       = source;
 }
コード例 #12
0
        protected override Boolean IsValid(CSSValue value)
        {
            OverflowMode mode;

            if (value is CSSIdentifierValue && modes.TryGetValue(((CSSIdentifierValue)value).Value, out mode))
            {
                _mode = mode;
            }
            else if (value != CSSValue.Inherit)
            {
                return(false);
            }

            return(true);
        }
コード例 #13
0
ファイル: FixedLengthField.cs プロジェクト: ywscr/FileHelpers
        /// <summary>
        /// Create a fixed length field from field information
        /// </summary>
        /// <param name="fi">Field definitions</param>
        /// <param name="length">Length of this field</param>
        /// <param name="overflowMode">Overflow mode of this field</param>
        /// <param name="align">Alignment, left or right</param>
        /// <param name="defaultCultureName">Default culture name used for each properties if no converter is specified otherwise. If null, the default decimal separator (".") will be used.</param>
        internal FixedLengthField(FieldInfo fi, int length, OverflowMode overflowMode, FieldAlignAttribute align, string defaultCultureName = null)
            : base(fi, defaultCultureName)
        {
            FixedMode    = FixedMode.ExactLength;
            OverflowMode = overflowMode;
            Align        = new FieldAlignAttribute(AlignMode.Left, ' ');
            FieldLength  = length;

            if (align != null)
            {
                Align = align;
            }
            else
            {
                if (TypeHelper.IsNumericType(fi.FieldType))
                {
                    Align = new FieldAlignAttribute(AlignMode.Right, ' ');
                }
            }
        }
コード例 #14
0
        public static Pool CreatePool(
            GameObject original,
            int defaultSize,
            ScaleResetMode scaleResetMode = ScaleResetMode.Default,
            OverflowMode overflowMode     = OverflowMode.Expand,
            bool initialize = true)
        {
            var pool = CreateInstance <Pool>();

            pool.m_Object         = original;
            pool.m_DefaultSize    = defaultSize;
            pool.m_ScaleResetMode = scaleResetMode;
            pool.m_OverflowMode   = overflowMode;

            if (initialize)
            {
                pool.Initialize();
            }

            return(pool);
        }
コード例 #15
0
ファイル: ToolBarPanel.cs プロジェクト: beda2280/wpf-1
        private bool MeasureGeneratedItems(bool asNeededPass, Size constraint, bool horizontal, double maxExtent, ref Size panelDesiredSize, out double overflowExtent)
        {
            ToolBarOverflowPanel overflowPanel = ToolBarOverflowPanel;
            bool sendToOverflow            = false; // Becomes true when the first AsNeeded does not fit
            bool hasOverflowItems          = false;
            bool overflowNeedsInvalidation = false;

            overflowExtent = 0.0;
            UIElementCollection children = InternalChildren;
            int childrenCount            = children.Count;
            int childrenIndex            = 0;

            for (int i = 0; i < _generatedItemsCollection.Count; i++)
            {
                UIElement    child        = _generatedItemsCollection[i];
                OverflowMode overflowMode = ToolBar.GetOverflowMode(child);
                bool         asNeededMode = overflowMode == OverflowMode.AsNeeded;

                // MeasureGeneratedItems is called twice to do a complete measure.
                // The first pass measures Always and Never items -- items that
                // are guaranteed to be or not to be in the overflow menu.
                // The second pass measures AsNeeded items and determines whether
                // there is enough room for them in the main bar or if they should
                // be placed in the overflow menu.
                // Check here whether the overflow mode matches a mode we should be
                // examining in this pass.
                if (asNeededMode == asNeededPass)
                {
                    DependencyObject visualParent = VisualTreeHelper.GetParent(child);

                    // In non-Always overflow modes, measure for main bar placement.
                    if ((overflowMode != OverflowMode.Always) && !sendToOverflow)
                    {
                        // Children may change their size depending on whether they are in the overflow
                        // menu or not. Ensure that when we measure, we are using the main bar size.
                        // If the item goes to overflow, this property will be updated later in this loop
                        // when it is removed from the visual tree.
                        ToolBar.SetIsOverflowItem(child, BooleanBoxes.FalseBox);
                        child.Measure(constraint);
                        Size childDesiredSize = child.DesiredSize;

                        // If the child is an AsNeeded, check if it fits. If it doesn't then
                        // this child and all subsequent AsNeeded children should be sent
                        // to the overflow menu.
                        if (asNeededMode)
                        {
                            double newExtent;
                            if (horizontal)
                            {
                                newExtent = childDesiredSize.Width + panelDesiredSize.Width;
                            }
                            else
                            {
                                newExtent = childDesiredSize.Height + panelDesiredSize.Height;
                            }
                            if (DoubleUtil.GreaterThan(newExtent, maxExtent))
                            {
                                // It doesn't fit, send to overflow
                                sendToOverflow = true;
                            }
                        }

                        // The child has been validated as belonging in the main bar.
                        // Update the panel desired size dimensions, and ensure the child
                        // is in the main bar's visual tree.
                        if (!sendToOverflow)
                        {
                            if (horizontal)
                            {
                                panelDesiredSize.Width += childDesiredSize.Width;
                                panelDesiredSize.Height = Math.Max(panelDesiredSize.Height, childDesiredSize.Height);
                            }
                            else
                            {
                                panelDesiredSize.Width   = Math.Max(panelDesiredSize.Width, childDesiredSize.Width);
                                panelDesiredSize.Height += childDesiredSize.Height;
                            }

                            if (visualParent != this)
                            {
                                if ((visualParent == overflowPanel) && (overflowPanel != null))
                                {
                                    overflowPanel.Children.Remove(child);
                                }

                                if (childrenIndex < childrenCount)
                                {
                                    children.InsertInternal(childrenIndex, child);
                                }
                                else
                                {
                                    children.AddInternal(child);
                                }
                                childrenCount++;
                            }

                            Debug.Assert(children[childrenIndex] == child, "InternalChildren is out of sync with _generatedItemsCollection.");
                            childrenIndex++;
                        }
                    }

                    // The child should go to the overflow menu
                    if ((overflowMode == OverflowMode.Always) || sendToOverflow)
                    {
                        hasOverflowItems = true;

                        // If a child is in the overflow menu, we don't want to keep measuring.
                        // However, we need to calculate the MaxLength as well as set the desired height
                        // correctly. Thus, we will use the DesiredSize of the child. There is a problem
                        // that can occur if the child changes size while in the overflow menu and
                        // was recently displayed. It will be measure clean, yet its DesiredSize
                        // will not be accurate for the MaxLength calculation.
                        if (child.MeasureDirty)
                        {
                            // Set this temporarily in case the size is different while in the overflow area
                            ToolBar.SetIsOverflowItem(child, BooleanBoxes.FalseBox);
                            child.Measure(constraint);
                        }

                        // Even when in the overflow, we need two pieces of information:
                        // 1. We need to continue to track the maximum size of the non-logical direction
                        //    (i.e. height in horizontal bars). This way, ToolBars with everything in
                        //    the overflow will still have some height.
                        // 2. We want to track how much of the space we saved by placing the child in
                        //    the overflow menu. This is used to calculate MinLength and MaxLength.
                        Size childDesiredSize = child.DesiredSize;
                        if (horizontal)
                        {
                            overflowExtent         += childDesiredSize.Width;
                            panelDesiredSize.Height = Math.Max(panelDesiredSize.Height, childDesiredSize.Height);
                        }
                        else
                        {
                            overflowExtent        += childDesiredSize.Height;
                            panelDesiredSize.Width = Math.Max(panelDesiredSize.Width, childDesiredSize.Width);
                        }

                        // Set the flag to indicate that the child is in the overflow menu
                        ToolBar.SetIsOverflowItem(child, BooleanBoxes.TrueBox);

                        // If the child is in this panel's visual tree, remove it.
                        if (visualParent == this)
                        {
                            Debug.Assert(children[childrenIndex] == child, "InternalChildren is out of sync with _generatedItemsCollection.");
                            children.RemoveNoVerify(child);
                            childrenCount--;
                            overflowNeedsInvalidation = true;
                        }
                        // If the child isnt connected to the visual tree, notify the overflow panel to pick it up.
                        else if (visualParent == null)
                        {
                            overflowNeedsInvalidation = true;
                        }
                    }
                }
                else
                {
                    // We are not measure this child in this pass. Update the index into the
                    // visual children collection.
                    if ((childrenIndex < childrenCount) && (children[childrenIndex] == child))
                    {
                        childrenIndex++;
                    }
                }
            }

            // A child was added to the overflow panel, but since we don't add it
            // to the overflow panel's visual collection until that panel's measure
            // pass, we need to mark it as measure dirty.
            if (overflowNeedsInvalidation && (overflowPanel != null))
            {
                overflowPanel.InvalidateMeasure();
            }

            return(hasOverflowItems);
        }
コード例 #16
0
 public static void SetOverflowMode(System.Windows.DependencyObject element, OverflowMode mode)
 {
 }
コード例 #17
0
 public static T OverflowMode <T>(this T target, OverflowMode value) where T : DependencyObject
 {
     Controls.ToolBar.SetOverflowMode(target, value);
     return(target);
 }
コード例 #18
0
 public void SetState(OverflowMode mode)
 {
     _mode = mode;
 }
コード例 #19
0
 internal override void Reset()
 {
     _mode = Default;
 }
コード例 #20
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="mode">Stacking mode.</param>
 /// <param name="overflow">Overflow handling mode.</param>
 public StackContent(StackMode mode, OverflowMode overflow)
     : base()
 {
     Mode     = mode;
     Overflow = overflow;
 }
コード例 #21
0
 public static void SetOverflowMode(System.Windows.DependencyObject element, OverflowMode mode)
 {
 }
コード例 #22
0
ファイル: NoesisGUI_.cs プロジェクト: Hengle/Managed
        public static IntPtr Box_OverflowMode(OverflowMode val)
        {
            IntPtr ret = NoesisGUI_PINVOKE.Box_OverflowMode((int)val);

            return(ret);
        }
コード例 #23
0
        public static OverflowMode GetOverflowMode(DependencyObject element)
        {
            OverflowMode ret = (OverflowMode)NoesisGUI_PINVOKE.ToolBar_GetOverflowMode(DependencyObject.getCPtr(element));

            return(ret);
        }
コード例 #24
0
 public static void SetOverflowMode(DependencyObject element, OverflowMode mode)
 {
     NoesisGUI_PINVOKE.ToolBar_SetOverflowMode(DependencyObject.getCPtr(element), (int)mode);
 }
コード例 #25
0
 internal CSSOverflowProperty()
     : base(PropertyNames.Overflow)
 {
     _mode      = modes["visible"];
     _inherited = false;
 }
コード例 #26
0
        public static IReadOnlyMachineState Create(int size, OverflowMode overflowMode)
        {
            Guard.IsBetweenOrEqualTo(size, Specs.MinimumMemorySize, Specs.MaximumMemorySize, nameof(size));

            return(new TuringMachineState(size, overflowMode));
        }
コード例 #27
0
        private async Task LoadDataAsync()
        {
            Guard.IsNotNull(Source, nameof(Source));

            using (await LoadingMutex.LockAsync())
            {
                _ExecutionTokenSource = new CancellationTokenSource(TimeSpan.FromSeconds(10));

                // Execution arguments and options
                string       stdin        = Messenger.Send(new StdinRequestMessage(false));
                int          memorySize   = SettingsService.GetValue <int>(SettingsKeys.MemorySize);
                OverflowMode overflowMode = SettingsService.GetValue <OverflowMode>(SettingsKeys.OverflowMode);

                // Run in RELEASE mode
                if (Breakpoints is null)
                {
                    InterpreterResult result = await Task.Run(() =>
                    {
                        return(Brainf_ckInterpreter
                               .CreateReleaseConfiguration()
                               .WithSource(Script !)
                               .WithStdin(stdin)
                               .WithMemorySize(memorySize)
                               .WithOverflowMode(overflowMode)
                               .WithExecutionToken(_ExecutionTokenSource.Token)
                               .TryRun()
                               .Value !);
                    });

                    LoadResults(result);
                }
                else
                {
                    _DebugTokenSource = new CancellationTokenSource();

                    // Run in DEBUG mode
                    _DebugSession = await Task.Run(() =>
                    {
                        var session = Brainf_ckInterpreter
                                      .CreateDebugConfiguration()
                                      .WithSource(Script !)
                                      .WithStdin(stdin)
                                      .WithBreakpoints(Breakpoints.Memory)
                                      .WithMemorySize(memorySize)
                                      .WithOverflowMode(overflowMode)
                                      .WithExecutionToken(_ExecutionTokenSource.Token)
                                      .WithDebugToken(_DebugTokenSource.Token)
                                      .TryRun()
                                      .Value !;

                        session.MoveNext();

                        return(session);
                    });

                    LoadResults(_DebugSession.Current);

                    OnPropertyChanged(nameof(IsAtBreakpoint));
                }
            }
        }
コード例 #28
0
 /// <summary>
 /// Writes the attached property OverflowMode to the given element.
 /// </summary>
 /// <param name="element">The element to which to write the attached property.</param>
 /// <param name="mode">The property value to set</param>
 public static void SetOverflowMode(DependencyObject element, OverflowMode mode)
 {
     if (element == null)
     {
         throw new ArgumentNullException("element");
     }
     element.SetValue(OverflowModeProperty, mode);
 }
コード例 #29
0
        // Token: 0x06006109 RID: 24841 RVA: 0x001B3754 File Offset: 0x001B1954
        private bool MeasureGeneratedItems(bool asNeededPass, Size constraint, bool horizontal, double maxExtent, ref Size panelDesiredSize, out double overflowExtent)
        {
            ToolBarOverflowPanel toolBarOverflowPanel = this.ToolBarOverflowPanel;
            bool flag   = false;
            bool result = false;
            bool flag2  = false;

            overflowExtent = 0.0;
            UIElementCollection internalChildren = base.InternalChildren;
            int num  = internalChildren.Count;
            int num2 = 0;

            for (int i = 0; i < this._generatedItemsCollection.Count; i++)
            {
                UIElement    uielement    = this._generatedItemsCollection[i];
                OverflowMode overflowMode = ToolBar.GetOverflowMode(uielement);
                bool         flag3        = overflowMode == OverflowMode.AsNeeded;
                if (flag3 == asNeededPass)
                {
                    DependencyObject parent = VisualTreeHelper.GetParent(uielement);
                    if (overflowMode != OverflowMode.Always && !flag)
                    {
                        ToolBar.SetIsOverflowItem(uielement, BooleanBoxes.FalseBox);
                        uielement.Measure(constraint);
                        Size desiredSize = uielement.DesiredSize;
                        if (flag3)
                        {
                            double value;
                            if (horizontal)
                            {
                                value = desiredSize.Width + panelDesiredSize.Width;
                            }
                            else
                            {
                                value = desiredSize.Height + panelDesiredSize.Height;
                            }
                            if (DoubleUtil.GreaterThan(value, maxExtent))
                            {
                                flag = true;
                            }
                        }
                        if (!flag)
                        {
                            if (horizontal)
                            {
                                panelDesiredSize.Width += desiredSize.Width;
                                panelDesiredSize.Height = Math.Max(panelDesiredSize.Height, desiredSize.Height);
                            }
                            else
                            {
                                panelDesiredSize.Width   = Math.Max(panelDesiredSize.Width, desiredSize.Width);
                                panelDesiredSize.Height += desiredSize.Height;
                            }
                            if (parent != this)
                            {
                                if (parent == toolBarOverflowPanel && toolBarOverflowPanel != null)
                                {
                                    toolBarOverflowPanel.Children.Remove(uielement);
                                }
                                if (num2 < num)
                                {
                                    internalChildren.InsertInternal(num2, uielement);
                                }
                                else
                                {
                                    internalChildren.AddInternal(uielement);
                                }
                                num++;
                            }
                            num2++;
                        }
                    }
                    if (overflowMode == OverflowMode.Always || flag)
                    {
                        result = true;
                        if (uielement.MeasureDirty)
                        {
                            ToolBar.SetIsOverflowItem(uielement, BooleanBoxes.FalseBox);
                            uielement.Measure(constraint);
                        }
                        Size desiredSize2 = uielement.DesiredSize;
                        if (horizontal)
                        {
                            overflowExtent         += desiredSize2.Width;
                            panelDesiredSize.Height = Math.Max(panelDesiredSize.Height, desiredSize2.Height);
                        }
                        else
                        {
                            overflowExtent        += desiredSize2.Height;
                            panelDesiredSize.Width = Math.Max(panelDesiredSize.Width, desiredSize2.Width);
                        }
                        ToolBar.SetIsOverflowItem(uielement, BooleanBoxes.TrueBox);
                        if (parent == this)
                        {
                            internalChildren.RemoveNoVerify(uielement);
                            num--;
                            flag2 = true;
                        }
                        else if (parent == null)
                        {
                            flag2 = true;
                        }
                    }
                }
                else if (num2 < num && internalChildren[num2] == uielement)
                {
                    num2++;
                }
            }
            if (flag2 && toolBarOverflowPanel != null)
            {
                toolBarOverflowPanel.InvalidateMeasure();
            }
            return(result);
        }
コード例 #30
0
 /// <summary>
 /// Creates a new blank machine state with the given parameters
 /// </summary>
 /// <param name="size">The size of the new memory buffer to use</param>
 /// <param name="mode">The overflow mode to use in the new instance</param>
 public TuringMachineState(int size, OverflowMode mode)
     : this(size, mode, true)
 {
 }
コード例 #31
0
ファイル: StackContent.cs プロジェクト: ChelseaLing/UForms
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="mode">Stacking mode.</param>
 /// <param name="overflow">Overflow handling mode.</param>
 public StackContent( StackMode mode, OverflowMode overflow )
     : base()
 {
     Mode = mode;
     Overflow = overflow;
 }
コード例 #32
0
 internal CSSOverflowProperty()
     : base(PropertyNames.Overflow)
 {
     _mode = modes["visible"];
     _inherited = false;
 }
コード例 #33
0
ファイル: NoesisGUI_.cs プロジェクト: Hengle/Managed
        public static OverflowMode Unbox_OverflowMode(IntPtr val)
        {
            OverflowMode ret = (OverflowMode)NoesisGUI_PINVOKE.Unbox_OverflowMode(val);

            return(ret);
        }
コード例 #34
0
 internal override void Reset()
 {
     _mode = OverflowMode.Visible;
 }