Example #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TabControl"/> class.
        /// </summary>
        /// <param name="parent">Parent control.</param>
        public TabControl(Base parent)
            : base(parent)
        {
            m_Scroll       = new ScrollBarButton[2];
            m_ScrollOffset = 0;

            m_TabStrip = new TabStrip(this);
            m_TabStrip.StripPosition = Pos.Top;

            // Make this some special control?
            m_Scroll[0] = new ScrollBarButton(this);
            m_Scroll[0].SetDirectionLeft();
            m_Scroll[0].Clicked += ScrollPressedLeft;
            m_Scroll[0].SetSize(14, 16);

            m_Scroll[1] = new ScrollBarButton(this);
            m_Scroll[1].SetDirectionRight();
            m_Scroll[1].Clicked += ScrollPressedRight;
            m_Scroll[1].SetSize(14, 16);

            m_InnerPanel      = new TabControlInner(this);
            m_InnerPanel.Dock = Pos.Fill;
            m_InnerPanel.SendToBack();

            IsTabable = false;
        }
Example #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TabControl"/> class.
        /// </summary>
        /// <param name="parent">Parent control.</param>
        public TabControl(ControlBase parent)
            : base(parent)
        {
            m_TabStrip = new TabStrip(this);
            m_TabStrip.StripPosition = Dock.Top;

            // Actually these should be inside the TabStrip but it would make things complicated
            // because TabStrip contains only TabButtons. ScrollButtons being here we don't need
            // an inner panel for TabButtons on the TabStrip.
            m_Scroll = new ScrollBarButton[2];

            m_Scroll[0] = new ScrollBarButton(this);
            m_Scroll[0].SetDirectionLeft();
            m_Scroll[0].Clicked += ScrollPressedLeft;
            m_Scroll[0].Size     = new Size(BaseUnit);

            m_Scroll[1] = new ScrollBarButton(this);
            m_Scroll[1].SetDirectionRight();
            m_Scroll[1].Clicked += ScrollPressedRight;
            m_Scroll[1].Size     = new Size(BaseUnit);

            m_InnerPanel      = new TabControlInner(this);
            m_InnerPanel.Dock = Dock.Fill;
            m_InnerPanel.SendToBack();

            IsTabable = false;

            m_ActualPadding = new Padding(6, 6, 6, 6);
        }
Example #3
0
        public ScrollContainer() : base()
        {
            VerticalScrollbarWidth = HorizontalScrollbarHeight = 10;
            upButton          = new ScrollBarButton(Direction.u, this);
            downButton        = new ScrollBarButton(Direction.d, this);
            leftButton        = new ScrollBarButton(Direction.l, this);
            rightButton       = new ScrollBarButton(Direction.r, this);
            verticalTracker   = new ScrollBarTracker(Orientation.v, this);
            horizontalTracker = new ScrollBarTracker(Orientation.h, this);
            GenerateScrollbarElements();

            components.ComponentAdded += new Action <IComponent>(c =>
            {
                c.ZIndexChanged += c_ZIndexChanged;
                c_ZIndexChanged(c);
                c.SizeChanged     += (ChildSizeChange);
                c.LocationChanged += (ChildLocationChange);
                LayoutScrollbarElements();
            });
            components.ComponentRemoved += new Action <IComponent>(c =>
            {
                c.ZIndexChanged   -= c_ZIndexChanged;
                c.SizeChanged     -= (ChildSizeChange);
                c.LocationChanged -= (ChildLocationChange);
                LayoutScrollbarElements();
            });
        }
Example #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TabControl"/> class.
        /// </summary>
        /// <param name="parent">Parent control.</param>
        public TabControl(ControlBase parent)
            : base(parent)
        {
            m_Scroll       = new ScrollBarButton[2];
            m_ScrollOffset = 0;

            m_TabStrip = new TabStrip(null);
            m_TabStrip.StripPosition = Dock.Top;

            // Make this some special control?
            m_Scroll[0] = new ScrollBarButton(null);
            m_Scroll[0].SetDirectionLeft();
            m_Scroll[0].Clicked += ScrollPressedLeft;
            m_Scroll[0].SetSize(14, 16);

            m_Scroll[1] = new ScrollBarButton(null);
            m_Scroll[1].SetDirectionRight();
            m_Scroll[1].Clicked += ScrollPressedRight;
            m_Scroll[1].SetSize(14, 16);

            PrivateChildren.Add(m_TabStrip);
            PrivateChildren.Add(m_Scroll[0]);
            PrivateChildren.Add(m_Scroll[1]);

            IsTabable = false;
        }
Example #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ScrollBar"/> class.
        /// </summary>
        /// <param name="parent">Parent control.</param>
        protected ScrollBar(Base parent) : base(parent)
        {
            m_ScrollButton    = new ScrollBarButton[2];
            m_ScrollButton[0] = new ScrollBarButton(this);
            m_ScrollButton[1] = new ScrollBarButton(this);

            m_Bar = new ScrollBarBar(this);

            SetBounds(0, 0, 15, 15);
            m_Depressed = false;

            m_ScrollAmount        = 0;
            m_ContentSize         = 0;
            m_ViewableContentSize = 0;

            NudgeAmount = 20;
        }
Example #6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ScrollBar"/> class.
        /// </summary>
        /// <param name="parent">Parent control.</param>
        protected ScrollBar(ControlBase parent) : base(parent)
        {
            scrollButton    = new ScrollBarButton[2];
            scrollButton[0] = new ScrollBarButton(this);
            scrollButton[1] = new ScrollBarButton(this);

            bar = new ScrollBarBar(this);

            SetBounds(0, 0, 15, 15);
            depressed = false;

            scrollAmount        = 0;
            contentSize         = 0;
            viewableContentSize = 0;

            NudgeAmount = 20;
        }
Example #7
0
        void SetupHorizontalScrollButtonProperties(RenderElement container)
        {
            var scroll_button = new ScrollBarButton(10, this.Height, this); //create with default value
            scroll_button.BackColor = KnownColors.FromKnownColor(KnownColor.DarkBlue);
            int thumbPosX = CalculateThumbPosition() + minmax_boxHeight;
            scroll_button.SetLocation(thumbPosX, 0);
            container.AddChild(scroll_button);
            this.scrollButton = scroll_button;
            //----------------------------

            EvaluateHorizontalScrollBarProperties();
            //----------------------------
            //3. drag


            scroll_button.MouseDrag += (s, e) =>
            {
                //dragging ...
                //find x-diff                 

                Point pos = scroll_button.Position;
                //if vscroll bar then move only y axis 
                int newXPos = (int)(pos.X + e.DiffCapturedX);
                //clamp!
                if (newXPos >= this.Width - (minmax_boxHeight + scrollButton.Width))
                {
                    newXPos = this.Width - (minmax_boxHeight + scrollButton.Width);
                }
                else if (newXPos < minmax_boxHeight)
                {
                    newXPos = minmax_boxHeight;
                }

                //calculate value from position 

                int currentMarkAt = (newXPos - minmax_boxHeight);
                this.scrollValue = (float)(onePixelFor * currentMarkAt);
                newXPos = CalculateThumbPosition() + minmax_boxHeight;
                scroll_button.SetLocation(newXPos, pos.Y);
                if (this.UserScroll != null)
                {
                    this.UserScroll(this, EventArgs.Empty);
                }

                e.StopPropagation();
            };
        }
Example #8
0
        void SetupMaxButtonProperties(RenderElement container)
        {
            ScrollBarButton max_button;
            if (this.ScrollBarType == ScrollBarType.Horizontal)
            {
                max_button = new ScrollBarButton(minmax_boxHeight, this.Height, this);
                max_button.SetLocation(this.Width - minmax_boxHeight, 0);
            }
            else
            {
                max_button = new ScrollBarButton(this.Width, minmax_boxHeight, this);
                max_button.SetLocation(0, this.Height - minmax_boxHeight);
            }


            max_button.BackColor = KnownColors.FromKnownColor(KnownColor.DarkGray);
            max_button.MouseUp += (s, e) => this.StepSmallToMax();
            container.AddChild(max_button);
            this.maxButton = max_button;
        }