Re: Form manager



Jaap Karssenberg wrote:

Now I'm thinking of a module which I would call Gtk2::Ex::FormManager 
(although suggestions are welcome), which would do for my preferences 
dialog what uimanager does for the menu- and toolbar.

The idea is to have an array  that defines name/type/default etc. of the 
options (similar to actions for uimanager) and a xml layout that 
arranges these options within the dialog. Thirdly there would be a hash 
that contains the actual values of these options. Probably the hash 
would need to be a tied object in order to allow code to be executed 
when an option changes.

One of the advantages would be that plugins for my application could 
easily define the options they have, and expose these to the user 
without containing any real Gtk code, similar to how UIManager allows 
them to define and expose actions without actual Gtk code.

That's very similar to what Gtk2::Ex::FormFactory does. You can take a 
look at the documentation here:

  http://www.exit1.org/Gtk2-Ex-FormFactory/

Basic principle is to declare the data model resp. the objects of your 
application, build your dialogs out of several widgets and bind the 
object's attributes to these widgets. All changes made to the widgets 
are passed to the underlying objects, and vice versa you can update the
GUI by a single method call to be in sync with your data. Additionally 
it manages sensivity of widgets, automatically updates dependent widgets
and much more.

For the standard things you don't need to write Gtk2 code. But 
Gtk2::Ex::FormFactory is extendible and offers enough hooks to support 
even very sophisticated dialogs. The API supports building custom 
widgets for application specific data types.

If you want to see Gtk2::Ex::FormFactory in action take a look at the 
tutorial program:

  http://www.exit1.org/pages/ff/tutorial.cipp

(or at the source code of dvd::rip 0.97.x, located at www.exit1.org as 
well). Sorry for the advertising... ;)

Regards,

Joern

-- 
 .''`.  Jörn Reder <joern zyn de>
: :' :  http://www.exit1.org/ http://www.zyn.de/
`. `'
  `-    Debian GNU/Linux -- The power of freedom

Attachment: pgpgL7723RM3_.pgp
Description: PGP signature



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