本文整理汇总了C++中MarginContainer类的典型用法代码示例。如果您正苦于以下问题:C++ MarginContainer类的具体用法?C++ MarginContainer怎么用?C++ MarginContainer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MarginContainer类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: NewProjectDialog
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: memnew
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
//.........这里部分代码省略.........
TreeItem *b = perf_monitors->create_item(root);
b->set_text(0,base.capitalize());
b->set_editable(0,false);
b->set_selectable(0,false);
bases[base]=b;
}
TreeItem *it = perf_monitors->create_item(bases[base]);
it->set_editable(0,false);
it->set_selectable(0,true);
it->set_text(0,name.capitalize());
perf_items.push_back(it);
perf_max[i]=0;
}
}
{ //vmem inspect
VBoxContainer *vmem_vb = memnew( VBoxContainer );
HBoxContainer *vmem_hb = memnew( HBoxContainer );
Label *vmlb = memnew(Label(TTR("List of Video Memory Usage by Resource:")+" ") );
vmlb->set_h_size_flags(SIZE_EXPAND_FILL);
vmem_hb->add_child( vmlb );
vmem_hb->add_child( memnew(Label(TTR("Total:")+" ")) );
vmem_total = memnew( LineEdit );
vmem_total->set_editable(false);
vmem_total->set_custom_minimum_size(Size2(100,1)*EDSCALE);
vmem_hb->add_child(vmem_total);
vmem_refresh = memnew( Button );
vmem_hb->add_child(vmem_refresh);
vmem_vb->add_child(vmem_hb);
vmem_refresh->connect("pressed",this,"_video_mem_request");
MarginContainer *vmmc = memnew( MarginContainer );
vmem_tree = memnew( Tree );
vmem_tree->set_v_size_flags(SIZE_EXPAND_FILL);
vmem_tree->set_h_size_flags(SIZE_EXPAND_FILL);
vmmc->add_child(vmem_tree);
vmmc->set_v_size_flags(SIZE_EXPAND_FILL);
vmem_vb->add_child(vmmc);
vmem_vb->set_name(TTR("Video Mem"));
vmem_tree->set_columns(4);
vmem_tree->set_column_titles_visible(true);
vmem_tree->set_column_title(0,TTR("Resource Path"));
vmem_tree->set_column_expand(0,true);
vmem_tree->set_column_expand(1,false);
vmem_tree->set_column_title(1,TTR("Type"));
vmem_tree->set_column_min_width(1,100);
vmem_tree->set_column_expand(2,false);
vmem_tree->set_column_title(2,TTR("Format"));
vmem_tree->set_column_min_width(2,150);
vmem_tree->set_column_expand(3,false);
vmem_tree->set_column_title(3,TTR("Usage"));
vmem_tree->set_column_min_width(3,80);
vmem_tree->set_hide_root(true);
tabs->add_child(vmem_vb);
}
{ // misc
VBoxContainer *info_left = memnew( VBoxContainer );
info_left->set_h_size_flags(SIZE_EXPAND_FILL);
info_left->set_name(TTR("Misc"));
tabs->add_child(info_left);
clicked_ctrl = memnew( LineEdit );
示例6: set_title
//.........这里部分代码省略.........
device_input->add_child(device_index);
save = memnew( Button );
input_base->add_child(save);
save->set_anchor(MARGIN_LEFT,ANCHOR_END);
save->set_anchor(MARGIN_RIGHT,ANCHOR_END);
save->set_anchor(MARGIN_TOP,ANCHOR_END);
save->set_anchor(MARGIN_BOTTOM,ANCHOR_END);
save->set_begin( Point2(80,28) );
save->set_end( Point2(10,20) );
save->set_text("Save");
save->connect("pressed",this,"_save");
setting=false;
//translations
TabContainer *translations = memnew( TabContainer );
translations->set_name("Localization");
tab_container->add_child(translations);
{
VBoxContainer *tvb = memnew( VBoxContainer );
translations->add_child(tvb);
tvb->set_name("Translations");
HBoxContainer *thb = memnew( HBoxContainer);
tvb->add_child(thb);
thb->add_child( memnew( Label("Translations:")));
thb->add_spacer();
Button *addtr = memnew( Button("Add..") );
addtr->connect("pressed",this,"_translation_file_open");
thb->add_child(addtr);
MarginContainer *tmc = memnew( MarginContainer );
tvb->add_child(tmc);
tmc->set_v_size_flags(SIZE_EXPAND_FILL);
translation_list = memnew( Tree );
translation_list->set_v_size_flags(SIZE_EXPAND_FILL);
tmc->add_child(translation_list);
translation_file_open=memnew( FileDialog );
add_child(translation_file_open);
translation_file_open->set_mode(FileDialog::MODE_OPEN_FILE);
translation_file_open->connect("file_selected",this,"_translation_add");
}
{
VBoxContainer *tvb = memnew( VBoxContainer );
translations->add_child(tvb);
tvb->set_name("Remaps");
HBoxContainer *thb = memnew( HBoxContainer);
tvb->add_child(thb);
thb->add_child( memnew( Label("Resources:")));
thb->add_spacer();
Button *addtr = memnew( Button("Add..") );
addtr->connect("pressed",this,"_translation_res_file_open");
thb->add_child(addtr);
MarginContainer *tmc = memnew( MarginContainer );
tvb->add_child(tmc);
tmc->set_v_size_flags(SIZE_EXPAND_FILL);
translation_remap = memnew( Tree );
translation_remap->set_v_size_flags(SIZE_EXPAND_FILL);
translation_remap->connect("cell_selected",this,"_translation_res_select");
tmc->add_child(translation_remap);
translation_remap->connect("button_pressed",this,"_translation_res_delete");
示例7: set_title
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: set_title
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");
//.........这里部分代码省略.........