Re: [gtkmm] lookup_widget in glademm



> > You should declare widgets as "public" in glade, then they will be
> > accessible by name without lookup_widget(). You can add new
> > (your own) methods and properties using produced by glade
> > classes as base classes and changing them by inheritance.
>
> Right. Very good explanation.
>
> Since this is far more flexible, far more secure and far more
> transparent I dropped support for the GMM_* macros and the lookup_widget
> function which were present in previous versions.
>

Of course, of course, it's all obvious now, when you see the
private/protected/public selector in glade itself. I had not noticed that
before, and the code for the main window looked like this (see below),
with no public/protected members.

Perhaps this should be a FAQ? I didn't see this in the glade-2 faq nor in
the glade-- user guide. If it was, it should be more salient. I'm sure you
people are tired by now of answering this question to beginners.

It's all coming together now. Thank you both!


// generated 2003/5/15 19:46:58 EDT by silviu orion (none)
// using glademm V1.1.3f
//
// DO NOT EDIT THIS FILE ! It was created using
// glade-- /home/silviu/Projects/stopstart/stopstart.glade
// for gtk 2.2.1 and gtkmm 2.2.1
//
// Please modify the corresponding derived classes in ./src/window1.hh
and./src/window1.cc

#ifndef _WINDOW1_GLADE_HH
#  define _WINDOW1_GLADE_HH


#if !defined(GLADEMM_DATA)
#define GLADEMM_DATA
#include <gtkmm/accelgroup.h>

class GlademmData
{

        Glib::RefPtr<Gtk::AccelGroup> accgrp;
public:

        GlademmData(Glib::RefPtr<Gtk::AccelGroup> ag) : accgrp(ag)
        {
        }

        Glib::RefPtr<Gtk::AccelGroup>  getAccelGroup()
        {  return accgrp;
        }
};
#endif //GLADEMM_DATA

#include <gtkmm/window.h>

class window1_glade : public Gtk::Window
{

        GlademmData *gmm_data;
protected:

        window1_glade();

        ~window1_glade();
private:
        virtual bool on_drawingarea1_button_press_event(GdkEventButton
*ev) = 0;
        virtual void on_togglebutton1_toggled() = 0;
        virtual bool on_window1_key_press_event(GdkEventKey *ev) = 0;
};
#endif





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