Beispiel #1
0
void PseudoAxesFrame::update(void)
{
	Gtk::CellRenderer *renderer;
	this->updatePseudoAxis();

	renderer = _treeview1->get_column_cell_renderer(1); // 1 is the index of the value column
	renderer->property_cell_background().set_value("white");
}
void playlistWindow::configureTreeview(void) {
	// create the data model
	playlistStore = Gtk::ListStore::create(playlistColumns);
	// set the data model
  playlistTreeview->set_model(playlistStore);
	//Add the TreeView's view columns
  playlistTreeview->append_column("", playlistColumns.playlistidcol);
  playlistTreeview->append_column("Name", playlistColumns.playlistnamecol);
  playlistTreeview->append_column("Length", playlistColumns.playlistlengthcol);
  playlistTreeview->append_column("Format", playlistColumns.playlistformatcol);
  playlistTreeview->append_column("Date of creation", playlistColumns.playlistdateofcreationcol);
  playlistTreeview->append_column("Cell background color", playlistColumns.playlistcellbgcolorcol);

	Gtk::TreeView::Column* pColumn;
	for(guint i = 1; i < 5; i++)
  { 
		pColumn = playlistTreeview->get_column(i);
		Gtk::CellRenderer* cellRenderer = playlistTreeview->get_column_cell_renderer(i);
		pColumn->add_attribute(cellRenderer->property_cell_background(), playlistColumns.playlistcellbgcolorcol);
    pColumn->set_reorderable();
		switch(i) {
			case 1 : pColumn->set_sort_column(playlistColumns.playlistnamecol); break;
			case 2 : pColumn->set_sort_column(playlistColumns.playlistlengthcol); break;
			case 3 : pColumn->set_sort_column(playlistColumns.playlistformatcol); break;
			case 4 : pColumn->set_sort_column(playlistColumns.playlistdateofcreationcol); break;
		}
  }
	pColumn = playlistTreeview->get_column(5);
	pColumn->set_visible(false);
	//All the items to be reordered with drag-and-drop
	// Set the visibility state of the headers. 
	playlistTreeview->set_headers_visible(true);
	// Allow the column title buttons to be clicked
	playlistTreeview->set_headers_clickable(true);
	// Resize all columns to their optimal width. 
	playlistTreeview->columns_autosize();
	// all element are reordorable
	playlistTreeview->set_reorderable();
  playlistTreeview->set_rules_hint();
	// grab the treeview selection
	playlistTreeviewSelection = playlistTreeview->get_selection();
	// connect signal to dectect when tree selection change
	playlistTreeview->signal_button_press_event().connect(sigc::mem_fun(*this,
              &playlistWindow::on_playlist_selection_changed),false);

	initPlaylistStates();		

}
Beispiel #3
0
void PseudoAxesFrame::on_cell_TreeView_pseudoAxis_value_edited(Glib::ustring const & spath,
							       Glib::ustring const & newText)
{
	double value;
	HklPseudoAxis *pseudo;

	Gtk::TreePath path(spath);
	Gtk::TreeModel::iterator iter = _pseudoAxis_ListStore->get_iter(path);
	Gtk::ListStore::Row row = *(iter);

	sscanf(newText.c_str(), "%lf", &value);

	pseudo = row[_pseudoAxis_columns.pseudo];
	if(pseudo){
		Gtk::CellRenderer *renderer;

		renderer = _treeview1->get_column_cell_renderer(1); // 1 is the index of the value column
		renderer->property_cell_background().set_value("red");
		hkl_parameter_set_value_unit((HklParameter *)pseudo, value);
		row[_pseudoAxis_columns.value] = value;
	}
}