Beispiel #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="cursor"/> class.
 /// </summary>
 /// <param name="__target">The target.</param>
 /// <param name="__mode">The mode.</param>
 /// <param name="__zone">The zone.</param>
 public cursor(cursorZone __target, textCursorMode __mode, textCursorZone __zone, String __name = "c")
 {
     name        = __name;
     frame       = __target;
     mode        = __mode;
     currentZone = __zone;
 }
Beispiel #2
0
        /// <summary>
        /// Selects the range area of space allocated within this zone, respecting what sub area type is specified
        /// </summary>
        /// <param name="subAreaType">Type of the sub area.</param>
        /// <returns></returns>
        /// <exception cref="System.ArgumentOutOfRangeException"></exception>
        public selectRangeArea selectRangeArea(textCursorZone subAreaType)
        {
            switch (subAreaType)
            {
            case textCursorZone.unknownZone:
            case textCursorZone.innerZone:
                return(new zone.selectRangeArea(innerLeftPosition, innerTopPosition, innerRightPosition, innerBottomPosition));

                break;

            case textCursorZone.innerBoxedZone:
                return(new zone.selectRangeArea(innerBoxedLeftPosition, innerBoxedTopPosition, innerBoxedRightPosition, innerBoxedBottomPosition));

                break;

            case textCursorZone.outterZone:
                return(new zone.selectRangeArea(0, 0, outerRightPosition, outerBottomPosition));

                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
            return(new zone.selectRangeArea(0, 0, outerRightPosition, outerBottomPosition));
        }
Beispiel #3
0
 /// <summary>
 /// Prebacuje kursor u datu zonu
 /// </summary>
 /// <param name="__zone">The zone.</param>
 /// <param name="__corner">The corner.</param>
 public void switchToZone(textCursorZone __zone, textCursorZoneCorner __corner = textCursorZoneCorner.default_corner)
 {
     if (__corner == textCursorZoneCorner.default_corner)
     {
         __corner = default_direction;
     }
     currentZone = __zone;
     moveToCorner(__corner);
 }
        /// <summary>
        /// Gets the boundary rectangle to hold all subzones with the specified role.
        /// </summary>
        /// <param name="role">The role of subzone or subzones to select</param>
        /// <param name="scope">The scope to look into for each subzone</param>
        /// <returns></returns>
        public selectRangeArea getBoundaryOf(cursorZoneRole role, textCursorZone scope = textCursorZone.innerZone)
        {
            selectRangeArea range = null; //new selectRangeArea(0,0,0,0);
            String          key   = role.ToString();

            foreach (KeyValuePair <string, cursorZone> z in items)
            {
                if (z.Key.StartsWith(key, StringComparison.InvariantCultureIgnoreCase))
                {
                    if (range == null)
                    {
                        range = z.Value.selectRangeArea(scope);
                    }
                    else
                    {
                        range.expandToWrap(z.Value.selectRangeArea(scope));
                    }
                }
            }
            return(range);
        }
        /// <summary>
        /// Heights the specified current zone.
        /// </summary>
        /// <param name="currentZone">The current zone.</param>
        /// <returns></returns>
        public Int32 getHeight(textCursorZone currentZone)
        {
            switch (currentZone)
            {
            case textCursorZone.innerZone:
                return(innerBottomPosition - innerTopPosition);

                break;

            case textCursorZone.innerBoxedZone:
                return(innerBoxedBottomPosition - innerBoxedTopPosition);

                break;

            default:
            case textCursorZone.outterZone:
                return(outerBottomPosition);

                break;
            }
        }
        public Int32 getWidth(textCursorZone currentZone)
        {
            switch (currentZone)
            {
            case textCursorZone.innerZone:
                return(innerRightPosition - innerLeftPosition);

                break;

            case textCursorZone.innerBoxedZone:
                return(innerBoxedRightPosition - innerBoxedLeftPosition);

                break;

            default:
            case textCursorZone.outterZone:
                return(outerRightPosition);

                break;
            }
        }
        /// <summary>
        /// Top position for specified zone.
        /// </summary>
        /// <param name="currentZone">Zone to test against</param>
        /// <returns>Requested position</returns>
        public Int32 top(textCursorZone currentZone)
        {
            switch (currentZone)
            {
            case textCursorZone.innerZone:
                return(innerTopPosition);

                break;

            case textCursorZone.innerBoxedZone:
                return(innerBoxedTopPosition);

                break;

            default:
            case textCursorZone.outterZone:
                return(0);

                break;
            }
        }
 /// <summary>
 /// Prebacuje kursor u datu zonu
 /// </summary>
 /// <param name="__zone"></param>
 /// <param name="__corner"></param>
 public void switchToZone(textCursorZone __zone, textCursorZoneCorner __corner = textCursorZoneCorner.default_corner)
 {
     currentZone = __zone;
     moveToCorner(__corner);
 }
 public textCursor(ISupportsBasicCursor __target, textCursorMode __mode, textCursorZone __zone)
 {
     target      = __target;
     mode        = __mode;
     currentZone = __zone;
 }