completely off topic -- gnumeric notebook



Hi there,

This is pretty off-topic, but I really like Gnumeric's interface and I'd
like to know how to do something like it.  I'm a gtk newbie, but I'm
trying to learn...

I'd like to add a notebook page from a menu item click, just like
gnumeric:



  void viewSpritesItemCallback(GtkButton *widget)
  {
        printf("hello world\n");
  }



   int main(int argc, char *argv[])
   {
      GtkWidget *mainwin;
      GtkWidget *mainVbox;
      GtkWidget *menuBar *viewItem, *viewMenu, *viewSpritesItem;
      GtkWidget *notebookWidget;
      ...
      mainwin = gtk_window_new(GTK_WINDOW_TOPLEVEL);
      mainVbox = gtk_vbox_new(FALSE, 0);
      gtk_container_add( GTK_CONTAINER(mainwin), mainVbox);
      ...
      viewSpritesItem = gtk_menu_item_new_with_label( "view sprites" );
      gtk_signal_connect( GTK_OBJECT(viewSpritesItem), "activate",
               viewSpritesItemCallback, NULL);
      ...
   }

so when someone clicks "view sprites" (like "insert sheet"), it calls
back viewSpritesItemCallback.   what i'd like to do is call:

  gtk_notebook_append(GtkNotebook *notebook,
     GtkWidget *ChildToEmbedInPage,
     GtkWidget *PageLabel)

But if this is called within the callback, ChildToBeEmbededInPage and
PageLabel both go out of scope when the callback ends.  

If i dynamically allocate static memory, the pointers are lost.


How does gnumeric add a sheet to a notebook from a menubar item?

Sorry for the off-topic posting, but i really love this interface!

Pete



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