2014-02-10 01:10:30 +00:00
|
|
|
/*************************************************************************/
|
|
|
|
/* tab_container.cpp */
|
|
|
|
/*************************************************************************/
|
|
|
|
/* This file is part of: */
|
|
|
|
/* GODOT ENGINE */
|
2017-08-27 12:16:55 +00:00
|
|
|
/* https://godotengine.org */
|
2014-02-10 01:10:30 +00:00
|
|
|
/*************************************************************************/
|
2018-01-01 13:40:08 +00:00
|
|
|
/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
|
|
|
|
/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
|
2014-02-10 01:10:30 +00:00
|
|
|
/* */
|
|
|
|
/* Permission is hereby granted, free of charge, to any person obtaining */
|
|
|
|
/* a copy of this software and associated documentation files (the */
|
|
|
|
/* "Software"), to deal in the Software without restriction, including */
|
|
|
|
/* without limitation the rights to use, copy, modify, merge, publish, */
|
|
|
|
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
|
|
|
/* permit persons to whom the Software is furnished to do so, subject to */
|
|
|
|
/* the following conditions: */
|
|
|
|
/* */
|
|
|
|
/* The above copyright notice and this permission notice shall be */
|
|
|
|
/* included in all copies or substantial portions of the Software. */
|
|
|
|
/* */
|
|
|
|
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
|
|
|
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
|
|
|
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
|
|
|
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
|
|
|
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
|
|
|
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
|
|
|
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|
|
|
/*************************************************************************/
|
2018-01-04 23:50:27 +00:00
|
|
|
|
2014-02-10 01:10:30 +00:00
|
|
|
#include "tab_container.h"
|
2016-03-08 23:00:52 +00:00
|
|
|
|
2014-02-10 01:10:30 +00:00
|
|
|
#include "message_queue.h"
|
|
|
|
|
|
|
|
int TabContainer::_get_top_margin() const {
|
|
|
|
|
2017-01-21 18:11:33 +00:00
|
|
|
if (!tabs_visible)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
// Respect the minimum tab height.
|
2014-02-10 01:10:30 +00:00
|
|
|
Ref<StyleBox> tab_bg = get_stylebox("tab_bg");
|
|
|
|
Ref<StyleBox> tab_fg = get_stylebox("tab_fg");
|
2017-02-27 18:07:50 +00:00
|
|
|
Ref<StyleBox> tab_disabled = get_stylebox("tab_disabled");
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-02-27 18:07:50 +00:00
|
|
|
int tab_height = MAX(MAX(tab_bg->get_minimum_size().height, tab_fg->get_minimum_size().height), tab_disabled->get_minimum_size().height);
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-01-21 18:11:33 +00:00
|
|
|
// Font height or higher icon wins.
|
|
|
|
Ref<Font> font = get_font("font");
|
|
|
|
int content_height = font->get_height();
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
Vector<Control *> tabs = _get_tabs();
|
2017-01-21 18:11:33 +00:00
|
|
|
for (int i = 0; i < tabs.size(); i++) {
|
|
|
|
|
|
|
|
Control *c = tabs[i];
|
2014-02-10 01:10:30 +00:00
|
|
|
if (!c->has_meta("_tab_icon"))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
Ref<Texture> tex = c->get_meta("_tab_icon");
|
|
|
|
if (!tex.is_valid())
|
|
|
|
continue;
|
2017-01-21 18:11:33 +00:00
|
|
|
content_height = MAX(content_height, tex->get_size().height);
|
2014-02-10 01:10:30 +00:00
|
|
|
}
|
|
|
|
|
2017-01-21 18:11:33 +00:00
|
|
|
return tab_height + content_height;
|
2014-02-10 01:10:30 +00:00
|
|
|
}
|
|
|
|
|
2017-05-20 15:38:03 +00:00
|
|
|
void TabContainer::_gui_input(const Ref<InputEvent> &p_event) {
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-05-20 15:38:03 +00:00
|
|
|
Ref<InputEventMouseButton> mb = p_event;
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-05-20 15:38:03 +00:00
|
|
|
if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) {
|
|
|
|
|
2017-06-03 08:54:24 +00:00
|
|
|
Point2 pos(mb->get_position().x, mb->get_position().y);
|
2017-01-21 18:11:33 +00:00
|
|
|
Size2 size = get_size();
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-01-21 18:11:33 +00:00
|
|
|
// Click must be on tabs in the tab header area.
|
|
|
|
if (pos.x < tabs_ofs_cache || pos.y > _get_top_margin())
|
|
|
|
return;
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-01-21 18:11:33 +00:00
|
|
|
// Handle menu button.
|
2015-06-14 01:12:53 +00:00
|
|
|
Ref<Texture> menu = get_icon("menu");
|
2017-01-21 18:11:33 +00:00
|
|
|
if (popup && pos.x > size.width - menu->get_width()) {
|
2015-06-14 01:12:53 +00:00
|
|
|
emit_signal("pre_popup_pressed");
|
|
|
|
|
2017-03-29 15:29:38 +00:00
|
|
|
Vector2 popup_pos = get_global_position();
|
2017-01-21 18:11:33 +00:00
|
|
|
popup_pos.x += size.width - popup->get_size().width;
|
|
|
|
popup_pos.y += menu->get_height();
|
|
|
|
|
2017-03-29 15:29:38 +00:00
|
|
|
popup->set_global_position(popup_pos);
|
2017-01-14 17:03:38 +00:00
|
|
|
popup->popup();
|
2015-06-14 01:12:53 +00:00
|
|
|
return;
|
|
|
|
}
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-10-30 12:20:51 +00:00
|
|
|
// Do not activate tabs when tabs is empty
|
|
|
|
if (get_tab_count() == 0)
|
|
|
|
return;
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
Vector<Control *> tabs = _get_tabs();
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-01-21 18:11:33 +00:00
|
|
|
// Handle navigation buttons.
|
2014-02-10 01:10:30 +00:00
|
|
|
if (buttons_visible_cache) {
|
2017-10-14 08:03:27 +00:00
|
|
|
int popup_ofs = 0;
|
|
|
|
if (popup) {
|
|
|
|
popup_ofs = menu->get_width();
|
|
|
|
}
|
|
|
|
|
2017-01-21 18:11:33 +00:00
|
|
|
Ref<Texture> increment = get_icon("increment");
|
|
|
|
Ref<Texture> decrement = get_icon("decrement");
|
2017-10-14 08:03:27 +00:00
|
|
|
if (pos.x > size.width - increment->get_width() - popup_ofs) {
|
2017-01-21 18:11:33 +00:00
|
|
|
if (last_tab_cache < tabs.size() - 1) {
|
|
|
|
first_tab_cache += 1;
|
2014-02-10 01:10:30 +00:00
|
|
|
update();
|
|
|
|
}
|
2017-01-21 18:11:33 +00:00
|
|
|
return;
|
2017-10-14 08:03:27 +00:00
|
|
|
} else if (pos.x > size.width - increment->get_width() - decrement->get_width() - popup_ofs) {
|
2017-01-21 18:11:33 +00:00
|
|
|
if (first_tab_cache > 0) {
|
|
|
|
first_tab_cache -= 1;
|
2014-02-10 01:10:30 +00:00
|
|
|
update();
|
|
|
|
}
|
2017-01-21 18:11:33 +00:00
|
|
|
return;
|
2014-02-10 01:10:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-01-21 18:11:33 +00:00
|
|
|
// Activate the clicked tab.
|
|
|
|
pos.x -= tabs_ofs_cache;
|
|
|
|
for (int i = first_tab_cache; i <= last_tab_cache; i++) {
|
|
|
|
int tab_width = _get_tab_width(i);
|
|
|
|
if (pos.x < tab_width) {
|
2017-02-27 18:07:50 +00:00
|
|
|
if (!get_tab_disabled(i)) {
|
|
|
|
set_current_tab(i);
|
|
|
|
}
|
2017-01-21 18:11:33 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
pos.x -= tab_width;
|
2014-02-10 01:10:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void TabContainer::_notification(int p_what) {
|
|
|
|
|
2017-01-21 18:11:33 +00:00
|
|
|
switch (p_what) {
|
2014-02-10 01:10:30 +00:00
|
|
|
|
|
|
|
case NOTIFICATION_DRAW: {
|
|
|
|
|
2017-01-21 18:11:33 +00:00
|
|
|
RID canvas = get_canvas_item();
|
2014-02-10 01:10:30 +00:00
|
|
|
Size2 size = get_size();
|
|
|
|
|
2017-01-21 18:11:33 +00:00
|
|
|
// Draw only the tab area if the header is hidden.
|
|
|
|
Ref<StyleBox> panel = get_stylebox("panel");
|
2014-02-10 01:10:30 +00:00
|
|
|
if (!tabs_visible) {
|
2017-01-21 18:11:33 +00:00
|
|
|
panel->draw(canvas, Rect2(0, 0, size.width, size.height));
|
2014-02-10 01:10:30 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
Vector<Control *> tabs = _get_tabs();
|
2014-02-10 01:10:30 +00:00
|
|
|
Ref<StyleBox> tab_bg = get_stylebox("tab_bg");
|
|
|
|
Ref<StyleBox> tab_fg = get_stylebox("tab_fg");
|
2017-02-27 18:07:50 +00:00
|
|
|
Ref<StyleBox> tab_disabled = get_stylebox("tab_disabled");
|
2017-01-21 18:11:33 +00:00
|
|
|
Ref<Texture> increment = get_icon("increment");
|
|
|
|
Ref<Texture> decrement = get_icon("decrement");
|
2015-06-14 01:12:53 +00:00
|
|
|
Ref<Texture> menu = get_icon("menu");
|
|
|
|
Ref<Texture> menu_hl = get_icon("menu_hl");
|
2014-02-10 01:10:30 +00:00
|
|
|
Ref<Font> font = get_font("font");
|
2017-01-21 18:11:33 +00:00
|
|
|
Color font_color_fg = get_color("font_color_fg");
|
|
|
|
Color font_color_bg = get_color("font_color_bg");
|
2017-02-27 18:07:50 +00:00
|
|
|
Color font_color_disabled = get_color("font_color_disabled");
|
2014-02-10 01:10:30 +00:00
|
|
|
int side_margin = get_constant("side_margin");
|
2017-01-21 18:11:33 +00:00
|
|
|
int icon_text_distance = get_constant("hseparation");
|
|
|
|
|
|
|
|
// Find out start and width of the header area.
|
|
|
|
int header_x = side_margin;
|
|
|
|
int header_width = size.width - side_margin * 2;
|
|
|
|
int header_height = _get_top_margin();
|
|
|
|
if (popup)
|
|
|
|
header_width -= menu->get_width();
|
|
|
|
|
|
|
|
// Check if all tabs would fit into the header area.
|
|
|
|
int all_tabs_width = 0;
|
|
|
|
for (int i = 0; i < tabs.size(); i++) {
|
|
|
|
int tab_width = _get_tab_width(i);
|
|
|
|
all_tabs_width += tab_width;
|
|
|
|
|
|
|
|
if (all_tabs_width > header_width) {
|
|
|
|
// Not all tabs are visible at the same time - reserve space for navigation buttons.
|
|
|
|
buttons_visible_cache = true;
|
|
|
|
header_width -= decrement->get_width() + increment->get_width();
|
2015-10-21 02:54:24 +00:00
|
|
|
break;
|
2014-02-10 01:10:30 +00:00
|
|
|
} else {
|
2017-01-21 18:11:33 +00:00
|
|
|
buttons_visible_cache = false;
|
2015-10-21 02:54:24 +00:00
|
|
|
}
|
2017-01-21 18:11:33 +00:00
|
|
|
}
|
|
|
|
// With buttons, a right side margin does not need to be respected.
|
|
|
|
if (popup || buttons_visible_cache) {
|
|
|
|
header_width += side_margin;
|
2015-06-14 01:12:53 +00:00
|
|
|
}
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-01-21 18:11:33 +00:00
|
|
|
// Go through the visible tabs to find the width they occupy.
|
|
|
|
all_tabs_width = 0;
|
|
|
|
Vector<int> tab_widths;
|
|
|
|
for (int i = first_tab_cache; i < tabs.size(); i++) {
|
|
|
|
int tab_width = _get_tab_width(i);
|
|
|
|
if (all_tabs_width + tab_width > header_width && tab_widths.size() > 0)
|
|
|
|
break;
|
|
|
|
all_tabs_width += tab_width;
|
|
|
|
tab_widths.push_back(tab_width);
|
|
|
|
}
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-01-21 18:11:33 +00:00
|
|
|
// Find the offset at which to draw tabs, according to the alignment.
|
|
|
|
switch (align) {
|
|
|
|
case ALIGN_LEFT:
|
|
|
|
tabs_ofs_cache = header_x;
|
|
|
|
break;
|
|
|
|
case ALIGN_CENTER:
|
|
|
|
tabs_ofs_cache = header_x + (header_width / 2) - (all_tabs_width / 2);
|
|
|
|
break;
|
|
|
|
case ALIGN_RIGHT:
|
|
|
|
tabs_ofs_cache = header_x + header_width - all_tabs_width;
|
|
|
|
break;
|
|
|
|
}
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-09-02 01:29:04 +00:00
|
|
|
// Draw the tab area.
|
|
|
|
panel->draw(canvas, Rect2(0, header_height, size.width, size.height - header_height));
|
|
|
|
|
2017-01-21 18:11:33 +00:00
|
|
|
// Draw all visible tabs.
|
|
|
|
int x = 0;
|
|
|
|
for (int i = 0; i < tab_widths.size(); i++) {
|
|
|
|
Ref<StyleBox> tab_style;
|
|
|
|
Color font_color;
|
2017-02-27 18:07:50 +00:00
|
|
|
if (get_tab_disabled(i + first_tab_cache)) {
|
|
|
|
tab_style = tab_disabled;
|
|
|
|
font_color = font_color_disabled;
|
|
|
|
} else if (i + first_tab_cache == current) {
|
2017-01-21 18:11:33 +00:00
|
|
|
tab_style = tab_fg;
|
|
|
|
font_color = font_color_fg;
|
2014-02-10 01:10:30 +00:00
|
|
|
} else {
|
2017-01-21 18:11:33 +00:00
|
|
|
tab_style = tab_bg;
|
|
|
|
font_color = font_color_bg;
|
2014-02-10 01:10:30 +00:00
|
|
|
}
|
|
|
|
|
2017-01-21 18:11:33 +00:00
|
|
|
// Draw the tab background.
|
|
|
|
int tab_width = tab_widths[i];
|
2017-05-02 21:02:06 +00:00
|
|
|
Rect2 tab_rect(tabs_ofs_cache + x, 0, tab_width, header_height);
|
2017-01-21 18:11:33 +00:00
|
|
|
tab_style->draw(canvas, tab_rect);
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-01-21 18:11:33 +00:00
|
|
|
// Draw the tab contents.
|
2017-08-24 20:58:51 +00:00
|
|
|
Control *control = Object::cast_to<Control>(tabs[i + first_tab_cache]);
|
2017-08-18 20:29:15 +00:00
|
|
|
String text = control->has_meta("_tab_name") ? String(tr(String(control->get_meta("_tab_name")))) : String(control->get_name());
|
2015-10-21 02:54:24 +00:00
|
|
|
|
2017-06-03 22:25:13 +00:00
|
|
|
int x_content = tab_rect.position.x + tab_style->get_margin(MARGIN_LEFT);
|
2017-01-21 18:11:33 +00:00
|
|
|
int top_margin = tab_style->get_margin(MARGIN_TOP);
|
|
|
|
int y_center = top_margin + (tab_rect.size.y - tab_style->get_minimum_size().y) / 2;
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-01-21 18:11:33 +00:00
|
|
|
// Draw the tab icon.
|
|
|
|
if (control->has_meta("_tab_icon")) {
|
|
|
|
Ref<Texture> icon = control->get_meta("_tab_icon");
|
|
|
|
if (icon.is_valid()) {
|
|
|
|
int y = y_center - (icon->get_height() / 2);
|
|
|
|
icon->draw(canvas, Point2i(x_content, y));
|
|
|
|
if (text != "")
|
|
|
|
x_content += icon->get_width() + icon_text_distance;
|
|
|
|
}
|
2014-02-10 01:10:30 +00:00
|
|
|
}
|
|
|
|
|
2017-01-21 18:11:33 +00:00
|
|
|
// Draw the tab text.
|
|
|
|
Point2i text_pos(x_content, y_center - (font->get_height() / 2) + font->get_ascent());
|
|
|
|
font->draw(canvas, text_pos, text, font_color);
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-01-21 18:11:33 +00:00
|
|
|
x += tab_width;
|
|
|
|
last_tab_cache = i + first_tab_cache;
|
2014-02-10 01:10:30 +00:00
|
|
|
}
|
|
|
|
|
2017-01-21 18:11:33 +00:00
|
|
|
// Draw the popup menu.
|
|
|
|
x = get_size().width;
|
|
|
|
if (popup) {
|
|
|
|
x -= menu->get_width();
|
|
|
|
if (mouse_x_cache > x)
|
2017-09-29 11:23:11 +00:00
|
|
|
menu_hl->draw(get_canvas_item(), Size2(x, (header_height - menu_hl->get_height()) / 2));
|
2017-01-21 18:11:33 +00:00
|
|
|
else
|
2017-09-29 11:23:11 +00:00
|
|
|
menu->draw(get_canvas_item(), Size2(x, (header_height - menu->get_height()) / 2));
|
2017-01-21 18:11:33 +00:00
|
|
|
}
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-01-21 18:11:33 +00:00
|
|
|
// Draw the navigation buttons.
|
2014-02-10 01:10:30 +00:00
|
|
|
if (buttons_visible_cache) {
|
2017-01-21 18:11:33 +00:00
|
|
|
int y_center = header_height / 2;
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-01-21 18:11:33 +00:00
|
|
|
x -= increment->get_width();
|
|
|
|
increment->draw(canvas,
|
2017-03-05 15:44:50 +00:00
|
|
|
Point2(x, y_center - (increment->get_height() / 2)),
|
|
|
|
Color(1, 1, 1, last_tab_cache < tabs.size() - 1 ? 1.0 : 0.5));
|
2015-06-14 01:12:53 +00:00
|
|
|
|
2017-01-21 18:11:33 +00:00
|
|
|
x -= decrement->get_width();
|
|
|
|
decrement->draw(canvas,
|
2017-03-05 15:44:50 +00:00
|
|
|
Point2(x, y_center - (decrement->get_height() / 2)),
|
|
|
|
Color(1, 1, 1, first_tab_cache > 0 ? 1.0 : 0.5));
|
2015-06-14 01:12:53 +00:00
|
|
|
}
|
2014-02-10 01:10:30 +00:00
|
|
|
} break;
|
2016-05-30 03:28:29 +00:00
|
|
|
case NOTIFICATION_THEME_CHANGED: {
|
2017-12-11 11:46:33 +00:00
|
|
|
call_deferred("_on_theme_changed"); //wait until all changed theme
|
2016-05-30 03:28:29 +00:00
|
|
|
} break;
|
2014-02-10 01:10:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-12-11 11:46:33 +00:00
|
|
|
void TabContainer::_on_theme_changed() {
|
|
|
|
if (get_tab_count() > 0) {
|
|
|
|
set_current_tab(get_current_tab());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-01-21 18:11:33 +00:00
|
|
|
int TabContainer::_get_tab_width(int p_index) const {
|
2017-10-30 12:20:51 +00:00
|
|
|
|
|
|
|
ERR_FAIL_INDEX_V(p_index, get_tab_count(), 0);
|
2017-08-24 20:58:51 +00:00
|
|
|
Control *control = Object::cast_to<Control>(_get_tabs()[p_index]);
|
2017-01-21 18:11:33 +00:00
|
|
|
if (!control || control->is_set_as_toplevel())
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
// Get the width of the text displayed on the tab.
|
|
|
|
Ref<Font> font = get_font("font");
|
2017-08-18 20:29:15 +00:00
|
|
|
String text = control->has_meta("_tab_name") ? String(tr(String(control->get_meta("_tab_name")))) : String(control->get_name());
|
2017-01-21 18:11:33 +00:00
|
|
|
int width = font->get_string_size(text).width;
|
|
|
|
|
|
|
|
// Add space for a tab icon.
|
|
|
|
if (control->has_meta("_tab_icon")) {
|
|
|
|
Ref<Texture> icon = control->get_meta("_tab_icon");
|
|
|
|
if (icon.is_valid()) {
|
|
|
|
width += icon->get_width();
|
|
|
|
if (text != "")
|
|
|
|
width += get_constant("hseparation");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Respect a minimum size.
|
|
|
|
Ref<StyleBox> tab_bg = get_stylebox("tab_bg");
|
|
|
|
Ref<StyleBox> tab_fg = get_stylebox("tab_fg");
|
2017-02-27 18:07:50 +00:00
|
|
|
Ref<StyleBox> tab_disabled = get_stylebox("tab_disabled");
|
|
|
|
if (get_tab_disabled(p_index)) {
|
|
|
|
width += tab_disabled->get_minimum_size().width;
|
|
|
|
} else if (p_index == current) {
|
2017-01-21 18:11:33 +00:00
|
|
|
width += tab_fg->get_minimum_size().width;
|
|
|
|
} else {
|
|
|
|
width += tab_bg->get_minimum_size().width;
|
|
|
|
}
|
|
|
|
|
|
|
|
return width;
|
|
|
|
}
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
Vector<Control *> TabContainer::_get_tabs() const {
|
2017-01-21 18:11:33 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
Vector<Control *> controls;
|
2017-01-21 18:11:33 +00:00
|
|
|
for (int i = 0; i < get_child_count(); i++) {
|
|
|
|
|
2017-08-24 20:58:51 +00:00
|
|
|
Control *control = Object::cast_to<Control>(get_child(i));
|
2017-01-21 18:11:33 +00:00
|
|
|
if (!control || control->is_toplevel_control())
|
|
|
|
continue;
|
|
|
|
|
|
|
|
controls.push_back(control);
|
|
|
|
}
|
|
|
|
return controls;
|
|
|
|
}
|
|
|
|
|
2014-02-10 01:10:30 +00:00
|
|
|
void TabContainer::_child_renamed_callback() {
|
|
|
|
|
|
|
|
update();
|
|
|
|
}
|
|
|
|
|
|
|
|
void TabContainer::add_child_notify(Node *p_child) {
|
|
|
|
|
2016-08-06 01:46:45 +00:00
|
|
|
Control::add_child_notify(p_child);
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-08-24 20:58:51 +00:00
|
|
|
Control *c = Object::cast_to<Control>(p_child);
|
2014-02-10 01:10:30 +00:00
|
|
|
if (!c)
|
|
|
|
return;
|
|
|
|
if (c->is_set_as_toplevel())
|
|
|
|
return;
|
|
|
|
|
2017-01-21 18:11:33 +00:00
|
|
|
bool first = false;
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-01-21 18:11:33 +00:00
|
|
|
if (get_tab_count() != 1)
|
2014-02-10 01:10:30 +00:00
|
|
|
c->hide();
|
|
|
|
else {
|
|
|
|
c->show();
|
|
|
|
//call_deferred("set_current_tab",0);
|
2017-01-21 18:11:33 +00:00
|
|
|
first = true;
|
|
|
|
current = 0;
|
2017-03-01 17:23:19 +00:00
|
|
|
previous = 0;
|
2014-02-10 01:10:30 +00:00
|
|
|
}
|
2017-09-21 22:12:33 +00:00
|
|
|
c->set_anchors_and_margins_preset(Control::PRESET_WIDE);
|
2014-02-10 01:10:30 +00:00
|
|
|
if (tabs_visible)
|
2017-01-21 18:11:33 +00:00
|
|
|
c->set_margin(MARGIN_TOP, _get_top_margin());
|
2014-02-10 01:10:30 +00:00
|
|
|
Ref<StyleBox> sb = get_stylebox("panel");
|
2017-07-06 07:16:27 +00:00
|
|
|
c->set_margin(Margin(MARGIN_TOP), c->get_margin(Margin(MARGIN_TOP)) + sb->get_margin(Margin(MARGIN_TOP)));
|
|
|
|
c->set_margin(Margin(MARGIN_LEFT), c->get_margin(Margin(MARGIN_LEFT)) + sb->get_margin(Margin(MARGIN_LEFT)));
|
|
|
|
c->set_margin(Margin(MARGIN_RIGHT), c->get_margin(Margin(MARGIN_RIGHT)) - sb->get_margin(Margin(MARGIN_RIGHT)));
|
|
|
|
c->set_margin(Margin(MARGIN_BOTTOM), c->get_margin(Margin(MARGIN_BOTTOM)) - sb->get_margin(Margin(MARGIN_BOTTOM)));
|
2014-02-10 01:10:30 +00:00
|
|
|
|
|
|
|
update();
|
2017-01-21 18:11:33 +00:00
|
|
|
p_child->connect("renamed", this, "_child_renamed_callback");
|
|
|
|
if (first)
|
|
|
|
emit_signal("tab_changed", current);
|
2014-02-10 01:10:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int TabContainer::get_tab_count() const {
|
|
|
|
|
2017-01-21 18:11:33 +00:00
|
|
|
return _get_tabs().size();
|
2014-02-10 01:10:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void TabContainer::set_current_tab(int p_current) {
|
|
|
|
|
2017-01-21 18:11:33 +00:00
|
|
|
ERR_FAIL_INDEX(p_current, get_tab_count());
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-03-01 17:23:19 +00:00
|
|
|
int pending_previous = current;
|
2017-01-21 18:11:33 +00:00
|
|
|
current = p_current;
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-01-21 18:11:33 +00:00
|
|
|
Ref<StyleBox> sb = get_stylebox("panel");
|
2017-03-05 15:44:50 +00:00
|
|
|
Vector<Control *> tabs = _get_tabs();
|
2017-01-21 18:11:33 +00:00
|
|
|
for (int i = 0; i < tabs.size(); i++) {
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-01-21 18:11:33 +00:00
|
|
|
Control *c = tabs[i];
|
|
|
|
if (i == current) {
|
2014-02-10 01:10:30 +00:00
|
|
|
c->show();
|
2017-09-21 22:12:33 +00:00
|
|
|
c->set_anchors_and_margins_preset(Control::PRESET_WIDE);
|
2014-02-10 01:10:30 +00:00
|
|
|
if (tabs_visible)
|
2017-01-21 18:11:33 +00:00
|
|
|
c->set_margin(MARGIN_TOP, _get_top_margin());
|
2017-07-06 07:16:27 +00:00
|
|
|
c->set_margin(Margin(MARGIN_TOP), c->get_margin(Margin(MARGIN_TOP)) + sb->get_margin(Margin(MARGIN_TOP)));
|
|
|
|
c->set_margin(Margin(MARGIN_LEFT), c->get_margin(Margin(MARGIN_LEFT)) + sb->get_margin(Margin(MARGIN_LEFT)));
|
|
|
|
c->set_margin(Margin(MARGIN_RIGHT), c->get_margin(Margin(MARGIN_RIGHT)) - sb->get_margin(Margin(MARGIN_RIGHT)));
|
|
|
|
c->set_margin(Margin(MARGIN_BOTTOM), c->get_margin(Margin(MARGIN_BOTTOM)) - sb->get_margin(Margin(MARGIN_BOTTOM)));
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
} else
|
2014-02-10 01:10:30 +00:00
|
|
|
c->hide();
|
|
|
|
}
|
|
|
|
|
|
|
|
_change_notify("current_tab");
|
2017-03-01 17:23:19 +00:00
|
|
|
|
|
|
|
if (pending_previous == current)
|
|
|
|
emit_signal("tab_selected", current);
|
|
|
|
else {
|
|
|
|
previous = pending_previous;
|
|
|
|
emit_signal("tab_selected", current);
|
|
|
|
emit_signal("tab_changed", current);
|
|
|
|
}
|
|
|
|
|
2014-02-10 01:10:30 +00:00
|
|
|
update();
|
|
|
|
}
|
|
|
|
|
|
|
|
int TabContainer::get_current_tab() const {
|
|
|
|
|
|
|
|
return current;
|
|
|
|
}
|
|
|
|
|
2017-03-01 17:23:19 +00:00
|
|
|
int TabContainer::get_previous_tab() const {
|
2017-03-05 15:44:50 +00:00
|
|
|
|
|
|
|
return previous;
|
2017-03-01 17:23:19 +00:00
|
|
|
}
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
Control *TabContainer::get_tab_control(int p_idx) const {
|
2015-06-14 01:12:53 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
Vector<Control *> tabs = _get_tabs();
|
2017-01-21 18:11:33 +00:00
|
|
|
if (p_idx >= 0 && p_idx < tabs.size())
|
|
|
|
return tabs[p_idx];
|
|
|
|
else
|
|
|
|
return NULL;
|
2015-06-14 01:12:53 +00:00
|
|
|
}
|
2017-03-01 17:23:19 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
Control *TabContainer::get_current_tab_control() const {
|
2015-06-14 01:12:53 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
Vector<Control *> tabs = _get_tabs();
|
2017-01-21 18:11:33 +00:00
|
|
|
if (current >= 0 && current < tabs.size())
|
|
|
|
return tabs[current];
|
|
|
|
else
|
|
|
|
return NULL;
|
2015-06-14 01:12:53 +00:00
|
|
|
}
|
2014-02-10 01:10:30 +00:00
|
|
|
|
|
|
|
void TabContainer::remove_child_notify(Node *p_child) {
|
|
|
|
|
2016-08-06 01:46:45 +00:00
|
|
|
Control::remove_child_notify(p_child);
|
|
|
|
|
2014-02-10 01:10:30 +00:00
|
|
|
int tc = get_tab_count();
|
2017-01-21 18:11:33 +00:00
|
|
|
if (current == tc - 1) {
|
2014-02-10 01:10:30 +00:00
|
|
|
current--;
|
2017-01-21 18:11:33 +00:00
|
|
|
if (current < 0)
|
|
|
|
current = 0;
|
2014-02-10 01:10:30 +00:00
|
|
|
else {
|
2017-01-21 18:11:33 +00:00
|
|
|
call_deferred("set_current_tab", current);
|
2014-02-10 01:10:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-01-21 18:11:33 +00:00
|
|
|
p_child->disconnect("renamed", this, "_child_renamed_callback");
|
2014-02-10 01:10:30 +00:00
|
|
|
|
|
|
|
update();
|
|
|
|
}
|
|
|
|
|
|
|
|
void TabContainer::set_tab_align(TabAlign p_align) {
|
|
|
|
|
2017-01-21 18:11:33 +00:00
|
|
|
ERR_FAIL_INDEX(p_align, 3);
|
|
|
|
align = p_align;
|
2014-02-10 01:10:30 +00:00
|
|
|
update();
|
|
|
|
|
|
|
|
_change_notify("tab_align");
|
|
|
|
}
|
|
|
|
TabContainer::TabAlign TabContainer::get_tab_align() const {
|
|
|
|
|
|
|
|
return align;
|
|
|
|
}
|
|
|
|
|
|
|
|
void TabContainer::set_tabs_visible(bool p_visibe) {
|
|
|
|
|
2017-01-21 18:11:33 +00:00
|
|
|
if (p_visibe == tabs_visible)
|
2014-02-10 01:10:30 +00:00
|
|
|
return;
|
|
|
|
|
2017-01-21 18:11:33 +00:00
|
|
|
tabs_visible = p_visibe;
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
Vector<Control *> tabs = _get_tabs();
|
2017-01-21 18:11:33 +00:00
|
|
|
for (int i = 0; i < tabs.size(); i++) {
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-01-21 18:11:33 +00:00
|
|
|
Control *c = tabs[i];
|
2014-02-10 01:10:30 +00:00
|
|
|
if (p_visibe)
|
2017-01-21 18:11:33 +00:00
|
|
|
c->set_margin(MARGIN_TOP, _get_top_margin());
|
2014-02-10 01:10:30 +00:00
|
|
|
else
|
2017-01-21 18:11:33 +00:00
|
|
|
c->set_margin(MARGIN_TOP, 0);
|
2014-02-10 01:10:30 +00:00
|
|
|
}
|
|
|
|
update();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool TabContainer::are_tabs_visible() const {
|
|
|
|
|
|
|
|
return tabs_visible;
|
|
|
|
}
|
|
|
|
|
|
|
|
Control *TabContainer::_get_tab(int p_idx) const {
|
|
|
|
|
2017-01-21 18:11:33 +00:00
|
|
|
return get_tab_control(p_idx);
|
2014-02-10 01:10:30 +00:00
|
|
|
}
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
void TabContainer::set_tab_title(int p_tab, const String &p_title) {
|
2014-02-10 01:10:30 +00:00
|
|
|
|
|
|
|
Control *child = _get_tab(p_tab);
|
|
|
|
ERR_FAIL_COND(!child);
|
2017-01-21 18:11:33 +00:00
|
|
|
child->set_meta("_tab_name", p_title);
|
2014-02-10 01:10:30 +00:00
|
|
|
}
|
|
|
|
|
2017-01-21 18:11:33 +00:00
|
|
|
String TabContainer::get_tab_title(int p_tab) const {
|
2014-02-10 01:10:30 +00:00
|
|
|
|
|
|
|
Control *child = _get_tab(p_tab);
|
2017-01-21 18:11:33 +00:00
|
|
|
ERR_FAIL_COND_V(!child, "");
|
2014-02-10 01:10:30 +00:00
|
|
|
if (child->has_meta("_tab_name"))
|
|
|
|
return child->get_meta("_tab_name");
|
|
|
|
else
|
|
|
|
return child->get_name();
|
|
|
|
}
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
void TabContainer::set_tab_icon(int p_tab, const Ref<Texture> &p_icon) {
|
2014-02-10 01:10:30 +00:00
|
|
|
|
|
|
|
Control *child = _get_tab(p_tab);
|
|
|
|
ERR_FAIL_COND(!child);
|
2017-01-21 18:11:33 +00:00
|
|
|
child->set_meta("_tab_icon", p_icon);
|
2014-02-10 01:10:30 +00:00
|
|
|
}
|
2017-01-21 18:11:33 +00:00
|
|
|
Ref<Texture> TabContainer::get_tab_icon(int p_tab) const {
|
2014-02-10 01:10:30 +00:00
|
|
|
|
|
|
|
Control *child = _get_tab(p_tab);
|
2017-01-21 18:11:33 +00:00
|
|
|
ERR_FAIL_COND_V(!child, Ref<Texture>());
|
2014-02-10 01:10:30 +00:00
|
|
|
if (child->has_meta("_tab_icon"))
|
|
|
|
return child->get_meta("_tab_icon");
|
|
|
|
else
|
|
|
|
return Ref<Texture>();
|
|
|
|
}
|
|
|
|
|
2017-08-11 19:10:05 +00:00
|
|
|
void TabContainer::set_tab_disabled(int p_tab, bool p_disabled) {
|
2017-02-27 18:07:50 +00:00
|
|
|
|
|
|
|
Control *child = _get_tab(p_tab);
|
|
|
|
ERR_FAIL_COND(!child);
|
2017-08-11 19:10:05 +00:00
|
|
|
child->set_meta("_tab_disabled", p_disabled);
|
2017-02-27 18:07:50 +00:00
|
|
|
update();
|
|
|
|
}
|
2017-03-01 17:23:19 +00:00
|
|
|
|
2017-02-27 18:07:50 +00:00
|
|
|
bool TabContainer::get_tab_disabled(int p_tab) const {
|
|
|
|
|
|
|
|
Control *child = _get_tab(p_tab);
|
|
|
|
ERR_FAIL_COND_V(!child, false);
|
|
|
|
if (child->has_meta("_tab_disabled"))
|
|
|
|
return child->get_meta("_tab_disabled");
|
|
|
|
else
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2014-02-10 01:10:30 +00:00
|
|
|
void TabContainer::get_translatable_strings(List<String> *p_strings) const {
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
Vector<Control *> tabs = _get_tabs();
|
2017-01-21 18:11:33 +00:00
|
|
|
for (int i = 0; i < tabs.size(); i++) {
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-01-21 18:11:33 +00:00
|
|
|
Control *c = tabs[i];
|
2014-02-10 01:10:30 +00:00
|
|
|
|
|
|
|
if (!c->has_meta("_tab_name"))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
String name = c->get_meta("_tab_name");
|
|
|
|
|
2017-01-21 18:11:33 +00:00
|
|
|
if (name != "")
|
2014-02-10 01:10:30 +00:00
|
|
|
p_strings->push_back(name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-01-03 01:34:22 +00:00
|
|
|
Size2 TabContainer::get_minimum_size() const {
|
|
|
|
|
|
|
|
Size2 ms;
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
Vector<Control *> tabs = _get_tabs();
|
2017-01-21 18:11:33 +00:00
|
|
|
for (int i = 0; i < tabs.size(); i++) {
|
2015-01-03 01:34:22 +00:00
|
|
|
|
2017-01-21 18:11:33 +00:00
|
|
|
Control *c = tabs[i];
|
2015-01-03 01:34:22 +00:00
|
|
|
|
2017-01-13 13:45:50 +00:00
|
|
|
if (!c->is_visible_in_tree())
|
2015-01-03 01:34:22 +00:00
|
|
|
continue;
|
|
|
|
|
2016-06-17 21:38:40 +00:00
|
|
|
Size2 cms = c->get_combined_minimum_size();
|
2017-01-21 18:11:33 +00:00
|
|
|
ms.x = MAX(ms.x, cms.x);
|
|
|
|
ms.y = MAX(ms.y, cms.y);
|
2015-01-03 01:34:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Ref<StyleBox> tab_bg = get_stylebox("tab_bg");
|
|
|
|
Ref<StyleBox> tab_fg = get_stylebox("tab_fg");
|
2017-02-27 18:07:50 +00:00
|
|
|
Ref<StyleBox> tab_disabled = get_stylebox("tab_disabled");
|
2015-01-03 01:34:22 +00:00
|
|
|
Ref<Font> font = get_font("font");
|
|
|
|
|
2017-02-27 18:07:50 +00:00
|
|
|
ms.y += MAX(MAX(tab_bg->get_minimum_size().y, tab_fg->get_minimum_size().y), tab_disabled->get_minimum_size().y);
|
2017-01-21 18:11:33 +00:00
|
|
|
ms.y += font->get_height();
|
2015-01-03 01:34:22 +00:00
|
|
|
|
2016-06-17 21:38:40 +00:00
|
|
|
Ref<StyleBox> sb = get_stylebox("panel");
|
2017-01-21 18:11:33 +00:00
|
|
|
ms += sb->get_minimum_size();
|
2016-06-17 21:38:40 +00:00
|
|
|
|
2015-01-03 01:34:22 +00:00
|
|
|
return ms;
|
|
|
|
}
|
|
|
|
|
2015-06-14 01:12:53 +00:00
|
|
|
void TabContainer::set_popup(Node *p_popup) {
|
|
|
|
ERR_FAIL_NULL(p_popup);
|
2017-08-24 20:58:51 +00:00
|
|
|
popup = Object::cast_to<Popup>(p_popup);
|
2015-06-14 01:12:53 +00:00
|
|
|
update();
|
|
|
|
}
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
Popup *TabContainer::get_popup() const {
|
2015-06-14 01:12:53 +00:00
|
|
|
return popup;
|
|
|
|
}
|
|
|
|
|
2014-02-10 01:10:30 +00:00
|
|
|
void TabContainer::_bind_methods() {
|
|
|
|
|
2017-01-21 18:11:33 +00:00
|
|
|
ClassDB::bind_method(D_METHOD("_gui_input"), &TabContainer::_gui_input);
|
|
|
|
ClassDB::bind_method(D_METHOD("get_tab_count"), &TabContainer::get_tab_count);
|
|
|
|
ClassDB::bind_method(D_METHOD("set_current_tab", "tab_idx"), &TabContainer::set_current_tab);
|
|
|
|
ClassDB::bind_method(D_METHOD("get_current_tab"), &TabContainer::get_current_tab);
|
2017-03-01 17:23:19 +00:00
|
|
|
ClassDB::bind_method(D_METHOD("get_previous_tab"), &TabContainer::get_previous_tab);
|
2017-08-09 11:19:41 +00:00
|
|
|
ClassDB::bind_method(D_METHOD("get_current_tab_control"), &TabContainer::get_current_tab_control);
|
|
|
|
ClassDB::bind_method(D_METHOD("get_tab_control", "idx"), &TabContainer::get_tab_control);
|
2017-01-21 18:11:33 +00:00
|
|
|
ClassDB::bind_method(D_METHOD("set_tab_align", "align"), &TabContainer::set_tab_align);
|
|
|
|
ClassDB::bind_method(D_METHOD("get_tab_align"), &TabContainer::get_tab_align);
|
|
|
|
ClassDB::bind_method(D_METHOD("set_tabs_visible", "visible"), &TabContainer::set_tabs_visible);
|
|
|
|
ClassDB::bind_method(D_METHOD("are_tabs_visible"), &TabContainer::are_tabs_visible);
|
|
|
|
ClassDB::bind_method(D_METHOD("set_tab_title", "tab_idx", "title"), &TabContainer::set_tab_title);
|
|
|
|
ClassDB::bind_method(D_METHOD("get_tab_title", "tab_idx"), &TabContainer::get_tab_title);
|
2017-08-09 11:19:41 +00:00
|
|
|
ClassDB::bind_method(D_METHOD("set_tab_icon", "tab_idx", "icon"), &TabContainer::set_tab_icon);
|
|
|
|
ClassDB::bind_method(D_METHOD("get_tab_icon", "tab_idx"), &TabContainer::get_tab_icon);
|
2017-02-27 18:07:50 +00:00
|
|
|
ClassDB::bind_method(D_METHOD("set_tab_disabled", "tab_idx", "disabled"), &TabContainer::set_tab_disabled);
|
|
|
|
ClassDB::bind_method(D_METHOD("get_tab_disabled", "tab_idx"), &TabContainer::get_tab_disabled);
|
2017-08-09 11:19:41 +00:00
|
|
|
ClassDB::bind_method(D_METHOD("set_popup", "popup"), &TabContainer::set_popup);
|
|
|
|
ClassDB::bind_method(D_METHOD("get_popup"), &TabContainer::get_popup);
|
2017-01-21 18:11:33 +00:00
|
|
|
|
|
|
|
ClassDB::bind_method(D_METHOD("_child_renamed_callback"), &TabContainer::_child_renamed_callback);
|
2017-12-11 11:46:33 +00:00
|
|
|
ClassDB::bind_method(D_METHOD("_on_theme_changed"), &TabContainer::_on_theme_changed);
|
2017-01-21 18:11:33 +00:00
|
|
|
|
|
|
|
ADD_SIGNAL(MethodInfo("tab_changed", PropertyInfo(Variant::INT, "tab")));
|
2017-03-01 17:23:19 +00:00
|
|
|
ADD_SIGNAL(MethodInfo("tab_selected", PropertyInfo(Variant::INT, "tab")));
|
2015-06-14 01:12:53 +00:00
|
|
|
ADD_SIGNAL(MethodInfo("pre_popup_pressed"));
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-01-21 18:11:33 +00:00
|
|
|
ADD_PROPERTY(PropertyInfo(Variant::INT, "tab_align", PROPERTY_HINT_ENUM, "Left,Center,Right"), "set_tab_align", "get_tab_align");
|
|
|
|
ADD_PROPERTY(PropertyInfo(Variant::INT, "current_tab", PROPERTY_HINT_RANGE, "-1,4096,1", PROPERTY_USAGE_EDITOR), "set_current_tab", "get_current_tab");
|
|
|
|
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "tabs_visible"), "set_tabs_visible", "are_tabs_visible");
|
2017-09-12 19:09:06 +00:00
|
|
|
|
|
|
|
BIND_ENUM_CONSTANT(ALIGN_LEFT);
|
|
|
|
BIND_ENUM_CONSTANT(ALIGN_CENTER);
|
|
|
|
BIND_ENUM_CONSTANT(ALIGN_RIGHT);
|
2014-02-10 01:10:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
TabContainer::TabContainer() {
|
|
|
|
|
2017-01-21 18:11:33 +00:00
|
|
|
first_tab_cache = 0;
|
2017-10-30 12:20:51 +00:00
|
|
|
last_tab_cache = 0;
|
2017-01-21 18:11:33 +00:00
|
|
|
buttons_visible_cache = false;
|
|
|
|
tabs_ofs_cache = 0;
|
|
|
|
current = 0;
|
2017-03-01 17:23:19 +00:00
|
|
|
previous = 0;
|
2017-01-21 18:11:33 +00:00
|
|
|
mouse_x_cache = 0;
|
2017-05-02 21:02:06 +00:00
|
|
|
align = ALIGN_CENTER;
|
2017-01-21 18:11:33 +00:00
|
|
|
tabs_visible = true;
|
|
|
|
popup = NULL;
|
2017-05-20 15:38:03 +00:00
|
|
|
}
|