[glade--]Re: [gtkmm] Preferred method to access glade objects within gtkmm

Christof Petig <[email protected]> Tue, 04 Nov 2003 09:07:50 +0100
Newsgroups gmane.comp.gnome.glademm,gmane.comp.gnome.glade.user,gmane.comp.gnome.gtkmm
Organization Adolf Petig GmbH & Co. KG
Message-ID <[email protected]>
Chris Haidinyak schrieb:
> Hi,
> 
>    I know this must have come up before but I cannot seem to find an 
> answer. I have several dialog objects built in glade-2 and I want to tie 
> them into the main window menu handling system. The trouble seems to be 
> that the glade-- program puts the definition of these objects in the 
> project scope instead of the main window scope. Is there a preferred 
> method of accessing this data from within the main window class? 

The main function is supposed to be edited by you. And of course you can 
create a dialog everywhere you want (e.g. inside another ctor or 
callback) and put a pointer to it inside any class.

> Surprisingly, I cannot find a single application out there which 
> utilizes gtkmm (c++)  AND glade-2 AND multiple dialog objects. I 
> definitely want to learn how it is done if there is a suggested 
> methodology. Please advise; thanks.

I'd suggest to put persistent dialogs into the main window class [e.g. 
window1]. Declare the dialog's (widgets or) methods as public you need 
to use in window1. [do not forget to delete the dialogs in the dtor]

> 
> Also, if there is a class of example programs which tie together 
> multiple objects across source files, please point me in the right 
> direction.

You might want to take a look at MAGuS [ http://midgard.berlios.de/ ]. 
It's a rather complicated glademm based application and the HEAD 
revision is not that bad code style. Another candidate is ManuProC [ 
http://manuproc.berlios.de e.g. the pps subdir] but I did not yet write 
neither packages nor docs for the masses ;-) .

Sadly there exists no really widely spread glademm based application, 
yet [MAGuS has a very limited _potential_ user base (only the users of a 
german role playing system)]. AFAIK of course.

    Christof