Re: TreeView::append_column_numeric() format?



On Mon, Nov 22, 2004 at 11:24:02AM +0100, Murray Cumming wrote:
> At the moment, Gtk::TreeView::append_column() can add numeric columns, but
> there is no way to specify how the number will be shown, such as how many
> decimal points or leading zeroes. So people have to use
> set_cell_data_func() and do the formatting in a callback.
> 
> So I would like to add another templated convenience method like this:
> Gtk::TreeView::append_column_numeric(TreeModelColumn& model, numeric_format);
> 
> But what's the best way to specify the display format for the number? I'd
> rather not use that nasty printf() style format. Does C++ have something
> more suitable?

Boost has a "format" object (described here:
http://www.boost.org/libs/format/doc/format.html)

I'm not suggesting that this actual class should be used, but it's a
starting point for ideas. The Gtk::TreeView::append_column_numeric()
method could take an object that formats a number (perhaps with a number of 
simple/common ones supplied). I don't know how all this works underneath though, does it need to translate to printf format for the Gtk+ interface, or does all the formatting happen in the C++ wrapper?

~Ainsley



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