split_container.cpp 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517
  1. /**************************************************************************/
  2. /* split_container.cpp */
  3. /**************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /**************************************************************************/
  8. /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
  9. /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
  10. /* */
  11. /* Permission is hereby granted, free of charge, to any person obtaining */
  12. /* a copy of this software and associated documentation files (the */
  13. /* "Software"), to deal in the Software without restriction, including */
  14. /* without limitation the rights to use, copy, modify, merge, publish, */
  15. /* distribute, sublicense, and/or sell copies of the Software, and to */
  16. /* permit persons to whom the Software is furnished to do so, subject to */
  17. /* the following conditions: */
  18. /* */
  19. /* The above copyright notice and this permission notice shall be */
  20. /* included in all copies or substantial portions of the Software. */
  21. /* */
  22. /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
  23. /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
  24. /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
  25. /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
  26. /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
  27. /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
  28. /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
  29. /**************************************************************************/
  30. #include "split_container.h"
  31. #include "scene/main/viewport.h"
  32. #include "scene/theme/theme_db.h"
  33. void SplitContainerDragger::gui_input(const Ref<InputEvent> &p_event) {
  34. ERR_FAIL_COND(p_event.is_null());
  35. SplitContainer *sc = Object::cast_to<SplitContainer>(get_parent());
  36. if (sc->collapsed || !sc->_get_sortable_child(0) || !sc->_get_sortable_child(1) || !sc->dragging_enabled) {
  37. return;
  38. }
  39. Ref<InputEventMouseButton> mb = p_event;
  40. if (mb.is_valid()) {
  41. if (mb->get_button_index() == MouseButton::LEFT) {
  42. if (mb->is_pressed()) {
  43. sc->_compute_split_offset(true);
  44. dragging = true;
  45. sc->emit_signal(SNAME("drag_started"));
  46. drag_ofs = sc->split_offset;
  47. if (sc->vertical) {
  48. drag_from = get_transform().xform(mb->get_position()).y;
  49. } else {
  50. drag_from = get_transform().xform(mb->get_position()).x;
  51. }
  52. } else {
  53. dragging = false;
  54. queue_redraw();
  55. sc->emit_signal(SNAME("drag_ended"));
  56. }
  57. }
  58. }
  59. Ref<InputEventMouseMotion> mm = p_event;
  60. if (mm.is_valid()) {
  61. if (!dragging) {
  62. return;
  63. }
  64. Vector2i in_parent_pos = get_transform().xform(mm->get_position());
  65. if (!sc->vertical && is_layout_rtl()) {
  66. sc->split_offset = drag_ofs - (in_parent_pos.x - drag_from);
  67. } else {
  68. sc->split_offset = drag_ofs + ((sc->vertical ? in_parent_pos.y : in_parent_pos.x) - drag_from);
  69. }
  70. sc->_compute_split_offset(true);
  71. sc->queue_sort();
  72. sc->emit_signal(SNAME("dragged"), sc->get_split_offset());
  73. }
  74. }
  75. Control::CursorShape SplitContainerDragger::get_cursor_shape(const Point2 &p_pos) const {
  76. SplitContainer *sc = Object::cast_to<SplitContainer>(get_parent());
  77. if (!sc->collapsed && sc->dragging_enabled) {
  78. return (sc->vertical ? CURSOR_VSPLIT : CURSOR_HSPLIT);
  79. }
  80. return Control::get_cursor_shape(p_pos);
  81. }
  82. void SplitContainerDragger::_notification(int p_what) {
  83. switch (p_what) {
  84. case NOTIFICATION_MOUSE_ENTER: {
  85. mouse_inside = true;
  86. SplitContainer *sc = Object::cast_to<SplitContainer>(get_parent());
  87. if (sc->theme_cache.autohide) {
  88. queue_redraw();
  89. }
  90. } break;
  91. case NOTIFICATION_MOUSE_EXIT: {
  92. mouse_inside = false;
  93. SplitContainer *sc = Object::cast_to<SplitContainer>(get_parent());
  94. if (sc->theme_cache.autohide) {
  95. queue_redraw();
  96. }
  97. } break;
  98. case NOTIFICATION_DRAW: {
  99. SplitContainer *sc = Object::cast_to<SplitContainer>(get_parent());
  100. draw_style_box(sc->theme_cache.split_bar_background, split_bar_rect);
  101. if (sc->dragger_visibility == sc->DRAGGER_VISIBLE && (dragging || mouse_inside || !sc->theme_cache.autohide)) {
  102. Ref<Texture2D> tex = sc->_get_grabber_icon();
  103. float available_size = sc->vertical ? (sc->get_size().x - tex->get_size().x) : (sc->get_size().y - tex->get_size().y);
  104. if (available_size - sc->drag_area_margin_begin - sc->drag_area_margin_end > 0) { // Draw the grabber only if it fits.
  105. draw_texture(tex, (split_bar_rect.get_position() + (split_bar_rect.get_size() - tex->get_size()) * 0.5));
  106. }
  107. }
  108. if (sc->show_drag_area && Engine::get_singleton()->is_editor_hint()) {
  109. draw_rect(Rect2(Vector2(0, 0), get_size()), sc->dragging_enabled ? Color(1, 1, 0, 0.3) : Color(1, 0, 0, 0.3));
  110. }
  111. } break;
  112. }
  113. }
  114. Control *SplitContainer::_get_sortable_child(int p_idx, SortableVisbilityMode p_visibility_mode) const {
  115. int idx = 0;
  116. for (int i = 0; i < get_child_count(false); i++) {
  117. Control *c = as_sortable_control(get_child(i, false), p_visibility_mode);
  118. if (!c) {
  119. continue;
  120. }
  121. if (idx == p_idx) {
  122. return c;
  123. }
  124. idx++;
  125. }
  126. return nullptr;
  127. }
  128. Ref<Texture2D> SplitContainer::_get_grabber_icon() const {
  129. if (is_fixed) {
  130. return theme_cache.grabber_icon;
  131. } else {
  132. if (vertical) {
  133. return theme_cache.grabber_icon_v;
  134. } else {
  135. return theme_cache.grabber_icon_h;
  136. }
  137. }
  138. }
  139. int SplitContainer::_get_separation() const {
  140. if (dragger_visibility == DRAGGER_HIDDEN_COLLAPSED) {
  141. return 0;
  142. }
  143. // DRAGGER_VISIBLE or DRAGGER_HIDDEN.
  144. Ref<Texture2D> g = _get_grabber_icon();
  145. return MAX(theme_cache.separation, vertical ? g->get_height() : g->get_width());
  146. }
  147. void SplitContainer::_compute_split_offset(bool p_clamp) {
  148. Control *first = _get_sortable_child(0);
  149. Control *second = _get_sortable_child(1);
  150. int axis_index = vertical ? 1 : 0;
  151. int size = get_size()[axis_index];
  152. int sep = _get_separation();
  153. // Compute the wished size.
  154. int wished_size = 0;
  155. int split_offset_with_collapse = 0;
  156. if (!collapsed) {
  157. split_offset_with_collapse = split_offset;
  158. }
  159. bool first_is_expanded = (vertical ? first->get_v_size_flags() : first->get_h_size_flags()) & SIZE_EXPAND;
  160. bool second_is_expanded = (vertical ? second->get_v_size_flags() : second->get_h_size_flags()) & SIZE_EXPAND;
  161. if (first_is_expanded && second_is_expanded) {
  162. float ratio = first->get_stretch_ratio() / (first->get_stretch_ratio() + second->get_stretch_ratio());
  163. wished_size = size * ratio - sep * 0.5 + split_offset_with_collapse;
  164. } else if (first_is_expanded) {
  165. wished_size = size - sep + split_offset_with_collapse;
  166. } else {
  167. wished_size = split_offset_with_collapse;
  168. }
  169. // Clamp the split offset to acceptable values.
  170. int first_min_size = first->get_combined_minimum_size()[axis_index];
  171. int second_min_size = second->get_combined_minimum_size()[axis_index];
  172. computed_split_offset = CLAMP(wished_size, first_min_size, size - sep - second_min_size);
  173. // Clamp the split_offset if requested.
  174. if (p_clamp) {
  175. split_offset -= wished_size - computed_split_offset;
  176. }
  177. }
  178. void SplitContainer::_resort() {
  179. Control *first = _get_sortable_child(0);
  180. Control *second = _get_sortable_child(1);
  181. if (!first || !second) { // Only one child.
  182. if (first) {
  183. fit_child_in_rect(first, Rect2(Point2(), get_size()));
  184. } else if (second) {
  185. fit_child_in_rect(second, Rect2(Point2(), get_size()));
  186. }
  187. dragging_area_control->hide();
  188. return;
  189. }
  190. dragging_area_control->set_visible(!collapsed);
  191. _compute_split_offset(false); // This recalculates and sets computed_split_offset.
  192. int sep = _get_separation();
  193. bool is_rtl = is_layout_rtl();
  194. // Move the children.
  195. if (vertical) {
  196. fit_child_in_rect(first, Rect2(Point2(0, 0), Size2(get_size().width, computed_split_offset)));
  197. int sofs = computed_split_offset + sep;
  198. fit_child_in_rect(second, Rect2(Point2(0, sofs), Size2(get_size().width, get_size().height - sofs)));
  199. } else {
  200. if (is_rtl) {
  201. computed_split_offset = get_size().width - computed_split_offset - sep;
  202. fit_child_in_rect(second, Rect2(Point2(0, 0), Size2(computed_split_offset, get_size().height)));
  203. int sofs = computed_split_offset + sep;
  204. fit_child_in_rect(first, Rect2(Point2(sofs, 0), Size2(get_size().width - sofs, get_size().height)));
  205. } else {
  206. fit_child_in_rect(first, Rect2(Point2(0, 0), Size2(computed_split_offset, get_size().height)));
  207. int sofs = computed_split_offset + sep;
  208. fit_child_in_rect(second, Rect2(Point2(sofs, 0), Size2(get_size().width - sofs, get_size().height)));
  209. }
  210. }
  211. dragging_area_control->set_mouse_filter(dragging_enabled ? MOUSE_FILTER_STOP : MOUSE_FILTER_IGNORE);
  212. const int dragger_ctrl_size = MAX(sep, theme_cache.minimum_grab_thickness);
  213. float split_bar_offset = (dragger_ctrl_size - sep) * 0.5;
  214. if (vertical) {
  215. Rect2 split_bar_rect = Rect2(is_rtl ? drag_area_margin_end : drag_area_margin_begin, computed_split_offset, get_size().width - drag_area_margin_begin - drag_area_margin_end, sep);
  216. dragging_area_control->set_rect(Rect2(split_bar_rect.position.x, split_bar_rect.position.y - split_bar_offset + drag_area_offset, split_bar_rect.size.x, dragger_ctrl_size));
  217. dragging_area_control->split_bar_rect = Rect2(Vector2(0.0, int(split_bar_offset) - drag_area_offset), split_bar_rect.size);
  218. } else {
  219. Rect2 split_bar_rect = Rect2(computed_split_offset, drag_area_margin_begin, sep, get_size().height - drag_area_margin_begin - drag_area_margin_end);
  220. dragging_area_control->set_rect(Rect2(split_bar_rect.position.x - split_bar_offset + drag_area_offset * (is_rtl ? -1 : 1), split_bar_rect.position.y, dragger_ctrl_size, split_bar_rect.size.y));
  221. dragging_area_control->split_bar_rect = Rect2(Vector2(int(split_bar_offset) - drag_area_offset * (is_rtl ? -1 : 1), 0.0), split_bar_rect.size);
  222. }
  223. queue_redraw();
  224. dragging_area_control->queue_redraw();
  225. }
  226. Size2 SplitContainer::get_minimum_size() const {
  227. Size2i minimum;
  228. int sep = _get_separation();
  229. for (int i = 0; i < 2; i++) {
  230. Control *child = _get_sortable_child(i, SortableVisbilityMode::VISIBLE);
  231. if (!child) {
  232. break;
  233. }
  234. if (i == 1) {
  235. if (vertical) {
  236. minimum.height += sep;
  237. } else {
  238. minimum.width += sep;
  239. }
  240. }
  241. Size2 ms = child->get_combined_minimum_size();
  242. if (vertical) {
  243. minimum.height += ms.height;
  244. minimum.width = MAX(minimum.width, ms.width);
  245. } else {
  246. minimum.width += ms.width;
  247. minimum.height = MAX(minimum.height, ms.height);
  248. }
  249. }
  250. return minimum;
  251. }
  252. void SplitContainer::_validate_property(PropertyInfo &p_property) const {
  253. if (is_fixed && p_property.name == "vertical") {
  254. p_property.usage = PROPERTY_USAGE_NONE;
  255. }
  256. }
  257. void SplitContainer::_notification(int p_what) {
  258. switch (p_what) {
  259. case NOTIFICATION_TRANSLATION_CHANGED:
  260. case NOTIFICATION_LAYOUT_DIRECTION_CHANGED: {
  261. queue_sort();
  262. } break;
  263. case NOTIFICATION_SORT_CHILDREN: {
  264. _resort();
  265. } break;
  266. case NOTIFICATION_THEME_CHANGED: {
  267. update_minimum_size();
  268. } break;
  269. }
  270. }
  271. void SplitContainer::set_split_offset(int p_offset) {
  272. if (split_offset == p_offset) {
  273. return;
  274. }
  275. split_offset = p_offset;
  276. queue_sort();
  277. }
  278. int SplitContainer::get_split_offset() const {
  279. return split_offset;
  280. }
  281. void SplitContainer::clamp_split_offset() {
  282. if (!_get_sortable_child(0) || !_get_sortable_child(1)) {
  283. return;
  284. }
  285. _compute_split_offset(true);
  286. queue_sort();
  287. }
  288. void SplitContainer::set_collapsed(bool p_collapsed) {
  289. if (collapsed == p_collapsed) {
  290. return;
  291. }
  292. collapsed = p_collapsed;
  293. queue_sort();
  294. }
  295. void SplitContainer::set_dragger_visibility(DraggerVisibility p_visibility) {
  296. if (dragger_visibility == p_visibility) {
  297. return;
  298. }
  299. dragger_visibility = p_visibility;
  300. queue_sort();
  301. }
  302. SplitContainer::DraggerVisibility SplitContainer::get_dragger_visibility() const {
  303. return dragger_visibility;
  304. }
  305. bool SplitContainer::is_collapsed() const {
  306. return collapsed;
  307. }
  308. void SplitContainer::set_vertical(bool p_vertical) {
  309. ERR_FAIL_COND_MSG(is_fixed, "Can't change orientation of " + get_class() + ".");
  310. vertical = p_vertical;
  311. update_minimum_size();
  312. _resort();
  313. }
  314. bool SplitContainer::is_vertical() const {
  315. return vertical;
  316. }
  317. void SplitContainer::set_dragging_enabled(bool p_enabled) {
  318. if (dragging_enabled == p_enabled) {
  319. return;
  320. }
  321. dragging_enabled = p_enabled;
  322. if (!dragging_enabled && dragging_area_control->dragging) {
  323. dragging_area_control->dragging = false;
  324. // queue_redraw() is called by _resort().
  325. emit_signal(SNAME("drag_ended"));
  326. }
  327. if (get_viewport()) {
  328. get_viewport()->update_mouse_cursor_state();
  329. }
  330. _resort();
  331. }
  332. bool SplitContainer::is_dragging_enabled() const {
  333. return dragging_enabled;
  334. }
  335. Vector<int> SplitContainer::get_allowed_size_flags_horizontal() const {
  336. Vector<int> flags;
  337. flags.append(SIZE_FILL);
  338. if (!vertical) {
  339. flags.append(SIZE_EXPAND);
  340. }
  341. flags.append(SIZE_SHRINK_BEGIN);
  342. flags.append(SIZE_SHRINK_CENTER);
  343. flags.append(SIZE_SHRINK_END);
  344. return flags;
  345. }
  346. Vector<int> SplitContainer::get_allowed_size_flags_vertical() const {
  347. Vector<int> flags;
  348. flags.append(SIZE_FILL);
  349. if (vertical) {
  350. flags.append(SIZE_EXPAND);
  351. }
  352. flags.append(SIZE_SHRINK_BEGIN);
  353. flags.append(SIZE_SHRINK_CENTER);
  354. flags.append(SIZE_SHRINK_END);
  355. return flags;
  356. }
  357. void SplitContainer::set_drag_area_margin_begin(int p_margin) {
  358. if (drag_area_margin_begin == p_margin) {
  359. return;
  360. }
  361. drag_area_margin_begin = p_margin;
  362. queue_sort();
  363. }
  364. int SplitContainer::get_drag_area_margin_begin() const {
  365. return drag_area_margin_begin;
  366. }
  367. void SplitContainer::set_drag_area_margin_end(int p_margin) {
  368. if (drag_area_margin_end == p_margin) {
  369. return;
  370. }
  371. drag_area_margin_end = p_margin;
  372. queue_sort();
  373. }
  374. int SplitContainer::get_drag_area_margin_end() const {
  375. return drag_area_margin_end;
  376. }
  377. void SplitContainer::set_drag_area_offset(int p_offset) {
  378. if (drag_area_offset == p_offset) {
  379. return;
  380. }
  381. drag_area_offset = p_offset;
  382. queue_sort();
  383. }
  384. int SplitContainer::get_drag_area_offset() const {
  385. return drag_area_offset;
  386. }
  387. void SplitContainer::set_show_drag_area_enabled(bool p_enabled) {
  388. show_drag_area = p_enabled;
  389. dragging_area_control->queue_redraw();
  390. }
  391. bool SplitContainer::is_show_drag_area_enabled() const {
  392. return show_drag_area;
  393. }
  394. void SplitContainer::_bind_methods() {
  395. ClassDB::bind_method(D_METHOD("set_split_offset", "offset"), &SplitContainer::set_split_offset);
  396. ClassDB::bind_method(D_METHOD("get_split_offset"), &SplitContainer::get_split_offset);
  397. ClassDB::bind_method(D_METHOD("clamp_split_offset"), &SplitContainer::clamp_split_offset);
  398. ClassDB::bind_method(D_METHOD("set_collapsed", "collapsed"), &SplitContainer::set_collapsed);
  399. ClassDB::bind_method(D_METHOD("is_collapsed"), &SplitContainer::is_collapsed);
  400. ClassDB::bind_method(D_METHOD("set_dragger_visibility", "mode"), &SplitContainer::set_dragger_visibility);
  401. ClassDB::bind_method(D_METHOD("get_dragger_visibility"), &SplitContainer::get_dragger_visibility);
  402. ClassDB::bind_method(D_METHOD("set_vertical", "vertical"), &SplitContainer::set_vertical);
  403. ClassDB::bind_method(D_METHOD("is_vertical"), &SplitContainer::is_vertical);
  404. ClassDB::bind_method(D_METHOD("set_dragging_enabled", "dragging_enabled"), &SplitContainer::set_dragging_enabled);
  405. ClassDB::bind_method(D_METHOD("is_dragging_enabled"), &SplitContainer::is_dragging_enabled);
  406. ClassDB::bind_method(D_METHOD("set_drag_area_margin_begin", "margin"), &SplitContainer::set_drag_area_margin_begin);
  407. ClassDB::bind_method(D_METHOD("get_drag_area_margin_begin"), &SplitContainer::get_drag_area_margin_begin);
  408. ClassDB::bind_method(D_METHOD("set_drag_area_margin_end", "margin"), &SplitContainer::set_drag_area_margin_end);
  409. ClassDB::bind_method(D_METHOD("get_drag_area_margin_end"), &SplitContainer::get_drag_area_margin_end);
  410. ClassDB::bind_method(D_METHOD("set_drag_area_offset", "offset"), &SplitContainer::set_drag_area_offset);
  411. ClassDB::bind_method(D_METHOD("get_drag_area_offset"), &SplitContainer::get_drag_area_offset);
  412. ClassDB::bind_method(D_METHOD("set_drag_area_highlight_in_editor", "drag_area_highlight_in_editor"), &SplitContainer::set_show_drag_area_enabled);
  413. ClassDB::bind_method(D_METHOD("is_drag_area_highlight_in_editor_enabled"), &SplitContainer::is_show_drag_area_enabled);
  414. ClassDB::bind_method(D_METHOD("get_drag_area_control"), &SplitContainer::get_drag_area_control);
  415. ADD_SIGNAL(MethodInfo("dragged", PropertyInfo(Variant::INT, "offset")));
  416. ADD_SIGNAL(MethodInfo("drag_started"));
  417. ADD_SIGNAL(MethodInfo("drag_ended"));
  418. ADD_PROPERTY(PropertyInfo(Variant::INT, "split_offset", PROPERTY_HINT_NONE, "suffix:px"), "set_split_offset", "get_split_offset");
  419. ADD_PROPERTY(PropertyInfo(Variant::BOOL, "collapsed"), "set_collapsed", "is_collapsed");
  420. ADD_PROPERTY(PropertyInfo(Variant::BOOL, "dragging_enabled"), "set_dragging_enabled", "is_dragging_enabled");
  421. ADD_PROPERTY(PropertyInfo(Variant::INT, "dragger_visibility", PROPERTY_HINT_ENUM, "Visible,Hidden,Hidden and Collapsed"), "set_dragger_visibility", "get_dragger_visibility");
  422. ADD_PROPERTY(PropertyInfo(Variant::BOOL, "vertical"), "set_vertical", "is_vertical");
  423. ADD_GROUP("Drag Area", "drag_area_");
  424. ADD_PROPERTY(PropertyInfo(Variant::INT, "drag_area_margin_begin", PROPERTY_HINT_NONE, "suffix:px"), "set_drag_area_margin_begin", "get_drag_area_margin_begin");
  425. ADD_PROPERTY(PropertyInfo(Variant::INT, "drag_area_margin_end", PROPERTY_HINT_NONE, "suffix:px"), "set_drag_area_margin_end", "get_drag_area_margin_end");
  426. ADD_PROPERTY(PropertyInfo(Variant::INT, "drag_area_offset", PROPERTY_HINT_NONE, "suffix:px"), "set_drag_area_offset", "get_drag_area_offset");
  427. ADD_PROPERTY(PropertyInfo(Variant::BOOL, "drag_area_highlight_in_editor"), "set_drag_area_highlight_in_editor", "is_drag_area_highlight_in_editor_enabled");
  428. BIND_ENUM_CONSTANT(DRAGGER_VISIBLE);
  429. BIND_ENUM_CONSTANT(DRAGGER_HIDDEN);
  430. BIND_ENUM_CONSTANT(DRAGGER_HIDDEN_COLLAPSED);
  431. BIND_THEME_ITEM(Theme::DATA_TYPE_CONSTANT, SplitContainer, separation);
  432. BIND_THEME_ITEM(Theme::DATA_TYPE_CONSTANT, SplitContainer, minimum_grab_thickness);
  433. BIND_THEME_ITEM(Theme::DATA_TYPE_CONSTANT, SplitContainer, autohide);
  434. BIND_THEME_ITEM_CUSTOM(Theme::DATA_TYPE_ICON, SplitContainer, grabber_icon, "grabber");
  435. BIND_THEME_ITEM_CUSTOM(Theme::DATA_TYPE_ICON, SplitContainer, grabber_icon_h, "h_grabber");
  436. BIND_THEME_ITEM_CUSTOM(Theme::DATA_TYPE_ICON, SplitContainer, grabber_icon_v, "v_grabber");
  437. BIND_THEME_ITEM_CUSTOM(Theme::DATA_TYPE_STYLEBOX, SplitContainer, split_bar_background, "split_bar_background");
  438. }
  439. SplitContainer::SplitContainer(bool p_vertical) {
  440. vertical = p_vertical;
  441. dragging_area_control = memnew(SplitContainerDragger);
  442. add_child(dragging_area_control, false, Node::INTERNAL_MODE_BACK);
  443. }