Merge pull request #7933 from RebelliousX/2.1
TabContainer's signal changes (v2.1)
This commit is contained in:
commit
eeca4a3aa3
|
@ -39867,13 +39867,21 @@
|
||||||
<return type="int">
|
<return type="int">
|
||||||
</return>
|
</return>
|
||||||
<description>
|
<description>
|
||||||
Return the current tab that is being showed.
|
Return the current tab index that is being shown.
|
||||||
|
</description>
|
||||||
|
</method>
|
||||||
|
<method name="get_previous_tab" qualifiers="const">
|
||||||
|
<return type="int">
|
||||||
|
</return>
|
||||||
|
<description>
|
||||||
|
Return the previous tab index that was being shown.
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="get_current_tab_control" qualifiers="const">
|
<method name="get_current_tab_control" qualifiers="const">
|
||||||
<return type="Control">
|
<return type="Control">
|
||||||
</return>
|
</return>
|
||||||
<description>
|
<description>
|
||||||
|
Return the current tab control that is being shown.
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="get_popup" qualifiers="const">
|
<method name="get_popup" qualifiers="const">
|
||||||
|
@ -39976,7 +39984,14 @@
|
||||||
<argument index="0" name="tab" type="int">
|
<argument index="0" name="tab" type="int">
|
||||||
</argument>
|
</argument>
|
||||||
<description>
|
<description>
|
||||||
Emitted when the current tab changes.
|
Emitted when a tab gets selected. Same behavior as [tab_selected] signal for backward compatibility. Note: In Godot v3.0+ this will change to be only emitted when tab gets changed.
|
||||||
|
</description>
|
||||||
|
</signal>
|
||||||
|
<signal name="tab_selected">
|
||||||
|
<argument index="0" name="tab" type="int">
|
||||||
|
</argument>
|
||||||
|
<description>
|
||||||
|
Emitted when a tab is being selected, even if it is the same tab.
|
||||||
</description>
|
</description>
|
||||||
</signal>
|
</signal>
|
||||||
</signals>
|
</signals>
|
||||||
|
|
|
@ -416,6 +416,7 @@ void TabContainer::add_child_notify(Node *p_child) {
|
||||||
//call_deferred("set_current_tab",0);
|
//call_deferred("set_current_tab",0);
|
||||||
first = true;
|
first = true;
|
||||||
current = 0;
|
current = 0;
|
||||||
|
previous = 0;
|
||||||
}
|
}
|
||||||
c->set_area_as_parent_rect();
|
c->set_area_as_parent_rect();
|
||||||
if (tabs_visible)
|
if (tabs_visible)
|
||||||
|
@ -451,6 +452,7 @@ void TabContainer::set_current_tab(int p_current) {
|
||||||
|
|
||||||
ERR_FAIL_INDEX( p_current, get_tab_count() );
|
ERR_FAIL_INDEX( p_current, get_tab_count() );
|
||||||
|
|
||||||
|
int pending_previous = current;
|
||||||
current = p_current;
|
current = p_current;
|
||||||
|
|
||||||
int idx=0;
|
int idx=0;
|
||||||
|
@ -478,7 +480,13 @@ void TabContainer::set_current_tab(int p_current) {
|
||||||
}
|
}
|
||||||
|
|
||||||
_change_notify("current_tab");
|
_change_notify("current_tab");
|
||||||
|
|
||||||
|
if (pending_previous != current)
|
||||||
|
previous = pending_previous;
|
||||||
|
|
||||||
|
emit_signal("tab_selected", current);
|
||||||
emit_signal("tab_changed", current);
|
emit_signal("tab_changed", current);
|
||||||
|
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -487,6 +495,11 @@ int TabContainer::get_current_tab() const {
|
||||||
return current;
|
return current;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int TabContainer::get_previous_tab() const {
|
||||||
|
|
||||||
|
return previous;
|
||||||
|
}
|
||||||
|
|
||||||
Control* TabContainer::get_tab_control(int p_idx) const {
|
Control* TabContainer::get_tab_control(int p_idx) const {
|
||||||
|
|
||||||
int idx=0;
|
int idx=0;
|
||||||
|
@ -508,6 +521,7 @@ Control* TabContainer::get_tab_control(int p_idx) const {
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Control* TabContainer::get_current_tab_control() const {
|
Control* TabContainer::get_current_tab_control() const {
|
||||||
|
|
||||||
int idx=0;
|
int idx=0;
|
||||||
|
@ -555,6 +569,7 @@ void TabContainer::set_tab_align(TabAlign p_align) {
|
||||||
|
|
||||||
_change_notify("tab_align");
|
_change_notify("tab_align");
|
||||||
}
|
}
|
||||||
|
|
||||||
TabContainer::TabAlign TabContainer::get_tab_align() const {
|
TabContainer::TabAlign TabContainer::get_tab_align() const {
|
||||||
|
|
||||||
return align;
|
return align;
|
||||||
|
@ -715,6 +730,7 @@ void TabContainer::_bind_methods() {
|
||||||
ObjectTypeDB::bind_method(_MD("get_tab_count"), &TabContainer::get_tab_count);
|
ObjectTypeDB::bind_method(_MD("get_tab_count"), &TabContainer::get_tab_count);
|
||||||
ObjectTypeDB::bind_method(_MD("set_current_tab","tab_idx"), &TabContainer::set_current_tab);
|
ObjectTypeDB::bind_method(_MD("set_current_tab","tab_idx"), &TabContainer::set_current_tab);
|
||||||
ObjectTypeDB::bind_method(_MD("get_current_tab"), &TabContainer::get_current_tab);
|
ObjectTypeDB::bind_method(_MD("get_current_tab"), &TabContainer::get_current_tab);
|
||||||
|
ObjectTypeDB::bind_method(_MD("get_previous_tab"), &TabContainer::get_previous_tab);
|
||||||
ObjectTypeDB::bind_method(_MD("get_current_tab_control:Control"), &TabContainer::get_current_tab_control);
|
ObjectTypeDB::bind_method(_MD("get_current_tab_control:Control"), &TabContainer::get_current_tab_control);
|
||||||
ObjectTypeDB::bind_method(_MD("get_tab_control:Control","idx"), &TabContainer::get_tab_control);
|
ObjectTypeDB::bind_method(_MD("get_tab_control:Control","idx"), &TabContainer::get_tab_control);
|
||||||
ObjectTypeDB::bind_method(_MD("set_tab_align","align"), &TabContainer::set_tab_align);
|
ObjectTypeDB::bind_method(_MD("set_tab_align","align"), &TabContainer::set_tab_align);
|
||||||
|
@ -731,6 +747,7 @@ void TabContainer::_bind_methods() {
|
||||||
ObjectTypeDB::bind_method(_MD("_child_renamed_callback"), &TabContainer::_child_renamed_callback);
|
ObjectTypeDB::bind_method(_MD("_child_renamed_callback"), &TabContainer::_child_renamed_callback);
|
||||||
|
|
||||||
ADD_SIGNAL(MethodInfo("tab_changed", PropertyInfo(Variant::INT, "tab")));
|
ADD_SIGNAL(MethodInfo("tab_changed", PropertyInfo(Variant::INT, "tab")));
|
||||||
|
ADD_SIGNAL(MethodInfo("tab_selected", PropertyInfo(Variant::INT, "tab")));
|
||||||
ADD_SIGNAL(MethodInfo("pre_popup_pressed"));
|
ADD_SIGNAL(MethodInfo("pre_popup_pressed"));
|
||||||
|
|
||||||
ADD_PROPERTY( PropertyInfo(Variant::INT, "tab_align", PROPERTY_HINT_ENUM,"Left,Center,Right"), _SCS("set_tab_align"), _SCS("get_tab_align") );
|
ADD_PROPERTY( PropertyInfo(Variant::INT, "tab_align", PROPERTY_HINT_ENUM,"Left,Center,Right"), _SCS("set_tab_align"), _SCS("get_tab_align") );
|
||||||
|
@ -745,6 +762,7 @@ TabContainer::TabContainer() {
|
||||||
buttons_visible_cache = false;
|
buttons_visible_cache = false;
|
||||||
tabs_ofs_cache = 0;
|
tabs_ofs_cache = 0;
|
||||||
current = 0;
|
current = 0;
|
||||||
|
previous = 0;
|
||||||
mouse_x_cache = 0;
|
mouse_x_cache = 0;
|
||||||
align = ALIGN_CENTER;
|
align = ALIGN_CENTER;
|
||||||
tabs_visible = true;
|
tabs_visible = true;
|
||||||
|
|
|
@ -50,6 +50,7 @@ private:
|
||||||
int tabs_ofs_cache;
|
int tabs_ofs_cache;
|
||||||
int last_tab_cache;
|
int last_tab_cache;
|
||||||
int current;
|
int current;
|
||||||
|
int previous;
|
||||||
bool tabs_visible;
|
bool tabs_visible;
|
||||||
bool buttons_visible_cache;
|
bool buttons_visible_cache;
|
||||||
TabAlign align;
|
TabAlign align;
|
||||||
|
@ -86,6 +87,7 @@ public:
|
||||||
int get_tab_count() const;
|
int get_tab_count() const;
|
||||||
void set_current_tab(int p_current);
|
void set_current_tab(int p_current);
|
||||||
int get_current_tab() const;
|
int get_current_tab() const;
|
||||||
|
int get_previous_tab() const;
|
||||||
|
|
||||||
Control* get_tab_control(int p_idx) const;
|
Control* get_tab_control(int p_idx) const;
|
||||||
Control* get_current_tab_control() const;
|
Control* get_current_tab_control() const;
|
||||||
|
|
Loading…
Reference in New Issue