Re: [gtkmm] Understanding Gtk::TreeView
- From: Daniel Elstner <daniel elstner gmx net>
- To: "James T. Richardson, " "Jr." <jamesrichardson wickander com>
- Cc: gtkmm-list gnome org
- Subject: Re: [gtkmm] Understanding Gtk::TreeView
- Date: 21 Sep 2002 18:28:56 +0200
Am Fre, 2002-09-20 um 22.58 schrieb James T. Richardson, Jr.:
> On 20 Sep 2002 21:19:47 +0100
> Matthew Walton <mxw00u Cs Nott AC UK> wrote:
>
> > On Fri, 2002-09-20 at 20:38, James T. Richardson, Jr. wrote:
> > > Hello, I was wondering if someone could verify my understanding of the Gtk::TreeView (and related) classes. I come from Windows programming background and implementing the Gtk::TreeView seems to be overly-complex.
> >
> > Yes, it's complicated, but it is extremely flexible.
> >
> > > class MyTreeViewColumns : public Gtk::TreeModel::ColumnRecord
> > > {
>
> <snip>
>
> > > };
> >
> > I always think of this as like a structure for the data model, telling
> > it what columns it should have, what to call them and what data types
> > they will contain.
>
> The more I look at stuff, the more I am starting to look at it this way too.
Yep, and it's actually meant to be interpreted this way, too. It's a
kind of meta-data used to ensure compile-time type safety in C++, while
providing the underlying GTK+ with runtime type information.
> > > const Glib::ScopedPtr<char> text_buf(g_strdup_printf("message #%d", i)); // const Glib::ScopedPtr<char> looks like a fancy c-style string, is it?
> >
> > I have no idea what that bit of code is for. Seems like a long way
> > around... and who sneaked Glib::ScopedPtr<> into the API without me
> > noticing?
>
> The code was adapted from the paned example distributed with gtkmm-1.3.22.
Erm, well, my fault. I probably didn't use std::ostringstream because
it isn't available in gcc-2.95.2, though that probably doesn't matter
anymore. ScopedPtr<> is there to make it at least exception safe,
though it's normally used only internally.
I'll make it use std::ostringstream instead.
> > Hope that was vaguely coherent. Might not be 100% accurate, but that's
> > my understanding of it.
>
> I'm understanding it bit by bit. I'm having trouble finding complete documentation/examples using the TreeView. Slowly, however, I am starting to gain an understanding for what it's doing (and not doing).
There are several uses of TreeView in demos/gtk-demo/*.cc, though the
code might not cover all details (you probably have looked at it
already, I'm mentioning this just in case).
--Daniel
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]