Some missing features of Gtk::TreeModelColumn



I've been going through hoops since Gtk::TreeModelColumn is missing a
few methods, for which I see no really good reason to not be there.

class FooClass
{
public:
  int bar;
};

class ModelColumns : public Gtk::TreeModel::ColumnRecord
{
public:
  Gtk::TreeModelColumn<int> a;
  Gtk::TreeModelColumn<int> b;
  Gtk::TreeModelColumn<FooClass *> c;
};

ModelColumns m_columns;

...

Gtk::TreeModel::Row row; // Set somewhere
std::ifstream foo("somefile");
foo >> row[m_columns.a];  // Fails.

I have to do something like this, for no good reason:
int tmp;
foo >> tmp;
row[m_columns.a] = tmp;

It seems to me that with a bit of work with templates this could be
made to work.

Another problem:
row[m_columns.a] = row[m_columns.b];	// Fails.

Once again, I have to work around this.
int tmp;
tmp = row[m_columns.b];
row[m_columns.a] = tmp;

Is there really any good reason to have the copy
constructor/operator=() private here?

One more annoyance:
row[m_columns.c]->bar = 5;	// Fails.

Simple enough to work around with:
(*row[m_columns.c]).bar = 5;

But having operator->() in the first place would be polite.



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