Pass UI_DIALOG& to ui_add_gadget_scrollbar

This commit is contained in:
Kp 2020-10-12 03:28:26 +00:00
parent 1d7f2e2ab5
commit ff039c0c90
3 changed files with 6 additions and 6 deletions

View file

@ -311,7 +311,7 @@ extern void ui_mega_process();
void ui_get_button_size(const grs_font &, const char *text, int &width, int &height);
__attribute_warn_unused_result
std::unique_ptr<UI_GADGET_SCROLLBAR> ui_add_gadget_scrollbar(UI_DIALOG * dlg, short x, short y, short w, short h, int start, int stop, int position, int window_size);
std::unique_ptr<UI_GADGET_SCROLLBAR> ui_add_gadget_scrollbar(UI_DIALOG &dlg, short x, short y, short w, short h, int start, int stop, int position, int window_size);
extern void ui_draw_scrollbar( UI_DIALOG *dlg, UI_GADGET_SCROLLBAR * scrollbar );

View file

@ -137,7 +137,7 @@ std::unique_ptr<UI_GADGET_LISTBOX> ui_add_gadget_listbox(UI_DIALOG &dlg, short x
listbox->dragging = 0;
listbox->selected_item = -1;
listbox->moved = 1;
listbox->scrollbar = ui_add_gadget_scrollbar(&dlg, x + w + 3, y, 0, h, 0, numitems - i, 0, i);
listbox->scrollbar = ui_add_gadget_scrollbar(dlg, x + w + 3, y, 0, h, 0, numitems - i, 0, i);
listbox->scrollbar->parent = listbox.get();
return listbox;
}

View file

@ -51,7 +51,7 @@ void ui_draw_scrollbar( UI_DIALOG *dlg, UI_GADGET_SCROLLBAR * scrollbar )
ui_draw_box_out(canvas, 0, scrollbar->fake_position, scrollbar->width - 1, scrollbar->fake_position + scrollbar->fake_size - 1);
}
std::unique_ptr<UI_GADGET_SCROLLBAR> ui_add_gadget_scrollbar(UI_DIALOG * dlg, short x, short y, short w, short h, int start, int stop, int position, int window_size)
std::unique_ptr<UI_GADGET_SCROLLBAR> ui_add_gadget_scrollbar(UI_DIALOG &dlg, short x, short y, short w, short h, int start, int stop, int position, int window_size)
{
int tw;
@ -64,12 +64,12 @@ std::unique_ptr<UI_GADGET_SCROLLBAR> ui_add_gadget_scrollbar(UI_DIALOG * dlg, sh
if (stop < start ) stop = start;
auto scrollbar = ui_gadget_add<UI_GADGET_SCROLLBAR>(*dlg, x, y + w, x + w - 1, y + h - w - 1);
auto scrollbar = ui_gadget_add<UI_GADGET_SCROLLBAR>(dlg, x, y + w, x + w - 1, y + h - w - 1);
scrollbar->up_button = ui_add_gadget_button(*dlg, x, y, w, w, up, nullptr);
scrollbar->up_button = ui_add_gadget_button(dlg, x, y, w, w, up, nullptr);
scrollbar->up_button->parent = scrollbar.get();
scrollbar->down_button = ui_add_gadget_button(*dlg, x, y+h-w, w, w, down, nullptr);
scrollbar->down_button = ui_add_gadget_button(dlg, x, y+h-w, w, w, down, nullptr);
scrollbar->down_button->parent = scrollbar.get();
scrollbar->horz = 0;