Example #1
0
        public static ulong DoProgress(ref uint state, CommandBuffer _out_, RectangleF bounds, ulong value,
                                       ulong max,
                                       int modifiable, nk_style_progress style, nk_input _in_)
        {
            float prog_scale;
            ulong prog_value;
            var   cursor = new RectangleF();

            if (_out_ == null || style == null)
            {
                return(0);
            }
            cursor.Width =
                bounds.Width < 2 * style.padding.X + 2 * style.border
                                        ? 2 * style.padding.X + 2 * style.border
                                        : bounds.Width;
            cursor.Height =
                bounds.Height < 2 * style.padding.Y + 2 * style.border
                                        ? 2 * style.padding.Y + 2 * style.border
                                        : bounds.Height;
            cursor =
                RectangleF.nk_pad_rect(bounds,
                                       new Vector2(style.padding.X + style.border,
                                                   style.padding.Y + style.border));
            prog_scale = value / (float)max;
            prog_value = value < max ? value : max;
            prog_value =
                ProgressBehavior(ref state, _in_, bounds, cursor, max,
                                 prog_value,
                                 modifiable);
            cursor.Width = cursor.Width * prog_scale;
            if (style.draw_begin != null)
            {
                style.draw_begin(_out_);
            }
            _out_.DrawProgress(state, style, &bounds, &cursor, value, max);
            if (style.draw_end != null)
            {
                style.draw_end(_out_);
            }
            return(prog_value);
        }