Re: [gtkmm] Glade-2, libgtkmm, Xml::create, callbacks



On Wed, 2003-09-03 at 22:28, Daniel Serpell wrote:
> Now, I think that a better way could be to extend libglademm, adding
> a new way to connect signals to methods.
> 
> Imagine that the folowing code could work:
> 
> -----------------------------------------------------
> class myClass : public Gnome::Glade::Connector
> {
>    /* My fields */
>    int a,b;
> 
>    /* My methods */
>    public:
>      void buttonClicked();
> };
> 
> myClass::buttonClicked()
> {
>    std::cout << "Hello, a=" << a << " b=" << b << "\n";
> }
> 
> main()
> {
>   /* Loads glade XML, etc.. */
>   Glib::RefPtr<Gnome::Glade::Xml> refXml =
>           Gnome::Glade::Xml::create("my.glade");
>   /* Instantiates myClass oject */
>   myClass obj("obj_name_used_in_glade_file");
>   
>   /* Connect */
>   refXml.Connect();
> 
>   /* etcetera */
>   
> }

You seem to assume that the developer would like one global class to
catch all signals, or maybe one class associated with each .glade file.
I'm sure that's not what people want - it's not much better than static
functions.

-- 
Murray Cumming
murrayc usa net
www.murrayc.com





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