summaryrefslogtreecommitdiff
path: root/scene/gui
diff options
context:
space:
mode:
Diffstat (limited to 'scene/gui')
-rw-r--r--scene/gui/control.cpp7
-rw-r--r--scene/gui/item_list.cpp60
-rw-r--r--scene/gui/item_list.h9
-rw-r--r--scene/gui/popup.cpp42
-rw-r--r--scene/gui/popup.h1
-rw-r--r--scene/gui/split_container.cpp3
-rw-r--r--scene/gui/tab_container.cpp120
-rw-r--r--scene/gui/tab_container.h11
-rw-r--r--scene/gui/tabs.cpp48
-rw-r--r--scene/gui/tabs.h16
-rw-r--r--scene/gui/tree.h2
11 files changed, 294 insertions, 25 deletions
diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp
index 22559c238c..2367c03e99 100644
--- a/scene/gui/control.cpp
+++ b/scene/gui/control.cpp
@@ -548,15 +548,18 @@ void Control::_notification(int p_notification) {
Control * parent = get_parent()->cast_to<Control>();
//make children reference them theme
- if (parent && data.theme.is_null() && parent->data.theme_owner)
+
+ if (parent && data.theme.is_null() && parent->data.theme_owner) {
_propagate_theme_changed(parent->data.theme_owner);
+ }
} break;
case NOTIFICATION_UNPARENTED: {
//make children unreference the theme
- if (data.theme.is_null() && data.theme_owner)
+ if (data.theme.is_null() && data.theme_owner) {
_propagate_theme_changed(NULL);
+ }
} break;
case NOTIFICATION_MOVED_IN_PARENT: {
diff --git a/scene/gui/item_list.cpp b/scene/gui/item_list.cpp
index 2fd4d810de..c29f6625d3 100644
--- a/scene/gui/item_list.cpp
+++ b/scene/gui/item_list.cpp
@@ -11,6 +11,7 @@ void ItemList::add_item(const String& p_item,const Ref<Texture>& p_texture,bool
item.selectable=p_selectable;
item.selected=false;
item.disabled=false;
+ item.custom_bg=Color(0,0,0,0);
items.push_back(item);
update();
@@ -26,6 +27,7 @@ void ItemList::add_icon_item(const Ref<Texture>& p_item,bool p_selectable){
item.selectable=p_selectable;
item.selected=false;
item.disabled=false;
+ item.custom_bg=Color(0,0,0,0);
items.push_back(item);
update();
@@ -85,6 +87,23 @@ Ref<Texture> ItemList::get_item_icon(int p_idx) const{
}
+void ItemList::set_item_custom_bg_color(int p_idx,const Color& p_custom_bg_color) {
+
+ ERR_FAIL_INDEX(p_idx,items.size());
+
+ items[p_idx].custom_bg=p_custom_bg_color;
+
+}
+
+Color ItemList::get_item_custom_bg_color(int p_idx) const {
+
+ ERR_FAIL_INDEX_V(p_idx,items.size(),Color());
+
+ return items[p_idx].custom_bg;
+
+}
+
+
void ItemList::set_item_tag_icon(int p_idx,const Ref<Texture>& p_tag_icon){
@@ -635,6 +654,7 @@ void ItemList::_notification(int p_what) {
Ref<Font> font = get_font("font");
Color guide_color = get_color("guide_color");
Color font_color = get_color("font_color");
+ Color font_color_selected = get_color("font_color_selected");
int font_height = font->get_height();
Vector<int> line_size_cache;
Vector<int> line_limit_cache;
@@ -781,6 +801,11 @@ void ItemList::_notification(int p_what) {
if (current_columns==1) {
rcache.size.width = width-rcache.pos.x;
}
+ if (items[i].custom_bg.a>0.001) {
+ Rect2 r=rcache;
+ r.pos+=base_ofs;
+ draw_rect(r,items[i].custom_bg);
+ }
if (items[i].selected) {
Rect2 r=rcache;
r.pos+=base_ofs;
@@ -864,7 +889,7 @@ void ItemList::_notification(int p_what) {
if (line>=max_text_lines)
break;
}
- ofs+=font->draw_char(get_canvas_item(),text_ofs+Vector2(ofs+(max_len-line_size_cache[line])/2,line*(font_height+line_separation)).floor(),items[i].text[j],items[i].text[j+1],font_color);
+ ofs+=font->draw_char(get_canvas_item(),text_ofs+Vector2(ofs+(max_len-line_size_cache[line])/2,line*(font_height+line_separation)).floor(),items[i].text[j],items[i].text[j+1],items[i].selected?font_color_selected:font_color);
}
//special multiline mode
@@ -884,7 +909,7 @@ void ItemList::_notification(int p_what) {
text_ofs+=base_ofs;
text_ofs+=items[i].rect_cache.pos;
- draw_string(font,text_ofs,items[i].text,font_color,max_len+1);
+ draw_string(font,text_ofs,items[i].text,items[i].selected?font_color_selected:font_color,max_len+1);
}
@@ -954,6 +979,30 @@ String ItemList::get_tooltip(const Point2& p_pos) const {
}
+void ItemList::sort_items_by_text() {
+ items.sort();
+ update();
+ if (select_mode==SELECT_SINGLE) {
+ for(int i=0;i<items.size();i++) {
+ if (items[i].selected) {
+ select(i);
+ return;
+ }
+ }
+ }
+}
+
+int ItemList::find_metadata(const Variant& p_metadata) const {
+
+ for(int i=0;i<items.size();i++) {
+ if (items[i].metadata==p_metadata) {
+ return i;
+ }
+ }
+
+ return -1;
+
+}
void ItemList::_bind_methods(){
@@ -972,6 +1021,12 @@ void ItemList::_bind_methods(){
ObjectTypeDB::bind_method(_MD("set_item_disabled","idx","disabled"),&ItemList::set_item_disabled);
ObjectTypeDB::bind_method(_MD("is_item_disabled","idx"),&ItemList::is_item_disabled);
+ ObjectTypeDB::bind_method(_MD("set_item_metadata","idx","metadata"),&ItemList::set_item_metadata);
+ ObjectTypeDB::bind_method(_MD("get_item_metadata","idx"),&ItemList::get_item_metadata);
+
+ ObjectTypeDB::bind_method(_MD("set_item_custom_bg_color","idx","custom_bg_color"),&ItemList::set_item_custom_bg_color);
+ ObjectTypeDB::bind_method(_MD("get_item_custom_bg_color","idx"),&ItemList::get_item_custom_bg_color);
+
ObjectTypeDB::bind_method(_MD("set_item_tooltip","idx","tooltip"),&ItemList::set_item_tooltip);
ObjectTypeDB::bind_method(_MD("get_item_tooltip","idx"),&ItemList::get_item_tooltip);
@@ -983,6 +1038,7 @@ void ItemList::_bind_methods(){
ObjectTypeDB::bind_method(_MD("remove_item","idx"),&ItemList::remove_item);
ObjectTypeDB::bind_method(_MD("clear"),&ItemList::clear);
+ ObjectTypeDB::bind_method(_MD("sort_items_by_text"),&ItemList::clear);
ObjectTypeDB::bind_method(_MD("set_fixed_column_width","width"),&ItemList::set_fixed_column_width);
ObjectTypeDB::bind_method(_MD("get_fixed_column_width"),&ItemList::get_fixed_column_width);
diff --git a/scene/gui/item_list.h b/scene/gui/item_list.h
index 6bbb416970..237079c428 100644
--- a/scene/gui/item_list.h
+++ b/scene/gui/item_list.h
@@ -29,8 +29,12 @@ private:
bool disabled;
Variant metadata;
String tooltip;
+ Color custom_bg;
+
Rect2 rect_cache;
+
+ bool operator<(const Item& p_another) const { return text<p_another.text; }
};
int current;
@@ -85,6 +89,9 @@ public:
void set_item_tooltip(int p_idx,const String& p_tooltip);
String get_item_tooltip(int p_idx) const;
+ void set_item_custom_bg_color(int p_idx,const Color& p_custom_bg_color);
+ Color get_item_custom_bg_color(int p_idx) const;
+
void select(int p_idx,bool p_single=true);
void unselect(int p_idx);
bool is_selected(int p_idx) const;
@@ -118,6 +125,8 @@ public:
void ensure_current_is_visible();
+ void sort_items_by_text();
+ int find_metadata(const Variant& p_metadata) const;
virtual String get_tooltip(const Point2& p_pos) const;
diff --git a/scene/gui/popup.cpp b/scene/gui/popup.cpp
index c73af74426..5ce7e2e0d3 100644
--- a/scene/gui/popup.cpp
+++ b/scene/gui/popup.cpp
@@ -84,6 +84,48 @@ void Popup::_fix_size() {
}
+void Popup::set_as_minsize() {
+
+ Size2 total_minsize;
+
+ for(int i=0;i<get_child_count();i++) {
+
+ Control *c=get_child(i)->cast_to<Control>();
+ if (!c)
+ continue;
+ if (c->is_hidden())
+ continue;
+
+ Size2 minsize = c->get_combined_minimum_size();
+
+ for(int j=0;j<2;j++) {
+
+ Margin m_beg = Margin(0+j);
+ Margin m_end = Margin(2+j);
+
+ float margin_begin = c->get_margin(m_beg);
+ float margin_end = c->get_margin(m_end);
+ AnchorType anchor_begin = c->get_anchor(m_beg);
+ AnchorType anchor_end = c->get_anchor(m_end);
+
+ if (anchor_begin == ANCHOR_BEGIN)
+ minsize[j]+=margin_begin;
+ if (anchor_end == ANCHOR_END)
+ minsize[j]+=margin_end;
+
+ }
+
+ print_line(String(c->get_type())+": "+minsize);
+
+ total_minsize.width = MAX( total_minsize.width, minsize.width );
+ total_minsize.height = MAX( total_minsize.height, minsize.height );
+ }
+
+ set_size(total_minsize);
+
+}
+
+
void Popup::popup_centered_minsize(const Size2& p_minsize) {
diff --git a/scene/gui/popup.h b/scene/gui/popup.h
index c2de6c8cf7..6c72a3c82b 100644
--- a/scene/gui/popup.h
+++ b/scene/gui/popup.h
@@ -62,6 +62,7 @@ public:
void popup_centered_ratio(float p_screen_ratio=0.75);
void popup_centered(const Size2& p_size=Size2());
void popup_centered_minsize(const Size2& p_minsize=Size2());
+ void set_as_minsize();
virtual void popup();
diff --git a/scene/gui/split_container.cpp b/scene/gui/split_container.cpp
index d02c833be9..d7ee7a6b86 100644
--- a/scene/gui/split_container.cpp
+++ b/scene/gui/split_container.cpp
@@ -345,6 +345,7 @@ void SplitContainer::_input_event(const InputEvent& p_event) {
expand_ofs=drag_ofs+((vertical?mm.y:mm.x)-drag_from);
queue_sort();
+ emit_signal("dragged",get_split_offset());
}
}
@@ -431,11 +432,13 @@ void SplitContainer::_bind_methods() {
ObjectTypeDB::bind_method(_MD("set_dragger_visible","visible"),&SplitContainer::set_dragger_visible);
ObjectTypeDB::bind_method(_MD("is_dragger_visible"),&SplitContainer::is_dragger_visible);
+ ADD_SIGNAL( MethodInfo("dragged",PropertyInfo(Variant::INT,"offset")));
ADD_PROPERTY( PropertyInfo(Variant::INT,"split/offset"),_SCS("set_split_offset"),_SCS("get_split_offset"));
ADD_PROPERTY( PropertyInfo(Variant::INT,"split/collapsed"),_SCS("set_collapsed"),_SCS("is_collapsed"));
ADD_PROPERTY( PropertyInfo(Variant::INT,"split/dragger_visible"),_SCS("set_dragger_visible"),_SCS("is_dragger_visible"));
+
}
SplitContainer::SplitContainer(bool p_vertical) {
diff --git a/scene/gui/tab_container.cpp b/scene/gui/tab_container.cpp
index 1db4998a27..3ed182c017 100644
--- a/scene/gui/tab_container.cpp
+++ b/scene/gui/tab_container.cpp
@@ -88,7 +88,22 @@ void TabContainer::_input_event(const InputEvent& p_event) {
Ref<Font> font = get_font("font");
Ref<Texture> incr = get_icon("increment");
Ref<Texture> decr = get_icon("decrement");
+ Ref<Texture> menu = get_icon("menu");
+ Ref<Texture> menu_hl = get_icon("menu_hl");
+ if (popup && pos.x>get_size().width-menu->get_width()) {
+
+
+ emit_signal("pre_popup_pressed");
+ Vector2 pp_pos = get_global_pos();
+ pp_pos.x+=get_size().width;
+ pp_pos.x-=popup->get_size().width;
+ pp_pos.y+=menu->get_height();
+
+ popup->set_global_pos( pp_pos );
+ popup->popup();;
+ return;
+ }
pos.x-=tabs_ofs_cache;
int idx=0;
@@ -116,17 +131,17 @@ void TabContainer::_input_event(const InputEvent& p_event) {
String s = c->has_meta("_tab_name")?String(XL_MESSAGE(String(c->get_meta("_tab_name")))):String(c->get_name());
int tab_width=font->get_string_size(s).width;
- if (c->has_meta("_tab_icon")) {
- Ref<Texture> icon = c->get_meta("_tab_icon");
- if (icon.is_valid()) {
- tab_width+=icon->get_width();
- if (s!="")
- tab_width+=get_constant("hseparation");
+ if (c->has_meta("_tab_icon")) {
+ Ref<Texture> icon = c->get_meta("_tab_icon");
+ if (icon.is_valid()) {
+ tab_width+=icon->get_width();
+ if (s!="")
+ tab_width+=get_constant("hseparation");
- }
- }
+ }
+ }
- if (idx==current) {
+ if (idx==current) {
tab_width+=tab_fg->get_minimum_size().width;
} else {
@@ -163,7 +178,7 @@ void TabContainer::_input_event(const InputEvent& p_event) {
if (found!=-1) {
- set_current_tab(found);
+ set_current_tab(found);
}
}
@@ -194,7 +209,9 @@ void TabContainer::_notification(int p_what) {
Ref<Texture> incr = get_icon("increment");
Ref<Texture> incr_hl = get_icon("increment_hilite");
Ref<Texture> decr = get_icon("decrement");
- Ref<Texture> decr_hl = get_icon("decrement_hilite");
+ Ref<Texture> decr_hl = get_icon("decrement_hilite");
+ Ref<Texture> menu = get_icon("menu");
+ Ref<Texture> menu_hl = get_icon("menu_hl");
Ref<Font> font = get_font("font");
Color color_fg = get_color("font_color_fg");
Color color_bg = get_color("font_color_bg");
@@ -209,6 +226,7 @@ void TabContainer::_notification(int p_what) {
Size2 top_size = Size2( size.width, top_margin );
+
int w=0;
int idx=0;
for(int i=0;i<get_child_count();i++) {
@@ -227,7 +245,7 @@ void TabContainer::_notification(int p_what) {
if (icon.is_valid()) {
w+=icon->get_width();
if (s!="")
- w+=get_constant("hseparation");
+ w+=get_constant("hseparation");
}
}
@@ -245,14 +263,18 @@ void TabContainer::_notification(int p_what) {
int ofs;
int limit=get_size().width;
+ if (popup) {
+ top_size.width-=menu->get_width();
+ limit-=menu->get_width();
+ }
- if (w<=get_size().width) {
+ if (w<=limit) {
switch(align) {
case ALIGN_LEFT: ofs = side_margin; break;
- case ALIGN_CENTER: ofs = (int(top_size.width) - w)/2; break;
- case ALIGN_RIGHT: ofs = int(top_size.width) - w - side_margin; break;
+ case ALIGN_CENTER: ofs = (int(limit) - w)/2; break;
+ case ALIGN_RIGHT: ofs = int(limit) - w - side_margin; break;
};
tab_display_ofs=0;
@@ -364,6 +386,15 @@ void TabContainer::_notification(int p_what) {
incr->draw(ci,Point2(limit+incr->get_width(),vofs),Color(1,1,1,notdone?1.0:0.5));
}
+ if (popup) {
+ int from = get_size().width-menu->get_width();
+
+ if (mouse_x_cache > from)
+ menu_hl->draw(get_canvas_item(),Size2(from,0));
+ else
+ menu->draw(get_canvas_item(),Size2(from,0));
+ }
+
panel->draw(ci, Rect2( 0, top_size.height, size.width, size.height-top_size.height));
} break;
@@ -465,6 +496,48 @@ int TabContainer::get_current_tab() const {
return current;
}
+Control* TabContainer::get_tab_control(int p_idx) const {
+
+ int idx=0;
+
+
+ for(int i=0;i<get_child_count();i++) {
+
+ Control *c = get_child(i)->cast_to<Control>();
+ if (!c)
+ continue;
+ if (c->is_set_as_toplevel())
+ continue;
+ if (idx==p_idx) {
+ return c;
+
+ }
+ idx++;
+ }
+
+ return NULL;
+}
+Control* TabContainer::get_current_tab_control() const {
+
+ int idx=0;
+
+
+ for(int i=0;i<get_child_count();i++) {
+
+ Control *c = get_child(i)->cast_to<Control>();
+ if (!c)
+ continue;
+ if (c->is_set_as_toplevel())
+ continue;
+ if (idx==current) {
+ return c;
+
+ }
+ idx++;
+ }
+
+ return NULL;
+}
void TabContainer::remove_child_notify(Node *p_child) {
@@ -635,12 +708,25 @@ Size2 TabContainer::get_minimum_size() const {
return ms;
}
+void TabContainer::set_popup(Node *p_popup) {
+ ERR_FAIL_NULL(p_popup);
+ popup=p_popup->cast_to<Popup>();
+ update();
+}
+
+Popup* TabContainer::get_popup() const {
+ return popup;
+}
+
+
void TabContainer::_bind_methods() {
ObjectTypeDB::bind_method(_MD("_input_event"),&TabContainer::_input_event);
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("get_current_tab"),&TabContainer::get_current_tab);
+ 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("set_tab_align","align"),&TabContainer::set_tab_align);
ObjectTypeDB::bind_method(_MD("get_tab_align"),&TabContainer::get_tab_align);
ObjectTypeDB::bind_method(_MD("set_tabs_visible","visible"),&TabContainer::set_tabs_visible);
@@ -649,10 +735,13 @@ void TabContainer::_bind_methods() {
ObjectTypeDB::bind_method(_MD("get_tab_title","tab_idx"),&TabContainer::get_tab_title);
ObjectTypeDB::bind_method(_MD("set_tab_icon","tab_idx","icon:Texture"),&TabContainer::set_tab_icon);
ObjectTypeDB::bind_method(_MD("get_tab_icon:Texture","tab_idx"),&TabContainer::get_tab_icon);
+ ObjectTypeDB::bind_method(_MD("set_popup","popup:Popup"),&TabContainer::set_popup);
+ ObjectTypeDB::bind_method(_MD("get_popup:Popup"),&TabContainer::get_popup);
ObjectTypeDB::bind_method(_MD("_child_renamed_callback"),&TabContainer::_child_renamed_callback);
ADD_SIGNAL(MethodInfo("tab_changed",PropertyInfo(Variant::INT,"tab")));
+ 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, "current_tab", PROPERTY_HINT_RANGE,"-1,4096,1",PROPERTY_USAGE_EDITOR), _SCS("set_current_tab"), _SCS("get_current_tab") );
@@ -669,5 +758,6 @@ TabContainer::TabContainer() {
mouse_x_cache=0;
align=ALIGN_CENTER;
tabs_visible=true;
+ popup=NULL;
}
diff --git a/scene/gui/tab_container.h b/scene/gui/tab_container.h
index 43314b026d..602d248b46 100644
--- a/scene/gui/tab_container.h
+++ b/scene/gui/tab_container.h
@@ -31,7 +31,7 @@
#include "scene/gui/control.h"
-
+#include "scene/gui/popup.h"
class TabContainer : public Control {
OBJ_TYPE( TabContainer, Control );
@@ -55,6 +55,8 @@ private:
TabAlign align;
Control *_get_tab(int idx) const;
int _get_top_margin() const;
+ Popup *popup;
+
protected:
@@ -85,10 +87,17 @@ public:
void set_current_tab(int p_current);
int get_current_tab() const;
+ Control* get_tab_control(int p_idx) const;
+ Control* get_current_tab_control() const;
+
virtual Size2 get_minimum_size() const;
virtual void get_translatable_strings(List<String> *p_strings) const;
+ void set_popup(Node *p_popup);
+ Popup* get_popup() const;
+
+
TabContainer();
};
diff --git a/scene/gui/tabs.cpp b/scene/gui/tabs.cpp
index 37369a7e6c..40a6e20c37 100644
--- a/scene/gui/tabs.cpp
+++ b/scene/gui/tabs.cpp
@@ -77,8 +77,8 @@ void Tabs::_input_event(const InputEvent& p_event) {
for(int i=0;i<tabs.size();i++) {
int ofs=tabs[i].ofs_cache;
-
- if (pos.x < ofs) {
+ int size = tabs[i].ofs_cache;
+ if (pos.x >=tabs[i].ofs_cache && pos.x<tabs[i].ofs_cache+tabs[i].size_cache) {
found=i;
break;
@@ -89,6 +89,7 @@ void Tabs::_input_event(const InputEvent& p_event) {
if (found!=-1) {
set_current_tab(found);
+ emit_signal("tab_changed",found);
}
}
@@ -117,8 +118,22 @@ void Tabs::_notification(int p_what) {
int w=0;
+ int mw = get_minimum_size().width;
+
+ if (tab_align==ALIGN_CENTER) {
+ w=(get_size().width-mw)/2;
+ } else if (tab_align==ALIGN_RIGHT) {
+ w=get_size().width-mw;
+
+ }
+
+ if (w<0) {
+ w=0;
+ }
+
for(int i=0;i<tabs.size();i++) {
+ tabs[i].ofs_cache=w;
String s = tabs[i].text;
int lsize=0;
@@ -171,7 +186,7 @@ void Tabs::_notification(int p_what) {
w+=slen+sb->get_margin(MARGIN_RIGHT);
- tabs[i].ofs_cache=w;
+ tabs[i].size_cache=w-tabs[i].ofs_cache;
}
@@ -195,7 +210,7 @@ void Tabs::set_current_tab(int p_current) {
current=p_current;
_change_notify("current_tab");
- emit_signal("tab_changed",current);
+ //emit_signal("tab_changed",current);
update();
}
@@ -249,6 +264,12 @@ void Tabs::add_tab(const String& p_str,const Ref<Texture>& p_icon) {
}
+void Tabs::clear_tabs() {
+ tabs.clear();
+ current=0;
+ update();
+}
+
void Tabs::remove_tab(int p_idx) {
ERR_FAIL_INDEX(p_idx,tabs.size());
@@ -263,8 +284,19 @@ void Tabs::remove_tab(int p_idx) {
if (current>=tabs.size())
current=tabs.size()-1;
- emit_signal("tab_changed",current);
+ //emit_signal("tab_changed",current);
+
+}
+
+void Tabs::set_tab_align(TabAlign p_align) {
+
+ tab_align=p_align;
+ update();
+}
+
+Tabs::TabAlign Tabs::get_tab_align() const {
+ return tab_align;
}
@@ -280,15 +312,21 @@ void Tabs::_bind_methods() {
ObjectTypeDB::bind_method(_MD("get_tab_icon:Texture","tab_idx"),&Tabs::get_tab_icon);
ObjectTypeDB::bind_method(_MD("remove_tab","tab_idx"),&Tabs::remove_tab);
ObjectTypeDB::bind_method(_MD("add_tab","title","icon:Texture"),&Tabs::add_tab);
+ ObjectTypeDB::bind_method(_MD("set_tab_align","align"),&Tabs::set_tab_align);
+ ObjectTypeDB::bind_method(_MD("get_tab_align"),&Tabs::get_tab_align);
ADD_SIGNAL(MethodInfo("tab_changed",PropertyInfo(Variant::INT,"tab")));
ADD_PROPERTY( PropertyInfo(Variant::INT, "current_tab", PROPERTY_HINT_RANGE,"-1,4096,1",PROPERTY_USAGE_EDITOR), _SCS("set_current_tab"), _SCS("get_current_tab") );
+ BIND_CONSTANT( ALIGN_LEFT );
+ BIND_CONSTANT( ALIGN_CENTER );
+ BIND_CONSTANT( ALIGN_RIGHT );
}
Tabs::Tabs() {
current=0;
+ tab_align=ALIGN_CENTER;
}
diff --git a/scene/gui/tabs.h b/scene/gui/tabs.h
index 4a969928ff..8d4d0123f8 100644
--- a/scene/gui/tabs.h
+++ b/scene/gui/tabs.h
@@ -34,6 +34,14 @@
class Tabs : public Control {
OBJ_TYPE( Tabs, Control );
+public:
+
+ enum TabAlign {
+
+ ALIGN_LEFT,
+ ALIGN_CENTER,
+ ALIGN_RIGHT
+ };
private:
@@ -42,12 +50,14 @@ private:
String text;
Ref<Texture> icon;
int ofs_cache;
+ int size_cache;
};
Vector<Tab> tabs;
int current;
Control *_get_tab(int idx) const;
int _get_top_margin() const;
+ TabAlign tab_align;
protected:
@@ -65,16 +75,22 @@ public:
void set_tab_icon(int p_tab,const Ref<Texture>& p_icon);
Ref<Texture> get_tab_icon(int p_tab) const;
+ void set_tab_align(TabAlign p_align);
+ TabAlign get_tab_align() const;
+
int get_tab_count() const;
void set_current_tab(int p_current);
int get_current_tab() const;
void remove_tab(int p_idx);
+ void clear_tabs();
+
Size2 get_minimum_size() const;
Tabs();
};
+VARIANT_ENUM_CAST(Tabs::TabAlign);
#endif // TABS_H
diff --git a/scene/gui/tree.h b/scene/gui/tree.h
index f03827f542..8ddddd0630 100644
--- a/scene/gui/tree.h
+++ b/scene/gui/tree.h
@@ -454,6 +454,8 @@ public:
void set_cursor_can_exit_tree(bool p_enable);
bool can_cursor_exit_tree() const;
+ VScrollBar *get_vscroll_bar() { return v_scroll; }
+
Tree();
~Tree();