From ff039c0c9084d5a8f8f2822b07cc6673804fb177 Mon Sep 17 00:00:00 2001 From: Kp Date: Mon, 12 Oct 2020 03:28:26 +0000 Subject: [PATCH] Pass UI_DIALOG& to ui_add_gadget_scrollbar --- common/include/ui.h | 2 +- common/ui/listbox.cpp | 2 +- common/ui/scroll.cpp | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/common/include/ui.h b/common/include/ui.h index a7f49fa5f..6246d4d54 100644 --- a/common/include/ui.h +++ b/common/include/ui.h @@ -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_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_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 ); diff --git a/common/ui/listbox.cpp b/common/ui/listbox.cpp index 65c54bab8..226f19ac0 100644 --- a/common/ui/listbox.cpp +++ b/common/ui/listbox.cpp @@ -137,7 +137,7 @@ std::unique_ptr 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; } diff --git a/common/ui/scroll.cpp b/common/ui/scroll.cpp index 3db8f6f11..d14550450 100644 --- a/common/ui/scroll.cpp +++ b/common/ui/scroll.cpp @@ -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_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_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_add_gadget_scrollbar(UI_DIALOG * dlg, sh if (stop < start ) stop = start; - auto scrollbar = ui_gadget_add(*dlg, x, y + w, x + w - 1, y + h - w - 1); + auto scrollbar = ui_gadget_add(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;