2014-02-10 02:10:30 +01:00
|
|
|
/*************************************************************************/
|
|
|
|
/* control.h */
|
|
|
|
/*************************************************************************/
|
|
|
|
/* This file is part of: */
|
|
|
|
/* GODOT ENGINE */
|
2017-08-27 14:16:55 +02:00
|
|
|
/* https://godotengine.org */
|
2014-02-10 02:10:30 +01:00
|
|
|
/*************************************************************************/
|
2017-01-01 22:01:57 +01:00
|
|
|
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
|
2017-04-08 00:11:42 +02:00
|
|
|
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
|
2014-02-10 02:10:30 +01: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. */
|
|
|
|
/*************************************************************************/
|
|
|
|
#ifndef CONTROL_H
|
|
|
|
#define CONTROL_H
|
|
|
|
|
|
|
|
#include "math_2d.h"
|
|
|
|
#include "rid.h"
|
2017-03-05 16:44:50 +01:00
|
|
|
#include "scene/2d/canvas_item.h"
|
2017-08-27 21:07:15 +02:00
|
|
|
#include "scene/gui/shortcut.h"
|
2017-03-05 16:44:50 +01:00
|
|
|
#include "scene/main/node.h"
|
|
|
|
#include "scene/main/timer.h"
|
|
|
|
#include "scene/resources/theme.h"
|
2014-02-10 02:10:30 +01:00
|
|
|
/**
|
|
|
|
@author Juan Linietsky <reduzio@gmail.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
class Viewport;
|
|
|
|
class Label;
|
|
|
|
class Panel;
|
|
|
|
|
|
|
|
class Control : public CanvasItem {
|
2016-03-09 00:00:52 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
GDCLASS(Control, CanvasItem);
|
2014-02-10 02:10:30 +01:00
|
|
|
OBJ_CATEGORY("GUI Nodes");
|
|
|
|
|
|
|
|
public:
|
2017-08-16 00:48:38 +02:00
|
|
|
enum Anchor {
|
|
|
|
|
|
|
|
ANCHOR_BEGIN = 0,
|
|
|
|
ANCHOR_END = 1
|
|
|
|
};
|
2016-03-09 00:00:52 +01:00
|
|
|
|
2017-07-06 18:26:39 +02:00
|
|
|
enum GrowDirection {
|
|
|
|
GROW_DIRECTION_BEGIN,
|
|
|
|
GROW_DIRECTION_END
|
|
|
|
};
|
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
enum FocusMode {
|
|
|
|
FOCUS_NONE,
|
|
|
|
FOCUS_CLICK,
|
|
|
|
FOCUS_ALL
|
|
|
|
};
|
|
|
|
|
|
|
|
enum SizeFlags {
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
SIZE_FILL = 1,
|
|
|
|
SIZE_EXPAND = 2,
|
2017-07-07 00:06:55 +02:00
|
|
|
SIZE_EXPAND_FILL = SIZE_EXPAND | SIZE_FILL,
|
|
|
|
SIZE_SHRINK_CENTER = 4, //ignored by expand or fill
|
|
|
|
SIZE_SHRINK_END = 8, //ignored by expand or fil
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
};
|
|
|
|
|
2017-01-08 23:54:19 +01:00
|
|
|
enum MouseFilter {
|
|
|
|
MOUSE_FILTER_STOP,
|
|
|
|
MOUSE_FILTER_PASS,
|
|
|
|
MOUSE_FILTER_IGNORE
|
|
|
|
};
|
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
enum CursorShape {
|
|
|
|
CURSOR_ARROW,
|
|
|
|
CURSOR_IBEAM,
|
|
|
|
CURSOR_POINTING_HAND,
|
|
|
|
CURSOR_CROSS,
|
|
|
|
CURSOR_WAIT,
|
|
|
|
CURSOR_BUSY,
|
|
|
|
CURSOR_DRAG,
|
|
|
|
CURSOR_CAN_DROP,
|
|
|
|
CURSOR_FORBIDDEN,
|
|
|
|
CURSOR_VSIZE,
|
|
|
|
CURSOR_HSIZE,
|
|
|
|
CURSOR_BDIAGSIZE,
|
|
|
|
CURSOR_FDIAGSIZE,
|
|
|
|
CURSOR_MOVE,
|
|
|
|
CURSOR_VSPLIT,
|
|
|
|
CURSOR_HSPLIT,
|
|
|
|
CURSOR_HELP,
|
|
|
|
CURSOR_MAX
|
|
|
|
};
|
|
|
|
|
2017-08-11 18:16:28 +02:00
|
|
|
enum LayoutPreset {
|
|
|
|
PRESET_TOP_LEFT,
|
|
|
|
PRESET_TOP_RIGHT,
|
|
|
|
PRESET_BOTTOM_LEFT,
|
|
|
|
PRESET_BOTTOM_RIGHT,
|
|
|
|
PRESET_CENTER_LEFT,
|
|
|
|
PRESET_CENTER_TOP,
|
|
|
|
PRESET_CENTER_RIGHT,
|
|
|
|
PRESET_CENTER_BOTTOM,
|
|
|
|
PRESET_CENTER,
|
|
|
|
PRESET_LEFT_WIDE,
|
|
|
|
PRESET_TOP_WIDE,
|
|
|
|
PRESET_RIGHT_WIDE,
|
|
|
|
PRESET_BOTTOM_WIDE,
|
|
|
|
PRESET_VCENTER_WIDE,
|
|
|
|
PRESET_HCENTER_WIDE,
|
|
|
|
PRESET_WIDE
|
|
|
|
};
|
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
private:
|
|
|
|
struct CComparator {
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
bool operator()(const Control *p_a, const Control *p_b) const {
|
|
|
|
if (p_a->get_canvas_layer() == p_b->get_canvas_layer())
|
2016-01-24 14:57:42 +01:00
|
|
|
return p_b->is_greater_than(p_a);
|
|
|
|
else
|
|
|
|
return p_a->get_canvas_layer() < p_b->get_canvas_layer();
|
|
|
|
}
|
2014-02-10 02:10:30 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
struct Data {
|
2016-03-09 00:00:52 +01:00
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
Point2 pos_cache;
|
|
|
|
Size2 size_cache;
|
|
|
|
|
|
|
|
float margin[4];
|
2017-07-06 09:16:27 +02:00
|
|
|
float anchor[4];
|
2015-12-12 17:54:26 +01:00
|
|
|
FocusMode focus_mode;
|
2017-07-06 18:26:39 +02:00
|
|
|
GrowDirection h_grow;
|
|
|
|
GrowDirection v_grow;
|
2015-12-12 17:54:26 +01:00
|
|
|
|
|
|
|
float rotation;
|
|
|
|
Vector2 scale;
|
2017-07-06 22:42:44 +02:00
|
|
|
Vector2 pivot_offset;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
bool pending_resize;
|
|
|
|
|
|
|
|
int h_size_flags;
|
|
|
|
int v_size_flags;
|
|
|
|
float expand;
|
|
|
|
bool pending_min_size_update;
|
|
|
|
Point2 custom_minimum_size;
|
|
|
|
|
2017-01-08 23:54:19 +01:00
|
|
|
MouseFilter mouse_filter;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-01-09 19:50:08 +01:00
|
|
|
bool clip_contents;
|
|
|
|
|
2016-08-25 22:45:20 +02:00
|
|
|
bool block_minimum_size_adjust;
|
2016-08-31 04:44:14 +02:00
|
|
|
bool disable_visibility_clip;
|
2016-08-25 22:45:20 +02:00
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
Control *parent;
|
2016-05-03 16:10:28 +02:00
|
|
|
ObjectID drag_owner;
|
2014-02-10 02:10:30 +01:00
|
|
|
bool modal;
|
|
|
|
bool modal_exclusive;
|
2016-06-27 16:22:13 +02:00
|
|
|
uint64_t modal_frame; //frame used to put something as modal
|
2014-02-10 02:10:30 +01:00
|
|
|
Ref<Theme> theme;
|
2016-03-09 00:00:52 +01:00
|
|
|
Control *theme_owner;
|
2014-02-10 02:10:30 +01:00
|
|
|
String tooltip;
|
|
|
|
CursorShape default_cursor;
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
List<Control *>::Element *MI; //modal item
|
|
|
|
List<Control *>::Element *SI;
|
|
|
|
List<Control *>::Element *RI;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
CanvasItem *parent_canvas_item;
|
|
|
|
|
|
|
|
ObjectID modal_prev_focus_owner;
|
|
|
|
|
|
|
|
NodePath focus_neighbour[4];
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
HashMap<StringName, Ref<Texture>, StringNameHasher> icon_override;
|
|
|
|
HashMap<StringName, Ref<Shader>, StringNameHasher> shader_override;
|
|
|
|
HashMap<StringName, Ref<StyleBox>, StringNameHasher> style_override;
|
|
|
|
HashMap<StringName, Ref<Font>, StringNameHasher> font_override;
|
|
|
|
HashMap<StringName, Color, StringNameHasher> color_override;
|
|
|
|
HashMap<StringName, int, StringNameHasher> constant_override;
|
|
|
|
Map<Ref<Font>, int> font_refcount;
|
2016-06-17 21:00:27 +02:00
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
} data;
|
2016-03-09 00:00:52 +01:00
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
// used internally
|
2017-03-05 16:44:50 +01:00
|
|
|
Control *_find_control_at_pos(CanvasItem *p_node, const Point2 &p_pos, const Transform2D &p_xform, Transform2D &r_inv_xform);
|
2016-01-17 02:41:10 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
void _window_find_focus_neighbour(const Vector2 &p_dir, Node *p_at, const Point2 *p_points, float p_min, float &r_closest_dist, Control **r_closest);
|
|
|
|
Control *_get_focus_neighbour(Margin p_margin, int p_count = 0);
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-07-06 09:16:27 +02:00
|
|
|
void _set_anchor(Margin p_margin, float p_anchor);
|
2016-03-09 17:59:35 +01:00
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
float _get_parent_range(int p_idx) const;
|
|
|
|
float _get_range(int p_idx) const;
|
2017-07-06 09:16:27 +02:00
|
|
|
float _s2a(float p_val, float p_anchor, float p_range) const;
|
|
|
|
float _a2s(float p_val, float p_anchor, float p_range) const;
|
2017-03-05 16:44:50 +01:00
|
|
|
void _propagate_theme_changed(CanvasItem *p_at, Control *p_owner, bool p_assign = true);
|
2016-07-18 21:41:28 +02:00
|
|
|
void _theme_changed();
|
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
void _change_notify_margins();
|
|
|
|
void _update_minimum_size();
|
|
|
|
|
|
|
|
void _update_scroll();
|
2017-03-05 16:44:50 +01:00
|
|
|
void _resize(const Size2 &p_size);
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
void _size_changed();
|
|
|
|
String _get_tooltip() const;
|
|
|
|
|
2016-05-06 23:38:08 +02:00
|
|
|
// Deprecated, should be removed in a future version.
|
|
|
|
void _set_rotation_deg(float p_degrees);
|
2015-12-12 17:54:26 +01:00
|
|
|
float _get_rotation_deg() const;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2016-06-17 21:00:27 +02:00
|
|
|
void _ref_font(Ref<Font> p_sc);
|
2017-03-05 16:44:50 +01:00
|
|
|
void _unref_font(Ref<Font> p_sc);
|
2016-06-17 21:00:27 +02:00
|
|
|
void _font_changed();
|
|
|
|
|
2016-08-31 04:44:14 +02:00
|
|
|
void _update_canvas_item_transform();
|
2016-06-17 21:00:27 +02:00
|
|
|
|
2017-07-06 22:42:44 +02:00
|
|
|
Transform2D _get_internal_transform() const;
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
friend class Viewport;
|
2016-01-17 02:41:10 +01:00
|
|
|
void _modal_stack_remove();
|
|
|
|
void _modal_set_prev_focus_owner(ObjectID p_prev);
|
|
|
|
|
2016-03-09 00:00:52 +01:00
|
|
|
protected:
|
2016-08-06 03:46:45 +02:00
|
|
|
virtual void add_child_notify(Node *p_child);
|
|
|
|
virtual void remove_child_notify(Node *p_child);
|
|
|
|
|
2017-01-08 20:28:12 +01:00
|
|
|
//virtual void _window_gui_input(InputEvent p_event);
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +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;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
void _notification(int p_notification);
|
|
|
|
|
2016-03-09 00:00:52 +01:00
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
//bind helpers
|
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
public:
|
|
|
|
enum {
|
2016-03-09 00:00:52 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
/* NOTIFICATION_DRAW=30,
|
2014-02-10 02:10:30 +01:00
|
|
|
NOTIFICATION_VISIBILITY_CHANGED=38*/
|
2017-03-05 16:44:50 +01:00
|
|
|
NOTIFICATION_RESIZED = 40,
|
|
|
|
NOTIFICATION_MOUSE_ENTER = 41,
|
|
|
|
NOTIFICATION_MOUSE_EXIT = 42,
|
|
|
|
NOTIFICATION_FOCUS_ENTER = 43,
|
|
|
|
NOTIFICATION_FOCUS_EXIT = 44,
|
|
|
|
NOTIFICATION_THEME_CHANGED = 45,
|
|
|
|
NOTIFICATION_MODAL_CLOSE = 46,
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
virtual Variant edit_get_state() const;
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void edit_set_state(const Variant &p_state);
|
|
|
|
virtual void edit_set_rect(const Rect2 &p_edit_rect);
|
2014-02-10 02:10:30 +01:00
|
|
|
virtual Size2 edit_get_minimum_size() const;
|
|
|
|
|
|
|
|
void accept_event();
|
|
|
|
|
|
|
|
virtual Size2 get_minimum_size() const;
|
|
|
|
virtual Size2 get_combined_minimum_size() const;
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual bool has_point(const Point2 &p_point) const;
|
2014-02-10 02:10:30 +01:00
|
|
|
virtual bool clips_input() const;
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void set_drag_forwarding(Control *p_target);
|
|
|
|
virtual Variant get_drag_data(const Point2 &p_point);
|
|
|
|
virtual bool can_drop_data(const Point2 &p_point, const Variant &p_data) const;
|
|
|
|
virtual void drop_data(const Point2 &p_point, const Variant &p_data);
|
2014-02-10 02:10:30 +01:00
|
|
|
void set_drag_preview(Control *p_control);
|
2017-03-05 16:44:50 +01:00
|
|
|
void force_drag(const Variant &p_data, Control *p_control);
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
void set_custom_minimum_size(const Size2 &p_custom);
|
2014-02-10 02:10:30 +01:00
|
|
|
Size2 get_custom_minimum_size() const;
|
2015-12-29 00:36:48 +01:00
|
|
|
|
|
|
|
bool is_window_modal_on_top() const;
|
2016-06-27 16:22:13 +02:00
|
|
|
uint64_t get_modal_frame() const; //frame in which this was made modal
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
Control *get_parent_control() const;
|
|
|
|
|
|
|
|
/* POSITIONING */
|
2016-03-09 00:00:52 +01:00
|
|
|
|
2017-08-11 19:25:26 +02:00
|
|
|
void set_anchor(Margin p_margin, float p_anchor, bool p_keep_margin = false, bool p_push_opposite_anchor = true);
|
|
|
|
void set_anchor_and_margin(Margin p_margin, float p_anchor, float p_pos, bool p_push_opposite_anchor = true);
|
2017-08-11 18:16:28 +02:00
|
|
|
void set_anchors_preset(LayoutPreset p_preset, bool p_keep_margin = false);
|
2016-03-09 00:00:52 +01:00
|
|
|
|
2017-07-06 09:16:27 +02:00
|
|
|
float get_anchor(Margin p_margin) const;
|
2016-03-09 00:00:52 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
void set_margin(Margin p_margin, float p_value);
|
2016-03-09 00:00:52 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
void set_begin(const Point2 &p_point); // helper
|
|
|
|
void set_end(const Point2 &p_point); // helper
|
2016-03-09 00:00:52 +01:00
|
|
|
|
2017-07-06 18:26:39 +02:00
|
|
|
void set_h_grow_direction(GrowDirection p_direction);
|
|
|
|
GrowDirection get_h_grow_direction() const;
|
|
|
|
|
|
|
|
void set_v_grow_direction(GrowDirection p_direction);
|
|
|
|
GrowDirection get_v_grow_direction() const;
|
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
float get_margin(Margin p_margin) const;
|
|
|
|
Point2 get_begin() const;
|
|
|
|
Point2 get_end() const;
|
2016-03-09 00:00:52 +01:00
|
|
|
|
2017-03-29 17:29:38 +02:00
|
|
|
void set_position(const Point2 &p_point);
|
2017-03-05 16:44:50 +01:00
|
|
|
void set_size(const Size2 &p_size);
|
2017-03-29 17:29:38 +02:00
|
|
|
void set_global_position(const Point2 &p_point);
|
2016-03-09 00:00:52 +01:00
|
|
|
|
2017-03-29 17:29:38 +02:00
|
|
|
Point2 get_position() const;
|
|
|
|
Point2 get_global_position() const;
|
2014-02-10 02:10:30 +01:00
|
|
|
Size2 get_size() const;
|
|
|
|
Rect2 get_rect() const;
|
|
|
|
Rect2 get_global_rect() const;
|
|
|
|
Rect2 get_window_rect() const; ///< use with care, as it blocks waiting for the visual server
|
2015-12-12 17:54:26 +01:00
|
|
|
|
2016-05-06 23:38:08 +02:00
|
|
|
void set_rotation(float p_radians);
|
|
|
|
void set_rotation_deg(float p_degrees);
|
2015-12-12 17:54:26 +01:00
|
|
|
float get_rotation() const;
|
2016-05-06 23:38:08 +02:00
|
|
|
float get_rotation_deg() const;
|
2015-12-12 17:54:26 +01:00
|
|
|
|
2017-07-06 22:42:44 +02:00
|
|
|
void set_pivot_offset(const Vector2 &p_pivot);
|
|
|
|
Vector2 get_pivot_offset() const;
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
void set_scale(const Vector2 &p_scale);
|
2015-12-12 17:54:26 +01:00
|
|
|
Vector2 get_scale() const;
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
void set_area_as_parent_rect(int p_margin = 0);
|
2016-03-09 00:00:52 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
void show_modal(bool p_exclusive = false);
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
void set_theme(const Ref<Theme> &p_theme);
|
2014-02-10 02:10:30 +01:00
|
|
|
Ref<Theme> get_theme() const;
|
|
|
|
|
|
|
|
void set_h_size_flags(int p_flags);
|
|
|
|
int get_h_size_flags() const;
|
|
|
|
|
|
|
|
void set_v_size_flags(int p_flags);
|
|
|
|
int get_v_size_flags() const;
|
|
|
|
|
|
|
|
void set_stretch_ratio(float p_ratio);
|
|
|
|
float get_stretch_ratio() const;
|
|
|
|
|
|
|
|
void minimum_size_changed();
|
|
|
|
|
|
|
|
/* FOCUS */
|
2016-03-09 00:00:52 +01:00
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
void set_focus_mode(FocusMode p_focus_mode);
|
|
|
|
FocusMode get_focus_mode() const;
|
|
|
|
bool has_focus() const;
|
|
|
|
void grab_focus();
|
|
|
|
void release_focus();
|
|
|
|
|
|
|
|
Control *find_next_valid_focus() const;
|
|
|
|
Control *find_prev_valid_focus() const;
|
|
|
|
|
|
|
|
void set_focus_neighbour(Margin p_margin, const NodePath &p_neighbour);
|
|
|
|
NodePath get_focus_neighbour(Margin p_margin) const;
|
|
|
|
|
|
|
|
Control *get_focus_owner() const;
|
|
|
|
|
2017-01-08 23:54:19 +01:00
|
|
|
void set_mouse_filter(MouseFilter p_filter);
|
|
|
|
MouseFilter get_mouse_filter() const;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
/* SKINNING */
|
2016-03-09 00:00:52 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
void add_icon_override(const StringName &p_name, const Ref<Texture> &p_icon);
|
|
|
|
void add_shader_override(const StringName &p_name, const Ref<Shader> &p_shader);
|
|
|
|
void add_style_override(const StringName &p_name, const Ref<StyleBox> &p_style);
|
|
|
|
void add_font_override(const StringName &p_name, const Ref<Font> &p_font);
|
|
|
|
void add_color_override(const StringName &p_name, const Color &p_color);
|
|
|
|
void add_constant_override(const StringName &p_name, int p_constant);
|
|
|
|
|
|
|
|
Ref<Texture> get_icon(const StringName &p_name, const StringName &p_type = StringName()) const;
|
|
|
|
Ref<Shader> get_shader(const StringName &p_name, const StringName &p_type = StringName()) const;
|
|
|
|
Ref<StyleBox> get_stylebox(const StringName &p_name, const StringName &p_type = StringName()) const;
|
|
|
|
Ref<Font> get_font(const StringName &p_name, const StringName &p_type = StringName()) const;
|
|
|
|
Color get_color(const StringName &p_name, const StringName &p_type = StringName()) const;
|
|
|
|
int get_constant(const StringName &p_name, const StringName &p_type = StringName()) const;
|
|
|
|
|
|
|
|
bool has_icon_override(const StringName &p_name) const;
|
|
|
|
bool has_shader_override(const StringName &p_name) const;
|
|
|
|
bool has_stylebox_override(const StringName &p_name) const;
|
|
|
|
bool has_font_override(const StringName &p_name) const;
|
|
|
|
bool has_color_override(const StringName &p_name) const;
|
|
|
|
bool has_constant_override(const StringName &p_name) const;
|
|
|
|
|
|
|
|
bool has_icon(const StringName &p_name, const StringName &p_type = StringName()) const;
|
|
|
|
bool has_shader(const StringName &p_name, const StringName &p_type = StringName()) const;
|
|
|
|
bool has_stylebox(const StringName &p_name, const StringName &p_type = StringName()) const;
|
|
|
|
bool has_font(const StringName &p_name, const StringName &p_type = StringName()) const;
|
|
|
|
bool has_color(const StringName &p_name, const StringName &p_type = StringName()) const;
|
|
|
|
bool has_constant(const StringName &p_name, const StringName &p_type = StringName()) const;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
/* TOOLTIP */
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
void set_tooltip(const String &p_tooltip);
|
|
|
|
virtual String get_tooltip(const Point2 &p_pos) const;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
/* CURSOR */
|
|
|
|
|
|
|
|
void set_default_cursor_shape(CursorShape p_shape);
|
|
|
|
CursorShape get_default_cursor_shape() const;
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual CursorShape get_cursor_shape(const Point2 &p_pos = Point2i()) const;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
virtual Rect2 get_item_rect() const;
|
2017-01-11 04:52:51 +01:00
|
|
|
virtual Transform2D get_transform() const;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
bool is_toplevel_control() const;
|
|
|
|
|
|
|
|
Size2 get_parent_area_size() const;
|
|
|
|
|
|
|
|
void grab_click_focus();
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
void warp_mouse(const Point2 &p_to_pos);
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2015-12-12 17:54:26 +01:00
|
|
|
virtual bool is_text_field() const;
|
2015-10-17 15:29:54 +02:00
|
|
|
|
2016-01-20 00:27:27 +01:00
|
|
|
Control *get_root_parent_control() const;
|
|
|
|
|
2017-01-09 19:50:08 +01:00
|
|
|
void set_clip_contents(bool p_clip);
|
|
|
|
bool is_clipping_contents();
|
2016-08-25 22:45:20 +02:00
|
|
|
|
|
|
|
void set_block_minimum_size_adjust(bool p_block);
|
|
|
|
bool is_minimum_size_adjust_blocked() const;
|
|
|
|
|
2016-08-31 04:44:14 +02:00
|
|
|
void set_disable_visibility_clip(bool p_ignore);
|
|
|
|
bool is_visibility_clip_disabled() const;
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void get_argument_options(const StringName &p_function, int p_idx, List<String> *r_options) const;
|
2016-09-11 16:48:31 +02:00
|
|
|
|
2016-03-09 00:00:52 +01:00
|
|
|
Control();
|
2014-02-10 02:10:30 +01:00
|
|
|
~Control();
|
|
|
|
};
|
|
|
|
|
|
|
|
VARIANT_ENUM_CAST(Control::FocusMode);
|
|
|
|
VARIANT_ENUM_CAST(Control::SizeFlags);
|
|
|
|
VARIANT_ENUM_CAST(Control::CursorShape);
|
2017-08-11 18:16:28 +02:00
|
|
|
VARIANT_ENUM_CAST(Control::LayoutPreset);
|
2017-01-08 23:54:19 +01:00
|
|
|
VARIANT_ENUM_CAST(Control::MouseFilter);
|
2017-07-06 18:26:39 +02:00
|
|
|
VARIANT_ENUM_CAST(Control::GrowDirection);
|
2017-08-16 00:48:38 +02:00
|
|
|
VARIANT_ENUM_CAST(Control::Anchor);
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
#endif
|