Hello,

It took me a little more time than expected, but here it is, 
the new, clean, and extensible Theme framework !

What's new since my previous posts:

+ The  code is in the CVS  archive, so take the  time to read at least
  the documentation  in the file "hthemes.h"  (the main one), and look
  at the  modified motif.cc, next.cc,  windows.cc  and platinum.cc, to
  see how it is easy now to add a new theme :)

  qwidget.h and qapplication.h have been modified in some places too.

  Other minor changes affected many files (the themeable widgets).

+ Everything  compiles  with egcs-1.1 (2.91.57)   or  with the  latest
  snapshot I tried (2.92.16).

+ The 'coolos' app has  new labels  for  its buttons, and are  working
  ("Motif", "NeXT", ... try them :) Hum, I said it  works, but from an
  optimistic  point of view.   The event  handling for button  presses
  seems   pretty slow. I don't  think  it has  anything  to do with my
  Themes implementation: when you drag another window above the coolos
  window, you can watch the Expose ->  paint () sequences going fairly
  quick.
  Also, the colors in the Motif themes seems messed up. 

+ About namespaces.

  I've put 2 new macros in hconfig.h:
        BEGIN_NAMESPACE(x) and  END_NAMESPACE(x).

  So you can use the 'x' namespace if your compiler support it.  Since
  the END_NAMESPACE(x)  also does an  "using namespace x", all symbols
  of that namespace are visible in the global  namespace (that is, the
  x:: qualifier is not mandatory except for resolving conflicts).

  If the  compiler doesn't support  namespace, then  all is defined in
  the global namespace, and the apparent behaviour is the same.

  This is a temporary solution until we require full namespace support .

  Currently, I've defined  the Harmony namespace,  and each Theme  has
  its   own namespace,  inside   the   Harmony  namespace  (that   is,
  Harmony::Motif, Harmony::NeXT, etc.)
  It would also be good to put all the Qt-compatibility stuff in a
  Qt namespace (if the two letters "Qt" are not trademarked :)

- (Some grins) About * and &

  I have applied many trivial changes  from * to  & in the theme code.
  Why? Because  all     the  usages of,  say,   QPainter    *p,  where
  unchecked. That is, we already assumed  that the p pointer is always
  valid.  That's exactly where the references  are useful, because the
  compiler can check that this  assumption is respected throughout the
  code.

  There are various places where Qt compatibility impose the choice of
  * instead of &, but   for Harmony internals   at least we should  be
  cleaner.

 
- The QWidget needs to be reworked a bit:

  As far as I understand the idea is to delay window creation until
  the window id is really needed.
  So far so good, but this should be done carefully. To take an example, 
  the setBackgroundPixmap doesn't work if the window is not currently
  visible.

  Another remark, when you have such complex design in mind, it should
  be documented a bit, the way I've done it in the "hthemes.h" file. I
  think  that  rudimentary documentation  about  the overall layout is
  sometimes more useful than a  detailed description of the parameters
  of  the  methods (of  course, in an  ideal  situation both should be
  available :).

+ Future work on themes

  I also  integrated   the  Arrow  drawing  functions  in  the   theme
  framework, for not having  theme-dependent code outside of the theme
  support file.
  
  A drawing  object should  also   be responsible for  allocating  the
  window of  the widget, so that themes  using shaped  window could be
  implemented.

  What's still missing is the dynamic loading of new Themes.  However,
  that should be easier than ever, now.

+ Misc. other stuff done:

  - put a little more structure in src/Makefile.am.
  - done small hacks on magna to make it compile better.
  - some documentation added in qwidget & qapplication
    (in particular, created pages with ^L. For the interested 
     ones, I have a particularly useful (X)Emacs-lisp 'page-menu'
     function :)
  - random hacks everywhere (and too many 'cout', 'cerr' ...)

My next work will be the integration of Relay++ with Harmony.

-- Christian

Reply via email to