2023-01-05 13:25:55 +01:00
|
|
|
/**************************************************************************/
|
|
|
|
/* window.h */
|
|
|
|
/**************************************************************************/
|
|
|
|
/* This file is part of: */
|
|
|
|
/* GODOT ENGINE */
|
|
|
|
/* https://godotengine.org */
|
|
|
|
/**************************************************************************/
|
|
|
|
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
|
|
|
|
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
|
|
|
/* */
|
|
|
|
/* 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. */
|
|
|
|
/**************************************************************************/
|
2020-03-04 02:51:12 +01:00
|
|
|
|
|
|
|
#ifndef WINDOW_H
|
|
|
|
#define WINDOW_H
|
|
|
|
|
|
|
|
#include "scene/main/viewport.h"
|
2022-09-01 12:38:08 +02:00
|
|
|
#include "scene/resources/theme.h"
|
2020-03-04 02:51:12 +01:00
|
|
|
|
2020-03-06 18:00:16 +01:00
|
|
|
class Control;
|
2021-08-13 01:05:59 +02:00
|
|
|
class Font;
|
2022-08-30 13:32:34 +02:00
|
|
|
class Shortcut;
|
2021-08-13 01:05:59 +02:00
|
|
|
class StyleBox;
|
2022-09-02 16:03:23 +02:00
|
|
|
class ThemeOwner;
|
2021-08-13 01:05:59 +02:00
|
|
|
|
2020-03-04 02:51:12 +01:00
|
|
|
class Window : public Viewport {
|
|
|
|
GDCLASS(Window, Viewport)
|
|
|
|
public:
|
2023-06-21 17:56:23 +02:00
|
|
|
// Keep synced with enum hint for `mode` property.
|
2020-03-04 02:51:12 +01:00
|
|
|
enum Mode {
|
|
|
|
MODE_WINDOWED = DisplayServer::WINDOW_MODE_WINDOWED,
|
|
|
|
MODE_MINIMIZED = DisplayServer::WINDOW_MODE_MINIMIZED,
|
|
|
|
MODE_MAXIMIZED = DisplayServer::WINDOW_MODE_MAXIMIZED,
|
2020-03-31 11:56:58 +02:00
|
|
|
MODE_FULLSCREEN = DisplayServer::WINDOW_MODE_FULLSCREEN,
|
2022-01-28 10:19:53 +01:00
|
|
|
MODE_EXCLUSIVE_FULLSCREEN = DisplayServer::WINDOW_MODE_EXCLUSIVE_FULLSCREEN,
|
2020-03-04 02:51:12 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
enum Flags {
|
|
|
|
FLAG_RESIZE_DISABLED = DisplayServer::WINDOW_FLAG_RESIZE_DISABLED,
|
|
|
|
FLAG_BORDERLESS = DisplayServer::WINDOW_FLAG_BORDERLESS,
|
|
|
|
FLAG_ALWAYS_ON_TOP = DisplayServer::WINDOW_FLAG_ALWAYS_ON_TOP,
|
|
|
|
FLAG_TRANSPARENT = DisplayServer::WINDOW_FLAG_TRANSPARENT,
|
2020-03-20 21:51:53 +01:00
|
|
|
FLAG_NO_FOCUS = DisplayServer::WINDOW_FLAG_NO_FOCUS,
|
2022-02-24 10:21:23 +01:00
|
|
|
FLAG_POPUP = DisplayServer::WINDOW_FLAG_POPUP,
|
2022-08-23 12:40:48 +02:00
|
|
|
FLAG_EXTEND_TO_TITLE = DisplayServer::WINDOW_FLAG_EXTEND_TO_TITLE,
|
2023-01-15 11:05:25 +01:00
|
|
|
FLAG_MOUSE_PASSTHROUGH = DisplayServer::WINDOW_FLAG_MOUSE_PASSTHROUGH,
|
2020-03-04 02:51:12 +01:00
|
|
|
FLAG_MAX = DisplayServer::WINDOW_FLAG_MAX,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum ContentScaleMode {
|
|
|
|
CONTENT_SCALE_MODE_DISABLED,
|
2020-07-02 22:15:11 +02:00
|
|
|
CONTENT_SCALE_MODE_CANVAS_ITEMS,
|
|
|
|
CONTENT_SCALE_MODE_VIEWPORT,
|
2020-03-04 02:51:12 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
enum ContentScaleAspect {
|
|
|
|
CONTENT_SCALE_ASPECT_IGNORE,
|
|
|
|
CONTENT_SCALE_ASPECT_KEEP,
|
|
|
|
CONTENT_SCALE_ASPECT_KEEP_WIDTH,
|
|
|
|
CONTENT_SCALE_ASPECT_KEEP_HEIGHT,
|
|
|
|
CONTENT_SCALE_ASPECT_EXPAND,
|
|
|
|
};
|
2020-03-31 11:56:58 +02:00
|
|
|
|
2023-04-06 23:41:27 +02:00
|
|
|
enum ContentScaleStretch {
|
|
|
|
CONTENT_SCALE_STRETCH_FRACTIONAL,
|
|
|
|
CONTENT_SCALE_STRETCH_INTEGER,
|
|
|
|
};
|
|
|
|
|
2020-09-03 13:22:16 +02:00
|
|
|
enum LayoutDirection {
|
|
|
|
LAYOUT_DIRECTION_INHERITED,
|
|
|
|
LAYOUT_DIRECTION_LOCALE,
|
|
|
|
LAYOUT_DIRECTION_LTR,
|
|
|
|
LAYOUT_DIRECTION_RTL
|
|
|
|
};
|
|
|
|
|
2020-03-04 02:51:12 +01:00
|
|
|
enum {
|
2020-03-31 11:56:58 +02:00
|
|
|
DEFAULT_WINDOW_SIZE = 100,
|
2020-03-04 02:51:12 +01:00
|
|
|
};
|
|
|
|
|
2023-06-21 17:56:23 +02:00
|
|
|
// Keep synced with enum hint for `initial_position` property.
|
2023-01-04 23:00:02 +01:00
|
|
|
enum WindowInitialPosition {
|
|
|
|
WINDOW_INITIAL_POSITION_ABSOLUTE,
|
2023-01-19 09:28:53 +01:00
|
|
|
WINDOW_INITIAL_POSITION_CENTER_PRIMARY_SCREEN,
|
|
|
|
WINDOW_INITIAL_POSITION_CENTER_MAIN_WINDOW_SCREEN,
|
|
|
|
WINDOW_INITIAL_POSITION_CENTER_OTHER_SCREEN,
|
2023-03-21 12:08:46 +01:00
|
|
|
WINDOW_INITIAL_POSITION_CENTER_SCREEN_WITH_MOUSE_FOCUS,
|
|
|
|
WINDOW_INITIAL_POSITION_CENTER_SCREEN_WITH_KEYBOARD_FOCUS,
|
2023-01-04 23:00:02 +01:00
|
|
|
};
|
|
|
|
|
2020-03-04 02:51:12 +01:00
|
|
|
private:
|
|
|
|
DisplayServer::WindowID window_id = DisplayServer::INVALID_WINDOW_ID;
|
2023-04-03 18:01:10 +02:00
|
|
|
bool initialized = false;
|
2020-03-04 02:51:12 +01:00
|
|
|
|
|
|
|
String title;
|
2023-01-19 09:28:53 +01:00
|
|
|
mutable int current_screen = 0;
|
2020-03-04 02:51:12 +01:00
|
|
|
mutable Vector2i position;
|
|
|
|
mutable Size2i size = Size2i(DEFAULT_WINDOW_SIZE, DEFAULT_WINDOW_SIZE);
|
|
|
|
mutable Size2i min_size;
|
|
|
|
mutable Size2i max_size;
|
2023-01-15 11:05:25 +01:00
|
|
|
mutable Vector<Vector2> mpath;
|
2020-03-04 02:51:12 +01:00
|
|
|
mutable Mode mode = MODE_WINDOWED;
|
2021-02-09 18:24:36 +01:00
|
|
|
mutable bool flags[FLAG_MAX] = {};
|
2020-03-04 02:51:12 +01:00
|
|
|
bool visible = true;
|
2020-03-06 18:00:16 +01:00
|
|
|
bool focused = false;
|
2023-01-04 23:00:02 +01:00
|
|
|
WindowInitialPosition initial_position = WINDOW_INITIAL_POSITION_ABSOLUTE;
|
2020-03-04 02:51:12 +01:00
|
|
|
|
|
|
|
bool use_font_oversampling = false;
|
2020-03-04 20:03:30 +01:00
|
|
|
bool transient = false;
|
2020-03-06 18:00:16 +01:00
|
|
|
bool exclusive = false;
|
|
|
|
bool wrap_controls = false;
|
|
|
|
bool updating_child_controls = false;
|
2023-01-15 16:04:05 +01:00
|
|
|
bool updating_embedded_window = false;
|
2020-07-01 17:39:42 +02:00
|
|
|
bool clamp_to_embedder = false;
|
2023-04-20 15:13:21 +02:00
|
|
|
bool unparent_when_invisible = false;
|
2020-03-06 18:00:16 +01:00
|
|
|
|
2020-09-03 13:22:16 +02:00
|
|
|
LayoutDirection layout_dir = LAYOUT_DIRECTION_INHERITED;
|
|
|
|
|
2021-05-27 19:31:33 +02:00
|
|
|
bool auto_translate = true;
|
|
|
|
|
2020-03-06 18:00:16 +01:00
|
|
|
void _update_child_controls();
|
2023-01-15 16:04:05 +01:00
|
|
|
void _update_embedded_window();
|
2020-03-04 02:51:12 +01:00
|
|
|
|
|
|
|
Size2i content_scale_size;
|
2021-02-09 18:24:36 +01:00
|
|
|
ContentScaleMode content_scale_mode = CONTENT_SCALE_MODE_DISABLED;
|
|
|
|
ContentScaleAspect content_scale_aspect = CONTENT_SCALE_ASPECT_IGNORE;
|
2023-04-06 23:41:27 +02:00
|
|
|
ContentScaleStretch content_scale_stretch = CONTENT_SCALE_STRETCH_FRACTIONAL;
|
2021-12-17 13:11:19 +01:00
|
|
|
real_t content_scale_factor = 1.0;
|
2020-03-04 02:51:12 +01:00
|
|
|
|
|
|
|
void _make_window();
|
|
|
|
void _clear_window();
|
|
|
|
void _update_from_window();
|
|
|
|
|
2023-04-20 15:13:21 +02:00
|
|
|
bool _try_parent_dialog(Node *p_from_node);
|
|
|
|
|
2022-06-18 12:52:30 +02:00
|
|
|
Size2i max_size_used;
|
|
|
|
|
|
|
|
Size2i _clamp_limit_size(const Size2i &p_limit_size);
|
|
|
|
Size2i _clamp_window_size(const Size2i &p_size);
|
|
|
|
void _validate_limit_size();
|
2020-03-14 17:06:39 +01:00
|
|
|
void _update_viewport_size();
|
|
|
|
void _update_window_size();
|
2020-03-04 02:51:12 +01:00
|
|
|
|
2020-03-04 17:36:09 +01:00
|
|
|
void _propagate_window_notification(Node *p_node, int p_notification);
|
|
|
|
|
|
|
|
void _update_window_callbacks();
|
|
|
|
|
2020-03-04 20:03:30 +01:00
|
|
|
void _clear_transient();
|
|
|
|
void _make_transient();
|
|
|
|
Window *transient_parent = nullptr;
|
2020-03-06 18:00:16 +01:00
|
|
|
Window *exclusive_child = nullptr;
|
2022-05-19 17:00:06 +02:00
|
|
|
HashSet<Window *> transient_children;
|
2020-03-04 20:03:30 +01:00
|
|
|
|
2022-09-02 16:03:23 +02:00
|
|
|
ThemeOwner *theme_owner = nullptr;
|
2020-03-06 18:00:16 +01:00
|
|
|
Ref<Theme> theme;
|
2021-07-04 22:42:23 +02:00
|
|
|
StringName theme_type_variation;
|
2020-03-06 18:00:16 +01:00
|
|
|
|
2022-11-29 21:01:45 +01:00
|
|
|
bool bulk_theme_override = false;
|
|
|
|
Theme::ThemeIconMap theme_icon_override;
|
|
|
|
Theme::ThemeStyleMap theme_style_override;
|
|
|
|
Theme::ThemeFontMap theme_font_override;
|
|
|
|
Theme::ThemeFontSizeMap theme_font_size_override;
|
|
|
|
Theme::ThemeColorMap theme_color_override;
|
|
|
|
Theme::ThemeConstantMap theme_constant_override;
|
|
|
|
|
2022-09-01 12:38:08 +02:00
|
|
|
mutable HashMap<StringName, Theme::ThemeIconMap> theme_icon_cache;
|
|
|
|
mutable HashMap<StringName, Theme::ThemeStyleMap> theme_style_cache;
|
|
|
|
mutable HashMap<StringName, Theme::ThemeFontMap> theme_font_cache;
|
|
|
|
mutable HashMap<StringName, Theme::ThemeFontSizeMap> theme_font_size_cache;
|
|
|
|
mutable HashMap<StringName, Theme::ThemeColorMap> theme_color_cache;
|
|
|
|
mutable HashMap<StringName, Theme::ThemeConstantMap> theme_constant_cache;
|
|
|
|
|
|
|
|
void _theme_changed();
|
2022-11-29 21:01:45 +01:00
|
|
|
void _notify_theme_override_changed();
|
2022-09-01 12:38:08 +02:00
|
|
|
void _invalidate_theme_cache();
|
|
|
|
|
2020-03-14 17:06:39 +01:00
|
|
|
Viewport *embedder = nullptr;
|
|
|
|
|
2022-03-31 22:40:26 +02:00
|
|
|
Transform2D window_transform;
|
|
|
|
|
2020-03-14 17:06:39 +01:00
|
|
|
friend class Viewport; //friend back, can call the methods below
|
|
|
|
|
|
|
|
void _window_input(const Ref<InputEvent> &p_ev);
|
|
|
|
void _window_input_text(const String &p_text);
|
|
|
|
void _window_drop_files(const Vector<String> &p_files);
|
|
|
|
void _rect_changed_callback(const Rect2i &p_callback);
|
|
|
|
void _event_callback(DisplayServer::WindowEvent p_event);
|
2020-07-10 12:34:39 +02:00
|
|
|
virtual bool _can_consume_input_events() const override;
|
2020-03-14 17:06:39 +01:00
|
|
|
|
2023-08-06 13:07:28 +02:00
|
|
|
bool mouse_in_window = false;
|
|
|
|
void _update_mouse_over(Vector2 p_pos) override;
|
|
|
|
void _mouse_leave_viewport() override;
|
|
|
|
|
2022-08-30 13:32:34 +02:00
|
|
|
Ref<Shortcut> debugger_stop_shortcut;
|
|
|
|
|
2020-03-04 02:51:12 +01:00
|
|
|
protected:
|
2020-03-20 03:32:09 +01:00
|
|
|
virtual Rect2i _popup_adjust_rect() const { return Rect2i(); }
|
|
|
|
|
2022-09-01 12:38:08 +02:00
|
|
|
virtual void _update_theme_item_cache();
|
|
|
|
|
2020-03-06 18:00:16 +01:00
|
|
|
virtual void _post_popup() {}
|
2020-03-04 02:51:12 +01:00
|
|
|
static void _bind_methods();
|
|
|
|
void _notification(int p_what);
|
2022-11-29 21:01:45 +01:00
|
|
|
|
|
|
|
bool _set(const StringName &p_name, const Variant &p_value);
|
|
|
|
bool _get(const StringName &p_name, Variant &r_ret) const;
|
|
|
|
void _get_property_list(List<PropertyInfo> *p_list) const;
|
2022-08-12 22:57:11 +02:00
|
|
|
void _validate_property(PropertyInfo &p_property) const;
|
2020-03-04 02:51:12 +01:00
|
|
|
|
2020-07-10 12:34:39 +02:00
|
|
|
virtual void add_child_notify(Node *p_child) override;
|
|
|
|
virtual void remove_child_notify(Node *p_child) override;
|
2020-03-06 18:00:16 +01:00
|
|
|
|
2023-08-02 18:53:37 +02:00
|
|
|
GDVIRTUAL0RC(Vector2, _get_contents_minimum_size)
|
|
|
|
|
2020-03-04 02:51:12 +01:00
|
|
|
public:
|
2020-03-06 18:00:16 +01:00
|
|
|
enum {
|
|
|
|
NOTIFICATION_VISIBILITY_CHANGED = 30,
|
|
|
|
NOTIFICATION_POST_POPUP = 31,
|
2020-09-03 13:22:16 +02:00
|
|
|
NOTIFICATION_THEME_CHANGED = 32
|
2020-03-06 18:00:16 +01:00
|
|
|
};
|
|
|
|
|
2020-03-04 02:51:12 +01:00
|
|
|
void set_title(const String &p_title);
|
|
|
|
String get_title() const;
|
|
|
|
|
2023-01-04 23:00:02 +01:00
|
|
|
void set_initial_position(WindowInitialPosition p_initial_position);
|
|
|
|
WindowInitialPosition get_initial_position() const;
|
|
|
|
|
2020-03-04 02:51:12 +01:00
|
|
|
void set_current_screen(int p_screen);
|
|
|
|
int get_current_screen() const;
|
|
|
|
|
|
|
|
void set_position(const Point2i &p_position);
|
|
|
|
Point2i get_position() const;
|
2023-08-26 09:30:31 +02:00
|
|
|
void move_to_center();
|
2020-03-04 02:51:12 +01:00
|
|
|
|
|
|
|
void set_size(const Size2i &p_size);
|
|
|
|
Size2i get_size() const;
|
2021-11-20 09:04:57 +01:00
|
|
|
void reset_size();
|
2020-03-04 02:51:12 +01:00
|
|
|
|
2022-11-30 09:28:16 +01:00
|
|
|
Point2i get_position_with_decorations() const;
|
|
|
|
Size2i get_size_with_decorations() const;
|
2020-03-04 02:51:12 +01:00
|
|
|
|
|
|
|
void set_max_size(const Size2i &p_max_size);
|
|
|
|
Size2i get_max_size() const;
|
|
|
|
|
|
|
|
void set_min_size(const Size2i &p_min_size);
|
|
|
|
Size2i get_min_size() const;
|
|
|
|
|
|
|
|
void set_mode(Mode p_mode);
|
|
|
|
Mode get_mode() const;
|
|
|
|
|
|
|
|
void set_flag(Flags p_flag, bool p_enabled);
|
|
|
|
bool get_flag(Flags p_flag) const;
|
|
|
|
|
|
|
|
bool is_maximize_allowed() const;
|
|
|
|
|
|
|
|
void request_attention();
|
|
|
|
void move_to_foreground();
|
|
|
|
|
|
|
|
void set_visible(bool p_visible);
|
|
|
|
bool is_visible() const;
|
|
|
|
|
2022-09-29 23:45:51 +02:00
|
|
|
void update_mouse_cursor_state() override;
|
2022-03-10 18:44:28 +01:00
|
|
|
|
2020-03-06 18:00:16 +01:00
|
|
|
void show();
|
|
|
|
void hide();
|
|
|
|
|
2020-03-04 20:03:30 +01:00
|
|
|
void set_transient(bool p_transient);
|
|
|
|
bool is_transient() const;
|
|
|
|
|
2020-03-06 18:00:16 +01:00
|
|
|
void set_exclusive(bool p_exclusive);
|
|
|
|
bool is_exclusive() const;
|
|
|
|
|
2020-07-01 17:39:42 +02:00
|
|
|
void set_clamp_to_embedder(bool p_enable);
|
|
|
|
bool is_clamped_to_embedder() const;
|
|
|
|
|
2023-04-20 15:13:21 +02:00
|
|
|
void set_unparent_when_invisible(bool p_unparent);
|
|
|
|
|
2022-10-11 07:39:36 +02:00
|
|
|
bool is_in_edited_scene_root() const;
|
|
|
|
|
2020-03-04 02:51:12 +01:00
|
|
|
bool can_draw() const;
|
|
|
|
|
|
|
|
void set_ime_active(bool p_active);
|
|
|
|
void set_ime_position(const Point2i &p_pos);
|
|
|
|
|
|
|
|
bool is_embedded() const;
|
2023-02-05 17:35:39 +01:00
|
|
|
Viewport *get_embedder() const;
|
2020-03-04 02:51:12 +01:00
|
|
|
|
|
|
|
void set_content_scale_size(const Size2i &p_size);
|
|
|
|
Size2i get_content_scale_size() const;
|
|
|
|
|
2020-03-04 20:03:30 +01:00
|
|
|
void set_content_scale_mode(ContentScaleMode p_mode);
|
2020-03-04 02:51:12 +01:00
|
|
|
ContentScaleMode get_content_scale_mode() const;
|
|
|
|
|
2020-03-04 20:03:30 +01:00
|
|
|
void set_content_scale_aspect(ContentScaleAspect p_aspect);
|
2020-03-04 02:51:12 +01:00
|
|
|
ContentScaleAspect get_content_scale_aspect() const;
|
|
|
|
|
2023-04-06 23:41:27 +02:00
|
|
|
void set_content_scale_stretch(ContentScaleStretch p_stretch);
|
|
|
|
ContentScaleStretch get_content_scale_stretch() const;
|
|
|
|
|
2021-12-17 13:11:19 +01:00
|
|
|
void set_content_scale_factor(real_t p_factor);
|
|
|
|
real_t get_content_scale_factor() const;
|
|
|
|
|
2020-03-04 02:51:12 +01:00
|
|
|
void set_use_font_oversampling(bool p_oversampling);
|
|
|
|
bool is_using_font_oversampling() const;
|
2020-03-06 18:00:16 +01:00
|
|
|
|
2023-01-15 11:05:25 +01:00
|
|
|
void set_mouse_passthrough_polygon(const Vector<Vector2> &p_region);
|
|
|
|
Vector<Vector2> get_mouse_passthrough_polygon() const;
|
|
|
|
|
2020-03-06 18:00:16 +01:00
|
|
|
void set_wrap_controls(bool p_enable);
|
|
|
|
bool is_wrapping_controls() const;
|
|
|
|
void child_controls_changed();
|
|
|
|
|
2023-01-11 09:13:21 +01:00
|
|
|
Window *get_exclusive_child() const { return exclusive_child; };
|
2020-03-06 18:00:16 +01:00
|
|
|
Window *get_parent_visible_window() const;
|
|
|
|
Viewport *get_parent_viewport() const;
|
2023-04-20 15:13:21 +02:00
|
|
|
|
2021-03-30 14:42:50 +02:00
|
|
|
virtual void popup(const Rect2i &p_screen_rect = Rect2i());
|
2020-03-25 15:16:19 +01:00
|
|
|
void popup_on_parent(const Rect2i &p_parent_rect);
|
|
|
|
void popup_centered(const Size2i &p_minsize = Size2i());
|
2023-04-20 15:13:21 +02:00
|
|
|
void popup_centered_ratio(float p_ratio = 0.8);
|
2020-03-25 15:16:19 +01:00
|
|
|
void popup_centered_clamped(const Size2i &p_size = Size2i(), float p_fallback_ratio = 0.75);
|
2020-03-06 18:00:16 +01:00
|
|
|
|
2023-04-20 15:13:21 +02:00
|
|
|
void popup_exclusive(Node *p_from_node, const Rect2i &p_screen_rect = Rect2i());
|
|
|
|
void popup_exclusive_on_parent(Node *p_from_node, const Rect2i &p_parent_rect);
|
|
|
|
void popup_exclusive_centered(Node *p_from_node, const Size2i &p_minsize = Size2i());
|
|
|
|
void popup_exclusive_centered_ratio(Node *p_from_node, float p_ratio = 0.8);
|
|
|
|
void popup_exclusive_centered_clamped(Node *p_from_node, const Size2i &p_size = Size2i(), float p_fallback_ratio = 0.75);
|
|
|
|
|
2023-03-19 17:26:22 +01:00
|
|
|
Rect2i fit_rect_in_parent(Rect2i p_rect, const Rect2i &p_parent_rect) const;
|
2020-03-12 13:37:40 +01:00
|
|
|
Size2 get_contents_minimum_size() const;
|
2022-06-18 12:52:30 +02:00
|
|
|
Size2 get_clamped_minimum_size() const;
|
2020-03-12 13:37:40 +01:00
|
|
|
|
2020-03-06 18:00:16 +01:00
|
|
|
void grab_focus();
|
|
|
|
bool has_focus() const;
|
|
|
|
|
2020-09-03 13:22:16 +02:00
|
|
|
void set_layout_direction(LayoutDirection p_direction);
|
|
|
|
LayoutDirection get_layout_direction() const;
|
|
|
|
bool is_layout_rtl() const;
|
|
|
|
|
2021-05-27 19:31:33 +02:00
|
|
|
void set_auto_translate(bool p_enable);
|
|
|
|
bool is_auto_translating() const;
|
|
|
|
_FORCE_INLINE_ String atr(const String p_string) const { return is_auto_translating() ? tr(p_string) : p_string; };
|
|
|
|
|
2020-03-20 03:32:09 +01:00
|
|
|
Rect2i get_usable_parent_rect() const;
|
|
|
|
|
2022-11-29 21:01:45 +01:00
|
|
|
// Theming.
|
|
|
|
|
|
|
|
void set_theme_owner_node(Node *p_node);
|
|
|
|
Node *get_theme_owner_node() const;
|
|
|
|
bool has_theme_owner_node() const;
|
|
|
|
|
|
|
|
void set_theme(const Ref<Theme> &p_theme);
|
|
|
|
Ref<Theme> get_theme() const;
|
|
|
|
|
|
|
|
void set_theme_type_variation(const StringName &p_theme_type);
|
|
|
|
StringName get_theme_type_variation() const;
|
|
|
|
|
|
|
|
void begin_bulk_theme_override();
|
|
|
|
void end_bulk_theme_override();
|
|
|
|
|
|
|
|
void add_theme_icon_override(const StringName &p_name, const Ref<Texture2D> &p_icon);
|
|
|
|
void add_theme_style_override(const StringName &p_name, const Ref<StyleBox> &p_style);
|
|
|
|
void add_theme_font_override(const StringName &p_name, const Ref<Font> &p_font);
|
|
|
|
void add_theme_font_size_override(const StringName &p_name, int p_font_size);
|
|
|
|
void add_theme_color_override(const StringName &p_name, const Color &p_color);
|
|
|
|
void add_theme_constant_override(const StringName &p_name, int p_constant);
|
|
|
|
|
|
|
|
void remove_theme_icon_override(const StringName &p_name);
|
|
|
|
void remove_theme_style_override(const StringName &p_name);
|
|
|
|
void remove_theme_font_override(const StringName &p_name);
|
|
|
|
void remove_theme_font_size_override(const StringName &p_name);
|
|
|
|
void remove_theme_color_override(const StringName &p_name);
|
|
|
|
void remove_theme_constant_override(const StringName &p_name);
|
|
|
|
|
2021-03-30 19:16:33 +02:00
|
|
|
Ref<Texture2D> get_theme_icon(const StringName &p_name, const StringName &p_theme_type = StringName()) const;
|
|
|
|
Ref<StyleBox> get_theme_stylebox(const StringName &p_name, const StringName &p_theme_type = StringName()) const;
|
|
|
|
Ref<Font> get_theme_font(const StringName &p_name, const StringName &p_theme_type = StringName()) const;
|
|
|
|
int get_theme_font_size(const StringName &p_name, const StringName &p_theme_type = StringName()) const;
|
|
|
|
Color get_theme_color(const StringName &p_name, const StringName &p_theme_type = StringName()) const;
|
|
|
|
int get_theme_constant(const StringName &p_name, const StringName &p_theme_type = StringName()) const;
|
|
|
|
|
2022-11-29 21:01:45 +01:00
|
|
|
bool has_theme_icon_override(const StringName &p_name) const;
|
|
|
|
bool has_theme_stylebox_override(const StringName &p_name) const;
|
|
|
|
bool has_theme_font_override(const StringName &p_name) const;
|
|
|
|
bool has_theme_font_size_override(const StringName &p_name) const;
|
|
|
|
bool has_theme_color_override(const StringName &p_name) const;
|
|
|
|
bool has_theme_constant_override(const StringName &p_name) const;
|
|
|
|
|
2021-03-30 19:16:33 +02:00
|
|
|
bool has_theme_icon(const StringName &p_name, const StringName &p_theme_type = StringName()) const;
|
|
|
|
bool has_theme_stylebox(const StringName &p_name, const StringName &p_theme_type = StringName()) const;
|
|
|
|
bool has_theme_font(const StringName &p_name, const StringName &p_theme_type = StringName()) const;
|
|
|
|
bool has_theme_font_size(const StringName &p_name, const StringName &p_theme_type = StringName()) const;
|
|
|
|
bool has_theme_color(const StringName &p_name, const StringName &p_theme_type = StringName()) const;
|
|
|
|
bool has_theme_constant(const StringName &p_name, const StringName &p_theme_type = StringName()) const;
|
2020-03-12 13:37:40 +01:00
|
|
|
|
2021-10-02 22:06:14 +02:00
|
|
|
float get_theme_default_base_scale() const;
|
|
|
|
Ref<Font> get_theme_default_font() const;
|
|
|
|
int get_theme_default_font_size() const;
|
|
|
|
|
2022-11-29 21:01:45 +01:00
|
|
|
//
|
|
|
|
|
2023-02-02 19:28:14 +01:00
|
|
|
virtual Transform2D get_final_transform() const override;
|
2023-01-20 22:33:05 +01:00
|
|
|
virtual Transform2D get_screen_transform_internal(bool p_absolute_position = false) const override;
|
2022-11-13 21:38:29 +01:00
|
|
|
virtual Transform2D get_popup_base_transform() const override;
|
2023-06-06 20:42:41 +02:00
|
|
|
virtual bool is_directly_attached_to_screen() const override;
|
2023-01-06 21:48:20 +01:00
|
|
|
virtual bool is_attached_in_viewport() const override;
|
2022-03-28 11:01:29 +02:00
|
|
|
|
2020-03-14 17:06:39 +01:00
|
|
|
Rect2i get_parent_rect() const;
|
2020-07-10 12:34:39 +02:00
|
|
|
virtual DisplayServer::WindowID get_window_id() const override;
|
2020-03-12 13:37:40 +01:00
|
|
|
|
2023-08-02 18:53:37 +02:00
|
|
|
virtual Size2 _get_contents_minimum_size() const;
|
|
|
|
|
2020-03-04 02:51:12 +01:00
|
|
|
Window();
|
|
|
|
~Window();
|
|
|
|
};
|
|
|
|
|
2020-03-31 11:56:58 +02:00
|
|
|
VARIANT_ENUM_CAST(Window::Mode);
|
|
|
|
VARIANT_ENUM_CAST(Window::Flags);
|
2020-03-04 02:51:12 +01:00
|
|
|
VARIANT_ENUM_CAST(Window::ContentScaleMode);
|
|
|
|
VARIANT_ENUM_CAST(Window::ContentScaleAspect);
|
2023-04-06 23:41:27 +02:00
|
|
|
VARIANT_ENUM_CAST(Window::ContentScaleStretch);
|
2020-09-03 13:22:16 +02:00
|
|
|
VARIANT_ENUM_CAST(Window::LayoutDirection);
|
2023-01-04 23:00:02 +01:00
|
|
|
VARIANT_ENUM_CAST(Window::WindowInitialPosition);
|
2020-03-04 02:51:12 +01:00
|
|
|
|
|
|
|
#endif // WINDOW_H
|