当前位置: 首页>>代码示例>>C++>>正文


C++ set_title函数代码示例

本文整理汇总了C++中set_title函数的典型用法代码示例。如果您正苦于以下问题:C++ set_title函数的具体用法?C++ set_title怎么用?C++ set_title使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了set_title函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: 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");
//.........这里部分代码省略.........
开发者ID:mcanders,项目名称:godot,代码行数:101,代码来源:project_export.cpp

示例2: memnew

FileDialog::FileDialog() {

	show_hidden_files=true;

	VBoxContainer *vbc = memnew( VBoxContainer );
	add_child(vbc);
	set_child_rect(vbc);

	mode=MODE_SAVE_FILE;
	set_title("Save a File");
	
	dir = memnew(LineEdit);
	HBoxContainer *pathhb = memnew( HBoxContainer );
	pathhb->add_child(dir);
	dir->set_h_size_flags(SIZE_EXPAND_FILL);

	drives = memnew( OptionButton );
	pathhb->add_child(drives);
	drives->connect("item_selected",this,"_select_drive");

	makedir = memnew( Button );
	makedir->set_text("Create Folder");
	makedir->connect("pressed",this,"_make_dir");
	pathhb->add_child(makedir);
	
	vbc->add_margin_child("Path:",pathhb);
	
	tree = memnew(Tree);
	tree->set_hide_root(true);
	vbc->add_margin_child("Directories & Files:",tree,true);
	
	file = memnew(LineEdit);
	//add_child(file);
	vbc->add_margin_child("File:",file);
	

	filter = memnew( OptionButton );
	//add_child(filter);
	vbc->add_margin_child("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("Create Folder");
	VBoxContainer *makevb= memnew( VBoxContainer );
	makedialog->add_child(makevb);
	makedialog->set_child_rect(makevb);
	makedirname = memnew( LineEdit );
	makevb->add_margin_child("Name:",makedirname);
	add_child(makedialog);
	makedialog->register_text_enter(makedirname);
	makedialog->connect("confirmed",this,"_make_dir_confirm");
	mkdirerr = memnew( AcceptDialog );
	mkdirerr->set_text("Could not create folder.");
	add_child(mkdirerr);

	exterr = memnew( AcceptDialog );
	exterr->set_text("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:zz676,项目名称:godot,代码行数:94,代码来源:file_dialog.cpp

示例3: main

int main() {
  FILE *file;
  // processing each line
  char line[128];
  char title[16];
  char centre[2];
  char filename[80];
  char t_str[10];
  int truncate;
  int frames;
  SNDFILE *wave_in;
  SF_INFO *wave_info;
  
  // running state
  int sample = 0;
  int pointer = 0;
  
  int i;
  
  // buffers
  unsigned char *buffer;
  float *wave_buffer;
  unsigned char *firmware;
  
  firmware = malloc(FIRMWARE_SIZE*sizeof(char));

  buffer=malloc(1024*1024*sizeof(unsigned char));
  memset(buffer,0x80,1024*1024*sizeof(unsigned char));
  
  wave_buffer = malloc(1024*1024*sizeof(float));
  wave_info = (SF_INFO *) malloc(sizeof(SF_INFO));  

  file = fopen("hr16b.bin", "rb");
  if(!file) {
    printf("can't open firmware image\n");
    exit(1);
  }
  
  fread(firmware,1,FIRMWARE_SIZE,file);
  fclose(file);
  flip(firmware);
  
  file = fopen("samplelist.txt", "rb");
  if(!file) {
    printf("can't open sample list\n");
    exit(1);
  }

  
  


  
  while (fgets(line, 128, file)) {

    centre[0]=0x00;

    sscanf(line, "%[^:]:%[^:]:%[^:]:%[^:]", title, centre, filename, t_str);
    
    //sscanf(line, "%[^:]:%[^:]:%[^:]", title, centre, filename);


    if (!(wave_in = sf_open(filename,SFM_READ,wave_info))) {
      printf("Failed to read sample %s\n", filename);
    }

    frames = wave_info->frames;
    truncate = atoi(t_str);
    if (truncate>0) frames=truncate;

    sf_readf_float(wave_in,wave_buffer,frames);

    sf_close(wave_in);

    for (i=0; i< frames; i++) {
      buffer[i+pointer] = 127*(wave_buffer[i]);
    }
    set_title(firmware, sample+1, title, 1);

    printf("pointer = %d (%05x)\nframes = %d (%05x)\n",pointer,pointer,frames, frames);
    frames += 2; // make sure there are at least two stop bytes
    frames = (frames & 0xffff0)+0x10;
    printf("frames = %d (%05x)\n\n",frames, frames);
    
    set_offset(firmware, sample+1, pointer);
    
    pointer += frames;
    sample++;

    //printf("%s:\n%d frames\n%d channels\n", title, wave_info->channels, wave_info->frames);

  }



  fclose(file);
  
  file = fopen("sample1.bin","wb");
  fwrite(buffer,1,524288,file);
  fclose(file);
//.........这里部分代码省略.........
开发者ID:bradholland,项目名称:hr16utils,代码行数:101,代码来源:readlist.c

示例4: aTable

//////////////////////////////////////////////////////////////////////////
// Default constructor
SelectEditUI::SelectEditUI(Manager* aManager, int type, int app, bool aBeingViewed) 
: aTable(11, 6, false),
  title("Please select a section to edit"),
  l1("General Information:", 0, 1, false),
  l2("Taken Courses:", 0, 1, false),
  l3("TA'd Courses:", 0, 1, false),
  l4("Work Experience:", 0, 1, false),
  e1("Edit"),
  e2("Edit"),
  e3("Edit"),
  e4("Edit"),
  cancelButton("Cancel Application"),
  doneButton("Done"), 
  uApp(0),
  gApp(0)
{
  manager = aManager;
  stuType = type;
  appNum  = app;
  beingViewed = aBeingViewed;
  set_default_size(500, 700);
  set_title("cuTAES");
  set_modal(true);
  set_position(Gtk::WIN_POS_CENTER_ALWAYS);
  set_deletable(false);
  beingViewedStuType = stuType;
  if(beingViewed){
    stuType = 0;
  }
  if (stuType == 0) {
    uApp = manager->getUGradApps()->getApp(appNum);
    appInfo.set_text("Application #" + Tools::intToString(appNum) + " for " + uApp->getCourse()->getName());
  }
  else {
    gApp = manager->getGradApps()->getApp(appNum);
    appInfo.set_text("Application #" + Tools::intToString(appNum) + " for " + gApp->getCourse()->getName());
  }

  add(aTable);
  fillTable();
  aTable.attach(title, 0, 6, 0, 1,Gtk::FILL,Gtk::FILL,0,10);
  aTable.attach(appInfo, 0, 6, 1, 2,Gtk::FILL,Gtk::FILL,0,10);
  aTable.attach(l1, 0, 6, 2, 3,Gtk::FILL,Gtk::FILL,15,0);
  aTable.attach(s1, 0, 4, 3, 4);
  aTable.attach(e1, 4, 6, 3, 4,Gtk::FILL,Gtk::SHRINK,15,0);
  if (stuType==0) {
    aTable.attach(l2, 0, 6, 4, 5,Gtk::FILL,Gtk::FILL,15,0);
    aTable.attach(s2, 0, 4, 5, 6);
    aTable.attach(e2, 4, 6, 5, 6,Gtk::FILL,Gtk::SHRINK,15,0);
  }
  aTable.attach(l3, 0, 6, 6, 7,Gtk::FILL,Gtk::FILL,15,0);
  aTable.attach(s3, 0, 4, 7, 8);
  aTable.attach(e3, 4, 6, 7, 8,Gtk::FILL,Gtk::SHRINK,15,0);
  aTable.attach(l4, 0, 6, 8, 9,Gtk::FILL,Gtk::FILL,15,0);
  aTable.attach(s4, 0, 4, 9, 10);
  aTable.attach(e4, 4, 6, 9, 10,Gtk::FILL,Gtk::SHRINK,15,0);
  if(!beingViewed)
    aTable.attach(cancelButton, 0, 2, 10, 11, Gtk::FILL,Gtk::FILL, 20, 20);
  aTable.attach(doneButton, 2, 6, 10, 11, Gtk::FILL, Gtk::FILL, 20, 20);

  cancelButton.signal_clicked().connect(
    sigc::bind<Glib::ustring>( sigc::mem_fun(*this, &SelectEditUI::on_cancelButton), "Cancel Application") );
  doneButton.signal_clicked().connect(
    sigc::bind<Glib::ustring>( sigc::mem_fun(*this, &SelectEditUI::on_doneButton), "Done") );
  e1.signal_clicked().connect(
    sigc::bind<Glib::ustring>( sigc::mem_fun(*this, &SelectEditUI::on_editInfoButton), "info") );
  e2.signal_clicked().connect(
    sigc::bind<Glib::ustring>( sigc::mem_fun(*this, &SelectEditUI::on_editEntryButton), "taken") );
  e3.signal_clicked().connect(
    sigc::bind<Glib::ustring>( sigc::mem_fun(*this, &SelectEditUI::on_editEntryButton), "ta") );
  e4.signal_clicked().connect(
    sigc::bind<Glib::ustring>( sigc::mem_fun(*this, &SelectEditUI::on_editEntryButton), "work") );
  
  show_all_children();
  //cout << "CONSTRUCT SelectEditUI" << endl;
}
开发者ID:CanadianBac0nz,项目名称:2404a5,代码行数:78,代码来源:SelectEditUI.cpp

示例5: while

void CreateDialog::popup_create(bool p_dont_clear, bool p_replace_mode, const String &p_select_type) {

	type_list.clear();
	ClassDB::get_class_list(&type_list);
	ScriptServer::get_global_class_list(&type_list);
	type_list.sort_custom<StringName::AlphCompare>();

	recent->clear();

	FileAccess *f = FileAccess::open(EditorSettings::get_singleton()->get_project_settings_dir().plus_file("create_recent." + base_type), FileAccess::READ);

	if (f) {

		TreeItem *root = recent->create_item();

		while (!f->eof_reached()) {
			String l = f->get_line().strip_edges();
			String name = l.split(" ")[0];

			if (ClassDB::class_exists(name) || ScriptServer::is_global_class(name)) {
				TreeItem *ti = recent->create_item(root);
				ti->set_text(0, l);
				ti->set_icon(0, EditorNode::get_singleton()->get_class_icon(l, base_type));
			}
		}

		memdelete(f);
	}

	favorites->clear();

	f = FileAccess::open(EditorSettings::get_singleton()->get_project_settings_dir().plus_file("favorites." + base_type), FileAccess::READ);

	favorite_list.clear();

	if (f) {

		while (!f->eof_reached()) {
			String l = f->get_line().strip_edges();

			if (l != String()) {
				favorite_list.push_back(l);
			}
		}

		memdelete(f);
	}

	_save_and_update_favorite_list();

	// Restore valid window bounds or pop up at default size.
	Rect2 saved_size = EditorSettings::get_singleton()->get_project_metadata("dialog_bounds", "create_new_node", Rect2());
	if (saved_size != Rect2()) {
		popup(saved_size);
	} else {
		popup_centered_clamped(Size2(900, 700) * EDSCALE, 0.8);
	}

	if (p_dont_clear) {
		search_box->select_all();
	} else {
		search_box->clear();
	}

	search_box->grab_focus();

	_update_search();

	is_replace_mode = p_replace_mode;

	if (p_replace_mode) {
		select_type(p_select_type);
		set_title(vformat(TTR("Change %s Type"), base_type));
		get_ok()->set_text(TTR("Change"));
	} else {
		set_title(vformat(TTR("Create New %s"), base_type));
		get_ok()->set_text(TTR("Create"));
	}
}
开发者ID:Paulloz,项目名称:godot,代码行数:79,代码来源:create_dialog.cpp

示例6: EditorBitMaskImportDialog

	EditorBitMaskImportDialog(EditorBitMaskImportPlugin *p_plugin) {

		plugin = p_plugin;


		set_title(TTR("Import BitMasks"));

		VBoxContainer *vbc = memnew(VBoxContainer);
		add_child(vbc);
		//set_child_rect(vbc);


		HBoxContainer *hbc = memnew(HBoxContainer);
		vbc->add_margin_child(TTR("Source Texture(s):"), hbc);

		import_path = memnew(LineEdit);
		import_path->set_h_size_flags(SIZE_EXPAND_FILL);
		hbc->add_child(import_path);

		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(TTR("Target Path:"), hbc);

		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);
		file_select->set_mode(EditorFileDialog::MODE_OPEN_FILES);
		file_select->connect("files_selected", this, "_choose_files");

		List<String> extensions;
		ImageLoader::get_recognized_extensions(&extensions);
		file_select->clear_filters();
		for (int i = 0; i<extensions.size(); i++) {

			file_select->add_filter("*." + extensions[i] + " ; " + extensions[i].to_upper());
		}

		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(TTR("Import"));


		error_dialog = memnew(ConfirmationDialog);
		add_child(error_dialog);
		error_dialog->get_ok()->set_text(TTR("Accept"));
		//error_dialog->get_cancel()->hide();

		set_hide_on_ok(false);
	}
开发者ID:MattUV,项目名称:godot,代码行数:69,代码来源:editor_bitmask_import_plugin.cpp

示例7: m_box1

ExampleWindow::ExampleWindow(int which)
: m_box1(Gtk::ORIENTATION_VERTICAL),
  m_buttonQuit("Quit")
{
  set_title("Gtk::Box example");

  PackBox *pPackBox1, *pPackBox2, *pPackBox3, *pPackBox4, *pPackBox5;

  switch(which)
  {
    case 1:
    {
      m_Label1.set_text("Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, 0); set_homogeneous(false);");

      // Align the label to the left side.  We'll discuss this function and
      // others in the section on Widget Attributes.
      m_Label1.set_alignment(Gtk::ALIGN_START, Gtk::ALIGN_START);

      // Pack the label into the vertical box (vbox box1).  Remember that
      // widgets added to a vbox will be packed one on top of the other in
      // order.
      m_box1.pack_start(m_Label1, Gtk::PACK_SHRINK);

      // Create a PackBox - homogeneous = false, spacing = 0,
      // options = Gtk::PACK_SHRINK, padding = 0
      pPackBox1 = Gtk::manage(new PackBox(false, 0, Gtk::PACK_SHRINK));
      m_box1.pack_start(*pPackBox1, Gtk::PACK_SHRINK);

      // Create a PackBox - homogeneous = false, spacing = 0,
      // options = Gtk::PACK_EXPAND_PADDING, padding = 0
      pPackBox2 = Gtk::manage(new PackBox(false, 0, Gtk::PACK_EXPAND_PADDING));
      m_box1.pack_start(*pPackBox2, Gtk::PACK_SHRINK);

      // Create a PackBox - homogeneous = false, spacing = 0,
      // options = Gtk::PACK_EXPAND_WIDGET, padding = 0
      pPackBox3 = Gtk::manage(new PackBox(false, 0, Gtk::PACK_EXPAND_WIDGET));
      m_box1.pack_start(*pPackBox3, Gtk::PACK_SHRINK);

      // pack the separator into the vbox.  Remember each of these
      // widgets are being packed into a vbox, so they'll be stacked
      // vertically.
      m_box1.pack_start(m_separator1, Gtk::PACK_SHRINK, 5);

      // create another new label, and show it.
      m_Label2.set_text("Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, 0); set_homogeneous(true);");
      m_Label2.set_alignment(Gtk::ALIGN_START, Gtk::ALIGN_START);
      m_box1.pack_start(m_Label2, Gtk::PACK_SHRINK);

      // Args are: homogeneous, spacing, options, padding
      pPackBox4 = Gtk::manage(new PackBox(true, 0, Gtk::PACK_EXPAND_PADDING));
      m_box1.pack_start(*pPackBox4, Gtk::PACK_SHRINK);

      // Args are: homogeneous, spacing, options, padding
      pPackBox5 = Gtk::manage(new PackBox(true, 0, Gtk::PACK_EXPAND_WIDGET));
      m_box1.pack_start(*pPackBox5, Gtk::PACK_SHRINK);

      m_box1.pack_start(m_separator2, Gtk::PACK_SHRINK, 5);

      break;
    }

    case 2:
    {

      m_Label1.set_text("Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, 10); set_homogeneous(false);");
      m_Label1.set_alignment(Gtk::ALIGN_START, Gtk::ALIGN_START);
      m_box1.pack_start(m_Label1, Gtk::PACK_SHRINK);

      pPackBox1 = Gtk::manage(new PackBox(false, 10, Gtk::PACK_EXPAND_PADDING));
      m_box1.pack_start(*pPackBox1, Gtk::PACK_SHRINK);

      pPackBox2 = Gtk::manage(new PackBox(false, 10, Gtk::PACK_EXPAND_WIDGET));
      m_box1.pack_start(*pPackBox2, Gtk::PACK_SHRINK);

      m_box1.pack_start(m_separator1, Gtk::PACK_SHRINK, 5);

      m_Label2.set_text("Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, 0); set_homogeneous(false);");
      m_Label2.set_alignment(Gtk::ALIGN_START, Gtk::ALIGN_START);
      m_box1.pack_start(m_Label2, Gtk::PACK_SHRINK);

      pPackBox3 = Gtk::manage(new PackBox(false, 0, Gtk::PACK_SHRINK, 10));
      m_box1.pack_start(*pPackBox3, Gtk::PACK_SHRINK);

      pPackBox4 = Gtk::manage(new PackBox(false, 0, Gtk::PACK_EXPAND_WIDGET, 10));
      m_box1.pack_start(*pPackBox4, Gtk::PACK_SHRINK);

      m_box1.pack_start(m_separator2, Gtk::PACK_SHRINK, 5);

      break;
    }

    case 3:
    {
      // This demonstrates the ability to use Gtk::Box::pack_end() to
      // right justify widgets.  First, we create a new box as before.
      pPackBox1 = Gtk::manage(new PackBox(false, 0, Gtk::PACK_SHRINK));

      // create the label that will be put at the end.
      m_Label1.set_text("end");

//.........这里部分代码省略.........
开发者ID:hamedobaidy,项目名称:gtkmm_eclipse_examples,代码行数:101,代码来源:examplewindow.cpp

示例8: Window

    Window() : canvas(), checkbutton1("Plot 1"),
      checkbutton2("Plot 2"), checkbutton3("Plot 3"),
      label_x("X:"),
      label_y("Y:") {
      set_default_size(720, 580);
      Gdk::Geometry geometry;
      geometry.min_aspect = geometry.max_aspect = double(720)/double(580);
      set_geometry_hints(*this, geometry, Gdk::HINT_ASPECT);
      set_title("Gtkmm-PLplot test4");
      canvas.set_hexpand(true);
      canvas.set_vexpand(true);
      canvas.set_background_color(Gdk::RGBA("Light Gray"));
      grid.set_column_homogeneous(true);
      checkbutton1.set_vexpand(false);
      checkbutton1.set_hexpand(false);
      checkbutton1.set_halign(Gtk::ALIGN_CENTER);
      checkbutton2.set_vexpand(false);
      checkbutton2.set_hexpand(false);
      checkbutton2.set_halign(Gtk::ALIGN_CENTER);
      checkbutton3.set_vexpand(false);
      checkbutton3.set_hexpand(false);
      checkbutton3.set_halign(Gtk::ALIGN_CENTER);

      std::valarray<double> x_va = Gtk::PLplot::indgen_va(1000)/50.0 - 10.0;
      std::valarray<double> y_va1 = sinh(x_va);
      std::valarray<double> y_va2 = cosh(x_va);
      std::valarray<double> y_va3 = tanh(x_va);

      //generate the data, the plot, add them to the canvas and use the return value to pass it to the checkbutton
      Gtk::PLplot::Plot2D *plot1 = Gtk::manage(
        new Gtk::PLplot::Plot2D(
          *Gtk::manage(
            new Gtk::PLplot::PlotData2D(
              x_va,
              y_va1,
              Gdk::RGBA("blue"),
              Gtk::PLplot::LineStyle::CONTINUOUS,
              3.0
            )
          ),
          "X-axis",
          "Y-axis",
          "Hyperbolic sine",
          0.5,
          0.5,
          0.0,
          0.0
        )
      );
      canvas.add_plot(*plot1);
      checkbutton1.connect_plot(plot1);

      Gtk::PLplot::Plot2D *plot2 = Gtk::manage(
        new Gtk::PLplot::Plot2D(
          *Gtk::manage(
            new Gtk::PLplot::PlotData2D(
              x_va,
              y_va2,
              Gdk::RGBA("red"),
              Gtk::PLplot::LineStyle::CONTINUOUS,
              3.0
            )
          ),
          "X-axis",
          "Y-axis",
          "Hyperbolic cosine",
          0.5,
          0.5,
          0.5,
          0.0
        )
      );
      canvas.add_plot(*plot2);
      checkbutton2.connect_plot(plot2);

      Gtk::PLplot::Plot2D *plot3 = Gtk::manage(
        new Gtk::PLplot::Plot2D(
          *Gtk::manage(
            new Gtk::PLplot::PlotData2D(
              x_va,
              y_va3,
              Gdk::RGBA("green"),
              Gtk::PLplot::LineStyle::CONTINUOUS,
              3.0
            )
          ),
          "X-axis",
          "Y-axis",
          "Hyperbolic tangent",
          0.4,
          0.4,
          0.2,
          0.55
        )
      );
      canvas.add_plot(*plot3);
      checkbutton3.connect_plot(plot3);

      checkbutton1.set_active();
      checkbutton2.set_active(false);
//.........这里部分代码省略.........
开发者ID:tschoonj,项目名称:gtkmm-plplot,代码行数:101,代码来源:test4.cpp

示例9: do_mpmset


//.........这里部分代码省略.........
			progbug( "MpMset: Invalid deity", ch );
			return;
		}
		STRFREE( victim->pcdata->deity_name );
		victim->pcdata->deity_name = QUICKLINK( deity->name );
		victim->pcdata->deity = deity;
		return;
	}

	if ( !str_cmp( arg2, "short" ) )
	{
		STRFREE( victim->short_descr );
		victim->short_descr = STRALLOC( arg3 );
		return;
	}

	if ( !str_cmp( arg2, "long" ) )
	{
		STRFREE( victim->long_descr );
		mudstrlcpy( buf, arg3, MAX_STRING_LENGTH );
		mudstrlcat( buf, "\r\n", MAX_STRING_LENGTH );
		victim->long_descr = STRALLOC( buf );
		return;
	}

	if ( !str_cmp( arg2, "title" ) )
	{
		if ( IS_NPC( victim ) )
		{
			progbug( "MpMset: can't set npc title", ch );
			return;
		}

		set_title( victim, arg3 );
		return;
	}

	if ( !str_cmp( arg2, "spec" ) )
	{
		if ( !IS_NPC( victim ) )
		{
			progbug( "MpMset: can't set pc spec", ch );
			return;
		}

		if ( !str_cmp( arg3, "none" ) )
		{
			victim->spec_fun = NULL;
			return;
		}

		if ( ( victim->spec_fun = spec_lookup( arg3 ) ) == 0 )
		{
			progbug( "MpMset: Invalid spec", ch );
			return;
		}
		return;
	}

	if ( !str_cmp( arg2, "flags" ) )
	{
		if ( !IS_NPC( victim ) )
		{
			progbug( "MpMset: can't set pc flags", ch );
			return;
		}
开发者ID:andycervantes,项目名称:SMAUG-Pi,代码行数:67,代码来源:mpxset.c

示例10: EditorTranslationImportDialog

	EditorTranslationImportDialog(EditorTranslationImportPlugin *p_plugin) {

		plugin=p_plugin;


		set_title("Import Translation");

		VBoxContainer *vbc = memnew( VBoxContainer );
		add_child(vbc);
		set_child_rect(vbc);



		VBoxContainer *csvb = memnew( VBoxContainer );

		HBoxContainer *hbc = memnew( HBoxContainer );
		csvb->add_child(hbc);
		vbc->add_margin_child("Source CSV:",csvb);

		import_path = memnew( LineEdit );
		import_path->set_h_size_flags(SIZE_EXPAND_FILL);
		hbc->add_child(import_path);
		ignore_first = memnew( CheckButton );
		ignore_first->set_text("Ignore First Row");
		csvb->add_child(ignore_first);

		Button * import_choose = memnew( Button );
		import_choose->set_text(" .. ");
		hbc->add_child(import_choose);

		import_choose->connect("pressed", this,"_browse");

		VBoxContainer *tcomp = memnew( VBoxContainer);
		hbc = memnew( HBoxContainer );
		tcomp->add_child(hbc);
		vbc->add_margin_child("Target Path:",tcomp);

		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");

		compress = memnew( CheckButton);
		compress->set_pressed(true);
		compress->set_text("Compress");
		tcomp->add_child(compress);

		add_to_project = memnew( CheckButton);
		add_to_project->set_pressed(true);
		add_to_project->set_text("Add to Project (engine.cfg)");
		tcomp->add_child(add_to_project);

		file_select = memnew(EditorFileDialog);
		file_select->set_access(EditorFileDialog::ACCESS_FILESYSTEM);
		add_child(file_select);
		file_select->set_mode(EditorFileDialog::MODE_OPEN_FILE);
		file_select->connect("file_selected", this,"_choose_file");
		file_select->add_filter("*.csv ; Translation CSV");
		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");


		error_dialog = memnew ( ConfirmationDialog );
		add_child(error_dialog);
		error_dialog->get_ok()->set_text("Accept");
	//	error_dialog->get_cancel()->hide();

		set_hide_on_ok(false);

		columns = memnew( Tree );
		vbc->add_margin_child("Import Languages:",columns,true);
	}
开发者ID:AMG194,项目名称:godot,代码行数:83,代码来源:editor_translation_import_plugin.cpp

示例11: set_custom_minimum_size

FindInFilesDialog::FindInFilesDialog() {

	set_custom_minimum_size(Size2(400, 190));
	set_resizable(true);
	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);

	{
		Control *placeholder = memnew(Control);
		gc->add_child(placeholder);
	}

	{
		HBoxContainer *hbc = memnew(HBoxContainer);

		_whole_words_checkbox = memnew(CheckBox);
		_whole_words_checkbox->set_text(TTR("Whole words"));
		_whole_words_checkbox->set_pressed(true);
		hbc->add_child(_whole_words_checkbox);

		_match_case_checkbox = memnew(CheckBox);
		_match_case_checkbox->set_text(TTR("Match case"));
		_match_case_checkbox->set_pressed(true);
		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(ROOT_PREFIX);
		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("Filter: "));
	gc->add_child(filter_label);

	{
		HBoxContainer *hbc = memnew(HBoxContainer);

		Vector<String> exts;
		exts.push_back("gd");
		exts.push_back("cs");

		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);
	}

	{
		Control *placeholder = memnew(Control);
//.........这里部分代码省略.........
开发者ID:kubecz3k,项目名称:godot,代码行数:101,代码来源:find_in_files.cpp

示例12: _show_location_dialog

static gboolean
_show_location_dialog(GtkMenuItem *menuitem, WebApplet *webapplet)
{
  GtkWidget *dialog, *entry, *hbox, *vbox, *home_img, *home_box;
  gint response;

  /* Make the dialog */
  dialog = gtk_dialog_new_with_buttons(_("Open Location"),
                                       GTK_WINDOW(webapplet->mainwindow),
                                       GTK_DIALOG_DESTROY_WITH_PARENT,
                                       GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
                                       GTK_STOCK_OPEN, GTK_RESPONSE_OK,
                                       NULL);
  webapplet->location_dialog = dialog;

  /* Entry and "URL:" label */
  entry = gtk_entry_new();
  g_signal_connect(G_OBJECT(entry), "activate",
                   G_CALLBACK(_send_dialog_response), dialog);

  hbox = gtk_hbox_new(FALSE, 6);
  gtk_box_pack_start(GTK_BOX(hbox), gtk_label_new(_("URL:")), FALSE, FALSE, 0);
  gtk_box_pack_start(GTK_BOX(hbox), entry, TRUE, TRUE, 0);

  /* Checkbox: Set as _home page, with nice little Home icon */
  home_img = gtk_image_new_from_stock(GTK_STOCK_HOME, GTK_ICON_SIZE_MENU);
  webapplet->check_home = gtk_check_button_new_with_mnemonic(_("Set as new _Home Page"));

  home_box = gtk_hbox_new(FALSE, 3);
  gtk_box_pack_start(GTK_BOX(home_box), home_img, FALSE, FALSE, 0);
  gtk_box_pack_start(GTK_BOX(home_box), webapplet->check_home, FALSE, FALSE, 0);

  /* Put everything together */
  vbox = gtk_vbox_new(FALSE, 6);
  gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
  gtk_box_pack_start(GTK_BOX(vbox), website_buttons(webapplet), FALSE, FALSE, 0);
  gtk_box_pack_start(GTK_BOX(vbox), home_box, FALSE, FALSE, 0);
  gtk_container_set_border_width(GTK_CONTAINER(vbox), 6);
  gtk_widget_show_all(vbox);

  gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), vbox, TRUE, TRUE, 0);

  response = gtk_dialog_run(GTK_DIALOG(dialog));

  if (response == GTK_RESPONSE_OK)
  {
    gchar *url = (gchar*)gtk_entry_get_text(GTK_ENTRY(entry));

    /* Open the page */
    go_to_url(webapplet, url);

    set_title(webapplet, url);

    /* User entered a URL, didn't choose a site */
    awn_applet_simple_set_icon_name(AWN_APPLET_SIMPLE(webapplet->applet),
                                    ICON_NAME);
    config_set_site(webapplet, "");
  }

  gtk_widget_destroy(dialog);

  return TRUE;
}
开发者ID:micove,项目名称:awn-extras,代码行数:63,代码来源:applet.c

示例13: set_title

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;
//.........这里部分代码省略.........
开发者ID:03050903,项目名称:godot,代码行数:101,代码来源:settings_config_dialog.cpp

示例14: load_rt_text_pf

/*!
 \brief load_rt_text_pf() is called to load up the runtime text configurations
 from the file specified in the firmware's interrogation profile, and populate
 a new window with the runtiem vars text value box.
 */
G_MODULE_EXPORT void load_rt_text_pf(void)
{
	GtkWidget *treeview = NULL; 
	GtkWidget *window = NULL;
	GtkWidget *parent = NULL;
	gint x = 0;
	gint y = 0;
	GtkListStore *store = NULL;
	gchar *filename = NULL;
	GladeXML *main_xml = NULL;
	GladeXML *xml = NULL;
	gboolean xml_result = FALSE;
	CmdLineArgs *args = DATA_GET(global_data,"args");
	xmlDoc *doc = NULL;
	xmlNode *root_element = NULL;
	Firmware_Details *firmware = NULL;

	firmware = DATA_GET(global_data,"firmware");

	if (!(DATA_GET(global_data,"interrogated")))
		return;
	if (!firmware->rtt_map_file)
	{
		dbg_func(CRITICAL,g_strdup_printf(__FILE__": firmware->rtt_map_file is UNDEFINED,\n\texiting runtime text window creation routine!!!!\n"));
		return;
	}

	main_xml = (GladeXML *)DATA_GET(global_data,"main_xml");
	if ((!main_xml) || (DATA_GET(global_data,"leaving")))
		return;

	if (!DATA_GET(global_data,"rtvars_loaded"))
	{
		dbg_func(CRITICAL,g_strdup(__FILE__": load_rt_text_pf()\n\tCRITICAL ERROR, Realtime Variable definitions NOT LOADED!!!\n\n"));
		return;
	}
	gdk_threads_enter();
	set_title(g_strdup(_("Loading RT Text...")));

	filename = get_file(g_build_path(PSEP,RTTEXT_DATA_DIR,firmware->rtt_map_file,NULL),g_strdup("xml"));
	if (!filename)
	{
		dbg_func(RTMLOADER|CRITICAL,g_strdup_printf(__FILE__": load_rt_text_pf()\n\t File \"%s.xml\" not found!!, exiting function\n",firmware->rtt_map_file));
		set_title(g_strdup(_("ERROR RunTimeText Map XML file DOES NOT EXIST!!!")));
		gdk_threads_leave();
		return; 
	}

	/* Create window */
	xml = glade_xml_new(main_xml->filename,"rtt_window",NULL);
	window = glade_xml_get_widget(xml,"rtt_window");
	register_widget("rtt_window",window);
	x = (GINT)DATA_GET(global_data,"rtt_x_origin");
	y = (GINT)DATA_GET(global_data,"rtt_y_origin");
	gtk_window_move(GTK_WINDOW(window),x,y);
	gtk_window_set_default_size(GTK_WINDOW(window),-1,-1);
	g_object_set(window, "resizable", TRUE, NULL);
	parent = glade_xml_get_widget(xml,"rtt_vbox");
	glade_xml_signal_autoconnect(xml);

	LIBXML_TEST_VERSION

		doc = xmlReadFile(filename, NULL, 0);
	g_free(filename);
	if (doc == NULL)
	{
		printf(_("error: could not parse file %s\n"),filename);
		gdk_threads_leave();
		return;
	}

	/*Get the root element node */
	store = gtk_list_store_new(RTT_NUM_COLS,G_TYPE_POINTER,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_FLOAT);
	DATA_SET(global_data,"rtt_model",store);
	treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
	gtk_box_pack_start(GTK_BOX(parent),treeview,TRUE,TRUE,0);
	setup_rtt_treeview(treeview);

	root_element = xmlDocGetRootElement(doc);
	xml_result = load_rtt_xml_elements(root_element,store,parent);
	xmlFreeDoc(doc);
	xmlCleanupParser();

	if (xml_result == FALSE)
		gtk_widget_destroy(window);
	else if ((!args->hide_rttext) && (xml_result))
		gtk_widget_show_all(window);

	set_title(g_strdup(_("RT Text Loaded...")));
	gdk_threads_leave();
	return;
}
开发者ID:seank,项目名称:MegaTunix,代码行数:97,代码来源:runtime_text.c

示例15: memnew


//.........这里部分代码省略.........
	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);
	nodes_to_remove->set_hide_root(true);
	nodes_to_remove->set_hide_folding(true);
	nodes_to_remove->set_select_mode(Tree::SELECT_MULTI);
	nodes_to_remove->connect("item_selected", this, "_node_to_remove_selected");

	HBoxContainer *remove_filter_hbc = memnew(HBoxContainer);
	remove_filter_hbc->add_constant_override("separate", 0);
	vbc_remove->add_child(remove_filter_hbc);

	remove_filter = memnew(LineEdit);
	remove_filter->set_h_size_flags(SIZE_EXPAND_FILL);
	remove_filter->set_placeholder(TTR("Filter nodes"));
	remove_filter_hbc->add_child(remove_filter);
	remove_filter->connect("text_changed", this, "_remove_filter_changed");

	set_title("Group Editor");
	get_cancel()->hide();
	set_as_toplevel(true);

	error = memnew(ConfirmationDialog);
	add_child(error);
	error->get_ok()->set_text(TTR("Close"));
}
开发者ID:marcelofg55,项目名称:godot,代码行数:101,代码来源:groups_editor.cpp


注:本文中的set_title函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。