mirror of
https://github.com/godotengine/godot.git
synced 2025-12-07 22:00:10 +00:00
Add option for a touch-friendly drag handle in SplitContainer
This commit is contained in:
parent
64b09905c7
commit
bccf36b27b
6 changed files with 122 additions and 2 deletions
|
|
@ -32,6 +32,8 @@
|
|||
|
||||
#include "scene/gui/container.h"
|
||||
|
||||
class TextureRect;
|
||||
|
||||
class SplitContainerDragger : public Control {
|
||||
GDCLASS(SplitContainerDragger, Control);
|
||||
friend class SplitContainer;
|
||||
|
|
@ -82,10 +84,16 @@ private:
|
|||
|
||||
SplitContainerDragger *dragging_area_control = nullptr;
|
||||
|
||||
bool touch_dragger_enabled = false;
|
||||
TextureRect *touch_dragger = nullptr;
|
||||
|
||||
struct ThemeCache {
|
||||
int separation = 0;
|
||||
int minimum_grab_thickness = 0;
|
||||
bool autohide = false;
|
||||
Ref<Texture2D> touch_dragger_icon;
|
||||
Ref<Texture2D> touch_dragger_icon_h;
|
||||
Ref<Texture2D> touch_dragger_icon_v;
|
||||
Ref<Texture2D> grabber_icon;
|
||||
Ref<Texture2D> grabber_icon_h;
|
||||
Ref<Texture2D> grabber_icon_v;
|
||||
|
|
@ -94,6 +102,9 @@ private:
|
|||
} theme_cache;
|
||||
|
||||
Ref<Texture2D> _get_grabber_icon() const;
|
||||
Ref<Texture2D> _get_touch_dragger_icon() const;
|
||||
void _touch_dragger_mouse_exited();
|
||||
void _touch_dragger_gui_input(const Ref<InputEvent> &p_event);
|
||||
void _compute_split_offset(bool p_clamp);
|
||||
int _get_separation() const;
|
||||
void _resort();
|
||||
|
|
@ -142,6 +153,9 @@ public:
|
|||
|
||||
Control *get_drag_area_control() { return dragging_area_control; }
|
||||
|
||||
void set_touch_dragger_enabled(bool p_enabled);
|
||||
bool is_touch_dragger_enabled() const;
|
||||
|
||||
SplitContainer(bool p_vertical = false);
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue