本文整理汇总了C++中HBoxContainer类的典型用法代码示例。如果您正苦于以下问题:C++ HBoxContainer类的具体用法?C++ HBoxContainer怎么用?C++ HBoxContainer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了HBoxContainer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: add_constant_override
EditorLog::EditorLog() {
VBoxContainer *vb = this;
add_constant_override("separation", get_constant("separation", "VBoxContainer"));
HBoxContainer *hb = memnew(HBoxContainer);
vb->add_child(hb);
title = memnew(Label);
title->set_text(TTR(" Output:"));
title->set_h_size_flags(SIZE_EXPAND_FILL);
hb->add_child(title);
//pd = memnew( PaneDrag );
//hb->add_child(pd);
//pd->connect("dragged",this,"_dragged");
//pd->set_default_cursor_shape(Control::CURSOR_MOVE);
clearbutton = memnew(Button);
hb->add_child(clearbutton);
clearbutton->set_text(TTR("Clear"));
clearbutton->connect("pressed", this, "_clear_request");
ec = memnew(Control);
vb->add_child(ec);
ec->set_custom_minimum_size(Size2(0, 180));
ec->set_v_size_flags(SIZE_EXPAND_FILL);
pc = memnew(PanelContainer);
ec->add_child(pc);
pc->set_area_as_parent_rect();
pc->connect("tree_entered", this, "_override_logger_styles");
log = memnew(RichTextLabel);
log->set_scroll_follow(true);
log->set_selection_enabled(true);
log->set_focus_mode(FOCUS_CLICK);
pc->add_child(log);
add_message(VERSION_FULL_NAME " (c) 2008-2017 Juan Linietsky, Ariel Manzur.");
//log->add_text("Initialization Complete.\n"); //because it looks cool.
eh.errfunc = _error_handler;
eh.userdata = this;
add_error_handler(&eh);
current = Thread::get_caller_ID();
EditorNode::get_undo_redo()->set_commit_notify_callback(_undo_redo_cbk, this);
}
示例2: memnew
ItemListEditor::ItemListEditor() {
selected_idx=-1;
options = memnew( MenuButton );
add_child(options);
options->set_area_as_parent_rect();
options->set_text("Items");
options->get_popup()->add_item("Edit Items",MENU_EDIT_ITEMS);
//options->get_popup()->add_item("Clear",MENU_CLEAR);
options->get_popup()->connect("item_pressed", this,"_menu_option");
dialog = memnew( AcceptDialog );
add_child( dialog );
HBoxContainer *hbc = memnew( HBoxContainer );
dialog->add_child(hbc);
dialog->set_child_rect(hbc);
prop_editor = memnew( PropertyEditor );
hbc->add_child(prop_editor);
prop_editor->set_h_size_flags(SIZE_EXPAND_FILL);
VBoxContainer *vbc = memnew( VBoxContainer );
hbc->add_child(vbc);
add_button = memnew( Button );
//add_button->set_text("Add");
add_button->connect("pressed",this,"_add_button");
vbc->add_child(add_button);
del_button = memnew( Button );
//del_button->set_text("Del");
del_button->connect("pressed",this,"_delete_button");
vbc->add_child(del_button);
dialog->set_title("Item List");
prop_editor->hide_top_label();
}
示例3: set_name
ConnectionsDock::ConnectionsDock(EditorNode *p_editor) {
editor = p_editor;
set_name(TTR("Signals"));
VBoxContainer *vbc = this;
tree = memnew(Tree);
tree->set_columns(1);
tree->set_select_mode(Tree::SELECT_ROW);
tree->set_hide_root(true);
vbc->add_child(tree);
tree->set_v_size_flags(SIZE_EXPAND_FILL);
connect_button = memnew(Button);
connect_button->set_text(TTR("Connect"));
HBoxContainer *hb = memnew(HBoxContainer);
vbc->add_child(hb);
hb->add_spacer();
hb->add_child(connect_button);
connect_button->connect("pressed", this, "_connect_pressed");
//add_child(tree);
connect_dialog = memnew(ConnectDialog);
connect_dialog->set_as_toplevel(true);
add_child(connect_dialog);
remove_confirm = memnew(ConfirmationDialog);
remove_confirm->set_as_toplevel(true);
add_child(remove_confirm);
/*
node_only->set_anchor( MARGIN_TOP, ANCHOR_END );
node_only->set_anchor( MARGIN_BOTTOM, ANCHOR_END );
node_only->set_anchor( MARGIN_RIGHT, ANCHOR_END );
node_only->set_begin( Point2( 20,51) );
node_only->set_end( Point2( 10,44) );
*/
remove_confirm->connect("confirmed", this, "_remove_confirm");
connect_dialog->connect("connected", this, "_connect");
tree->connect("item_selected", this, "_something_selected");
tree->connect("item_activated", this, "_something_activated");
add_constant_override("separation", 3 * EDSCALE);
}
示例4: memnew
EditorAssetLibraryItemDescription::EditorAssetLibraryItemDescription() {
VBoxContainer *vbox = memnew(VBoxContainer);
add_child(vbox);
HBoxContainer *hbox = memnew(HBoxContainer);
vbox->add_child(hbox);
vbox->add_constant_override("separation", 15);
VBoxContainer *desc_vbox = memnew(VBoxContainer);
hbox->add_child(desc_vbox);
hbox->add_constant_override("separation", 15);
item = memnew(EditorAssetLibraryItem);
desc_vbox->add_child(item);
desc_vbox->set_custom_minimum_size(Size2(300, 0));
PanelContainer *desc_bg = memnew(PanelContainer);
desc_vbox->add_child(desc_bg);
desc_bg->set_v_size_flags(SIZE_EXPAND_FILL);
description = memnew(RichTextLabel);
description->connect("meta_clicked", this, "_link_click");
//desc_vbox->add_child(description);
desc_bg->add_child(description);
desc_bg->add_style_override("panel", get_stylebox("normal", "TextEdit"));
preview = memnew(TextureRect);
preview->set_custom_minimum_size(Size2(640, 345));
hbox->add_child(preview);
PanelContainer *previews_bg = memnew(PanelContainer);
vbox->add_child(previews_bg);
previews_bg->set_custom_minimum_size(Size2(0, 85));
previews_bg->add_style_override("panel", get_stylebox("normal", "TextEdit"));
previews = memnew(ScrollContainer);
previews_bg->add_child(previews);
previews->set_enable_v_scroll(false);
previews->set_enable_h_scroll(true);
preview_hb = memnew(HBoxContainer);
preview_hb->set_v_size_flags(SIZE_EXPAND_FILL);
previews->add_child(preview_hb);
get_ok()->set_text("Install");
get_cancel()->set_text("Close");
}
示例5: memnew
SpriteEditor::SpriteEditor() {
options = memnew(MenuButton);
CanvasItemEditor::get_singleton()->add_control_to_menu_panel(options);
options->set_text(TTR("Sprite"));
options->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("Sprite", "EditorIcons"));
options->get_popup()->add_item(TTR("Convert to 2D Mesh"), MENU_OPTION_CREATE_MESH_2D);
options->get_popup()->connect("id_pressed", this, "_menu_option");
err_dialog = memnew(AcceptDialog);
add_child(err_dialog);
debug_uv_dialog = memnew(ConfirmationDialog);
debug_uv_dialog->get_ok()->set_text(TTR("Create 2D Mesh"));
debug_uv_dialog->set_title("Mesh 2D Preview");
VBoxContainer *vb = memnew(VBoxContainer);
debug_uv_dialog->add_child(vb);
ScrollContainer *scroll = memnew(ScrollContainer);
scroll->set_custom_minimum_size(Size2(800, 500) * EDSCALE);
scroll->set_enable_h_scroll(true);
scroll->set_enable_v_scroll(true);
vb->add_margin_child(TTR("Preview:"), scroll, true);
debug_uv = memnew(Control);
debug_uv->connect("draw", this, "_debug_uv_draw");
scroll->add_child(debug_uv);
debug_uv_dialog->connect("confirmed", this, "_create_mesh_node");
HBoxContainer *hb = memnew(HBoxContainer);
hb->add_child(memnew(Label(TTR("Simplification: "))));
simplification = memnew(SpinBox);
simplification->set_min(0.01);
simplification->set_max(10.00);
simplification->set_step(0.01);
simplification->set_value(2);
hb->add_child(simplification);
hb->add_spacer();
hb->add_child(memnew(Label(TTR("Grow (Pixels): "))));
island_merging = memnew(SpinBox);
island_merging->set_min(0);
island_merging->set_max(10);
island_merging->set_step(1);
island_merging->set_value(2);
hb->add_child(island_merging);
hb->add_spacer();
update_preview = memnew(Button);
update_preview->set_text(TTR("Update Preview"));
update_preview->connect("pressed", this, "_update_mesh_data");
hb->add_child(update_preview);
vb->add_margin_child(TTR("Settings:"), hb);
add_child(debug_uv_dialog);
}
示例6: set_title
EditorSubScene::EditorSubScene() {
scene = NULL;
is_root = false;
set_title(TTR("Select Node(s) to Import"));
set_hide_on_ok(false);
VBoxContainer *vb = memnew(VBoxContainer);
add_child(vb);
//set_child_rect(vb);
HBoxContainer *hb = memnew(HBoxContainer);
path = memnew(LineEdit);
path->connect("text_entered", this, "_path_changed");
hb->add_child(path);
path->set_h_size_flags(SIZE_EXPAND_FILL);
Button *b = memnew(Button);
b->set_text(" .. ");
hb->add_child(b);
b->connect("pressed", this, "_path_browse");
vb->add_margin_child(TTR("Scene Path:"), hb);
tree = memnew(Tree);
tree->set_v_size_flags(SIZE_EXPAND_FILL);
vb->add_margin_child(TTR("Import From Node:"), tree, true);
tree->set_select_mode(Tree::SELECT_MULTI);
tree->connect("multi_selected", this, "_item_multi_selected");
//tree->connect("nothing_selected", this, "_deselect_items");
tree->connect("cell_selected", this, "_selected_changed");
tree->connect("item_activated", this, "_ok", make_binds(), CONNECT_DEFERRED);
file_dialog = memnew(EditorFileDialog);
List<String> extensions;
ResourceLoader::get_recognized_extensions_for_type("PackedScene", &extensions);
for (List<String>::Element *E = extensions.front(); E; E = E->next()) {
file_dialog->add_filter("*." + E->get());
}
file_dialog->set_mode(EditorFileDialog::MODE_OPEN_FILE);
add_child(file_dialog);
file_dialog->connect("file_selected", this, "_path_selected");
}
示例7: _panel_draw
void ProjectManager::_panel_draw(Node *p_hb) {
HBoxContainer *hb = p_hb->cast_to<HBoxContainer>();
hb->draw_line(Point2(0,hb->get_size().y+1),Point2(hb->get_size().x-10,hb->get_size().y+1),get_color("guide_color","Tree"));
if (selected_list.has(hb->get_meta("name"))) {
hb->draw_style_box(get_stylebox("selected","Tree"),Rect2(Point2(),hb->get_size()-Size2(10,0)));
}
}
示例8: memnew
Variant ProjectExportDialog::get_drag_data_fw(const Point2 &p_point, Control *p_from) {
if (p_from == presets) {
int pos = presets->get_item_at_position(p_point, true);
if (pos >= 0) {
Dictionary d;
d["type"] = "export_preset";
d["preset"] = pos;
HBoxContainer *drag = memnew(HBoxContainer);
TextureRect *tr = memnew(TextureRect);
tr->set_texture(presets->get_item_icon(pos));
drag->add_child(tr);
Label *label = memnew(Label);
label->set_text(presets->get_item_text(pos));
drag->add_child(label);
set_drag_preview(drag);
return d;
}
} else if (p_from == patches) {
TreeItem *item = patches->get_item_at_position(p_point);
if (item && item->get_cell_mode(0) == TreeItem::CELL_MODE_CHECK) {
int metadata = item->get_metadata(0);
Dictionary d;
d["type"] = "export_patch";
d["patch"] = metadata;
Label *label = memnew(Label);
label->set_text(item->get_text(0));
set_drag_preview(label);
return d;
}
}
return Variant();
}
示例9: add_child
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();
}
示例10: memnew
ResourcePreloaderEditor::ResourcePreloaderEditor() {
//add_style_override("panel", EditorNode::get_singleton()->get_gui_base()->get_stylebox("panel","Panel"));
VBoxContainer *vbc = memnew(VBoxContainer);
add_child(vbc);
HBoxContainer *hbc = memnew(HBoxContainer);
vbc->add_child(hbc);
load = memnew(Button);
load->set_tooltip(TTR("Load Resource"));
hbc->add_child(load);
paste = memnew(Button);
paste->set_text(TTR("Paste"));
hbc->add_child(paste);
file = memnew(EditorFileDialog);
add_child(file);
tree = memnew(Tree);
tree->connect("button_pressed", this, "_cell_button_pressed");
tree->set_columns(2);
tree->set_column_min_width(0, 2);
tree->set_column_min_width(1, 3);
tree->set_column_expand(0, true);
tree->set_column_expand(1, true);
tree->set_v_size_flags(SIZE_EXPAND_FILL);
tree->set_drag_forwarding(this);
vbc->add_child(tree);
dialog = memnew(AcceptDialog);
add_child(dialog);
load->connect("pressed", this, "_load_pressed");
paste->connect("pressed", this, "_paste_pressed");
file->connect("files_selected", this, "_files_load_request");
tree->connect("item_edited", this, "_item_edited");
loading_scene = false;
}
示例11: memnew
ImportDock::ImportDock() {
imported = memnew(LineEdit);
imported->set_editable(false);
add_child(imported);
HBoxContainer *hb = memnew(HBoxContainer);
add_margin_child(TTR("Import As:"), hb);
import_as = memnew(OptionButton);
hb->add_child(import_as);
import_as->set_h_size_flags(SIZE_EXPAND_FILL);
preset = memnew(MenuButton);
preset->set_text(TTR("Preset.."));
preset->get_popup()->connect("index_pressed", this, "_preset_selected");
hb->add_child(preset);
import_opts = memnew(PropertyEditor);
add_child(import_opts);
import_opts->set_v_size_flags(SIZE_EXPAND_FILL);
import_opts->hide_top_label();
import_opts->set_hide_script(true);
hb = memnew(HBoxContainer);
add_child(hb);
import = memnew(Button);
import->set_text(TTR("Reimport"));
import->connect("pressed", this, "_reimport");
hb->add_spacer();
hb->add_child(import);
hb->add_spacer();
params = memnew(ImportDockParameters);
import_opts->edit(params);
}
示例12: 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);
}
示例13: set_title
EditorSubScene::EditorSubScene() {
set_title("Select Sub-Scene..");
VBoxContainer *vb = memnew( VBoxContainer );
add_child(vb);
set_child_rect(vb);
HBoxContainer *hb = memnew( HBoxContainer );
path = memnew( LineEdit );
path->connect("text_entered",this,"_path_changed");
hb->add_child(path);
path->set_h_size_flags(SIZE_EXPAND_FILL);
Button *b = memnew( Button );
b->set_text(" .. ");
hb->add_child(b);
b->connect("pressed",this,"_path_browse");
vb->add_margin_child("Scene Path:",hb);
tree = memnew( Tree );
tree->set_v_size_flags(SIZE_EXPAND_FILL);
vb->add_margin_child("Import From Node:",tree)->set_v_size_flags(SIZE_EXPAND_FILL);
file_dialog = memnew( FileDialog );
List<String> extensions;
ResourceLoader::get_recognized_extensions_for_type("PackedScene",&extensions);
for(List<String>::Element *E = extensions.front();E;E=E->next() ) {
file_dialog->add_filter("*."+E->get());
}
file_dialog->set_mode(FileDialog::MODE_OPEN_FILE);
add_child(file_dialog);
file_dialog->connect("file_selected",this,"_path_selected");
scene=NULL;
set_hide_on_ok(false);
}
示例14: memnew
GroupsEditor::GroupsEditor() {
node = NULL;
VBoxContainer *vbc = this;
group_dialog = memnew(GroupDialog);
group_dialog->set_as_toplevel(true);
add_child(group_dialog);
group_dialog->connect("popup_hide", this, "_group_dialog_closed");
Button *group_dialog_button = memnew(Button);
group_dialog_button->set_text(TTR("Manage Groups"));
vbc->add_child(group_dialog_button);
group_dialog_button->connect("pressed", this, "_show_group_dialog");
HBoxContainer *hbc = memnew(HBoxContainer);
vbc->add_child(hbc);
group_name = memnew(LineEdit);
group_name->set_h_size_flags(SIZE_EXPAND_FILL);
hbc->add_child(group_name);
group_name->connect("text_entered", this, "_add_group");
add = memnew(Button);
add->set_text(TTR("Add"));
hbc->add_child(add);
add->connect("pressed", this, "_add_group", varray(String()));
tree = memnew(Tree);
tree->set_hide_root(true);
tree->set_v_size_flags(SIZE_EXPAND_FILL);
vbc->add_child(tree);
tree->connect("button_pressed", this, "_remove_group");
add_constant_override("separation", 3 * EDSCALE);
}
示例15: _panel_input
void ProjectManager::_panel_input(const InputEvent& p_ev,Node *p_hb) {
if (p_ev.type==InputEvent::MOUSE_BUTTON && p_ev.mouse_button.pressed && p_ev.mouse_button.button_index==BUTTON_LEFT) {
String clicked = p_hb->get_meta("name");
String clicked_main_scene = p_hb->get_meta("main_scene");
if (p_ev.key.mod.shift && selected_list.size()>0 && last_clicked!="" && clicked != last_clicked) {
int clicked_id = -1;
int last_clicked_id = -1;
for(int i=0;i<scroll_childs->get_child_count();i++) {
HBoxContainer *hb = scroll_childs->get_child(i)->cast_to<HBoxContainer>();
if (!hb) continue;
if (hb->get_meta("name") == clicked) clicked_id = i;
if (hb->get_meta("name") == last_clicked) last_clicked_id = i;
}
if (last_clicked_id!=-1 && clicked_id!=-1) {
int min = clicked_id < last_clicked_id? clicked_id : last_clicked_id;
int max = clicked_id > last_clicked_id? clicked_id : last_clicked_id;
for(int i=0; i<scroll_childs->get_child_count(); ++i) {
HBoxContainer *hb = scroll_childs->get_child(i)->cast_to<HBoxContainer>();
if (!hb) continue;
if (i!=clicked_id && (i<min || i>max) && !p_ev.key.mod.control) {
selected_list.erase(hb->get_meta("name"));
} else if (i>=min && i<=max) {
selected_list.insert(hb->get_meta("name"), hb->get_meta("main_scene"));
}
}
}
} else if (selected_list.has(clicked) && p_ev.key.mod.control) {
selected_list.erase(clicked);
} else {
last_clicked = clicked;
if (p_ev.key.mod.control || selected_list.size()==0) {
selected_list.insert(clicked, clicked_main_scene);
} else {
selected_list.clear();
selected_list.insert(clicked, clicked_main_scene);
}
}
_update_project_buttons();
if (p_ev.mouse_button.doubleclick)
_open_project(); //open if doubleclicked
}
}