mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2025-04-14 23:58:26 +02:00
Allow ScrollBar params of a ScrollContainer to be modified from _ready()
Cherrypicks b8610dbd3159985f007deb0424a64df386832d07
This commit is contained in:
parent
132fd3ad10
commit
54b02c41e6
@ -253,18 +253,7 @@ void ScrollContainer::ensure_control_visible(Control *p_control) {
|
|||||||
set_v_scroll(get_v_scroll() + (diff.y - global_rect.position.y));
|
set_v_scroll(get_v_scroll() + (diff.y - global_rect.position.y));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScrollContainer::_notification(int p_what) {
|
void ScrollContainer::_update_dimensions() {
|
||||||
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
|
|
||||||
call_deferred("_update_scrollbar_position");
|
|
||||||
};
|
|
||||||
|
|
||||||
if (p_what == NOTIFICATION_READY) {
|
|
||||||
Viewport *viewport = get_viewport();
|
|
||||||
ERR_FAIL_COND(!viewport);
|
|
||||||
viewport->connect("gui_focus_changed", this, "_gui_focus_changed");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (p_what == NOTIFICATION_SORT_CHILDREN) {
|
|
||||||
child_max_size = Size2(0, 0);
|
child_max_size = Size2(0, 0);
|
||||||
Size2 size = get_size();
|
Size2 size = get_size();
|
||||||
Point2 ofs;
|
Point2 ofs;
|
||||||
@ -318,6 +307,22 @@ void ScrollContainer::_notification(int p_what) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
update();
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScrollContainer::_notification(int p_what) {
|
||||||
|
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
|
||||||
|
call_deferred("_update_scrollbar_position");
|
||||||
|
};
|
||||||
|
|
||||||
|
if (p_what == NOTIFICATION_READY) {
|
||||||
|
Viewport *viewport = get_viewport();
|
||||||
|
ERR_FAIL_COND(!viewport);
|
||||||
|
viewport->connect("gui_focus_changed", this, "_gui_focus_changed");
|
||||||
|
_update_dimensions();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (p_what == NOTIFICATION_SORT_CHILDREN) {
|
||||||
|
_update_dimensions();
|
||||||
};
|
};
|
||||||
|
|
||||||
if (p_what == NOTIFICATION_DRAW) {
|
if (p_what == NOTIFICATION_DRAW) {
|
||||||
|
@ -70,6 +70,7 @@ protected:
|
|||||||
|
|
||||||
void _gui_input(const Ref<InputEvent> &p_gui_input);
|
void _gui_input(const Ref<InputEvent> &p_gui_input);
|
||||||
void _gui_focus_changed(Control *p_control);
|
void _gui_focus_changed(Control *p_control);
|
||||||
|
void _update_dimensions();
|
||||||
void _notification(int p_what);
|
void _notification(int p_what);
|
||||||
|
|
||||||
void _scroll_moved(float);
|
void _scroll_moved(float);
|
||||||
|
Loading…
Reference in New Issue
Block a user