Re: maemomm: virtual function overrides
- From: VLG <3rdshift comcast net>
- To: John Steele Scott <toojays toojays net>
- Cc: gtkmm-list gnome org
- Subject: Re: maemomm: virtual function overrides
- Date: Sun, 11 Nov 2007 15:04:21 -0500
This has been covered in 'Changes to gtkmm' chapter [1] of "Programming
with maemomm." Another major this you are going to face is disabled
exception handling. You can handle this same way by writing wrappers:
std::string
MyKlass::locale_from_utf8 (const Glib::ustring& utf8_string_)
{
std::string result;
#ifdef GLIBMM_EXCEPTIONS_ENABLED
try {
result = Glib::locale_from_utf8 (utf8_string_);
}
catch (Glib::ConvertError& e) {
/* cannot convert */
}
#else
std::auto_ptr<Glib::Error> err;
result = Glib::locale_from_utf8 (utf8_string_, err);
/* check the err */
#endif
return result;
}
[1] <http://maemomm.garage.maemo.org/docs/tutorial/html/ch04s02.html>
--Vlad
On Sun, 2007-11-11 at 12:19 +0100, Armin Burgmeier wrote:
> On Sun, 2007-11-11 at 07:50 +0000, John Steele Scott wrote:
> > I have a Gtkmm application which uses a custom widget derived from
> > Gtk::DrawingArea. This widget overrides the virtual functions of the
> > parent, such as e.g.:
> >
> > void PlotCanvas::on_realize()
> > {
> > Gtk::DrawingArea::on_realize();
> >
> > // do some other stuff . . .
> > }
> >
> > This works fine on my Ubuntu Gutsy machine, but when I try to compile
> > this in the Maemo sandbox, it fails because there is no
> > Gtk::DrawingArea::on_realize(). Similarly, other such signal handlers are
> > never called, it seems that they need to be explicitly connected via
> > their signal proxies.
> >
> > Since I'm new to Gtkmm, I'd like to know: is this difference due to the
> > version of Gtkmm in Ubuntu Gutsy being much newer than the version in
> > Maemo Bora, or is it a core difference between the Hildon and vanilla
> > versions of Gtkmm? (I imagine it might be the latter, to save code size.)
>
> It's exactly that. Default signal handlers are, among other API,
> disabled in maemo to save code size. It shouldn't be much of a deal,
> though, since you just can do something like
>
> #ifndef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
> signal_realize().connect(sigc::mem_fun(*this, &PlotCanvas::on_realize));
> #endif
>
> in your constructor. It gets trickier if you want to override GObject
> vfuncs (those that end in _vfunc() in gtkmm).
>
> Armin
>
> > If the difference is due to the version number of Gtkmm, in which version
> > did this feature (virtual functions for signals) get included in Gtkmm?
> > Does the Maemo Chinook version of Gtkmm have overridable virtual
> > functions?
> >
> > cheers,
> >
> > John
> >
> > _______________________________________________
> > gtkmm-list mailing list
> > gtkmm-list gnome org
> > http://mail.gnome.org/mailman/listinfo/gtkmm-list
>
> _______________________________________________
> gtkmm-list mailing list
> gtkmm-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtkmm-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]