Пример #1
0
void ParticlesChooser::reloadParticles()
{
	// Try to select the previously selected particle again
	_preSelectParticle = _selectedParticle;

	populateParticleList();
}
Пример #2
0
void ParticlesChooser::reloadParticles()
{
	std::string prevSelection = _selectedParticle;

	populateParticleList();

	// Try to select the previously selected particle again
	setSelectedParticle(prevSelection);
}
Пример #3
0
// Create the tree view
wxWindow* ParticlesChooser::createTreeView(wxWindow* parent)
{
	_treeView = wxutil::TreeView::CreateWithModel(parent, _particlesList);
	_treeView->SetSize(300, -1);

	// Single text column
	_treeView->AppendTextColumn(_("Particle"), COLUMNS().name.getColumnIndex(), 
		wxDATAVIEW_CELL_INERT, wxCOL_WIDTH_AUTOSIZE, wxALIGN_NOT, wxDATAVIEW_COL_SORTABLE);

	// Apply full-text search to the column
	_treeView->AddSearchColumn(COLUMNS().name);

	// Start loading particles into the view
	populateParticleList();

	// Connect up the selection changed callback
	_treeView->Connect(wxEVT_DATAVIEW_SELECTION_CHANGED, 
		wxDataViewEventHandler(ParticlesChooser::_onSelChanged), NULL, this);

	return _treeView;
}
Пример #4
0
// Create the tree view
GtkWidget* ParticlesChooser::createTreeView() {
	
	GtkWidget* tv = 
		gtk_tree_view_new_with_model(GTK_TREE_MODEL(_particlesList));
	
	// Single text column
	gtk_tree_view_append_column(GTK_TREE_VIEW(tv),
								gtkutil::TextColumn(_("Particle"), 0));
	
	// Populate with particle names
	populateParticleList();
	
	// Connect up the selection changed callback
	_selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(tv));
	g_signal_connect(
		G_OBJECT(_selection), "changed", G_CALLBACK(_onSelChanged), this
	);
	
	// Pack into scrolled window and return
	return gtkutil::ScrolledFrame(tv);
	
}
Пример #5
0
// Create the tree view
Gtk::Widget& ParticlesChooser::createTreeView()
{
	_treeView = Gtk::manage(new Gtk::TreeView(_particlesList));

	_treeView->set_size_request(300, -1);

	// Single text column
	_treeView->append_column(*Gtk::manage(new gtkutil::TextColumn(_("Particle"), COLUMNS().name, false)));

	// Apply full-text search to the column
	_treeView->set_search_equal_func(sigc::ptr_fun(gtkutil::TreeModel::equalFuncStringContains));

	// Populate with particle names
	populateParticleList();

	// Connect up the selection changed callback
	_selection = _treeView->get_selection();
	_selection->signal_changed().connect(sigc::mem_fun(*this, &ParticlesChooser::_onSelChanged));

	// Pack into scrolled window and return
	return *Gtk::manage(new gtkutil::ScrolledFrame(*_treeView));
}