MCPcopy Create free account
hub / github.com/Redot-Engine/redot-engine / ScreenSelect

Method ScreenSelect

editor/gui/window_wrapper.cpp:497–538  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

495}
496
497ScreenSelect::ScreenSelect() {
498 set_button_mask(MouseButtonMask::RIGHT);
499 set_theme_type_variation(SceneStringName(FlatButton));
500 set_toggle_mode(true);
501 set_focus_mode(FOCUS_NONE);
502 set_action_mode(ACTION_MODE_BUTTON_PRESS);
503
504 if (!EditorNode::get_singleton()->is_multi_window_enabled()) {
505 set_disabled(true);
506 set_tooltip_text(EditorNode::get_singleton()->get_multiwindow_support_tooltip_text());
507 } else {
508 set_tooltip_text(TTR("Make this panel floating.") + "\n" + TTR("Right-click to open the screen selector."));
509 }
510
511 // Create the popup.
512 const Size2 borders = Size2(4, 4) * EDSCALE;
513
514 popup = memnew(PopupPanel);
515 popup->connect("popup_hide", callable_mp(static_cast<BaseButton *>(this), &ScreenSelect::set_pressed).bind(false));
516 add_child(popup);
517
518 MarginContainer *popup_root = memnew(MarginContainer);
519 popup_root->add_theme_constant_override("margin_right", borders.width);
520 popup_root->add_theme_constant_override("margin_top", borders.height);
521 popup_root->add_theme_constant_override("margin_left", borders.width);
522 popup_root->add_theme_constant_override("margin_bottom", borders.height);
523 popup->add_child(popup_root);
524
525 VBoxContainer *vb = memnew(VBoxContainer);
526 vb->set_alignment(BoxContainer::ALIGNMENT_CENTER);
527 popup_root->add_child(vb);
528
529 Label *description = memnew(Label(TTR("Select Screen")));
530 description->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER);
531 vb->add_child(description);
532
533 screen_list = memnew(HBoxContainer);
534 screen_list->set_alignment(BoxContainer::ALIGNMENT_CENTER);
535 vb->add_child(screen_list);
536
537 popup_root->set_anchors_and_offsets_preset(PRESET_FULL_RECT);
538}

Callers

nothing calls this directly

Calls 11

TTRFunction · 0.85
LabelClass · 0.70
connectMethod · 0.65
bindMethod · 0.45
add_childMethod · 0.45
set_alignmentMethod · 0.45

Tested by

no test coverage detected