From 275e537058ed870c4d37002f2110b7866d2ed1ae Mon Sep 17 00:00:00 2001 From: Ruslan Mustakov Date: Wed, 4 Oct 2017 15:39:31 +0700 Subject: Allow to obtain virtual keyboard height On mobile platforms virtual keyboards take up significant amount of screen space and UI containing a text box may need to be adjusted after the keyboard appears to keep the text box visible to user. This commit adds a way to obtain virtual keyabord height so that controls are aware of how much they need to move. --- core/os/os.cpp | 4 ++++ core/os/os.h | 3 +++ 2 files changed, 7 insertions(+) (limited to 'core/os') diff --git a/core/os/os.cpp b/core/os/os.cpp index ff17cdb508..fd1ded63d0 100644 --- a/core/os/os.cpp +++ b/core/os/os.cpp @@ -193,6 +193,10 @@ void OS::show_virtual_keyboard(const String &p_existing_text, const Rect2 &p_scr void OS::hide_virtual_keyboard() { } +int OS::get_virtual_keyboard_height() const { + return 0; +} + void OS::print_all_resources(String p_to_file) { ERR_FAIL_COND(p_to_file != "" && _OSPRF); diff --git a/core/os/os.h b/core/os/os.h index c9d25792b9..b68cea1144 100644 --- a/core/os/os.h +++ b/core/os/os.h @@ -313,6 +313,9 @@ public: virtual void show_virtual_keyboard(const String &p_existing_text, const Rect2 &p_screen_rect = Rect2()); virtual void hide_virtual_keyboard(); + // returns height of the currently shown virtual keyboard (0 if keyboard is hidden) + virtual int get_virtual_keyboard_height() const; + virtual void set_cursor_shape(CursorShape p_shape) = 0; virtual bool get_swap_ok_cancel() { return false; } -- cgit v1.2.3