/// <summary>
        /// Draws scrollbars in the viewMatrix.
        /// </summary>
        /// <param name="view">The view.</param>
        /// <param name="viewMatrix">The view matrix.</param>
        /// <param name="xOffset">The x offset.</param>
        /// <param name="yOffset">The y offset.</param>
        /// <param name="paintArrows">if set to <c>true</c> [paint arrows].</param>
        /// <returns></returns>
        public static bool DrawScrollbars(IViewBoxModel view, ref bool[,] viewMatrix, int xOffset, int yOffset, bool paintArrows = false)
        {
            AbstractViewBoxModelBase vb = view as AbstractViewBoxModelBase;

            if (vb != null)
            {
                if (vb.GetXOffset() != 0)
                {
                    xOffset = vb.GetXOffset();
                }

                if (vb.GetYOffset() != 0)
                {
                    yOffset = vb.GetYOffset();
                }
            }

            bool vertical = false;

            if (view.ContentBox.Height < view.ContentHeight)
            {
                vertical = true;
                drawVerticalScrollBar(view, ref viewMatrix, yOffset, (view.ContentBox.Height < 8 ? true : paintArrows));
            }

            if (view.ContentBox.Width < view.ContentWidth)
            {
                drawHorizontalScrollBar(view, ref viewMatrix, xOffset, vertical, (view.ContentBox.Width < 8 ? true : paintArrows));
            }
            return(true);
        }
예제 #2
0
        /// <summary>
        /// Add a ViewRange or a Screen to list
        /// </summary>
        /// <param name="name">
        /// name of view
        /// </param>
        /// <param name="view">
        /// ViewRange or a Screen
        /// </param>
        /// <returns>
        /// bool success
        /// </returns>
        public bool AddView(String name, AbstractViewBoxModelBase view)
        {
            if (view is BrailleIOViewRange || view is BrailleIOScreen)
            {
                bool success = this.views.TryAdd(name, view);
                view.Name = name;
                if (success)
                {
                    view.PropertyChanged += view_PropertyChanged;
                }

                return(success);
            }
            return(false);
        }