本文整理汇总了C++中HBoxContainer::set_h_size_flags方法的典型用法代码示例。如果您正苦于以下问题:C++ HBoxContainer::set_h_size_flags方法的具体用法?C++ HBoxContainer::set_h_size_flags怎么用?C++ HBoxContainer::set_h_size_flags使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HBoxContainer
的用法示例。
在下文中一共展示了HBoxContainer::set_h_size_flags方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: memnew
ItemListEditor::ItemListEditor() {
selected_idx=-1;
add_child( memnew( VSeparator ) );
toolbar_button = memnew( ToolButton );
toolbar_button->set_text(TTR("Items"));
add_child(toolbar_button);
toolbar_button->connect("pressed",this,"_edit_items");
dialog = memnew( AcceptDialog );
dialog->set_title(TTR("Item List Editor"));
add_child( dialog );
VBoxContainer *vbc = memnew( VBoxContainer );
dialog->add_child(vbc);
dialog->set_child_rect(vbc);
HBoxContainer *hbc = memnew( HBoxContainer );
hbc->set_h_size_flags(SIZE_EXPAND_FILL);
vbc->add_child(hbc);
add_button = memnew( Button );
add_button->set_text(TTR("Add"));
hbc->add_child(add_button);
add_button->connect("pressed",this,"_add_button");
hbc->add_spacer();
del_button = memnew( Button );
del_button->set_text(TTR("Delete"));
hbc->add_child(del_button);
del_button->connect("pressed",this,"_delete_button");
property_editor = memnew( PropertyEditor );
property_editor->hide_top_label();
property_editor->set_subsection_selectable(true);
vbc->add_child(property_editor);
property_editor->set_v_size_flags(SIZE_EXPAND_FILL);
tree = property_editor->get_scene_tree();
}
示例2: base
GridMapEditor::GridMapEditor(EditorNode *p_editor) {
input_action=INPUT_NONE;
editor=p_editor;
undo_redo=p_editor->get_undo_redo();
int mw = EDITOR_DEF("editors/grid_map/palette_min_width",230);
Control *ec = memnew( Control);
ec->set_custom_minimum_size(Size2(mw,0));
add_child(ec);
spatial_editor_hb = memnew( HBoxContainer );
SpatialEditor::get_singleton()->add_control_to_menu_panel(spatial_editor_hb);
options = memnew( MenuButton );
spatial_editor_hb->add_child(options);
spatial_editor_hb->hide();
options->set_text("Grid");
options->get_popup()->add_check_item("Snap View",MENU_OPTION_LOCK_VIEW);
options->get_popup()->add_separator();
options->get_popup()->add_item("Prev Level ("+keycode_get_string(KEY_MASK_CMD)+"Down Wheel)",MENU_OPTION_PREV_LEVEL);
options->get_popup()->add_item("Next Level ("+keycode_get_string(KEY_MASK_CMD)+"Up Wheel)",MENU_OPTION_NEXT_LEVEL);
options->get_popup()->add_separator();
options->get_popup()->add_check_item("Clip Disabled",MENU_OPTION_CLIP_DISABLED);
options->get_popup()->set_item_checked( options->get_popup()->get_item_index(MENU_OPTION_CLIP_DISABLED), true );
options->get_popup()->add_check_item("Clip Above",MENU_OPTION_CLIP_ABOVE);
options->get_popup()->add_check_item("Clip Below",MENU_OPTION_CLIP_BELOW);
options->get_popup()->add_separator();
options->get_popup()->add_check_item("Edit X Axis",MENU_OPTION_X_AXIS,KEY_Z);
options->get_popup()->add_check_item("Edit Y Axis",MENU_OPTION_Y_AXIS,KEY_X);
options->get_popup()->add_check_item("Edit Z Axis",MENU_OPTION_Z_AXIS,KEY_C);
options->get_popup()->set_item_checked( options->get_popup()->get_item_index(MENU_OPTION_Y_AXIS), true );
options->get_popup()->add_separator();
options->get_popup()->add_item("Cursor Rotate X",MENU_OPTION_CURSOR_ROTATE_X,KEY_A);
options->get_popup()->add_item("Cursor Rotate Y",MENU_OPTION_CURSOR_ROTATE_Y,KEY_S);
options->get_popup()->add_item("Cursor Rotate Z",MENU_OPTION_CURSOR_ROTATE_Z,KEY_D);
options->get_popup()->add_item("Cursor Back Rotate X",MENU_OPTION_CURSOR_BACK_ROTATE_X,KEY_MASK_SHIFT+KEY_A);
options->get_popup()->add_item("Cursor Back Rotate Y",MENU_OPTION_CURSOR_BACK_ROTATE_Y,KEY_MASK_SHIFT+KEY_S);
options->get_popup()->add_item("Cursor Back Rotate Z",MENU_OPTION_CURSOR_BACK_ROTATE_Z,KEY_MASK_SHIFT+KEY_D);
options->get_popup()->add_item("Cursor Clear Rotation",MENU_OPTION_CURSOR_CLEAR_ROTATION,KEY_W);
options->get_popup()->add_separator();
options->get_popup()->add_check_item("Duplicate Selects",MENU_OPTION_DUPLICATE_SELECTS);
options->get_popup()->add_separator();
options->get_popup()->add_item("Create Area",MENU_OPTION_SELECTION_MAKE_AREA,KEY_CONTROL+KEY_C);
options->get_popup()->add_item("Create Exterior Connector",MENU_OPTION_SELECTION_MAKE_EXTERIOR_CONNECTOR);
options->get_popup()->add_item("Erase Area",MENU_OPTION_REMOVE_AREA);
options->get_popup()->add_separator();
options->get_popup()->add_item("Selection -> Duplicate",MENU_OPTION_SELECTION_DUPLICATE,KEY_MASK_SHIFT+KEY_INSERT);
options->get_popup()->add_item("Selection -> Clear",MENU_OPTION_SELECTION_CLEAR,KEY_MASK_SHIFT+KEY_DELETE);
//options->get_popup()->add_separator();
//options->get_popup()->add_item("Configure",MENU_OPTION_CONFIGURE);
options->get_popup()->add_separator();
options->get_popup()->add_item("Settings", MENU_OPTION_GRIDMAP_SETTINGS);
settings_dialog = memnew(ConfirmationDialog);
settings_dialog->set_title("GridMap Settings");
add_child(settings_dialog);
settings_vbc = memnew(VBoxContainer);
settings_vbc->set_custom_minimum_size(Size2(200, 0));
settings_dialog->add_child(settings_vbc);
settings_pick_distance = memnew(SpinBox);
settings_pick_distance->set_max(10000.0f);
settings_pick_distance->set_min(500.0f);
settings_pick_distance->set_step(1.0f);
settings_pick_distance->set_value(EDITOR_DEF("editors/grid_map/pick_distance", 5000.0));
settings_vbc->add_margin_child("Pick Distance:", settings_pick_distance);
clip_mode=CLIP_DISABLED;
options->get_popup()->connect("id_pressed", this,"_menu_option");
HBoxContainer *hb = memnew( HBoxContainer );
add_child(hb);
hb->set_h_size_flags(SIZE_EXPAND_FILL);
edit_mode = memnew(OptionButton);
edit_mode->set_area_as_parent_rect();
edit_mode->set_anchor_and_margin(MARGIN_BOTTOM,ANCHOR_BEGIN,24);
edit_mode->set_anchor_and_margin(MARGIN_RIGHT,ANCHOR_END,14);
edit_mode->add_item("Tiles");
edit_mode->add_item("Areas");
hb->add_child(edit_mode);
edit_mode->set_h_size_flags(SIZE_EXPAND_FILL);
mode_thumbnail = memnew( ToolButton );
mode_thumbnail->set_toggle_mode(true);
mode_thumbnail->set_pressed(true);
mode_thumbnail->set_icon(p_editor->get_gui_base()->get_icon("FileThumbnail","EditorIcons"));
hb->add_child(mode_thumbnail);
mode_thumbnail->connect("pressed", this, "_set_display_mode", varray(DISPLAY_THUMBNAIL));
mode_list = memnew( ToolButton );
mode_list->set_toggle_mode(true);
mode_list->set_pressed(false);
mode_list->set_icon(p_editor->get_gui_base()->get_icon("FileList", "EditorIcons"));
hb->add_child(mode_list);
mode_list->connect("pressed", this, "_set_display_mode", varray(DISPLAY_LIST));
//.........这里部分代码省略.........
示例3: memnew
EditorSettingsDialog::EditorSettingsDialog() {
set_title(TTR("Editor Settings"));
set_resizable(true);
undo_redo = memnew(UndoRedo);
tabs = memnew(TabContainer);
tabs->set_tab_align(TabContainer::ALIGN_LEFT);
tabs->connect("tab_changed", this, "_tabs_tab_changed");
add_child(tabs);
//set_child_rect(tabs);
// General Tab
tab_general = memnew(VBoxContainer);
tabs->add_child(tab_general);
tab_general->set_name(TTR("General"));
HBoxContainer *hbc = memnew(HBoxContainer);
hbc->set_h_size_flags(Control::SIZE_EXPAND_FILL);
tab_general->add_child(hbc);
search_box = memnew(LineEdit);
search_box->set_h_size_flags(Control::SIZE_EXPAND_FILL);
hbc->add_child(search_box);
inspector = memnew(SectionedInspector);
//inspector->hide_top_label();
inspector->get_inspector()->set_use_filter(true);
inspector->register_search_box(search_box);
inspector->set_v_size_flags(Control::SIZE_EXPAND_FILL);
inspector->get_inspector()->set_undo_redo(undo_redo);
tab_general->add_child(inspector);
inspector->get_inspector()->connect("property_edited", this, "_settings_property_edited");
inspector->get_inspector()->connect("restart_requested", this, "_editor_restart_request");
restart_container = memnew(PanelContainer);
tab_general->add_child(restart_container);
HBoxContainer *restart_hb = memnew(HBoxContainer);
restart_container->add_child(restart_hb);
restart_icon = memnew(TextureRect);
restart_icon->set_v_size_flags(SIZE_SHRINK_CENTER);
restart_hb->add_child(restart_icon);
restart_label = memnew(Label);
restart_label->set_text(TTR("Editor must be restarted for changes to take effect"));
restart_hb->add_child(restart_label);
restart_hb->add_spacer();
Button *restart_button = memnew(Button);
restart_button->connect("pressed", this, "_editor_restart");
restart_hb->add_child(restart_button);
restart_button->set_text(TTR("Save & Restart"));
restart_close_button = memnew(ToolButton);
restart_close_button->connect("pressed", this, "_editor_restart_close");
restart_hb->add_child(restart_close_button);
restart_container->hide();
// Shortcuts Tab
tab_shortcuts = memnew(VBoxContainer);
tabs->add_child(tab_shortcuts);
tab_shortcuts->set_name(TTR("Shortcuts"));
hbc = memnew(HBoxContainer);
hbc->set_h_size_flags(Control::SIZE_EXPAND_FILL);
tab_shortcuts->add_child(hbc);
shortcut_search_box = memnew(LineEdit);
shortcut_search_box->set_h_size_flags(Control::SIZE_EXPAND_FILL);
hbc->add_child(shortcut_search_box);
shortcut_search_box->connect("text_changed", this, "_filter_shortcuts");
shortcuts = memnew(Tree);
tab_shortcuts->add_child(shortcuts, true);
shortcuts->set_v_size_flags(SIZE_EXPAND_FILL);
shortcuts->set_columns(2);
shortcuts->set_hide_root(true);
//shortcuts->set_hide_folding(true);
shortcuts->set_column_titles_visible(true);
shortcuts->set_column_title(0, TTR("Name"));
shortcuts->set_column_title(1, TTR("Binding"));
shortcuts->connect("button_pressed", this, "_shortcut_button_pressed");
press_a_key = memnew(ConfirmationDialog);
press_a_key->set_focus_mode(FOCUS_ALL);
add_child(press_a_key);
Label *l = memnew(Label);
l->set_text(TTR("Press a Key..."));
l->set_anchors_and_margins_preset(Control::PRESET_WIDE);
l->set_align(Label::ALIGN_CENTER);
l->set_margin(MARGIN_TOP, 20);
l->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_BEGIN, 30);
press_a_key_label = l;
press_a_key->add_child(l);
press_a_key->connect("gui_input", this, "_wait_for_key");
press_a_key->connect("confirmed", this, "_press_a_key_confirm");
//get_ok()->set_text("Apply");
set_hide_on_ok(true);
//get_cancel()->set_text("Close");
//.........这里部分代码省略.........
示例4: memnew
TileMapEditor::TileMapEditor(EditorNode *p_editor) {
node=NULL;
canvas_item_editor=NULL;
editor=p_editor;
undo_redo = editor->get_undo_redo();
int mw = EDITOR_DEF("tile_map/palette_min_width",80);
Control *ec = memnew( Control);
ec->set_custom_minimum_size(Size2(mw,0));
add_child(ec);
HBoxContainer *hb = memnew( HBoxContainer );
add_child(hb);
hb->set_h_size_flags(SIZE_EXPAND_FILL);
hb->add_spacer(true);
button_thumbnail = memnew( ToolButton );
button_thumbnail->set_toggle_mode(true);
button_thumbnail->set_pressed(true);
button_thumbnail->set_icon(p_editor->get_gui_base()->get_icon("FileThumbnail","EditorIcons"));
hb->add_child(button_thumbnail);
button_thumbnail->connect("pressed", this, "_set_display_mode", varray(DISPLAY_THUMBNAIL));
button_list = memnew( ToolButton );
button_list->set_toggle_mode(true);
button_list->set_pressed(false);
button_list->set_icon(p_editor->get_gui_base()->get_icon("FileList","EditorIcons"));
hb->add_child(button_list);
button_list->connect("pressed", this, "_set_display_mode", varray(DISPLAY_LIST));
// Add tile palette
palette = memnew( ItemList );
palette->set_v_size_flags(SIZE_EXPAND_FILL);
add_child(palette);
// Add menu items
canvas_item_editor_hb = memnew( HBoxContainer );
CanvasItemEditor::get_singleton()->add_control_to_menu_panel(canvas_item_editor_hb);
canvas_item_editor_hb->add_child( memnew( VSeparator ));
transpose = memnew( ToolButton );
transpose->set_toggle_mode(true);
transpose->set_tooltip("Transpose");
transpose->set_focus_mode(FOCUS_NONE);
transpose->connect("pressed", this, "_update_transform_buttons", make_binds(transpose));
canvas_item_editor_hb->add_child(transpose);
mirror_x = memnew( ToolButton );
mirror_x->set_toggle_mode(true);
mirror_x->set_tooltip("Mirror X (A)");
mirror_x->set_focus_mode(FOCUS_NONE);
mirror_x->connect("pressed", this, "_update_transform_buttons", make_binds(mirror_x));
canvas_item_editor_hb->add_child(mirror_x);
mirror_y = memnew( ToolButton );
mirror_y->set_toggle_mode(true);
mirror_y->set_tooltip("Mirror Y (S)");
mirror_y->set_focus_mode(FOCUS_NONE);
mirror_y->connect("pressed", this, "_update_transform_buttons", make_binds(mirror_y));
canvas_item_editor_hb->add_child(mirror_y);
canvas_item_editor_hb->add_child(memnew(VSeparator));
rotate_0 = memnew( ToolButton );
rotate_0->set_toggle_mode(true);
rotate_0->set_tooltip("Rotate 0 degrees");
rotate_0->set_focus_mode(FOCUS_NONE);
rotate_0->connect("pressed", this, "_update_transform_buttons", make_binds(rotate_0));
canvas_item_editor_hb->add_child(rotate_0);
rotate_90 = memnew( ToolButton );
rotate_90->set_toggle_mode(true);
rotate_90->set_tooltip("Rotate 90 degrees");
rotate_90->set_focus_mode(FOCUS_NONE);
rotate_90->connect("pressed", this, "_update_transform_buttons", make_binds(rotate_90));
canvas_item_editor_hb->add_child(rotate_90);
rotate_180 = memnew( ToolButton );
rotate_180->set_toggle_mode(true);
rotate_180->set_tooltip("Rotate 180 degrees");
rotate_180->set_focus_mode(FOCUS_NONE);
rotate_180->connect("pressed", this, "_update_transform_buttons", make_binds(rotate_180));
canvas_item_editor_hb->add_child(rotate_180);
rotate_270 = memnew( ToolButton );
rotate_270->set_toggle_mode(true);
rotate_270->set_tooltip("Rotate 270 degrees");
rotate_270->set_focus_mode(FOCUS_NONE);
rotate_270->connect("pressed", this, "_update_transform_buttons", make_binds(rotate_270));
canvas_item_editor_hb->add_child(rotate_270);
canvas_item_editor_hb->hide();
rotate_0->set_pressed(true);
tool=TOOL_NONE;
selection_active=false;
mouse_over=false;
}
示例5: memnew
GroupDialog::GroupDialog() {
scene_tree = SceneTree::get_singleton();
VBoxContainer *vbc = memnew(VBoxContainer);
add_child(vbc);
HBoxContainer *hbc = memnew(HBoxContainer);
vbc->add_child(hbc);
hbc->set_v_size_flags(SIZE_EXPAND_FILL);
VBoxContainer *vbc_left = memnew(VBoxContainer);
hbc->add_child(vbc_left);
vbc_left->set_h_size_flags(SIZE_EXPAND_FILL);
Label *group_title = memnew(Label);
group_title->set_text(TTR("Groups"));
vbc_left->add_child(group_title);
groups = memnew(Tree);
vbc_left->add_child(groups);
groups->set_hide_root(true);
groups->set_v_size_flags(SIZE_EXPAND_FILL);
groups->set_select_mode(Tree::SELECT_SINGLE);
groups->set_allow_reselect(true);
groups->set_allow_rmb_select(true);
groups->connect("item_selected", this, "_group_selected");
groups->connect("button_pressed", this, "_delete_group_pressed");
groups->connect("item_edited", this, "_group_renamed");
HBoxContainer *chbc = memnew(HBoxContainer);
vbc_left->add_child(chbc);
chbc->set_h_size_flags(SIZE_EXPAND_FILL);
add_group_text = memnew(LineEdit);
chbc->add_child(add_group_text);
add_group_text->set_h_size_flags(SIZE_EXPAND_FILL);
Button *add_group_button = memnew(Button);
add_group_button->set_text("Add");
chbc->add_child(add_group_button);
add_group_button->connect("pressed", this, "_add_group_pressed");
VBoxContainer *vbc_add = memnew(VBoxContainer);
hbc->add_child(vbc_add);
vbc_add->set_h_size_flags(SIZE_EXPAND_FILL);
Label *out_of_group_title = memnew(Label);
out_of_group_title->set_text(TTR("Nodes not in Group"));
vbc_add->add_child(out_of_group_title);
nodes_to_add = memnew(Tree);
vbc_add->add_child(nodes_to_add);
nodes_to_add->set_hide_root(true);
nodes_to_add->set_hide_folding(true);
nodes_to_add->set_v_size_flags(SIZE_EXPAND_FILL);
nodes_to_add->set_select_mode(Tree::SELECT_MULTI);
nodes_to_add->connect("item_selected", this, "_nodes_to_add_selected");
HBoxContainer *add_filter_hbc = memnew(HBoxContainer);
add_filter_hbc->add_constant_override("separate", 0);
vbc_add->add_child(add_filter_hbc);
add_filter = memnew(LineEdit);
add_filter->set_h_size_flags(SIZE_EXPAND_FILL);
add_filter->set_placeholder(TTR("Filter nodes"));
add_filter_hbc->add_child(add_filter);
add_filter->connect("text_changed", this, "_add_filter_changed");
VBoxContainer *vbc_buttons = memnew(VBoxContainer);
hbc->add_child(vbc_buttons);
vbc_buttons->set_h_size_flags(SIZE_SHRINK_CENTER);
vbc_buttons->set_v_size_flags(SIZE_SHRINK_CENTER);
add_button = memnew(ToolButton);
add_button->set_text(TTR("Add"));
add_button->connect("pressed", this, "_add_pressed");
vbc_buttons->add_child(add_button);
vbc_buttons->add_spacer();
vbc_buttons->add_spacer();
vbc_buttons->add_spacer();
remove_button = memnew(ToolButton);
remove_button->set_text(TTR("Remove"));
remove_button->connect("pressed", this, "_removed_pressed");
vbc_buttons->add_child(remove_button);
VBoxContainer *vbc_remove = memnew(VBoxContainer);
hbc->add_child(vbc_remove);
vbc_remove->set_h_size_flags(SIZE_EXPAND_FILL);
Label *in_group_title = memnew(Label);
in_group_title->set_text(TTR("Nodes in Group"));
vbc_remove->add_child(in_group_title);
nodes_to_remove = memnew(Tree);
vbc_remove->add_child(nodes_to_remove);
nodes_to_remove->set_v_size_flags(SIZE_EXPAND_FILL);
//.........这里部分代码省略.........
示例6: memnew
EditorAbout::EditorAbout() {
set_title(TTR("Thanks from the Godot community!"));
get_ok()->set_text(TTR("Thanks!"));
set_hide_on_ok(true);
set_resizable(true);
VBoxContainer *vbc = memnew(VBoxContainer);
HBoxContainer *hbc = memnew(HBoxContainer);
hbc->set_h_size_flags(Control::SIZE_EXPAND_FILL);
hbc->set_alignment(BoxContainer::ALIGN_CENTER);
hbc->add_constant_override("separation", 30 * EDSCALE);
add_child(vbc);
vbc->add_child(hbc);
_logo = memnew(TextureRect);
hbc->add_child(_logo);
String hash = String(VERSION_HASH);
if (hash.length() != 0)
hash = "." + hash.left(7);
Label *about_text = memnew(Label);
about_text->set_v_size_flags(Control::SIZE_SHRINK_CENTER);
about_text->set_text(VERSION_FULL_NAME + hash + String::utf8("\n\u00A9 2007-2017 Juan Linietsky, Ariel Manzur.\n\u00A9 2014-2017 ") +
TTR("Godot Engine contributors") + "\n");
hbc->add_child(about_text);
TabContainer *tc = memnew(TabContainer);
tc->set_custom_minimum_size(Size2(630, 240) * EDSCALE);
tc->set_v_size_flags(Control::SIZE_EXPAND_FILL);
vbc->add_child(tc);
// Authors
List<String> dev_sections;
dev_sections.push_back(TTR("Project Founders"));
dev_sections.push_back(TTR("Lead Developer"));
dev_sections.push_back(TTR("Project Manager"));
dev_sections.push_back(TTR("Developers"));
const char **dev_src[] = { dev_founders, dev_lead, dev_manager, dev_names };
tc->add_child(_populate_list(TTR("Authors"), dev_sections, dev_src));
// Donors
List<String> donor_sections;
donor_sections.push_back(TTR("Platinum Sponsors"));
donor_sections.push_back(TTR("Gold Sponsors"));
donor_sections.push_back(TTR("Mini Sponsors"));
donor_sections.push_back(TTR("Gold Donors"));
donor_sections.push_back(TTR("Silver Donors"));
donor_sections.push_back(TTR("Bronze Donors"));
const char **donor_src[] = { donor_s_plat, donor_s_gold, donor_s_mini, donor_gold, donor_silver, donor_bronze };
tc->add_child(_populate_list(TTR("Donors"), donor_sections, donor_src));
// License
TextEdit *license = memnew(TextEdit);
license->set_name(TTR("License"));
license->set_h_size_flags(Control::SIZE_EXPAND_FILL);
license->set_v_size_flags(Control::SIZE_EXPAND_FILL);
license->set_wrap(true);
license->set_readonly(true);
license->set_text(String::utf8(about_license));
tc->add_child(license);
// Thirdparty License
VBoxContainer *license_thirdparty = memnew(VBoxContainer);
license_thirdparty->set_name(TTR("Thirdparty License"));
license_thirdparty->set_h_size_flags(Control::SIZE_EXPAND_FILL);
tc->add_child(license_thirdparty);
Label *tpl_label = memnew(Label);
tpl_label->set_h_size_flags(Control::SIZE_EXPAND_FILL);
tpl_label->set_autowrap(true);
tpl_label->set_text(TTR("Godot Engine relies on a number of thirdparty free and open source libraries, all compatible with the terms of its MIT license. The following is an exhaustive list of all such thirdparty components with their respective copyright statements and license terms."));
license_thirdparty->add_child(tpl_label);
HSplitContainer *tpl_hbc = memnew(HSplitContainer);
tpl_hbc->set_h_size_flags(Control::SIZE_EXPAND_FILL);
tpl_hbc->set_v_size_flags(Control::SIZE_EXPAND_FILL);
tpl_hbc->set_split_offset(240 * EDSCALE);
license_thirdparty->add_child(tpl_hbc);
_tpl_tree = memnew(Tree);
_tpl_tree->set_hide_root(true);
TreeItem *root = _tpl_tree->create_item();
TreeItem *tpl_ti_all = _tpl_tree->create_item(root);
tpl_ti_all->set_text(0, TTR("All Components"));
TreeItem *tpl_ti_tp = _tpl_tree->create_item(root);
tpl_ti_tp->set_text(0, TTR("Components"));
tpl_ti_tp->set_selectable(0, false);
TreeItem *tpl_ti_lc = _tpl_tree->create_item(root);
tpl_ti_lc->set_text(0, TTR("Licenses"));
tpl_ti_lc->set_selectable(0, false);
int read_idx = 0;
String long_text = "";
for (int i = 0; i < THIRDPARTY_COUNT; i++) {
//.........这里部分代码省略.........
示例7: memnew
EditorSettingsDialog::EditorSettingsDialog() {
set_title(TTR("Editor Settings"));
tabs = memnew( TabContainer );
add_child(tabs);
set_child_rect(tabs);
VBoxContainer *vbc = memnew( VBoxContainer );
tabs->add_child(vbc);
vbc->set_name(TTR("General"));
HBoxContainer *hbc = memnew( HBoxContainer );
hbc->set_h_size_flags(Control::SIZE_EXPAND_FILL);
vbc->add_child(hbc);
Label *l = memnew( Label );
l->set_text(TTR("Search:")+" ");
hbc->add_child(l);
search_box = memnew( LineEdit );
search_box->set_h_size_flags(Control::SIZE_EXPAND_FILL);
hbc->add_child(search_box);
clear_button = memnew( ToolButton );
hbc->add_child(clear_button);
clear_button->connect("pressed",this,"_clear_search_box");
property_editor = memnew( SectionedPropertyEditor );
//property_editor->hide_top_label();
property_editor->get_property_editor()->set_use_filter(true);
property_editor->get_property_editor()->register_text_enter(search_box);
property_editor->set_v_size_flags(Control::SIZE_EXPAND_FILL);
vbc->add_child(property_editor);
property_editor->get_property_editor()->connect("property_edited", this, "_settings_property_edited");
vbc = memnew( VBoxContainer );
tabs->add_child(vbc);
vbc->set_name(TTR("Shortcuts"));
hbc = memnew( HBoxContainer );
hbc->set_h_size_flags(Control::SIZE_EXPAND_FILL);
vbc->add_child(hbc);
l = memnew( Label );
l->set_text(TTR("Search:")+" ");
hbc->add_child(l);
shortcut_search_box = memnew( LineEdit );
shortcut_search_box->set_h_size_flags(Control::SIZE_EXPAND_FILL);
hbc->add_child(shortcut_search_box);
shortcut_search_box->connect("text_changed", this, "_filter_shortcuts");
shortcut_clear_button = memnew( ToolButton );
hbc->add_child(shortcut_clear_button);
shortcut_clear_button->connect("pressed",this,"_clear_shortcut_search_box");
shortcuts = memnew( Tree );
vbc->add_margin_child("Shortcut List:",shortcuts,true);
shortcuts->set_columns(2);
shortcuts->set_hide_root(true);
//shortcuts->set_hide_folding(true);
shortcuts->set_column_titles_visible(true);
shortcuts->set_column_title(0,"Name");
shortcuts->set_column_title(1,"Binding");
shortcuts->connect("button_pressed",this,"_shortcut_button_pressed");
press_a_key = memnew( ConfirmationDialog );
press_a_key->set_focus_mode(FOCUS_ALL);
add_child(press_a_key);
l = memnew( Label );
l->set_text(TTR("Press a Key.."));
l->set_area_as_parent_rect();
l->set_align(Label::ALIGN_CENTER);
l->set_margin(MARGIN_TOP,20);
l->set_anchor_and_margin(MARGIN_BOTTOM,ANCHOR_BEGIN,30);
press_a_key_label=l;
press_a_key->add_child(l);
press_a_key->connect("input_event",this,"_wait_for_key");
press_a_key->connect("confirmed",this,"_press_a_key_confirm");
//Button *load = memnew( Button );
//load->set_text("Load..");
//hbc->add_child(load);
//get_ok()->set_text("Apply");
set_hide_on_ok(true);
//get_cancel()->set_text("Close");
timer = memnew( Timer );
timer->set_wait_time(1.5);
timer->connect("timeout",this,"_settings_save");
timer->set_one_shot(true);
add_child(timer);
EditorSettings::get_singleton()->connect("settings_changed",this,"_settings_changed");
get_ok()->set_text(TTR("Close"));
updating=false;
//.........这里部分代码省略.........
示例8: memnew
ScriptCreateDialog::ScriptCreateDialog() {
/* DIALOG */
/* Main Controls */
GridContainer *gc = memnew(GridContainer);
gc->set_columns(2);
/* Error Messages Field */
VBoxContainer *vb = memnew(VBoxContainer);
HBoxContainer *hb = memnew(HBoxContainer);
Label *l = memnew(Label);
l->set_text(" - ");
hb->add_child(l);
error_label = memnew(Label);
error_label->set_text(TTR("Error!"));
error_label->set_align(Label::ALIGN_LEFT);
hb->add_child(error_label);
vb->add_child(hb);
hb = memnew(HBoxContainer);
l = memnew(Label);
l->set_text(" - ");
hb->add_child(l);
path_error_label = memnew(Label);
path_error_label->set_text(TTR("Error!"));
path_error_label->set_align(Label::ALIGN_LEFT);
hb->add_child(path_error_label);
vb->add_child(hb);
PanelContainer *pc = memnew(PanelContainer);
pc->set_h_size_flags(Control::SIZE_FILL);
pc->add_style_override("panel", EditorNode::get_singleton()->get_gui_base()->get_stylebox("bg", "Tree"));
pc->add_child(vb);
/* Margins */
Control *empty_h = memnew(Control);
empty_h->set_name("empty_h"); //duplicate() doesn't like nodes without a name
empty_h->set_h_size_flags(Control::SIZE_EXPAND_FILL);
empty_h->set_v_size_flags(Control::SIZE_EXPAND_FILL);
empty_h->set_custom_minimum_size(Size2(0, 10 * EDSCALE));
Control *empty_v = memnew(Control);
empty_v->set_name("empty_v");
empty_v->set_h_size_flags(Control::SIZE_EXPAND_FILL);
empty_v->set_v_size_flags(Control::SIZE_EXPAND_FILL);
empty_v->set_custom_minimum_size(Size2(10, 0 * EDSCALE));
vb = memnew(VBoxContainer);
vb->add_child(empty_h->duplicate());
vb->add_child(gc);
vb->add_child(empty_h->duplicate());
vb->add_child(pc);
vb->add_child(empty_h->duplicate());
hb = memnew(HBoxContainer);
hb->add_child(empty_v->duplicate());
hb->add_child(vb);
hb->add_child(empty_v->duplicate());
memdelete(empty_h);
memdelete(empty_v);
add_child(hb);
/* Language */
language_menu = memnew(OptionButton);
language_menu->set_custom_minimum_size(Size2(250, 0) * EDSCALE);
language_menu->set_h_size_flags(SIZE_EXPAND_FILL);
l = memnew(Label);
l->set_text(TTR("Language"));
l->set_align(Label::ALIGN_RIGHT);
gc->add_child(l);
gc->add_child(language_menu);
int default_lang = 0;
for (int i = 0; i < ScriptServer::get_language_count(); i++) {
String lang = ScriptServer::get_language(i)->get_name();
language_menu->add_item(lang);
if (lang == "GDScript") {
default_lang = i;
}
}
String last_selected_language = EditorSettings::get_singleton()->get_project_metadata("script_setup", "last_selected_language", "");
if (last_selected_language != "") {
for (int i = 0; i < language_menu->get_item_count(); i++) {
if (language_menu->get_item_text(i) == last_selected_language) {
language_menu->select(i);
current_language = i;
break;
}
}
} else {
language_menu->select(default_lang);
current_language = default_lang;
//.........这里部分代码省略.........