Exemple #1
0
        /// <summary>
        /// Sets the value of this scrollbar to the specified value.
        /// <para>
        /// If the value supplied is less than the current minimum or
        /// greater than the current maximum, then one of those values is
        /// substituted, as appropriate. Also, creates and dispatches
        /// the AdjustementEvent with specified type and value.
        ///
        /// </para>
        /// </summary>
        /// <param name="v"> the new value of the scrollbar </param>
        /// <param name="type"> the type of the scrolling operation occurred </param>
        private void SetTypedValue(int v, int type)
        {
            v = System.Math.Max(v, Minimum_Renamed);
            v = System.Math.Min(v, Maximum_Renamed - VisibleAmount_Renamed);

            if (v != Value_Renamed)
            {
                Value_Renamed = v;
                // Synchronously notify the listeners so that they are
                // guaranteed to be up-to-date with the Adjustable before
                // it is mutated again.
                AdjustmentEvent e = new AdjustmentEvent(this, AdjustmentEvent.ADJUSTMENT_VALUE_CHANGED, type, Value_Renamed, IsAdjusting);
                AdjustmentListener.AdjustmentValueChanged(e);
            }
        }