guile-gtk-general
[Top][All Lists]
Advanced

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

Re: simple task?


From: Paul Emsley
Subject: Re: simple task?
Date: Fri, 07 Jul 2006 11:26:02 +0100

On Fri, 2006-07-07 at 01:06 -0400, steve tell wrote:
> On Wed, 5 Jul 2006, Paul Emsley wrote:
> 
> >
> > Dear guile-gtkers,
> >
> > I have, what I believe/hope to be a simple task:
> >
> > I want to expose the menubar of my application [1] to the scheme level
> > so that others can add their own menu/menu items using scheme.
> 
> > Let's suppose that I have global variable
> >
> > GtkWidget *main_menubar
> >
> > how do I expose it?
> 
> In gwave, a C + guile + guile-gkt-1.2 application, I do it with a C 
> function like this:
> 
> 
> SCM_DEFINE(get_wavewin_menubar, "get-wavewin-menubar", 0, 0, 0, (),
>     "return the GtkMenuBar object for menubar in the main waveform window")
> #define FUNC_NAME s_get_wavewin_menubar
> {
>          return sgtk_wrap_gtkobj(GTK_OBJECT(wtable->menubar));
> }
> #undef FUNC_NAME
> 
> 
> Where wtable is a global pointer to a structure containing
> a "GtkWidget *menubar"
> 
> 
> I create the menubar in C, add it to the window, and then call a
> guile hook to which procedures can be added to build all of the 
> menus (and toolbars) for the window.  Getting the various standard and 
> plugin-extension menus to appear in the desired order requires some 
> careful use of append-hook! vs. add-hook!.
> 
> In guile-gnome-platform, I've discovered that 
> scm_c_gtype_instance_to_scm() appears to do the equivalent to what 
> sgtk_wrap_gtkobj() did in guile-gtk 1.2.

Great. That looks like just what I wanted to know.

When I get it sorted, I will put together some text that can be added to
README or some such (if you like).

Cheers, 

Paul.









reply via email to

[Prev in Thread] Current Thread [Next in Thread]