Reworked tooltips to use the popup system.
This commit is contained in:
parent
b3080bc2f4
commit
047e0b7de5
15 changed files with 149 additions and 65 deletions
|
@ -1610,6 +1610,11 @@ void EditorHelpBit::_bind_methods() {
|
|||
void EditorHelpBit::_notification(int p_what) {
|
||||
|
||||
switch (p_what) {
|
||||
case NOTIFICATION_READY: {
|
||||
rich_text->clear();
|
||||
_add_text_to_rt(text, rich_text);
|
||||
|
||||
} break;
|
||||
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
|
||||
|
||||
rich_text->add_theme_color_override("selection_color", get_theme_color("accent_color", "Editor") * Color(1, 1, 1, 0.4));
|
||||
|
@ -1620,8 +1625,9 @@ void EditorHelpBit::_notification(int p_what) {
|
|||
|
||||
void EditorHelpBit::set_text(const String &p_text) {
|
||||
|
||||
text = p_text;
|
||||
rich_text->clear();
|
||||
_add_text_to_rt(p_text, rich_text);
|
||||
_add_text_to_rt(text, rich_text);
|
||||
}
|
||||
|
||||
EditorHelpBit::EditorHelpBit() {
|
||||
|
|
|
@ -200,6 +200,8 @@ class EditorHelpBit : public PanelContainer {
|
|||
void _go_to_help(String p_what);
|
||||
void _meta_clicked(String p_select);
|
||||
|
||||
String text;
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
void _notification(int p_what);
|
||||
|
|
|
@ -776,13 +776,14 @@ Control *EditorProperty::make_custom_tooltip(const String &p_text) const {
|
|||
|
||||
tooltip_text = p_text;
|
||||
EditorHelpBit *help_bit = memnew(EditorHelpBit);
|
||||
help_bit->add_theme_style_override("panel", get_theme_stylebox("panel", "TooltipPanel"));
|
||||
//help_bit->add_theme_style_override("panel", get_theme_stylebox("panel", "TooltipPanel"));
|
||||
help_bit->get_rich_text()->set_fixed_size_to_width(360 * EDSCALE);
|
||||
|
||||
String text;
|
||||
PackedStringArray slices = p_text.split("::", false);
|
||||
if (!slices.empty()) {
|
||||
String property_name = slices[0].strip_edges();
|
||||
String text = TTR("Property:") + " [u][b]" + property_name + "[/b][/u]";
|
||||
text = TTR("Property:") + " [u][b]" + property_name + "[/b][/u]";
|
||||
|
||||
if (slices.size() > 1) {
|
||||
String property_doc = slices[1].strip_edges();
|
||||
|
@ -790,7 +791,7 @@ Control *EditorProperty::make_custom_tooltip(const String &p_text) const {
|
|||
text += "\n" + property_doc;
|
||||
}
|
||||
}
|
||||
help_bit->call_deferred("set_text", text); //hack so it uses proper theme once inside scene
|
||||
help_bit->set_text(text);
|
||||
}
|
||||
|
||||
return help_bit;
|
||||
|
@ -1026,7 +1027,7 @@ Control *EditorInspectorCategory::make_custom_tooltip(const String &p_text) cons
|
|||
text += "\n" + property_doc;
|
||||
}
|
||||
}
|
||||
help_bit->call_deferred("set_text", text); //hack so it uses proper theme once inside scene
|
||||
help_bit->set_text(text); //hack so it uses proper theme once inside scene
|
||||
}
|
||||
|
||||
return help_bit;
|
||||
|
|
|
@ -977,6 +977,8 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
|
|||
theme->set_stylebox("focus", "RichTextLabel", make_empty_stylebox());
|
||||
theme->set_stylebox("normal", "RichTextLabel", style_tree_bg);
|
||||
|
||||
theme->set_stylebox("panel", "EditorHelpBit", make_flat_stylebox(dark_color_1, 6, 4, 6, 4));
|
||||
|
||||
theme->set_color("headline_color", "EditorHelp", mono_color);
|
||||
|
||||
// Panel
|
||||
|
|
|
@ -451,15 +451,29 @@ DisplayServer::WindowID DisplayServerWindows::create_sub_window(WindowMode p_mod
|
|||
_THREAD_SAFE_METHOD_
|
||||
|
||||
WindowID window_id = _create_window(p_mode, p_flags, p_rect);
|
||||
for (int i = 0; i < WINDOW_FLAG_MAX; i++) {
|
||||
if (p_flags & (1 << i)) {
|
||||
window_set_flag(WindowFlags(i), true, window_id);
|
||||
}
|
||||
|
||||
WindowData &wd = windows[window_id];
|
||||
|
||||
if (p_flags & WINDOW_FLAG_RESIZE_DISABLED_BIT) {
|
||||
wd.resizable = false;
|
||||
}
|
||||
if (p_flags & WINDOW_FLAG_BORDERLESS_BIT) {
|
||||
wd.borderless = true;
|
||||
}
|
||||
if (p_flags & WINDOW_FLAG_ALWAYS_ON_TOP_BIT && p_mode != WINDOW_MODE_FULLSCREEN) {
|
||||
wd.always_on_top = true;
|
||||
}
|
||||
if (p_flags & WINDOW_FLAG_NO_FOCUS_BIT) {
|
||||
wd.no_focus = true;
|
||||
}
|
||||
|
||||
ShowWindow(windows[window_id].hWnd, SW_SHOW); // Show The Window
|
||||
SetForegroundWindow(windows[window_id].hWnd); // Slightly Higher Priority
|
||||
SetFocus(windows[window_id].hWnd); // Sets Keyboard Focus To
|
||||
_update_window_style(window_id);
|
||||
|
||||
ShowWindow(wd.hWnd, (p_flags & WINDOW_FLAG_NO_FOCUS_BIT) ? SW_SHOWNOACTIVATE : SW_SHOW); // Show The Window
|
||||
if (!(p_flags & WINDOW_FLAG_NO_FOCUS_BIT)) {
|
||||
SetForegroundWindow(wd.hWnd); // Slightly Higher Priority
|
||||
SetFocus(wd.hWnd); // Sets Keyboard Focus To
|
||||
}
|
||||
|
||||
return window_id;
|
||||
}
|
||||
|
@ -792,7 +806,7 @@ Size2i DisplayServerWindows::window_get_real_size(WindowID p_window) const {
|
|||
return Size2();
|
||||
}
|
||||
|
||||
void DisplayServerWindows::_get_window_style(bool p_main_window, bool p_fullscreen, bool p_borderless, bool p_resizable, bool p_maximized, DWORD &r_style, DWORD &r_style_ex) {
|
||||
void DisplayServerWindows::_get_window_style(bool p_main_window, bool p_fullscreen, bool p_borderless, bool p_resizable, bool p_maximized, bool p_no_activate_focus, DWORD &r_style, DWORD &r_style_ex) {
|
||||
|
||||
r_style = 0;
|
||||
r_style_ex = WS_EX_WINDOWEDGE;
|
||||
|
@ -818,6 +832,9 @@ void DisplayServerWindows::_get_window_style(bool p_main_window, bool p_fullscre
|
|||
}
|
||||
}
|
||||
|
||||
if (p_no_activate_focus) {
|
||||
r_style_ex |= WS_EX_TOPMOST | WS_EX_NOACTIVATE;
|
||||
}
|
||||
r_style |= WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
|
||||
}
|
||||
|
||||
|
@ -831,12 +848,12 @@ void DisplayServerWindows::_update_window_style(WindowID p_window, bool p_repain
|
|||
DWORD style = 0;
|
||||
DWORD style_ex = 0;
|
||||
|
||||
_get_window_style(p_window == MAIN_WINDOW_ID, wd.fullscreen, wd.borderless, wd.resizable, wd.maximized, style, style_ex);
|
||||
_get_window_style(p_window == MAIN_WINDOW_ID, wd.fullscreen, wd.borderless, wd.resizable, wd.maximized, wd.no_focus, style, style_ex);
|
||||
|
||||
SetWindowLongPtr(wd.hWnd, GWL_STYLE, style);
|
||||
SetWindowLongPtr(wd.hWnd, GWL_EXSTYLE, style_ex);
|
||||
|
||||
SetWindowPos(wd.hWnd, wd.always_on_top ? HWND_TOPMOST : HWND_NOTOPMOST, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE);
|
||||
SetWindowPos(wd.hWnd, wd.always_on_top ? HWND_TOPMOST : HWND_NOTOPMOST, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE | (wd.no_focus ? SWP_NOACTIVATE : 0));
|
||||
|
||||
if (p_repaint) {
|
||||
RECT rect;
|
||||
|
@ -972,6 +989,11 @@ void DisplayServerWindows::window_set_flag(WindowFlags p_flag, bool p_enabled, W
|
|||
case WINDOW_FLAG_TRANSPARENT: {
|
||||
|
||||
} break;
|
||||
case WINDOW_FLAG_NO_FOCUS: {
|
||||
|
||||
wd.no_focus = p_enabled;
|
||||
_update_window_style(p_window);
|
||||
} break;
|
||||
}
|
||||
}
|
||||
bool DisplayServerWindows::window_get_flag(WindowFlags p_flag, WindowID p_window) const {
|
||||
|
@ -2615,7 +2637,7 @@ DisplayServer::WindowID DisplayServerWindows::_create_window(WindowMode p_mode,
|
|||
DWORD dwExStyle;
|
||||
DWORD dwStyle;
|
||||
|
||||
_get_window_style(window_id_counter == MAIN_WINDOW_ID, p_mode == WINDOW_MODE_FULLSCREEN, p_flags & WINDOW_FLAG_BORDERLESS_BIT, !(p_flags & WINDOW_FLAG_RESIZE_DISABLED_BIT), p_mode == WINDOW_MODE_MAXIMIZED, dwStyle, dwExStyle);
|
||||
_get_window_style(window_id_counter == MAIN_WINDOW_ID, p_mode == WINDOW_MODE_FULLSCREEN, p_flags & WINDOW_FLAG_BORDERLESS_BIT, !(p_flags & WINDOW_FLAG_RESIZE_DISABLED_BIT), p_mode == WINDOW_MODE_MAXIMIZED, (p_flags & WINDOW_FLAG_NO_FOCUS_BIT), dwStyle, dwExStyle);
|
||||
|
||||
RECT WindowRect;
|
||||
|
||||
|
|
|
@ -181,6 +181,7 @@ class DisplayServerWindows : public DisplayServer {
|
|||
bool window_focused = false;
|
||||
bool was_maximized = false;
|
||||
bool always_on_top = false;
|
||||
bool no_focus = false;
|
||||
bool window_has_focus = false;
|
||||
|
||||
HBITMAP hBitmap; //DIB section for layered window
|
||||
|
@ -225,7 +226,7 @@ class DisplayServerWindows : public DisplayServer {
|
|||
WNDPROC user_proc = nullptr;
|
||||
|
||||
void _send_window_event(const WindowData &wd, WindowEvent p_event);
|
||||
void _get_window_style(bool p_main_window, bool p_fullscreen, bool p_borderless, bool p_resizable, bool p_maximized, DWORD &r_style, DWORD &r_style_ex);
|
||||
void _get_window_style(bool p_main_window, bool p_fullscreen, bool p_borderless, bool p_resizable, bool p_maximized, bool p_no_activate_focus, DWORD &r_style, DWORD &r_style_ex);
|
||||
|
||||
MouseMode mouse_mode;
|
||||
bool alt_mem = false;
|
||||
|
|
|
@ -43,7 +43,7 @@ Size2 PanelContainer::get_minimum_size() const {
|
|||
for (int i = 0; i < get_child_count(); i++) {
|
||||
|
||||
Control *c = Object::cast_to<Control>(get_child(i));
|
||||
if (!c || !c->is_visible_in_tree())
|
||||
if (!c || !c->is_visible())
|
||||
continue;
|
||||
if (c->is_set_as_toplevel())
|
||||
continue;
|
||||
|
|
|
@ -150,7 +150,7 @@ Popup::~Popup() {
|
|||
|
||||
Size2 PopupPanel::_get_contents_minimum_size() const {
|
||||
|
||||
Ref<StyleBox> p = get_theme_stylebox("panel", "PopupPanel");
|
||||
Ref<StyleBox> p = get_theme_stylebox("panel", get_class_name());
|
||||
|
||||
Size2 ms;
|
||||
|
||||
|
@ -172,7 +172,7 @@ Size2 PopupPanel::_get_contents_minimum_size() const {
|
|||
|
||||
void PopupPanel::_update_child_rects() {
|
||||
|
||||
Ref<StyleBox> p = get_theme_stylebox("panel", "PopupPanel");
|
||||
Ref<StyleBox> p = get_theme_stylebox("panel", get_class_name());
|
||||
|
||||
Vector2 cpos(p->get_offset());
|
||||
Vector2 csize(get_size() - p->get_minimum_size());
|
||||
|
@ -198,10 +198,10 @@ void PopupPanel::_update_child_rects() {
|
|||
void PopupPanel::_notification(int p_what) {
|
||||
|
||||
if (p_what == NOTIFICATION_THEME_CHANGED) {
|
||||
panel->add_theme_style_override("panel", get_theme_stylebox("panel", "PopupPanel"));
|
||||
panel->add_theme_style_override("panel", get_theme_stylebox("panel", get_class_name()));
|
||||
} else if (p_what == NOTIFICATION_READY || p_what == NOTIFICATION_ENTER_TREE) {
|
||||
|
||||
panel->add_theme_style_override("panel", get_theme_stylebox("panel", "PopupPanel"));
|
||||
panel->add_theme_style_override("panel", get_theme_stylebox("panel", get_class_name()));
|
||||
_update_child_rects();
|
||||
} else if (p_what == NOTIFICATION_WM_SIZE_CHANGED) {
|
||||
|
||||
|
|
|
@ -1647,6 +1647,10 @@ void RichTextLabel::_add_item(Item *p_item, bool p_enter, bool p_ensure_newline)
|
|||
p_item->line = current_frame->lines.size() - 1;
|
||||
|
||||
_invalidate_current_line(current_frame);
|
||||
|
||||
if (fixed_width != -1) {
|
||||
minimum_size_changed();
|
||||
}
|
||||
}
|
||||
|
||||
void RichTextLabel::_remove_item(Item *p_item, const int p_line, const int p_subitem_line) {
|
||||
|
@ -1968,6 +1972,10 @@ void RichTextLabel::clear() {
|
|||
selection.click = NULL;
|
||||
selection.active = false;
|
||||
current_idx = 1;
|
||||
|
||||
if (fixed_width != -1) {
|
||||
minimum_size_changed();
|
||||
}
|
||||
}
|
||||
|
||||
void RichTextLabel::set_tab_size(int p_spaces) {
|
||||
|
|
|
@ -168,9 +168,9 @@ ViewportTexture::~ViewportTexture() {
|
|||
|
||||
/////////////////////////////////////
|
||||
|
||||
class TooltipPanel : public PanelContainer {
|
||||
class TooltipPanel : public PopupPanel {
|
||||
|
||||
GDCLASS(TooltipPanel, PanelContainer);
|
||||
GDCLASS(TooltipPanel, PopupPanel);
|
||||
|
||||
public:
|
||||
TooltipPanel(){};
|
||||
|
@ -328,6 +328,7 @@ void Viewport::_sub_window_grab_focus(Window *p_window) {
|
|||
|
||||
return;
|
||||
}
|
||||
|
||||
int index = -1;
|
||||
for (int i = 0; i < gui.sub_windows.size(); i++) {
|
||||
if (gui.sub_windows[i].window == p_window) {
|
||||
|
@ -338,6 +339,16 @@ void Viewport::_sub_window_grab_focus(Window *p_window) {
|
|||
|
||||
ERR_FAIL_COND(index == -1);
|
||||
|
||||
if (p_window->get_flag(Window::FLAG_NO_FOCUS)) {
|
||||
//can only move to foreground, but no focus granted
|
||||
SubWindow sw = gui.sub_windows[index];
|
||||
gui.sub_windows.remove(index);
|
||||
gui.sub_windows.push_back(sw);
|
||||
index = gui.sub_windows.size() - 1;
|
||||
_sub_window_update_order();
|
||||
return; //i guess not...
|
||||
}
|
||||
|
||||
if (gui.subwindow_focused) {
|
||||
if (gui.subwindow_focused == p_window) {
|
||||
return; //nothing to do
|
||||
|
@ -1587,47 +1598,49 @@ void Viewport::_gui_show_tooltip() {
|
|||
|
||||
Control *rp = which;
|
||||
|
||||
gui.tooltip_popup = which->make_custom_tooltip(tooltip);
|
||||
|
||||
if (!gui.tooltip_popup) {
|
||||
gui.tooltip_popup = memnew(TooltipPanel);
|
||||
Control *base_tooltip = which->make_custom_tooltip(tooltip);
|
||||
|
||||
if (!base_tooltip) {
|
||||
gui.tooltip_label = memnew(TooltipLabel);
|
||||
gui.tooltip_popup->add_child(gui.tooltip_label);
|
||||
|
||||
Ref<StyleBox> ttp = gui.tooltip_label->get_theme_stylebox("panel", "TooltipPanel");
|
||||
|
||||
gui.tooltip_label->set_anchor_and_margin(MARGIN_LEFT, Control::ANCHOR_BEGIN, ttp->get_margin(MARGIN_LEFT));
|
||||
gui.tooltip_label->set_anchor_and_margin(MARGIN_TOP, Control::ANCHOR_BEGIN, ttp->get_margin(MARGIN_TOP));
|
||||
gui.tooltip_label->set_anchor_and_margin(MARGIN_RIGHT, Control::ANCHOR_END, -ttp->get_margin(MARGIN_RIGHT));
|
||||
gui.tooltip_label->set_anchor_and_margin(MARGIN_BOTTOM, Control::ANCHOR_END, -ttp->get_margin(MARGIN_BOTTOM));
|
||||
gui.tooltip_label->set_text(tooltip);
|
||||
base_tooltip = gui.tooltip_label;
|
||||
}
|
||||
|
||||
base_tooltip->set_anchors_and_margins_preset(Control::PRESET_WIDE);
|
||||
|
||||
TooltipPanel *panel = memnew(TooltipPanel);
|
||||
panel->set_transient(false);
|
||||
panel->set_flag(Window::FLAG_NO_FOCUS, true);
|
||||
panel->set_wrap_controls(true);
|
||||
panel->add_child(base_tooltip);
|
||||
|
||||
gui.tooltip_popup = panel;
|
||||
|
||||
rp->add_child(gui.tooltip_popup);
|
||||
gui.tooltip_popup->force_parent_owned();
|
||||
gui.tooltip_popup->set_as_toplevel(true);
|
||||
if (gui.tooltip) // Avoids crash when rapidly switching controls.
|
||||
gui.tooltip_popup->set_scale(gui.tooltip->get_global_transform().get_scale());
|
||||
|
||||
//if (gui.tooltip) // Avoids crash when rapidly switching controls.
|
||||
// gui.tooltip_popup->set_scale(gui.tooltip->get_global_transform().get_scale());
|
||||
|
||||
Point2 tooltip_offset = ProjectSettings::get_singleton()->get("display/mouse_cursor/tooltip_position_offset");
|
||||
Rect2 r(gui.tooltip_pos + tooltip_offset, gui.tooltip_popup->get_minimum_size());
|
||||
Rect2 vr = gui.tooltip_popup->get_viewport_rect();
|
||||
if (r.size.x * gui.tooltip_popup->get_scale().x + r.position.x > vr.size.x)
|
||||
r.position.x = vr.size.x - r.size.x * gui.tooltip_popup->get_scale().x;
|
||||
else if (r.position.x < 0)
|
||||
r.position.x = 0;
|
||||
Rect2 r(gui.tooltip_pos + tooltip_offset, gui.tooltip_popup->get_contents_minimum_size());
|
||||
|
||||
if (r.size.y * gui.tooltip_popup->get_scale().y + r.position.y > vr.size.y)
|
||||
r.position.y = vr.size.y - r.size.y * gui.tooltip_popup->get_scale().y;
|
||||
else if (r.position.y < 0)
|
||||
r.position.y = 0;
|
||||
Rect2i vr = gui.tooltip_popup->get_parent_visible_window()->get_usable_parent_rect();
|
||||
|
||||
gui.tooltip_popup->set_global_position(r.position);
|
||||
if (r.size.x + r.position.x > vr.size.x + vr.position.x)
|
||||
r.position.x = vr.position.x + vr.size.x - r.size.x;
|
||||
else if (r.position.x < vr.position.x)
|
||||
r.position.x = vr.position.x;
|
||||
|
||||
if (r.size.y + r.position.y > vr.size.y + vr.position.y)
|
||||
r.position.y = vr.position.y + vr.size.y - r.size.y;
|
||||
else if (r.position.y < vr.position.y)
|
||||
r.position.y = vr.position.y;
|
||||
|
||||
gui.tooltip_popup->set_position(r.position);
|
||||
gui.tooltip_popup->set_size(r.size);
|
||||
|
||||
gui.tooltip_popup->raise();
|
||||
gui.tooltip_popup->show();
|
||||
gui.tooltip_popup->child_controls_changed();
|
||||
}
|
||||
|
||||
void Viewport::_gui_call_input(Control *p_control, const Ref<InputEvent> &p_input) {
|
||||
|
@ -1761,9 +1774,6 @@ Control *Viewport::_gui_find_control_at_pos(CanvasItem *p_node, const Point2 &p_
|
|||
|
||||
for (int i = p_node->get_child_count() - 1; i >= 0; i--) {
|
||||
|
||||
if (p_node == gui.tooltip_popup)
|
||||
continue;
|
||||
|
||||
CanvasItem *ci = Object::cast_to<CanvasItem>(p_node->get_child(i));
|
||||
if (!ci || ci->is_set_as_toplevel())
|
||||
continue;
|
||||
|
@ -2125,8 +2135,17 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) {
|
|||
if (tooltip == gui.tooltip_label->get_text()) {
|
||||
is_tooltip_shown = true;
|
||||
}
|
||||
} else if (tooltip == String(gui.tooltip_popup->call("get_tooltip_text"))) {
|
||||
is_tooltip_shown = true;
|
||||
} else {
|
||||
|
||||
Variant t = gui.tooltip_popup->call("get_tooltip_text");
|
||||
|
||||
if (t.get_type() == Variant::STRING) {
|
||||
if (tooltip == String(t)) {
|
||||
is_tooltip_shown = true;
|
||||
}
|
||||
} else {
|
||||
is_tooltip_shown = true; //well, nothing to compare against, likely using custom control, so if it changes there is nothing we can do
|
||||
}
|
||||
}
|
||||
} else
|
||||
_gui_cancel_tooltip();
|
||||
|
@ -2135,7 +2154,7 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) {
|
|||
if (can_tooltip && !is_tooltip_shown) {
|
||||
|
||||
gui.tooltip = over;
|
||||
gui.tooltip_pos = mpos; //(parent_xform * get_transform()).affine_inverse().xform(pos);
|
||||
gui.tooltip_pos = over->get_screen_transform().xform(pos); //(parent_xform * get_transform()).affine_inverse().xform(pos);
|
||||
gui.tooltip_timer = gui.tooltip_delay;
|
||||
}
|
||||
}
|
||||
|
@ -2444,9 +2463,6 @@ void Viewport::_gui_remove_control(Control *p_control) {
|
|||
gui.mouse_over = NULL;
|
||||
if (gui.tooltip == p_control)
|
||||
gui.tooltip = NULL;
|
||||
if (gui.tooltip_popup == p_control) {
|
||||
_gui_cancel_tooltip();
|
||||
}
|
||||
}
|
||||
|
||||
void Viewport::_gui_remove_focus() {
|
||||
|
|
|
@ -311,7 +311,7 @@ private:
|
|||
Control *key_focus;
|
||||
Control *mouse_over;
|
||||
Control *tooltip;
|
||||
Control *tooltip_popup;
|
||||
Window *tooltip_popup;
|
||||
Label *tooltip_label;
|
||||
Point2 tooltip_pos;
|
||||
Point2 last_mouse_pos;
|
||||
|
|
|
@ -1061,7 +1061,6 @@ Rect2i Window::get_usable_parent_rect() const {
|
|||
Rect2i parent;
|
||||
if (is_embedded()) {
|
||||
parent = _get_embedder()->get_visible_rect();
|
||||
print_line("using embedded " + parent);
|
||||
} else {
|
||||
|
||||
const Window *w = is_visible() ? this : get_parent_visible_window();
|
||||
|
@ -1069,7 +1068,6 @@ Rect2i Window::get_usable_parent_rect() const {
|
|||
ERR_FAIL_COND_V(!w, Rect2());
|
||||
|
||||
parent = DisplayServer::get_singleton()->screen_get_usable_rect(DisplayServer::get_singleton()->window_get_current_screen(w->get_window_id()));
|
||||
print_line("using windowid " + parent);
|
||||
}
|
||||
return parent;
|
||||
}
|
||||
|
@ -1337,6 +1335,7 @@ void Window::_bind_methods() {
|
|||
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "borderless"), "set_flag", "get_flag", FLAG_BORDERLESS);
|
||||
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "always_on_top"), "set_flag", "get_flag", FLAG_ALWAYS_ON_TOP);
|
||||
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "transparent"), "set_flag", "get_flag", FLAG_TRANSPARENT);
|
||||
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "unfocusable"), "set_flag", "get_flag", FLAG_NO_FOCUS);
|
||||
ADD_GROUP("Limits", "");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2I, "min_size"), "set_min_size", "get_min_size");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2I, "max_size"), "set_max_size", "get_max_size");
|
||||
|
@ -1360,6 +1359,28 @@ void Window::_bind_methods() {
|
|||
ADD_SIGNAL(MethodInfo("about_to_popup"));
|
||||
|
||||
BIND_CONSTANT(NOTIFICATION_VISIBILITY_CHANGED);
|
||||
|
||||
BIND_ENUM_CONSTANT(MODE_WINDOWED);
|
||||
BIND_ENUM_CONSTANT(MODE_MINIMIZED);
|
||||
BIND_ENUM_CONSTANT(MODE_MAXIMIZED);
|
||||
BIND_ENUM_CONSTANT(MODE_FULLSCREEN);
|
||||
|
||||
BIND_ENUM_CONSTANT(FLAG_RESIZE_DISABLED);
|
||||
BIND_ENUM_CONSTANT(FLAG_BORDERLESS);
|
||||
BIND_ENUM_CONSTANT(FLAG_ALWAYS_ON_TOP);
|
||||
BIND_ENUM_CONSTANT(FLAG_TRANSPARENT);
|
||||
BIND_ENUM_CONSTANT(FLAG_NO_FOCUS);
|
||||
BIND_ENUM_CONSTANT(FLAG_MAX);
|
||||
|
||||
BIND_ENUM_CONSTANT(CONTENT_SCALE_MODE_DISABLED);
|
||||
BIND_ENUM_CONSTANT(CONTENT_SCALE_MODE_OBJECTS);
|
||||
BIND_ENUM_CONSTANT(CONTENT_SCALE_MODE_PIXELS);
|
||||
|
||||
BIND_ENUM_CONSTANT(CONTENT_SCALE_ASPECT_IGNORE);
|
||||
BIND_ENUM_CONSTANT(CONTENT_SCALE_ASPECT_KEEP);
|
||||
BIND_ENUM_CONSTANT(CONTENT_SCALE_ASPECT_KEEP_WIDTH);
|
||||
BIND_ENUM_CONSTANT(CONTENT_SCALE_ASPECT_KEEP_HEIGHT);
|
||||
BIND_ENUM_CONSTANT(CONTENT_SCALE_ASPECT_EXPAND);
|
||||
}
|
||||
|
||||
Window::Window() {
|
||||
|
|
|
@ -51,6 +51,7 @@ public:
|
|||
FLAG_BORDERLESS = DisplayServer::WINDOW_FLAG_BORDERLESS,
|
||||
FLAG_ALWAYS_ON_TOP = DisplayServer::WINDOW_FLAG_ALWAYS_ON_TOP,
|
||||
FLAG_TRANSPARENT = DisplayServer::WINDOW_FLAG_TRANSPARENT,
|
||||
FLAG_NO_FOCUS = DisplayServer::WINDOW_FLAG_NO_FOCUS,
|
||||
FLAG_MAX = DisplayServer::WINDOW_FLAG_MAX,
|
||||
};
|
||||
|
||||
|
|
|
@ -414,11 +414,13 @@ void DisplayServer::_bind_methods() {
|
|||
BIND_ENUM_CONSTANT(WINDOW_FLAG_BORDERLESS);
|
||||
BIND_ENUM_CONSTANT(WINDOW_FLAG_ALWAYS_ON_TOP);
|
||||
BIND_ENUM_CONSTANT(WINDOW_FLAG_TRANSPARENT);
|
||||
BIND_ENUM_CONSTANT(WINDOW_FLAG_NO_FOCUS);
|
||||
BIND_ENUM_CONSTANT(WINDOW_FLAG_MAX);
|
||||
BIND_ENUM_CONSTANT(WINDOW_FLAG_RESIZE_DISABLED_BIT);
|
||||
BIND_ENUM_CONSTANT(WINDOW_FLAG_BORDERLESS_BIT);
|
||||
BIND_ENUM_CONSTANT(WINDOW_FLAG_ALWAYS_ON_TOP_BIT);
|
||||
BIND_ENUM_CONSTANT(WINDOW_FLAG_TRANSPARENT_BIT);
|
||||
BIND_ENUM_CONSTANT(WINDOW_FLAG_NO_FOCUS_BIT);
|
||||
|
||||
BIND_ENUM_CONSTANT(LATIN_KEYBOARD_QWERTY);
|
||||
BIND_ENUM_CONSTANT(LATIN_KEYBOARD_QWERTZ);
|
||||
|
|
|
@ -173,11 +173,13 @@ public:
|
|||
WINDOW_FLAG_BORDERLESS,
|
||||
WINDOW_FLAG_ALWAYS_ON_TOP,
|
||||
WINDOW_FLAG_TRANSPARENT,
|
||||
WINDOW_FLAG_NO_FOCUS,
|
||||
WINDOW_FLAG_MAX,
|
||||
WINDOW_FLAG_RESIZE_DISABLED_BIT = (1 << WINDOW_FLAG_RESIZE_DISABLED),
|
||||
WINDOW_FLAG_BORDERLESS_BIT = (1 << WINDOW_FLAG_BORDERLESS),
|
||||
WINDOW_FLAG_ALWAYS_ON_TOP_BIT = (1 << WINDOW_FLAG_ALWAYS_ON_TOP),
|
||||
WINDOW_FLAG_TRANSPARENT_BIT = (1 << WINDOW_FLAG_TRANSPARENT)
|
||||
WINDOW_FLAG_TRANSPARENT_BIT = (1 << WINDOW_FLAG_TRANSPARENT),
|
||||
WINDOW_FLAG_NO_FOCUS_BIT = (1 << WINDOW_FLAG_NO_FOCUS)
|
||||
};
|
||||
|
||||
virtual WindowID create_sub_window(WindowMode p_mode, uint32_t p_flags, const Rect2i & = Rect2i());
|
||||
|
|
Loading…
Reference in a new issue