本文整理汇总了C++中MarginContainer::add_child方法的典型用法代码示例。如果您正苦于以下问题:C++ MarginContainer::add_child方法的具体用法?C++ MarginContainer::add_child怎么用?C++ MarginContainer::add_child使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MarginContainer
的用法示例。
在下文中一共展示了MarginContainer::add_child方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: memnew
NewProjectDialog() {
VBoxContainer *vb = memnew( VBoxContainer );
add_child(vb);
set_child_rect(vb);
Label* l = memnew(Label);
l->set_text("Project Path:");
vb->add_child(l);
pp=l;
project_path = memnew( LineEdit );
MarginContainer *mc = memnew( MarginContainer );
vb->add_child(mc);
HBoxContainer *pphb = memnew( HBoxContainer );
mc->add_child(pphb);
pphb->add_child(project_path);
project_path->set_h_size_flags(SIZE_EXPAND_FILL);
Button* browse = memnew( Button );
pphb->add_child(browse);
browse->set_text("Browse");
browse->connect("pressed", this,"_browse_path");
l = memnew(Label);
l->set_text("Project Name:");
l->set_pos(Point2(5,50));
vb->add_child(l);
pn=l;
project_name = memnew( LineEdit );
mc = memnew( MarginContainer );
vb->add_child(mc);
mc->add_child(project_name);
project_name->set_text("New Game Project");
l = memnew(Label);
l->set_text("That's a BINGO!");
vb->add_child(l);
error=l;
l->add_color_override("font_color",Color(1,0.4,0.3,0.8));
l->set_align(Label::ALIGN_CENTER);
get_ok()->set_text("Create");
DirAccess *d = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
project_path->set_text(d->get_current_dir());
memdelete(d);
fdialog = memnew( FileDialog );
add_child(fdialog);
fdialog->set_access(FileDialog::ACCESS_FILESYSTEM);
project_name->connect("text_changed", this,"_text_changed");
project_path->connect("text_changed", this,"_path_text_changed");
fdialog->connect("dir_selected", this,"_path_selected");
fdialog->connect("file_selected", this,"_file_selected");
set_hide_on_ok(false);
import_mode=false;
}
示例2: add_margin_child
MarginContainer* VBoxContainer::add_margin_child(const String& p_label,Control *p_control,bool p_expand) {
Label *l = memnew( Label );
l->set_text(p_label);
add_child(l);
MarginContainer *mc = memnew( MarginContainer );
mc->add_child(p_control);
add_child(mc);
if (p_expand)
mc->set_v_size_flags(SIZE_EXPAND_FILL);
return mc;
}
示例3: memnew
DependencyEditor::DependencyEditor() {
VBoxContainer *vb = memnew( VBoxContainer );
vb->set_name(TTR("Dependencies"));
add_child(vb);
set_child_rect(vb);
tree = memnew( Tree );
tree->set_columns(2);
tree->set_column_titles_visible(true);
tree->set_column_title(0,"Resource");
tree->set_column_title(1,"Path");
tree->set_hide_root(true);
tree->connect("button_pressed",this,"_load_pressed");
HBoxContainer *hbc = memnew( HBoxContainer );
Label *label = memnew( Label(TTR("Dependencies:")));
hbc->add_child(label);
hbc->add_spacer();
fixdeps = memnew( Button(TTR("Fix Broken")));
hbc->add_child(fixdeps);
fixdeps->connect("pressed",this,"_fix_all");
vb->add_child(hbc);
MarginContainer *mc = memnew( MarginContainer );
mc->set_v_size_flags(SIZE_EXPAND_FILL);
mc->add_child(tree);
vb->add_child(mc);
set_title(TTR("Dependency Editor"));
search = memnew( EditorFileDialog );
search->connect("file_selected",this,"_searched");
search->set_mode(EditorFileDialog::MODE_OPEN_FILE);
search->set_title(TTR("Search Replacement Resource:"));
add_child(search);
}
示例4: memnew
EditorPluginSettings::EditorPluginSettings() {
HBoxContainer *title_hb = memnew( HBoxContainer );
title_hb->add_child(memnew( Label(TTR("Installed Plugins:"))));
title_hb->add_spacer();
update_list = memnew( Button(TTR("Update")) );
update_list->connect("pressed",this,"update_plugins");
title_hb->add_child(update_list);
add_child(title_hb);
plugin_list = memnew( Tree );
plugin_list->set_v_size_flags(SIZE_EXPAND_FILL);
plugin_list->set_columns(4);
plugin_list->set_column_titles_visible(true);
plugin_list->set_column_title(0,TTR("Name:"));
plugin_list->set_column_title(1,TTR("Version:"));
plugin_list->set_column_title(2,TTR("Author:"));
plugin_list->set_column_title(3,TTR("Status:"));
plugin_list->set_column_expand(0,true);
plugin_list->set_column_expand(1,false);
plugin_list->set_column_expand(2,false);
plugin_list->set_column_expand(3,false);
plugin_list->set_column_min_width(1,100);
plugin_list->set_column_min_width(2,250);
plugin_list->set_column_min_width(3,80);
plugin_list->set_hide_root(true);
plugin_list->connect("item_edited",this,"_plugin_activity_changed");
MarginContainer *mc = memnew( MarginContainer );
mc->add_child(plugin_list);
mc->set_v_size_flags(SIZE_EXPAND_FILL);
add_child(mc);
updating=false;
}
示例5: memnew
ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor){
ppeer = Ref<PacketPeerStream>( memnew( PacketPeerStream ) );
editor=p_editor;
tabs = memnew( TabContainer );
tabs->set_v_size_flags(SIZE_EXPAND_FILL);
tabs->set_area_as_parent_rect();
add_child(tabs);
{ //debugger
VBoxContainer *vbc = memnew( VBoxContainer );
vbc->set_name(TTR("Debugger"));
//tabs->add_child(vbc);
Control *dbg=vbc;
HBoxContainer *hbc = memnew( HBoxContainer );
vbc->add_child(hbc);
reason = memnew( LineEdit );
reason->set_text("");
reason->set_editable(false);
hbc->add_child(reason);
reason->add_color_override("font_color",Color(1,0.4,0.0,0.8));
reason->set_h_size_flags(SIZE_EXPAND_FILL);
//reason->set_clip_text(true);
hbc->add_child( memnew( VSeparator) );
step = memnew( Button );
hbc->add_child(step);
step->set_tooltip(TTR("Step Into"));
step->connect("pressed",this,"debug_step");
next = memnew( Button );
hbc->add_child(next);
next->set_tooltip(TTR("Step Over"));
next->connect("pressed",this,"debug_next");
hbc->add_child( memnew( VSeparator) );
dobreak = memnew( Button );
hbc->add_child(dobreak);
dobreak->set_tooltip(TTR("Break"));
dobreak->connect("pressed",this,"debug_break");
docontinue = memnew( Button );
hbc->add_child(docontinue);
docontinue->set_tooltip(TTR("Continue"));
docontinue->connect("pressed",this,"debug_continue");
//hbc->add_child( memnew( VSeparator) );
back = memnew( Button );
hbc->add_child(back);
back->set_tooltip(TTR("Inspect Previous Instance"));
back->hide();
forward = memnew( Button );
hbc->add_child(forward);
forward->set_tooltip(TTR("Inspect Next Instance"));
forward->hide();
HSplitContainer *sc = memnew( HSplitContainer );
vbc->add_child(sc);
sc->set_v_size_flags(SIZE_EXPAND_FILL);
stack_dump = memnew( Tree );
stack_dump->set_columns(1);
stack_dump->set_column_titles_visible(true);
stack_dump->set_column_title(0,TTR("Stack Frames"));
stack_dump->set_h_size_flags(SIZE_EXPAND_FILL);
stack_dump->set_hide_root(true);
stack_dump->connect("cell_selected",this,"_stack_dump_frame_selected");
sc->add_child(stack_dump);
inspector = memnew( PropertyEditor );
inspector->set_h_size_flags(SIZE_EXPAND_FILL);
inspector->hide_top_label();
inspector->get_scene_tree()->set_column_title(0,TTR("Variable"));
inspector->set_capitalize_paths(false);
inspector->set_read_only(true);
sc->add_child(inspector);
server = TCP_Server::create_ref();
pending_in_queue=0;
variables = memnew( ScriptEditorDebuggerVariables );
breaked=false;
tabs->add_child(dbg);
//tabs->move_child(vbc,0);
//.........这里部分代码省略.........
示例6: Settings
ProjectSettings::ProjectSettings(EditorData *p_data) {
singleton=this;
set_title("Project Settings (engine.cfg)");
undo_redo=&p_data->get_undo_redo();
data=p_data;
TabContainer *tab_container = memnew( TabContainer );
add_child(tab_container);
set_child_rect(tab_container);
//tab_container->set_anchor_and_margin(MARGIN_LEFT,ANCHOR_BEGIN, 15 );
//tab_container->set_anchor_and_margin(MARGIN_RIGHT,ANCHOR_END, 15 );
//tab_container->set_anchor_and_margin(MARGIN_TOP,ANCHOR_BEGIN, 15 );
//tab_container->set_anchor_and_margin(MARGIN_BOTTOM,ANCHOR_END, 35 );
Control *props_base = memnew( Control );
tab_container->add_child(props_base);
props_base->set_name("General");
globals_editor = memnew( PropertyEditor );
props_base->add_child(globals_editor);
globals_editor->set_area_as_parent_rect();
globals_editor->hide_top_label();
globals_editor->set_anchor_and_margin(MARGIN_TOP,ANCHOR_BEGIN, 55 );
globals_editor->set_anchor_and_margin(MARGIN_BOTTOM,ANCHOR_END, 35 );
globals_editor->set_anchor_and_margin(MARGIN_LEFT,ANCHOR_BEGIN, 5 );
globals_editor->set_anchor_and_margin(MARGIN_RIGHT,ANCHOR_END, 5 );
globals_editor->set_capitalize_paths(false);
globals_editor->get_tree()->connect("cell_selected",this,"_item_selected");
globals_editor->connect("property_toggled",this,"_item_checked");
globals_editor->connect("property_edited",this,"_settings_prop_edited");
Label *l = memnew( Label );
props_base->add_child(l);
l->set_pos(Point2(6,5));
l->set_text("Category:");
l = memnew( Label );
l->set_anchor(MARGIN_LEFT,ANCHOR_RATIO);
props_base->add_child(l);
l->set_begin(Point2(0.21,5));
l->set_text("Property:");
l = memnew( Label );
l->set_anchor(MARGIN_LEFT,ANCHOR_RATIO);
props_base->add_child(l);
l->set_begin(Point2(0.51,5));
l->set_text("Type:");
category = memnew( LineEdit );
props_base->add_child(category);
category->set_anchor(MARGIN_RIGHT,ANCHOR_RATIO);
category->set_begin( Point2(5,25) );
category->set_end( Point2(0.20,26) );
category->connect("text_entered",this,"_item_adds");
property = memnew( LineEdit );
props_base->add_child(property);
property->set_anchor(MARGIN_LEFT,ANCHOR_RATIO);
property->set_anchor(MARGIN_RIGHT,ANCHOR_RATIO);
property->set_begin( Point2(0.21,25) );
property->set_end( Point2(0.50,26) );
property->connect("text_entered",this,"_item_adds");
type = memnew( OptionButton );
props_base->add_child(type);
type->set_anchor(MARGIN_LEFT,ANCHOR_RATIO);
type->set_anchor(MARGIN_RIGHT,ANCHOR_RATIO);
type->set_begin( Point2(0.51,25) );
type->set_end( Point2(0.70,26) );
type->add_item("bool");
type->add_item("int");
type->add_item("float");
type->add_item("string");
Button *add = memnew( Button );
props_base->add_child(add);
add->set_anchor(MARGIN_LEFT,ANCHOR_RATIO);
add->set_anchor(MARGIN_RIGHT,ANCHOR_RATIO);
add->set_begin( Point2(0.71,25) );
add->set_end( Point2(0.85,26) );
add->set_text("Add");
add->connect("pressed",this,"_item_add");
Button *del = memnew( Button );
props_base->add_child(del);
del->set_anchor(MARGIN_LEFT,ANCHOR_RATIO);
del->set_anchor(MARGIN_RIGHT,ANCHOR_END);
del->set_begin( Point2(0.86,25) );
del->set_end( Point2(5,26) );
del->set_text("Del");
del->connect("pressed",this,"_item_del");
Button *save = memnew( Button );
props_base->add_child(save);
//.........这里部分代码省略.........
示例7: memnew
ProjectExportDialog::ProjectExportDialog() {
set_title(TTR("Export"));
set_resizable(true);
VBoxContainer *main_vb = memnew(VBoxContainer);
add_child(main_vb);
HBoxContainer *hbox = memnew(HBoxContainer);
main_vb->add_child(hbox);
hbox->set_v_size_flags(SIZE_EXPAND_FILL);
VBoxContainer *preset_vb = memnew(VBoxContainer);
preset_vb->set_h_size_flags(Control::SIZE_EXPAND_FILL);
hbox->add_child(preset_vb);
HBoxContainer *preset_hb = memnew(HBoxContainer);
preset_hb->add_child(memnew(Label(TTR("Presets"))));
preset_hb->add_spacer();
preset_vb->add_child(preset_hb);
add_preset = memnew(MenuButton);
add_preset->set_text(TTR("Add..."));
add_preset->get_popup()->connect("index_pressed", this, "_add_preset");
preset_hb->add_child(add_preset);
MarginContainer *mc = memnew(MarginContainer);
preset_vb->add_child(mc);
mc->set_v_size_flags(SIZE_EXPAND_FILL);
presets = memnew(ItemList);
presets->set_drag_forwarding(this);
mc->add_child(presets);
presets->connect("item_selected", this, "_edit_preset");
duplicate_preset = memnew(ToolButton);
preset_hb->add_child(duplicate_preset);
duplicate_preset->connect("pressed", this, "_duplicate_preset");
delete_preset = memnew(ToolButton);
preset_hb->add_child(delete_preset);
delete_preset->connect("pressed", this, "_delete_preset");
VBoxContainer *settings_vb = memnew(VBoxContainer);
settings_vb->set_h_size_flags(Control::SIZE_EXPAND_FILL);
hbox->add_child(settings_vb);
name = memnew(LineEdit);
settings_vb->add_margin_child(TTR("Name:"), name);
name->connect("text_changed", this, "_name_changed");
runnable = memnew(CheckButton);
runnable->set_text(TTR("Runnable"));
runnable->connect("pressed", this, "_runnable_pressed");
settings_vb->add_child(runnable);
sections = memnew(TabContainer);
sections->set_tab_align(TabContainer::ALIGN_LEFT);
settings_vb->add_child(sections);
sections->set_v_size_flags(SIZE_EXPAND_FILL);
parameters = memnew(EditorInspector);
sections->add_child(parameters);
parameters->set_name(TTR("Options"));
parameters->set_v_size_flags(SIZE_EXPAND_FILL);
parameters->connect("property_edited", this, "_update_parameters");
VBoxContainer *resources_vb = memnew(VBoxContainer);
sections->add_child(resources_vb);
resources_vb->set_name(TTR("Resources"));
export_filter = memnew(OptionButton);
export_filter->add_item(TTR("Export all resources in the project"));
export_filter->add_item(TTR("Export selected scenes (and dependencies)"));
export_filter->add_item(TTR("Export selected resources (and dependencies)"));
resources_vb->add_margin_child(TTR("Export Mode:"), export_filter);
export_filter->connect("item_selected", this, "_export_type_changed");
include_label = memnew(Label);
include_label->set_text(TTR("Resources to export:"));
resources_vb->add_child(include_label);
include_margin = memnew(MarginContainer);
include_margin->set_v_size_flags(SIZE_EXPAND_FILL);
resources_vb->add_child(include_margin);
include_files = memnew(Tree);
include_margin->add_child(include_files);
include_files->connect("item_edited", this, "_tree_changed");
include_filters = memnew(LineEdit);
resources_vb->add_margin_child(TTR("Filters to export non-resource files (comma separated, e.g: *.json, *.txt)"), include_filters);
include_filters->connect("text_changed", this, "_filter_changed");
exclude_filters = memnew(LineEdit);
resources_vb->add_margin_child(TTR("Filters to exclude files from project (comma separated, e.g: *.json, *.txt)"), exclude_filters);
exclude_filters->connect("text_changed", this, "_filter_changed");
VBoxContainer *patch_vb = memnew(VBoxContainer);
sections->add_child(patch_vb);
patch_vb->set_name(TTR("Patches"));
patches = memnew(Tree);
patch_vb->add_child(patches);
patches->set_v_size_flags(SIZE_EXPAND_FILL);
patches->set_hide_root(true);
patches->connect("button_pressed", this, "_patch_button_pressed");
//.........这里部分代码省略.........
示例8: memnew
ProjectExportDialog::ProjectExportDialog() {
set_title(TTR("Export"));
set_resizable(true);
VBoxContainer *main_vb = memnew(VBoxContainer);
add_child(main_vb);
HBoxContainer *hbox = memnew(HBoxContainer);
main_vb->add_child(hbox);
hbox->set_v_size_flags(SIZE_EXPAND_FILL);
VBoxContainer *preset_vb = memnew(VBoxContainer);
preset_vb->set_h_size_flags(Control::SIZE_EXPAND_FILL);
hbox->add_child(preset_vb);
HBoxContainer *preset_hb = memnew(HBoxContainer);
preset_hb->add_child(memnew(Label(TTR("Presets"))));
preset_hb->add_spacer();
preset_vb->add_child(preset_hb);
add_preset = memnew(MenuButton);
add_preset->set_text(TTR("Add.."));
add_preset->get_popup()->connect("index_pressed", this, "_add_preset");
preset_hb->add_child(add_preset);
MarginContainer *mc = memnew(MarginContainer);
preset_vb->add_child(mc);
mc->set_v_size_flags(SIZE_EXPAND_FILL);
presets = memnew(ItemList);
presets->set_drag_forwarding(this);
mc->add_child(presets);
presets->connect("item_selected", this, "_edit_preset");
delete_preset = memnew(ToolButton);
preset_hb->add_child(delete_preset);
delete_preset->connect("pressed", this, "_delete_preset");
VBoxContainer *settings_vb = memnew(VBoxContainer);
settings_vb->set_h_size_flags(Control::SIZE_EXPAND_FILL);
hbox->add_child(settings_vb);
name = memnew(LineEdit);
settings_vb->add_margin_child(TTR("Name:"), name);
name->connect("text_changed", this, "_name_changed");
runnable = memnew(CheckButton);
runnable->set_text(TTR("Runnable"));
runnable->connect("pressed", this, "_runnable_pressed");
settings_vb->add_child(runnable);
sections = memnew(TabContainer);
sections->set_tab_align(TabContainer::ALIGN_LEFT);
settings_vb->add_child(sections);
sections->set_v_size_flags(SIZE_EXPAND_FILL);
parameters = memnew(PropertyEditor);
sections->add_child(parameters);
parameters->set_name(TTR("Options"));
parameters->hide_top_label();
parameters->set_v_size_flags(SIZE_EXPAND_FILL);
parameters->set_hide_script(true);
parameters->connect("property_edited", this, "_update_parameters");
VBoxContainer *resources_vb = memnew(VBoxContainer);
sections->add_child(resources_vb);
resources_vb->set_name(TTR("Resources"));
export_filter = memnew(OptionButton);
export_filter->add_item(TTR("Export all resources in the project"));
export_filter->add_item(TTR("Export selected scenes (and dependencies)"));
export_filter->add_item(TTR("Export selected resources (and dependencies)"));
resources_vb->add_margin_child(TTR("Export Mode:"), export_filter);
export_filter->connect("item_selected", this, "_export_type_changed");
include_label = memnew(Label);
include_label->set_text(TTR("Resources to export:"));
resources_vb->add_child(include_label);
include_margin = memnew(MarginContainer);
include_margin->set_v_size_flags(SIZE_EXPAND_FILL);
resources_vb->add_child(include_margin);
include_files = memnew(Tree);
include_margin->add_child(include_files);
include_files->connect("item_edited", this, "_tree_changed");
include_filters = memnew(LineEdit);
resources_vb->add_margin_child(TTR("Filters to export non-resource files (comma separated, e.g: *.json, *.txt)"), include_filters);
include_filters->connect("text_changed", this, "_filter_changed");
exclude_filters = memnew(LineEdit);
resources_vb->add_margin_child(TTR("Filters to exclude files from project (comma separated, e.g: *.json, *.txt)"), exclude_filters);
exclude_filters->connect("text_changed", this, "_filter_changed");
VBoxContainer *patch_vb = memnew(VBoxContainer);
sections->add_child(patch_vb);
patch_vb->set_name(TTR("Patches"));
patches = memnew(Tree);
patch_vb->add_child(patches);
patches->set_v_size_flags(SIZE_EXPAND_FILL);
patches->set_hide_root(true);
patches->connect("button_pressed", this, "_patch_button_pressed");
patches->connect("item_edited", this, "_patch_edited");
//.........这里部分代码省略.........