How do I set font style on Treeview rows independently.



I set the style permanently when adding the columns by doing the following:

pFileRenderer->property_style() = Pango::STYLE_ITALIC;
pFileRenderer->property_style_set() = true;

However I want to set the style per rows. I used the standard way of setting column/cell properties but the does not work using the following:

NOTE: The following is only showing part of the code.

myclass::append_columns()
{

Gtk::CellRendererText* pFileRenderer = Gtk::manage( new Gtk::CellRendererText() );
int cols_count = m_TreeView.append_column("File", *pFileRenderer);
Gtk::TreeViewColumn* pFileColumn = m_TreeView.get_column(cols_count-1);

if(pFileColumn)
{
pFileColumn->add_attribute(pFileRenderer->property_text(),
m_writtenColumns.m_col_nFile);
pFileColumn->add_attribute(pFileRenderer->property_style(),
m_writtenColumns.m_col_nFontStyle);
pFileColumn->add_attribute(pFileRenderer->property_style_set(),
m_writtenColumns.m_col_bStyleSet);
}
}

myclass::AppendRow(MyObject &object)
{
iter = m_refListStore->append();
Gtk::TreeModel::Row row = *iter;

row[m_writtenColumns.m_col_nFile] = Object.getFileNumber();
row[m_writtenColumns.m_col_nFontStyle] = Pango::STYLE_ITALIC;
row[m_writtenColumns.m_col_bStyleSet] = true;
}

Everything compiles clean but does not work.

Thanks,
Sam

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]