public static float nk_do_scrollbarh(ref uint state, CommandBuffer _out_, RectangleF scroll, bool has_scrolling, float offset, float target, float step, float button_pixel_inc, nk_style_scrollbar style, nk_input _in_, nk_font font) { var cursor = new RectangleF(); var empty_west = new RectangleF(); var empty_east = new RectangleF(); float scroll_step; float scroll_offset; float scroll_off; float scroll_ratio; if (_out_ == null || style == null) { return(0); } scroll.Height = scroll.Height < 1 ? 1 : scroll.Height; scroll.Width = scroll.Width < 2 * scroll.Height ? 2 * scroll.Height : scroll.Width; if (target <= scroll.Width) { return(0); } if (style.show_buttons != 0) { uint ws = 0; float scroll_w; var button = new RectangleF(); button.Y = scroll.Y; button.Width = scroll.Height; button.Height = scroll.Height; scroll_w = scroll.Width - 2 * button.Width; scroll_step = step < button_pixel_inc ? step : button_pixel_inc; button.X = scroll.X; if ( DoButtonSymbol(ref ws, _out_, button, style.dec_symbol, NK_BUTTON_REPEATER, style.dec_button, _in_, font)) { offset = offset - scroll_step; } button.X = scroll.X + scroll.Width - button.Width; if ( DoButtonSymbol(ref ws, _out_, button, style.inc_symbol, NK_BUTTON_REPEATER, style.inc_button, _in_, font)) { offset = offset + scroll_step; } scroll.X = scroll.X + button.Width; scroll.Width = scroll_w; } scroll_step = step < scroll.Width ? step : scroll.Width; scroll_offset = (offset < target - scroll.Width ? offset : target - scroll.Width) < 0 ? 0 : offset < target - scroll.Width ? offset : target - scroll.Width; scroll_ratio = scroll.Width / target; scroll_off = scroll_offset / target; cursor.Width = scroll_ratio * scroll.Width - (2 * style.border + 2 * style.padding.X); cursor.X = scroll.X + scroll_off * scroll.Width + style.border + style.padding.X; cursor.Height = scroll.Height - (2 * style.border + 2 * style.padding.Y); cursor.Y = scroll.Y + style.border + style.padding.Y; empty_west.X = scroll.X; empty_west.Y = scroll.Y; empty_west.Width = cursor.X - scroll.X; empty_west.Height = scroll.Height; empty_east.X = cursor.X + cursor.Width; empty_east.Y = scroll.Y; empty_east.Width = scroll.X + scroll.Width - (cursor.X + cursor.Width); empty_east.Height = scroll.Height; scroll_offset = nk_scrollbar_behavior(ref state, _in_, has_scrolling, &scroll, ref cursor, &empty_west, &empty_east, scroll_offset, target, scroll_step, NK_HORIZONTAL); scroll_off = scroll_offset / target; cursor.X = scroll.X + scroll_off * scroll.Width; if (style.draw_begin != null) { style.draw_begin(_out_); } _out_.DrawScrollbar(state, style, &scroll, &cursor); if (style.draw_end != null) { style.draw_end(_out_); } return(scroll_offset); }