RE: [gtkmm] Gtkmm or Qt?
- From: Murray Cumming Comneon com
- To: mark austrics com au
- Cc: gtkmm-list gnome org
- Subject: RE: [gtkmm] Gtkmm or Qt?
- Date: Thu, 28 Aug 2003 10:04:56 +0200
> From: Dr Mark H Phillips [mailto:mark austrics com au]
> > > One thing I'm a bit confused about is... isn't this what
> libglademm
> > > allows?
> >
> > libglademm allows visual layout of controls, including
> properties of those
> > controls. Properties can be discovered at runtime.
> >
> > libglade (not libglademm) can do automatic signal
> connection (you enter the
> > name of the source code callback function in the GUI
> designer), but that
> > doesn't work with C++, because we need a specific runtime
> instance too.
>
> Okay, thanks. So in practice you would manually do some code which
> scanned the properties of the controls produced at runtime, check that
> the expected structure was really there, and manually create signal to
> slot connections?
Properties are things like "border is 5 pixels", "text is bold", so there's
no point in checking it. You might as well write the code yourself if you
don't trust libglademm to do it for you.
However, it is of course good practice to check for null pointers when you
obtain pointers to the libglademm-instantiated widgets.
> You would statically define all the "commonly used" calling signatures
> for callbacks.
static callbacks are not much use with C++. Instance data is useful.
Polymorphism is useful.
There is no way for a GUI designer to know the address of the instances at
runtime.
[snip]
> You would write
> some code that, at run-time, scanned through the libglademm produced
> controls, for each control looked for the appropriate calling
> signature and assigned the "f" of the connection to the appropriate
> function.
I think you are talking about connecting all widgets of the same type. But
1. The GUI designer does not know about your derived types (I guess you
could use a custom RTTI system - GTK+ has one - and tell it about it).
2. People generally want signal handlers of one window to handle a button's
clicked signal. They don't want always want every window that happens to
have the same C++ type to handle it. Instance are important.
I could be misunderstanding, I suppose.
> (For information on FC++ see:
> http://www.cc.gatech.edu/~yannis/fc++/
> )
I think that's much the same as libsigc++ and boost's signals library
(inspired by libsigc++), which also allow mapping of static callbacks to
member methods when some instance data can be passed through the whole
chain. I'm assuming that a "functoid" is a functor or a closure.
Murray Cumming
murrayc usa net
www.murrayc.com
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]