Example #1
0
        /// <summary>
        /// Invoked when the value of the adjustable has changed.
        /// </summary>
        public virtual void AdjustmentValueChanged(AdjustmentEvent e)
        {
            Adjustable     adj   = e.Adjustable;
            int            value = e.Value;
            ScrollPanePeer peer  = (ScrollPanePeer)Scroller.Peer_Renamed;

            if (peer != null)
            {
                peer.SetValue(adj, value);
            }

            Component c = Scroller.GetComponent(0);

            switch (adj.Orientation)
            {
            case Adjustable_Fields.VERTICAL:
                c.Move(c.Location.x, -(value));
                break;

            case Adjustable_Fields.HORIZONTAL:
                c.Move(-(value), c.Location.y);
                break;

            default:
                throw new IllegalArgumentException("Illegal adjustable orientation");
            }
        }
Example #2
0
        public override void Layout()
        {
            if (ComponentCount == 0)
            {
                return;
            }
            Component c  = GetComponent(0);
            Point     p  = ScrollPosition;
            Dimension cs = CalculateChildSize();
            Dimension vs = ViewportSize;

            c.Reshape(-p.x, -p.y, cs.Width_Renamed, cs.Height_Renamed);
            ScrollPanePeer peer = (ScrollPanePeer)this.Peer_Renamed;

            if (peer != null)
            {
                peer.ChildResized(cs.Width_Renamed, cs.Height_Renamed);
            }

            // update adjustables... the viewport size may have changed
            // with the scrollbars coming or going so the viewport size
            // is updated before the adjustables.
            vs = ViewportSize;
            HAdjustable_Renamed.SetSpan(0, cs.Width_Renamed, vs.Width_Renamed);
            VAdjustable_Renamed.SetSpan(0, cs.Height_Renamed, vs.Height_Renamed);
        }