On Mon, 2016-02-08 at 00:08 +0100, Murray Cumming wrote:
> I think I'd be content with needing a call to a getter method after a
> std::move(). I think that would make sense to people.
> 
> But, for simple setup code, to arrange widgets in their initial
> working
> state, it would be nice if our API didn't require this. At the moment
> it's only necessary in a few places, and maybe we can improve them.

Currently, the worst part of the API for this, which has never felt
quite right, is this:

  auto cell = std::make_unique<Gtk::CellRendererText>();
  cell->property_style() = Pango::STYLE_ITALIC

  auto column = std::make_unique<Gtk::TreeViewColumn>("something",
cell);
  column->add_attribute(cell->property_text(), columns.title);
  column->add_attribute(cell->property_style_set(), columns.italic);

  m_TreeView.append_column(std::move(column));


The TreeViewColumn constructor does a pack_start(), which actually
takes the unique_ptr<>, so I hoped I could move that pack_start() to
later:

  auto cell = std::make_unique<Gtk::CellRendererText>();
  cell
->property_style() = Pango::STYLE_ITALIC

  auto column = std::make_unique<Gtk::TreeViewColumn>("something");
  column->add_attribute(cell->property_text(), columns.title);
  column->add_attribute(cell->property_style_set(), columns.italic);
  column->pack_start(std::move(cell));

  m_TreeView.append_column(std::move(column));

But that cell->add_attribute() really fails, in GTK+, if the Column doesn't 
contain a CellRenderer yet.

-- 
Murray Cumming
murr...@murrayc.com
www.murrayc.com



_______________________________________________
gtkmm-list mailing list
gtkmm-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtkmm-list

Reply via email to