本文整理汇总了C++中VBoxContainer类的典型用法代码示例。如果您正苦于以下问题:C++ VBoxContainer类的具体用法?C++ VBoxContainer怎么用?C++ VBoxContainer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了VBoxContainer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: set_custom_minimum_size
FindInFilesDialog::FindInFilesDialog() {
set_custom_minimum_size(Size2(500 * EDSCALE, 0));
set_title(TTR("Find in Files"));
VBoxContainer *vbc = memnew(VBoxContainer);
vbc->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_BEGIN, 8 * EDSCALE);
vbc->set_anchor_and_margin(MARGIN_TOP, ANCHOR_BEGIN, 8 * EDSCALE);
vbc->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, -8 * EDSCALE);
vbc->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, -8 * EDSCALE);
add_child(vbc);
GridContainer *gc = memnew(GridContainer);
gc->set_columns(2);
vbc->add_child(gc);
Label *find_label = memnew(Label);
find_label->set_text(TTR("Find:"));
gc->add_child(find_label);
_search_text_line_edit = memnew(LineEdit);
_search_text_line_edit->set_h_size_flags(SIZE_EXPAND_FILL);
_search_text_line_edit->connect("text_changed", this, "_on_search_text_modified");
_search_text_line_edit->connect("text_entered", this, "_on_search_text_entered");
gc->add_child(_search_text_line_edit);
gc->add_child(memnew(Control)); // Space to maintain the grid aligned.
{
HBoxContainer *hbc = memnew(HBoxContainer);
_whole_words_checkbox = memnew(CheckBox);
_whole_words_checkbox->set_text(TTR("Whole Words"));
hbc->add_child(_whole_words_checkbox);
_match_case_checkbox = memnew(CheckBox);
_match_case_checkbox->set_text(TTR("Match Case"));
hbc->add_child(_match_case_checkbox);
gc->add_child(hbc);
}
Label *folder_label = memnew(Label);
folder_label->set_text(TTR("Folder:"));
gc->add_child(folder_label);
{
HBoxContainer *hbc = memnew(HBoxContainer);
Label *prefix_label = memnew(Label);
prefix_label->set_text("res://");
hbc->add_child(prefix_label);
_folder_line_edit = memnew(LineEdit);
_folder_line_edit->set_h_size_flags(SIZE_EXPAND_FILL);
hbc->add_child(_folder_line_edit);
Button *folder_button = memnew(Button);
folder_button->set_text("...");
folder_button->connect("pressed", this, "_on_folder_button_pressed");
hbc->add_child(folder_button);
_folder_dialog = memnew(FileDialog);
_folder_dialog->set_mode(FileDialog::MODE_OPEN_DIR);
_folder_dialog->connect("dir_selected", this, "_on_folder_selected");
add_child(_folder_dialog);
gc->add_child(hbc);
}
Label *filter_label = memnew(Label);
filter_label->set_text(TTR("Filters:"));
gc->add_child(filter_label);
{
HBoxContainer *hbc = memnew(HBoxContainer);
// TODO: Unhardcode this.
Vector<String> exts;
exts.push_back("gd");
if (Engine::get_singleton()->has_singleton("GodotSharp"))
exts.push_back("cs");
exts.push_back("shader");
for (int i = 0; i < exts.size(); ++i) {
CheckBox *cb = memnew(CheckBox);
cb->set_text(exts[i]);
cb->set_pressed(true);
hbc->add_child(cb);
_filters.push_back(cb);
}
gc->add_child(hbc);
}
_find_button = add_button(TTR("Find..."), false, "find");
_find_button->set_disabled(true);
_replace_button = add_button(TTR("Replace..."), false, "replace");
_replace_button->set_disabled(true);
//.........这里部分代码省略.........
开发者ID:deliciousfudge,项目名称:godot,代码行数:101,代码来源:find_in_files.cpp
示例2: memnew
EditorAssetLibraryItemDownload::EditorAssetLibraryItemDownload() {
HBoxContainer *hb = memnew(HBoxContainer);
add_child(hb);
icon = memnew(TextureRect);
hb->add_child(icon);
VBoxContainer *vb = memnew(VBoxContainer);
hb->add_child(vb);
vb->set_h_size_flags(SIZE_EXPAND_FILL);
HBoxContainer *title_hb = memnew(HBoxContainer);
vb->add_child(title_hb);
title = memnew(Label);
title_hb->add_child(title);
title->set_h_size_flags(SIZE_EXPAND_FILL);
dismiss = memnew(TextureButton);
dismiss->connect("pressed", this, "_close");
title_hb->add_child(dismiss);
title->set_clip_text(true);
vb->add_spacer();
status = memnew(Label(TTR("Idle")));
vb->add_child(status);
status->add_color_override("font_color", Color(0.5, 0.5, 0.5));
progress = memnew(ProgressBar);
vb->add_child(progress);
HBoxContainer *hb2 = memnew(HBoxContainer);
vb->add_child(hb2);
hb2->add_spacer();
install = memnew(Button);
install->set_text(TTR("Install"));
install->set_disabled(true);
install->connect("pressed", this, "_install");
retry = memnew(Button);
retry->set_text(TTR("Retry"));
retry->connect("pressed", this, "_make_request");
hb2->add_child(retry);
hb2->add_child(install);
set_custom_minimum_size(Size2(250, 0));
download = memnew(HTTPRequest);
add_child(download);
download->connect("request_completed", this, "_http_download_completed");
download->set_use_threads(EDITOR_DEF("asset_library/use_threads", true));
download_error = memnew(AcceptDialog);
add_child(download_error);
download_error->set_title(TTR("Download Error"));
asset_installer = memnew(EditorAssetInstaller);
add_child(asset_installer);
prev_status = -1;
external_install = false;
}
开发者ID:ippan,项目名称:godot,代码行数:64,代码来源:asset_library_editor_plugin.cpp
示例3: memnew
ResourcesDock::ResourcesDock(EditorNode *p_editor) {
editor=p_editor;
VBoxContainer *vbc = this;
HBoxContainer *hbc = memnew( HBoxContainer );
vbc->add_child(hbc);
Button *b;
b = memnew( ToolButton );
b->set_tooltip("Create New Resource");
b->connect("pressed",this,"_tool_selected",make_binds(TOOL_NEW));
hbc->add_child( b );
button_new=b;
b = memnew( ToolButton );
b->set_tooltip("Open Resource");
b->connect("pressed",this,"_tool_selected",make_binds(TOOL_OPEN));
hbc->add_child( b );
button_open=b;
MenuButton *mb = memnew( MenuButton );
mb->set_tooltip("Save Resource");
mb->get_popup()->add_item("Save Resource",TOOL_SAVE);
mb->get_popup()->add_item("Save Resource As..",TOOL_SAVE_AS);
mb->get_popup()->connect("item_pressed",this,"_tool_selected" );
hbc->add_child( mb );
button_save=mb;
hbc->add_spacer();
mb = memnew( MenuButton );
mb->set_tooltip("Resource Tools");
mb->get_popup()->add_item("Make Local",TOOL_MAKE_LOCAL);
mb->get_popup()->add_item("Copy",TOOL_COPY);
mb->get_popup()->add_item("Paste",TOOL_PASTE);
mb->get_popup()->connect("item_pressed",this,"_tool_selected" );
hbc->add_child( mb );
button_tools=mb;
resources = memnew( Tree );
vbc->add_child(resources);
resources->set_v_size_flags(SIZE_EXPAND_FILL);
resources->create_item(); //root
resources->set_hide_root(true);
resources->connect("cell_selected",this,"_resource_selected");
resources->connect("button_pressed",this,"_delete");
create_dialog = memnew( CreateDialog );
add_child(create_dialog);
create_dialog->set_base_type("Resource");
create_dialog->connect("create",this,"_create");
accept = memnew (AcceptDialog);
add_child(accept);
file = memnew( FileDialog );
add_child(file);
file->connect("file_selected",this,"_file_action");
block_add=false;
}
开发者ID:0871087123,项目名称:godot,代码行数:64,代码来源:resources_dock.cpp
示例4: editor_set_scale
ProjectManager::ProjectManager() {
// load settings
if (!EditorSettings::get_singleton())
EditorSettings::create();
EditorSettings::get_singleton()->set_optimize_save(false); //just write settings as they came
{
int dpi_mode = EditorSettings::get_singleton()->get("global/hidpi_mode");
if (dpi_mode==0) {
editor_set_scale( OS::get_singleton()->get_screen_dpi(0) > 150 && OS::get_singleton()->get_screen_size(OS::get_singleton()->get_current_screen()).x>2000 ? 2.0 : 1.0 );
} else if (dpi_mode==1) {
editor_set_scale(0.75);
} else if (dpi_mode==2) {
editor_set_scale(1.0);
} else if (dpi_mode==3) {
editor_set_scale(1.5);
} else if (dpi_mode==4) {
editor_set_scale(2.0);
}
}
FileDialog::set_default_show_hidden_files(EditorSettings::get_singleton()->get("file_dialog/show_hidden_files"));
set_area_as_parent_rect();
set_theme(create_editor_theme());
gui_base = memnew( Control );
add_child(gui_base);
gui_base->set_area_as_parent_rect();
gui_base->set_theme(create_custom_theme());
Panel *panel = memnew( Panel );
gui_base->add_child(panel);
panel->set_area_as_parent_rect();
VBoxContainer *vb = memnew( VBoxContainer );
panel->add_child(vb);
vb->set_area_as_parent_rect(20*EDSCALE);
vb->set_margin(MARGIN_TOP,4*EDSCALE);
vb->set_margin(MARGIN_BOTTOM,4*EDSCALE);
vb->add_constant_override("separation",15*EDSCALE);
String cp;
cp.push_back(0xA9);
cp.push_back(0);
OS::get_singleton()->set_window_title(_MKSTR(VERSION_NAME)+String(" - ")+TTR("Project Manager")+" - "+cp+" 2008-2016 Juan Linietsky, Ariel Manzur.");
HBoxContainer *top_hb = memnew( HBoxContainer);
vb->add_child(top_hb);
CenterContainer *ccl = memnew( CenterContainer );
Label *l = memnew( Label );
l->set_text(_MKSTR(VERSION_NAME)+String(" - ")+TTR("Project Manager"));
l->add_font_override("font", gui_base->get_font("doc","EditorFonts"));
ccl->add_child(l);
top_hb->add_child(ccl);
top_hb->add_spacer();
l = memnew( Label );
l->set_text("v" VERSION_MKSTRING);
//l->add_font_override("font",get_font("bold","Fonts"));
l->set_align(Label::ALIGN_CENTER);
top_hb->add_child(l);
//vb->add_child(memnew(HSeparator));
//vb->add_margin_child("\n",memnew(Control));
tabs = memnew( TabContainer );
vb->add_child(tabs);
tabs->set_v_size_flags(SIZE_EXPAND_FILL);
HBoxContainer *tree_hb = memnew( HBoxContainer);
projects_hb = tree_hb;
projects_hb->set_name(TTR("Project List"));
tabs->add_child(tree_hb);
VBoxContainer *search_tree_vb = memnew(VBoxContainer);
search_tree_vb->set_h_size_flags(SIZE_EXPAND_FILL);
tree_hb->add_child(search_tree_vb);
HBoxContainer *search_box = memnew(HBoxContainer);
search_box->add_spacer(true);
project_filter = memnew(ProjectListFilter);
search_box->add_child(project_filter);
project_filter->connect("filter_changed", this, "_load_recent_projects");
project_filter->set_custom_minimum_size(Size2(250,10));
search_tree_vb->add_child(search_box);
PanelContainer *pc = memnew( PanelContainer);
pc->add_style_override("panel", gui_base->get_stylebox("bg","Tree"));
search_tree_vb->add_child(pc);
pc->set_v_size_flags(SIZE_EXPAND_FILL);
scroll = memnew( ScrollContainer );
pc->add_child(scroll);
scroll->set_enable_h_scroll(false);
VBoxContainer *tree_vb = memnew( VBoxContainer);
//.........这里部分代码省略.........
开发者ID:SPTelur,项目名称:godot,代码行数:101,代码来源:project_manager.cpp
示例5: while
//.........这里部分代码省略.........
ProjectItem &item = E->get();
String project = item.project;
String path = item.path;
String conf = item.conf;
bool is_favorite = item.favorite;
Ref<ConfigFile> cf = memnew( ConfigFile );
Error err = cf->load(conf);
ERR_CONTINUE(err!=OK);
String project_name=TTR("Unnamed Project");
if (cf->has_section_key("application","name")) {
project_name = static_cast<String>(cf->get_value("application","name")).xml_unescape();
}
if (filter_option==ProjectListFilter::FILTER_NAME && search_term!="" && project_name.findn(search_term)==-1)
continue;
Ref<Texture> icon;
if (cf->has_section_key("application","icon")) {
String appicon = cf->get_value("application","icon");
if (appicon!="") {
Image img;
Error err = img.load(appicon.replace_first("res://",path+"/"));
if (err==OK) {
img.resize(64,64);
Ref<ImageTexture> it = memnew( ImageTexture );
it->create_from_image(img);
icon=it;
}
}
}
if (icon.is_null()) {
icon=get_icon("DefaultProjectIcon","EditorIcons");
}
String main_scene;
if (cf->has_section_key("application","main_scene")) {
main_scene = cf->get_value("application","main_scene");
}
selected_list_copy.erase(project);
HBoxContainer *hb = memnew( HBoxContainer );
hb->set_meta("name",project);
hb->set_meta("main_scene",main_scene);
hb->set_meta("favorite",is_favorite);
hb->connect("draw",this,"_panel_draw",varray(hb));
hb->connect("input_event",this,"_panel_input",varray(hb));
hb->add_constant_override("separation",10*EDSCALE);
VBoxContainer *favorite_box = memnew( VBoxContainer );
TextureButton *favorite = memnew( TextureButton );
favorite->set_normal_texture(favorite_icon);
if (!is_favorite)
favorite->set_opacity(0.2);
favorite->set_v_size_flags(SIZE_EXPAND);
favorite->connect("pressed",this,"_favorite_pressed",varray(hb));
favorite_box->add_child(favorite);
hb->add_child(favorite_box);
TextureFrame *tf = memnew( TextureFrame );
tf->set_texture(icon);
hb->add_child(tf);
VBoxContainer *vb = memnew(VBoxContainer);
hb->add_child(vb);
Control *ec = memnew( Control );
ec->set_custom_minimum_size(Size2(0,1));
vb->add_child(ec);
Label *title = memnew( Label(project_name) );
title->add_font_override("font", gui_base->get_font("large","Fonts"));
title->add_color_override("font_color",font_color);
vb->add_child(title);
Label *fpath = memnew( Label(path) );
vb->add_child(fpath);
fpath->set_opacity(0.5);
fpath->add_color_override("font_color",font_color);
scroll_childs->add_child(hb);
}
for (Map<String,String>::Element *E = selected_list_copy.front();E;E = E->next()) {
String key = E->key();
selected_list.erase(key);
}
scroll->set_v_scroll(0);
_update_project_buttons();
EditorSettings::get_singleton()->save();
tabs->set_current_tab(0);
}
开发者ID:SPTelur,项目名称:godot,代码行数:101,代码来源:project_manager.cpp
示例6: tracker
InterfaceMini::InterfaceMini(Window *p_window,Mixer *p_mixer,ConfigApi *p_config) : tracker(p_mixer) {
config=p_config;
window=p_window;
//window->set_large_dialogs(true);
MiniTheme::create(window->get_skin(),window->get_painter());
VBoxContainer *vbc = new VBoxContainer;
window->set_root_frame(vbc);
window->key_unhandled_signal.connect( this, &InterfaceMini::main_key );
vbc->set_separation( 0 );
top=vbc->add( new VBoxContainer);
top_bar=top->add( new HBoxContainer, 0 );
file = top_bar->add( new MenuBox("Song.."), 0);
file->add_item("New");
file->add_item("Open..");
file->add_item("Save");
file->add_item("Save As..");
file->add_separator();
file->add_item("Export WAV");
file->add_separator();
file->add_item("Clean Up");
file->add_separator();
file->add_item("Quit");
file->item_selected_signal.connect(this, &InterfaceMini::song_menu_selected );
file->set_focus_mode( FOCUS_NONE );
top_bar->add( new VSeparator,0);
/* Tab Bar */
tabs=top_bar->add( new TabBar, 0 );
tabs->add_tab("Pat");
tabs->add_tab("Smp");
tabs->add_tab("Ins");
tabs->add_tab("Var");
tabs->set_focus_mode( FOCUS_NONE );
tabs->set_tab_visible( 2, false );
// top_bar->add( new Widget,1);
top_bar->add( new VSeparator,0);
settings=top_bar->add(new MenuBox("Setup"),0);
settings->add_item("Audio Driver");
settings->add_item("Software Mixer");
settings->add_item("Keyboard");
settings->add_item("InterfaceMini");
settings->add_item("Default Paths");
settings->item_selected_signal.connect( this, &InterfaceMini::config_menu_selected );
settings->set_focus_mode( FOCUS_NONE );
top_bar->add( new VSeparator );
help=top_bar->add(new MenuBox("Help"),0);
help->add_item("Command List");
help->add_item("Skins");
help->add_item("About");
help->set_focus_mode( FOCUS_NONE );
help->item_selected_signal.connect( this, &InterfaceMini::help_menu_selected );
/*
HBoxContainer *status_hb = top->add( new HBoxContainer, 0);
status_label = status_hb->add(new Label("Stopped"),1);
status_hb->add( new Label("Memory: "), 0);
memory_label=status_hb->add( new Label("0kb"), 0); */
top->set_stylebox_override( window->get_skin()->get_stylebox(SB_TOP_STACK_FRAME) );
main_stack=vbc->add( new StackContainer,1);
tabs->tab_changed_signal.connect( main_stack, &StackContainer::raise );
tabs->tab_changed_signal.connect( this, &InterfaceMini::screen_changed_to );
tabs->pre_tab_changed_signal.connect( this, &InterfaceMini::pre_screen_changed_from );
pattern_screen=main_stack->add( new PatternScreen(&tracker,true) );
sample_screen=main_stack->add( new SampleScreen(&tracker,true) );
instrument_screen = main_stack->add(new InstrumentScreen(&tracker,true));
instrument_screen->sample_list_changed_signal.connect( sample_screen, &SampleScreen::update_components );
variables_screen = main_stack->add(new VariablesScreen(&tracker,true));
variables_screen->song_name_changed_signal.connect(this, &InterfaceMini::update_title_bar);
variables_screen->instrument_mode_changed.connect( this, &InterfaceMini::check_instrument_visibility );
set_default_keybinds();
main_stack->set_stylebox_override(window->get_skin()->get_stylebox(SB_MAIN_STACK_FRAME));
/* default_octave->get_range()->set( (int)tracker.editor->get_default_octave() ); */
//.........这里部分代码省略.........
开发者ID:babymastodon,项目名称:chibitracker,代码行数:101,代码来源:interface_mini.cpp
示例7: memnew
SceneTreeDock::SceneTreeDock(EditorNode *p_editor,Node *p_scene_root,EditorSelection *p_editor_selection,EditorData &p_editor_data) {
editor=p_editor;
edited_scene=NULL;
editor_data=&p_editor_data;
editor_selection=p_editor_selection;
scene_root=p_scene_root;
VBoxContainer *vbc = this;
HBoxContainer *hbc_top = memnew( HBoxContainer );
vbc->add_child(hbc_top);
ToolButton *tb;
tb = memnew( ToolButton );
tb->connect("pressed",this,"_tool_selected",make_binds(TOOL_NEW, false));
tb->set_tooltip("Add/Create a New Node\n("+keycode_get_string(KEY_MASK_CMD|KEY_A)+")");
hbc_top->add_child(tb);
tool_buttons[TOOL_NEW]=tb;
tb = memnew( ToolButton );
tb->connect("pressed",this,"_tool_selected",make_binds(TOOL_INSTANCE, false));
tb->set_tooltip("Instance a scene file as a Node.");
hbc_top->add_child(tb);
tool_buttons[TOOL_INSTANCE]=tb;
tb = memnew( ToolButton );
tb->connect("pressed",this,"_tool_selected",make_binds(TOOL_REPLACE, false));
tb->set_tooltip("Replace a Node by Another Node Type");
hbc_top->add_child(tb);
tool_buttons[TOOL_REPLACE]=tb;
hbc_top->add_spacer();
tb = memnew( ToolButton );
tb->connect("pressed",this,"_tool_selected",make_binds(TOOL_CONNECT, false));
tb->set_tooltip("Edit the Node Connections");
hbc_top->add_child(tb);
tool_buttons[TOOL_CONNECT]=tb;
tb = memnew( ToolButton );
tb->connect("pressed",this,"_tool_selected",make_binds(TOOL_GROUP, false));
tb->set_tooltip("Edit the Node Groups");
hbc_top->add_child(tb);
tool_buttons[TOOL_GROUP]=tb;
tb = memnew( ToolButton );
tb->connect("pressed",this,"_tool_selected",make_binds(TOOL_SCRIPT, false));
tb->set_tooltip("Edit/Create the Node Script");
hbc_top->add_child(tb);
tool_buttons[TOOL_SCRIPT]=tb;
scene_tree = memnew( SceneTreeEditor(false,true,true ));
vbc->add_child(scene_tree);
scene_tree->set_v_size_flags(SIZE_EXPAND|SIZE_FILL);
scene_tree->connect("node_selected", this,"_node_selected",varray(),CONNECT_DEFERRED);
scene_tree->connect("node_renamed", this,"_node_renamed",varray(),CONNECT_DEFERRED);
scene_tree->connect("node_prerename", this,"_node_prerenamed");
scene_tree->connect("open",this,"_load_request");
scene_tree->connect("open_script",this,"_script_open_request");
scene_tree->set_undo_redo(&editor_data->get_undo_redo());
scene_tree->set_editor_selection(editor_selection);
HBoxContainer *hbc_bottom = memnew( HBoxContainer );
vbc->add_child(hbc_bottom);
tb = memnew( ToolButton );
tb->connect("pressed",this,"_tool_selected",make_binds(TOOL_MOVE_UP, false));
tb->set_tooltip("Move Node Up\n("+keycode_get_string(KEY_MASK_CMD|KEY_UP)+")");
hbc_bottom->add_child(tb);
tool_buttons[TOOL_MOVE_UP]=tb;
tb = memnew( ToolButton );
tb->connect("pressed",this,"_tool_selected",make_binds(TOOL_MOVE_DOWN, false));
tb->set_tooltip("Move Node Down\n("+keycode_get_string(KEY_MASK_CMD|KEY_DOWN)+")");
hbc_bottom->add_child(tb);
tool_buttons[TOOL_MOVE_DOWN]=tb;
tb = memnew( ToolButton );
tb->connect("pressed",this,"_tool_selected",make_binds(TOOL_DUPLICATE, false));
tb->set_tooltip("Duplicate Selected Node(s)\n("+keycode_get_string(KEY_MASK_CMD|KEY_D)+")");
hbc_bottom->add_child(tb);
tool_buttons[TOOL_DUPLICATE]=tb;
tb = memnew( ToolButton );
tb->connect("pressed",this,"_tool_selected",make_binds(TOOL_REPARENT, false));
tb->set_tooltip("Reparent Selected Node(s)");
hbc_bottom->add_child(tb);
tool_buttons[TOOL_REPARENT]=tb;
hbc_bottom->add_spacer();
tb = memnew( ToolButton );
tb->connect("pressed",this,"_tool_selected",make_binds(TOOL_MULTI_EDIT, false));
tb->set_tooltip("Multi-Edit Selected Nodes");
hbc_bottom->add_child(tb);
//.........这里部分代码省略.........
开发者ID:LiamOW,项目名称:godot,代码行数:101,代码来源:scene_tree_dock.cpp
示例8: memnew
ExportTemplateManager::ExportTemplateManager() {
VBoxContainer *main_vb = memnew(VBoxContainer);
add_child(main_vb);
current_hb = memnew(HBoxContainer);
main_vb->add_margin_child(TTR("Current Version:"), current_hb, false);
installed_scroll = memnew(ScrollContainer);
main_vb->add_margin_child(TTR("Installed Versions:"), installed_scroll, true);
installed_vb = memnew(VBoxContainer);
installed_scroll->add_child(installed_vb);
installed_scroll->set_enable_v_scroll(true);
installed_scroll->set_enable_h_scroll(false);
installed_vb->set_h_size_flags(SIZE_EXPAND_FILL);
get_cancel()->set_text(TTR("Close"));
get_ok()->set_text(TTR("Install From File"));
remove_confirm = memnew(ConfirmationDialog);
remove_confirm->set_title(TTR("Remove Template"));
add_child(remove_confirm);
remove_confirm->connect("confirmed", this, "_uninstall_template_confirm");
template_open = memnew(FileDialog);
template_open->set_title(TTR("Select template file"));
template_open->add_filter("*.tpz ; Godot Export Templates");
template_open->set_access(FileDialog::ACCESS_FILESYSTEM);
template_open->set_mode(FileDialog::MODE_OPEN_FILE);
template_open->connect("file_selected", this, "_install_from_file");
add_child(template_open);
set_title(TTR("Export Template Manager"));
set_hide_on_ok(false);
request_mirror = memnew(HTTPRequest);
add_child(request_mirror);
request_mirror->connect("request_completed", this, "_http_download_mirror_completed");
download_templates = memnew(HTTPRequest);
add_child(download_templates);
download_templates->connect("request_completed", this, "_http_download_templates_completed");
template_downloader = memnew(AcceptDialog);
template_downloader->set_title(TTR("Download Templates"));
template_downloader->get_ok()->set_text(TTR("Close"));
add_child(template_downloader);
VBoxContainer *vbc = memnew(VBoxContainer);
template_downloader->add_child(vbc);
ScrollContainer *sc = memnew(ScrollContainer);
sc->set_custom_minimum_size(Size2(400, 200) * EDSCALE);
vbc->add_margin_child(TTR("Select mirror from list: "), sc);
template_list = memnew(VBoxContainer);
sc->add_child(template_list);
sc->set_enable_v_scroll(true);
sc->set_enable_h_scroll(false);
template_list_state = memnew(Label);
vbc->add_child(template_list_state);
template_download_progress = memnew(ProgressBar);
vbc->add_child(template_download_progress);
update_countdown = 0;
}
开发者ID:nakoff,项目名称:godot,代码行数:65,代码来源:export_template_manager.cpp
示例9: memnew
FileDialog::FileDialog() {
show_hidden_files=default_show_hidden_files;
VBoxContainer *vbc = memnew( VBoxContainer );
add_child(vbc);
mode=MODE_SAVE_FILE;
set_title(RTR("Save a File"));
dir = memnew(LineEdit);
HBoxContainer *pathhb = memnew( HBoxContainer );
pathhb->add_child(dir);
dir->set_h_size_flags(SIZE_EXPAND_FILL);
refresh = memnew( ToolButton );
refresh->connect("pressed",this,"_update_file_list");
pathhb->add_child(refresh);
drives = memnew( OptionButton );
pathhb->add_child(drives);
drives->connect("item_selected",this,"_select_drive");
makedir = memnew( Button );
makedir->set_text(RTR("Create Folder"));
makedir->connect("pressed",this,"_make_dir");
pathhb->add_child(makedir);
vbc->add_margin_child(RTR("Path:"),pathhb);
tree = memnew(Tree);
tree->set_hide_root(true);
vbc->add_margin_child(RTR("Directories & Files:"),tree,true);
file = memnew(LineEdit);
//add_child(file);
vbc->add_margin_child(RTR("File:"),file);
filter = memnew( OptionButton );
//add_child(filter);
vbc->add_margin_child(RTR("Filter:"),filter);
filter->set_clip_text(true);//too many extensions overflow it
dir_access = DirAccess::create(DirAccess::ACCESS_RESOURCES);
access=ACCESS_RESOURCES;
_update_drives();
connect("confirmed", this,"_action_pressed");
//cancel->connect("pressed", this,"_cancel_pressed");
tree->connect("cell_selected", this,"_tree_selected",varray(),CONNECT_DEFERRED);
tree->connect("item_activated", this,"_tree_db_selected",varray());
dir->connect("text_entered", this,"_dir_entered");
file->connect("text_entered", this,"_file_entered");
filter->connect("item_selected", this,"_filter_selected");
confirm_save = memnew( ConfirmationDialog );
confirm_save->set_as_toplevel(true);
add_child(confirm_save);
confirm_save->connect("confirmed", this,"_save_confirm_pressed");
makedialog = memnew( ConfirmationDialog );
makedialog->set_title(RTR("Create Folder"));
VBoxContainer *makevb= memnew( VBoxContainer );
makedialog->add_child(makevb);
makedirname = memnew( LineEdit );
makevb->add_margin_child(RTR("Name:"),makedirname);
add_child(makedialog);
makedialog->register_text_enter(makedirname);
makedialog->connect("confirmed",this,"_make_dir_confirm");
mkdirerr = memnew( AcceptDialog );
mkdirerr->set_text(RTR("Could not create folder."));
add_child(mkdirerr);
exterr = memnew( AcceptDialog );
exterr->set_text(RTR("Must use a valid extension."));
add_child(exterr);
//update_file_list();
update_filters();
update_dir();
set_hide_on_ok(false);
vbox=vbc;
invalidated=true;
if (register_func)
register_func(this);
}
开发者ID:baekdahl,项目名称:godot,代码行数:98,代码来源:file_dialog.cpp
示例10: set_self_modulate
FindReplaceDialog::FindReplaceDialog() {
set_self_modulate(Color(1,1,1,0.8));
VBoxContainer *vb = memnew( VBoxContainer );
add_child(vb);
set_child_rect(vb);
search_text = memnew( LineEdit );
vb->add_margin_child(TTR("Search"),search_text);
search_text->connect("text_entered", this,"_search_text_entered");
//search_text->set_self_opacity(0.7);
replace_label = memnew( Label);
replace_label->set_text(TTR("Replace By"));
vb->add_child(replace_label);
replace_mc= memnew( MarginContainer);
vb->add_child(replace_mc);
replace_text = memnew( LineEdit );
replace_text->set_anchor( MARGIN_RIGHT, ANCHOR_END );
replace_text->set_begin( Point2(15,132) );
replace_text->set_end( Point2(15,135) );
//replace_text->set_self_opacity(0.7);
replace_mc->add_child(replace_text);
replace_text->connect("text_entered", this,"_replace_text_entered");
MarginContainer *opt_mg = memnew( MarginContainer );
vb->add_child(opt_mg);
VBoxContainer *svb = memnew( VBoxContainer);
opt_mg->add_child(svb);
svb ->add_child(memnew(Label));
whole_words = memnew( CheckButton );
whole_words->set_text(TTR("Whole Words"));
svb->add_child(whole_words);
case_sensitive = memnew( CheckButton );
case_sensitive->set_text(TTR("Case Sensitive"));
svb->add_child(case_sensitive);
backwards = memnew( CheckButton );
backwards->set_text(TTR("Backwards"));
svb->add_child(backwards);
opt_mg = memnew( MarginContainer );
vb->add_child(opt_mg);
VBoxContainer *rvb = memnew( VBoxContainer);
opt_mg->add_child(rvb);
replace_vb=rvb;
// rvb ->add_child(memnew(HSeparator));
rvb ->add_child(memnew(Label));
prompt = memnew( CheckButton );
prompt->set_text(TTR("Prompt On Replace"));
rvb->add_child(prompt);
prompt->connect("pressed", this,"_prompt_changed");
selection_only = memnew( CheckButton );
selection_only->set_text(TTR("Selection Only"));
rvb->add_child(selection_only);
int margin = get_constant("margin","Dialogs");
int button_margin = get_constant("button_margin","Dialogs");
skip = memnew( Button );
skip->set_anchor( MARGIN_LEFT, ANCHOR_END );
skip->set_anchor( MARGIN_TOP, ANCHOR_END );
skip->set_anchor( MARGIN_RIGHT, ANCHOR_END );
skip->set_anchor( MARGIN_BOTTOM, ANCHOR_END );
skip->set_begin( Point2( 70, button_margin ) );
skip->set_end( Point2( 10, margin ) );
skip->set_text(TTR("Skip"));
add_child(skip);
skip->connect("pressed", this,"_skip_pressed");
error_label = memnew( Label );
error_label->set_align(Label::ALIGN_CENTER);
error_label->add_color_override("font_color",Color(1,0.4,0.3));
error_label->add_color_override("font_color_shadow",Color(0,0,0,0.2));
error_label->add_constant_override("shadow_as_outline",1);
vb->add_child(error_label);
set_hide_on_ok(false);
}
开发者ID:lonesurvivor,项目名称:godot,代码行数:98,代码来源:code_editor.cpp
示例11: 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;
//.........这里部分代码省略.........
开发者ID:arcanis,项目名称:godot,代码行数:101,代码来源:script_create_dialog.cpp
示例12: BoxContainer
ColorPicker::ColorPicker() :
BoxContainer(true) {
updating=true;
edit_alpha=true;
text_is_constructor = false;
raw_mode_enabled=false;
changing_color=false;
screen=NULL;
HBoxContainer *hb_smpl = memnew( HBoxContainer );
btn_pick = memnew( ToolButton );
btn_pick->connect("pressed",this,"_screen_pick_pressed");
sample = memnew( TextureFrame );
sample->set_h_size_flags(SIZE_EXPAND_FILL);
sample->connect("draw",this,"_sample_draw");
hb_smpl->add_child(sample);
hb_smpl->add_child(btn_pick);
add_child(hb_smpl);
HBoxContainer *hb_edit = memnew( HBoxContainer );
uv_edit= memnew ( TextureFrame );
Image i(256, 256, false, Image::FORMAT_RGB);
for (int y=0;y<256;y++)
for (int x=0;x<256;x++)
i.put_pixel(x,y,Color());
Ref<ImageTexture> t;
t.instance();
t->create_from_image(i);
uv_edit->set_texture(t);
uv_edit->set_ignore_mouse(false);
uv_edit->set_custom_minimum_size(Size2(256,256));
uv_edit->connect("input_event", this, "_uv_input");
Control *c= memnew( Control );
uv_edit->add_child(c);
c->set_area_as_parent_rect();
c->set_stop_mouse(false);
c->set_material(memnew ( CanvasItemMaterial ));
Vector<Variant> args=Vector<Variant>();
args.push_back(0);
args.push_back(c);
c->connect("draw",this,"_hsv_draw",args);
add_child(hb_edit);
w_edit= memnew( TextureFrame );
i = Image(15, 256, false, Image::FORMAT_RGB);
for (int y=0;y<256;y++)
for (int x=0;x<15;x++)
i.put_pixel(x,y,Color());
Ref<ImageTexture> tw;
tw.instance();
tw->create_from_image(i);
w_edit->set_texture(tw);
w_edit->set_ignore_mouse(false);
w_edit->set_custom_minimum_size(Size2(15,256));
w_edit->connect("input_event", this, "_w_input");
c= memnew( Control );
w_edit->add_child(c);
c->set_area_as_parent_rect();
c->set_stop_mouse(false);
c->set_material(memnew ( CanvasItemMaterial ));
args.clear();
args.push_back(1);
args.push_back(c);
c->connect("draw",this,"_hsv_draw",args);
hb_edit->add_child(uv_edit);
hb_edit->add_child(memnew( VSeparator ));
hb_edit->add_child(w_edit);
VBoxContainer *vbl = memnew( VBoxContainer );
add_child(vbl);
add_child(memnew( HSeparator ));
VBoxContainer *vbr = memnew( VBoxContainer );
add_child(vbr);
vbr->set_h_size_flags(SIZE_EXPAND_FILL);
const char* lt[4] = {"R","G","B","A"};
for(int i=0;i<4;i++) {
HBoxContainer *hbc = memnew( HBoxContainer );
labels[i]=memnew( Label(lt[i]) );
hbc->add_child(labels[i]);
scroll[i]=memnew( HSlider );
hbc->add_child(scroll[i]);
values[i]=memnew( SpinBox );
scroll[i]->share(values[i]);
hbc->add_child(values[i]);
scroll[i]->set_min(0);
scroll[i]->set_page(0);
//.........这里部分代码省略.........
开发者ID:cimpresovec,项目名称:godot,代码行数:101,代码来源:color_picker.cpp
示例13: set_title
EditorTextureImportDialog::EditorTextureImportDialog(EditorTextureImportPlugin* p_plugin, bool p_2d, bool p_atlas,bool p_large) {
atlas=p_atlas;
large=p_large;
plugin=p_plugin;
set_title("Import Textures");
VBoxContainer *vbc = memnew(VBoxContainer);
add_child(vbc);
set_child_rect(vbc);
VBoxContainer *source_vb=memnew(VBoxContainer);
if (large)
vbc->add_margin_child("Source Texture:",source_vb);
else
vbc->add_margin_child("Source Texture(s):",source_vb);
HBoxContainer *hbc = memnew( HBoxContainer );
source_vb->add_child(hbc);
import_path = memnew( LineEdit );
import_path->set_h_size_flags(SIZE_EXPAND_FILL);
hbc->add_child(import_path);
crop_source = memnew( CheckButton );
crop_source->set_pressed(true);
source_vb->add_child(crop_source);
crop_source->set_text("Crop empty space.");
if (!p_atlas)
crop_source->hide();
Button * import_choose = memnew( Button );
import_choose->set_text(" .. ");
hbc->add_child(import_choose);
import_choose->connect("pressed", this,"_browse");
hbc = memnew( HBoxContainer );
vbc->add_margin_child("Target Path:",hbc);
size = memnew( SpinBox );
size->set_min(128);
size->set_max(16384);
if (p_atlas) {
size->set_val(2048);
vbc->add_margin_child("Max Texture size:",size);
} else {
size->set_val(256);
vbc->add_margin_child("Cell Size:",size);
}
save_path = memnew( LineEdit );
save_path->set_h_size_flags(SIZE_EXPAND_FILL);
hbc->add_child(save_path);
Button * save_choose = memnew( Button );
save_choose->set_text(" .. ");
hbc->add_child(save_choose);
save_choose->connect("pressed", this,"_browse_target");
file_select = memnew(EditorFileDialog);
file_select->set_access(EditorFileDialog::ACCESS_FILESYSTEM);
add_child(file_select);
if (!large)
file_select->set_mode(EditorFileDialog::MODE_OPEN_FILES);
else
file_select->set_mode(EditorFileDialog::MODE_OPEN_FILE);
file_select->connect("files_selected", this,"_choose_files");
file_select->connect("file_selected", this,"_choose_file");
save_file_select = memnew(EditorFileDialog);
save_file_select->set_access(EditorFileDialog::ACCESS_RESOURCES);
add_child(save_file_select);
save_file_select->set_mode(EditorFileDialog::MODE_SAVE_FILE);
save_file_select->clear_filters();
if (large)
save_file_select->add_filter("*.ltex;Large Texture");
else
save_file_select->add_filter("*.tex;Base Atlas Texture");
save_file_select->connect("file_selected", this,"_choose_save_dir");
save_select = memnew( EditorDirDialog );
add_child(save_select);
// save_select->set_mode(EditorFileDialog::MODE_OPEN_DIR);
save_select->connect("dir_selected", this,"_choose_save_dir");
get_ok()->connect("pressed", this,"_import");
get_ok()->set_text("Import");
//move stuff up
//for(int i=0;i<4;i++)
// vbc->move_child( vbc->get_child( vbc->get_child_count() -1), 0);
//.........这里部分代码省略.........
开发者ID:BradWBeer,项目名称:godot,代码行数:101,代码来源:editor_texture_import_plugin.cpp
示例14: memnew
FindInFilesPanel::FindInFilesPanel() {
_finder = memnew(FindInFiles);
_finder->connect(FindInFiles::SIGNAL_RESULT_FOUND, this, "_on_result_found");
_finder->connect(FindInFiles::SIGNAL_FINISHED, this, "_on_finished");
add_child(_finder);
VBoxContainer *vbc = memnew(VBoxContainer);
vbc->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_BEGIN, 0);
vbc->set_anchor_and_margin(MARGIN_TOP, ANCHOR_BEGIN, 0);
vbc->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, 0);
vbc->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, 0);
add_child(vbc);
{
HBoxContainer *hbc = memnew(HBoxContainer);
Label *find_label = memnew(Label);
find_label->set_text(TTR("Find: "));
hbc->add_child(find_label);
_search_text_label = memnew(Label);
_search_text_label->add_font_override("font", EditorNode::get_singleton()->get_gui_base()->get_font("source", "EditorFonts"));
hbc->add_child(_search_text_label);
_progress_bar = memnew(ProgressBar);
_progress_bar->set_h_size_flags(SIZE_EXPAND_FILL);
hbc->add_child(_progress_bar);
set_progress_visible(false);
_status_label = memnew(Label);
hbc->add_child(_status_label);
_cancel_button = memnew(Button);
_cancel_button->set_text(TTR("Cancel"));
_cancel_button->connect("pressed", this, "_on_cancel_button_clicked");
_cancel_button->hide();
hbc->add_child(_cancel_button);
vbc->add_child(hbc);
}
_results_display = memnew(Tree);
_results_display->add_font_override("font", EditorNode::get_singleton()->get_gui_base()->get_font("source", "EditorFonts"));
_results_display->set_v_size_flags(SIZE_EXPAND_FILL);
_results_display->connect("item_selected", this, "_on_result_selected");
_results_display->connect("item_edited", this, "_on_item_edited");
_results_display->set_hide_root(true);
_results_display->set_select_mode(Tree::SELECT_ROW);
_results_display->create_item(); // Root
vbc->add_child(_results_display);
_with_replace = false;
{
_replace_container = memnew(HBoxContainer);
Label *replace_label = memnew(Label);
replace_label->set_text(TTR("Replace: "));
_replace_container->add_child(replace_label);
_replace_line_edit = memnew(LineEdit);
_replace_line_edit->set_h_size_flags(SIZE_EXPAND_FILL);
_replace_line_edit->connect("text_changed", this, "_on_replace_text_changed");
_replace_container->add_child(_replace_line_edit);
_replace_all_button = memnew(Button);
_replace_all_button->set_text(TTR("Replace all (no undo)"));
_replace_all_button->connect("pressed", this, "_on_replace_all_clicked");
_replace_container->add_child(_replace_all_button);
_replace_container->hide();
vbc->add_child(_replace_container);
}
}
开发者ID:deliciousfudge,项目名称:godot,代码行数:76,代码来源:find_in_files.cpp
示例15: EditorFontImportDialog
|
请发表评论