Re: Notebooks in Gtk+ v1.2.x



On Wed, 22 Jan 2003 18:02:15 -0500
Jim Parker <hopeye cfl rr com> wrote:

I have been able to create the notebook and a couple of windows, but 
can not figure out how to get them to respond to menu commands 
independently.

My current thought is to create a struct, something like:

      typedef struct {
        GtkWidget  *notebook_page;
        GtkWidget  *drawing_area;
        gint        page_number;
        gfloat      xRotation;
        gfloat      yRotation;
           gfloat      zRotation;
           gfloat      scale;
      } typNotebookPage;

Now as I add a drawing area, I can fill the struct and add it to a 
linked list.

Every page should have a pointer to its typNotebookPage. You can set this with
g_object_set_data()

Now define a function that does the following:
- get the current notebook page via gtk_notebook_get_current_page() and
  gtk_notebook_get_nth_page ()
- retrieve a pointer to this page's typNotebookPage, with g_object_get_data ()
- return the pointer

Call this function in all your menu items callbacks, so it can use the
information in the right structure. That should do the trick.

Roland
-- 
R.F. Smith                           /"\    ASCII Ribbon Campaign
r s m i t h @ x s 4 a l l . n l      \ /    No HTML/RTF in email
http://www.xs4all.nl/~rsmith/         X     No Word docs in email
                                     / \    Respect for open standards

Attachment: pgpvH7c2ZrteL.pgp
Description: PGP signature



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