Re: [gtkmm] Thin GUI with gtkmm



Hi

> Does anyone have any tips for how to structure an application so that
> most of the application logic is not closely tied to the GUI toolkit?
>
> I'm writing an application, but I'm having difficulties with getting the
> gtkmm code to communicate with the rest of the application logic.  I'm
> trying to write the code such that I can easily port my application to
> different toolkits and operating systems, but it's not coming along as
> smoothly as I'd hoped.

This is the way all code that uses a GUI should be written!

Write the application logic in Standard C++ as a static library and link it
into a separate (console) executable to run your unit tests. You then have a
self contained application that you can test to your hearts content without
worrying about the platform or GUI toolkit.

Then write a second executable which is your GUI, link the static library
into it and write the thinnest possible GUI wrapper that does not intrude on
the application logic.

Can I recommend looking at the pimple idiom (also known as bridge and
Cheshire cat) and facade from gang of four for a way of using the
application logic from the GUI  executable and reducing compile times.

If you don't have a unit testing framework, check out mine:
http://www.paulgrenyer.co.uk/aeryn. There is a more up-to-date version I can
email you if you're interested.

If there is anything else I can do to help, please just shout.

Regards
Paul

Paul Grenyer
Email: paul paulgrenyer co uk
Web: http://www.paulgrenyer.co.uk

Have you met Aeryn: http://www.paulgrenyer.co.uk/aeryn?





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