Ejemplo n.º 1
0
        /// <summary>
        /// Creates a slider with specified orientation, and minimum, maximum, and initial values.
        /// </summary>
        /// <param name="orientation">The orientation of the slider</param>
        /// <param name="min">The minimum value the slider can take</param>
        /// <param name="max">The maximum value the slider can take</param>
        /// <param name="value">An initial value between the range of min and max values</param>
        public G2DSlider(GoblinEnums.Orientation orientation, int min, int max, int value)
            : base()
        {
            this.minValue = min;
            this.maxValue = max;
            this.value    = value;

            drawBackground = false;
            drawBorder     = true;
            name           = "G2DSlider";

            majorTickSpacing = 0;
            minorTickSpacing = 0;
            snapToTicks      = false;
            paintTicks       = false;
            paintLabels      = false;
            paintTrack       = true;
            valueIsAdjusting = false;
            knobWithin       = false;

            knobColor        = new Color((byte)204, (byte)204, (byte)204, (byte)255);
            knobBorderColor  = Color.Black;
            trackBorderColor = Color.DarkGray;
            trackColor       = Color.White;

            knobBound  = new Rectangle();
            trackBound = new Rectangle();
            tickBound  = new Rectangle();
            labelBound = new Rectangle();

            knobPoints = new List <Point>();
            knobPoints.Add(Point.Zero);

            minorTickCount = 0;
            majorTickCount = 0;
            minorTickDelta = 0;
            majorTickDelta = 0;

            knobLength = 10;
            trackGap   = knobLength / 2;

            tickLabels  = new List <string>();
            labelShifts = new List <int>();

            Orientation = orientation;
            AdjustKnobIncrement();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Creates a divider line with the specified thickness and orientation.
        /// </summary>
        /// <param name="thickness">The thickness of the line</param>
        /// <param name="adjustLength">Indicates whether to adjust the length of this divider line to
        /// either its parent's width or height depending on the orientation. If false, its own Bounds
        /// information is used to decide the length</param>
        /// <param name="orientation">The orientation of the line</param>
        public G2DSeparator(int thickness, bool adjustLength, GoblinEnums.Orientation orientation)
            : base()
        {
            backgroundColor = Color.DarkBlue;
            borderColor     = Color.Black;

            this.orientation  = orientation;
            this.thickness    = thickness;
            this.adjustLength = adjustLength;

            name = "G2DSeparator";

            p1   = new Point();
            p2   = new Point();
            rect = new Rectangle();

            SetDrawingPoints();
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Creates a scroll bar with the specified orientation, value, extent, and maximum.
        /// </summary>
        /// <param name="orientation"></param>
        /// <param name="value"></param>
        /// <param name="extent">The size of the viewable area (a.k.a visible amount)</param>
        /// <param name="max"></param>
        public G2DScrollBar(GoblinEnums.Orientation orientation, int value, int extent, int max)
            : base()
        {
            if (value < 0)
            {
                throw new ArgumentException("value has to be greater than or equal to 0");
            }

            if (extent > max)
            {
                throw new ArgumentException("extent must be smaller than max");
            }

            this.orientation = orientation;
            this.extent      = extent;

            upLeftButton    = new G2DButton();
            downRightButton = new G2DButton();

            if (orientation == GoblinEnums.Orientation.Horizontal)
            {
                upLeftButton.ActionPerformedEvent    += new ActionPerformed(DecrementUnit);
                downRightButton.ActionPerformedEvent += new ActionPerformed(IncrementUnit);
            }
            else
            {
                upLeftButton.ActionPerformedEvent    += new ActionPerformed(IncrementUnit);
                downRightButton.ActionPerformedEvent += new ActionPerformed(DecrementUnit);
            }

            scrollBar                    = new G2DSlider(0, max - extent, value);
            scrollBar.Orientation        = orientation;
            scrollBar.PaintTrack         = false;
            scrollBar.SnapToTicks        = true;
            scrollBar.BackgroundColor    = Color.White;
            scrollBar.StateChangedEvent += new StateChanged(ValueChanged);

            buttonColor = Color.DarkBlue;

            unitIncrement  = 1;
            blockIncrement = 1;

            scrollBar.MinorTickSpacing = blockIncrement;
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Creates a progress bar with the specified orientation, and minimum and maximum values.
        /// </summary>
        /// <param name="orientation">The orientation of the progress bar</param>
        /// <param name="min">The minimum value of the progress bar</param>
        /// <param name="max">The maximum value of the progress bar</param>
        public G2DProgressBar(GoblinEnums.Orientation orientation, int min, int max)
            : base()
        {
            this.orientation = orientation;
            if (min >= max)
            {
                throw new GoblinException("Minimum value has to be less than maximum value");
            }

            this.min = min;
            this.max = max;

            name            = "G2DProgressBar";
            backgroundColor = Color.White;

            indeterminate = false;
            paintString   = false;
            value         = min;

            barColor    = new Color(198, 226, 255);
            stringColor = new Color(16, 78, 139);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Creates a divider line with the specified thickness and orientation.
        /// </summary>
        /// <param name="thickness">The thickness of the line</param>
        /// <param name="adjustLength">Indicates whether to adjust the length of this divider line to 
        /// either its parent's width or height depending on the orientation. If false, its own Bounds
        /// information is used to decide the length</param>
        /// <param name="orientation">The orientation of the line</param>
        public G2DSeparator(int thickness, bool adjustLength, GoblinEnums.Orientation orientation)
            : base()
        {
            backgroundColor = Color.DarkBlue;
            borderColor = Color.Black;

            this.orientation = orientation;
            this.thickness = thickness;
            this.adjustLength = adjustLength;

            name = "G2DSeparator";

            p1 = new Point();
            p2 = new Point();
            rect = new Rectangle();

            SetDrawingPoints();
        }
Ejemplo n.º 6
0
 /// <summary>
 /// Creates a divider line with thickness of 3 pixels and specified orientation.
 /// </summary>
 /// <param name="adjustLength">Indicates whether to adjust the length of this divider line to
 /// either its parent's width or height depending on the orientation. If false, its own Bounds
 /// information is used to decide the length</param>
 /// <param name="orientation">The orientation of the line</param>
 public G2DSeparator(bool adjustLength, GoblinEnums.Orientation orientation)
     : this(3, adjustLength, orientation)
 {
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Creates a progress bar with the specified orientation, and minimum value of 0 and
 /// maximum value of 100.
 /// </summary>
 /// <param name="orientation">The orientation of the progress bar</param>
 public G2DProgressBar(GoblinEnums.Orientation orientation) :
     this(orientation, 0, 100)
 {
 }
Ejemplo n.º 8
0
        /// <summary>
        /// Creates a progress bar with the specified orientation, and minimum and maximum values.
        /// </summary>
        /// <param name="orientation">The orientation of the progress bar</param>
        /// <param name="min">The minimum value of the progress bar</param>
        /// <param name="max">The maximum value of the progress bar</param>
        public G2DProgressBar(GoblinEnums.Orientation orientation, int min, int max)
            : base()
        {
            this.orientation = orientation;
            if(min >= max)
                throw new GoblinException("Minimum value has to be less than maximum value");

            this.min = min;
            this.max = max;

            name = "G2DProgressBar";
            backgroundColor = Color.White;

            indeterminate = false;
            paintString = false;
            value = min;

            barColor = new Color(198, 226, 255);
            stringColor = new Color(16, 78, 139);
        }
Ejemplo n.º 9
0
 /// <summary>
 /// Creates a slider in the range between 0 and 10 with the specified orientation and initial value
 /// of 5.
 /// </summary>
 /// <param name="orientation"></param>
 public G2DSlider(GoblinEnums.Orientation orientation)
     : this(orientation, 0, 10, 5)
 {
 }
Ejemplo n.º 10
0
 public int GetScrollableUnitIncrement(Rectangle visibleRect, GoblinEnums.Orientation orientation, int direction)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 11
0
 public G2DScrollBar(GoblinEnums.Orientation orientation) : this(orientation, 0, 8, 10)
 {
 }
Ejemplo n.º 12
0
        /// <summary>
        /// Creates a scroll bar with the specified orientation, value, extent, and maximum.
        /// </summary>
        /// <param name="orientation"></param>
        /// <param name="value"></param>
        /// <param name="extent">The size of the viewable area (a.k.a visible amount)</param>
        /// <param name="max"></param>
        public G2DScrollBar(GoblinEnums.Orientation orientation, int value, int extent, int max)
            : base()
        {
            if (value < 0)
                throw new ArgumentException("value has to be greater than or equal to 0");

            if (extent > max)
                throw new ArgumentException("extent must be smaller than max");

            this.orientation = orientation;
            this.extent = extent;

            upLeftButton = new G2DButton();
            downRightButton = new G2DButton();

            if (orientation == GoblinEnums.Orientation.Horizontal)
            {
                upLeftButton.ActionPerformedEvent += new ActionPerformed(DecrementUnit);
                downRightButton.ActionPerformedEvent += new ActionPerformed(IncrementUnit);
            }
            else
            {
                upLeftButton.ActionPerformedEvent += new ActionPerformed(IncrementUnit);
                downRightButton.ActionPerformedEvent += new ActionPerformed(DecrementUnit);
            }

            scrollBar = new G2DSlider(0, max - extent, value);
            scrollBar.Orientation = orientation;
            scrollBar.PaintTrack = false;
            scrollBar.SnapToTicks = true;
            scrollBar.BackgroundColor = Color.White;
            scrollBar.StateChangedEvent += new StateChanged(ValueChanged);

            buttonColor = Color.DarkBlue;

            unitIncrement = 1;
            blockIncrement = 1;

            scrollBar.MinorTickSpacing = blockIncrement;
        }