[Commits] (heikki) wxPython 2.5.2.9+chandler changes into branch.

commits at osafoundation.org commits at osafoundation.org
Mon Sep 13 18:11:52 PDT 2004


Commit by: heikki
Modified files:
internal/wxPython-2.5/src/gtk/artgtk.cpp None 1.1.2.1
internal/wxPython-2.5/src/gtk/colordlg.cpp None 1.1.2.1
internal/wxPython-2.5/src/gtk/eggtrayicon.c None 1.1.2.1
internal/wxPython-2.5/src/gtk/eggtrayicon.h None 1.1.2.1
internal/wxPython-2.5/src/gtk/taskbar.cpp None 1.1.2.1
internal/wxPython-2.5/src/gtk/app.cpp 2.1.5.1 2.1.5.1.4.1
internal/wxPython-2.5/src/gtk/bitmap.cpp 2.1.5.1 2.1.5.1.4.1
internal/wxPython-2.5/src/gtk/bmpbuttn.cpp 2.1.5.1 2.1.5.1.4.1
internal/wxPython-2.5/src/gtk/brush.cpp 2.1.5.1 2.1.5.1.4.1
internal/wxPython-2.5/src/gtk/button.cpp 2.1.5.1 2.1.5.1.4.1
internal/wxPython-2.5/src/gtk/checkbox.cpp 2.1.5.1 2.1.5.1.4.1
internal/wxPython-2.5/src/gtk/checklst.cpp 2.1.5.1 2.1.5.1.4.1
internal/wxPython-2.5/src/gtk/choice.cpp 2.1.5.1 2.1.5.1.4.1
internal/wxPython-2.5/src/gtk/clipbrd.cpp 2.1.5.1 2.1.5.1.4.1
internal/wxPython-2.5/src/gtk/colour.cpp 2.1.5.1 2.1.5.1.4.1
internal/wxPython-2.5/src/gtk/combobox.cpp 2.1.5.1 2.1.5.1.4.1
internal/wxPython-2.5/src/gtk/control.cpp 2.1.5.1 2.1.5.1.4.1
internal/wxPython-2.5/src/gtk/cursor.cpp 2.1.5.1 2.1.5.1.4.1
internal/wxPython-2.5/src/gtk/data.cpp 2.1.5.1 2.1.5.1.4.1
internal/wxPython-2.5/src/gtk/dataobj.cpp 2.1.5.1 2.1.5.1.4.1
internal/wxPython-2.5/src/gtk/dc.cpp 2.1.5.1 2.1.5.1.4.1
internal/wxPython-2.5/src/gtk/dcclient.cpp 2.1.5.1 2.1.5.1.4.1
internal/wxPython-2.5/src/gtk/dcmemory.cpp 2.1.5.1 2.1.5.1.4.1
internal/wxPython-2.5/src/gtk/dcscreen.cpp 2.1.5.1 2.1.5.1.4.1
internal/wxPython-2.5/src/gtk/descrip.mms 2.1.5.1 2.1.5.1.4.1
internal/wxPython-2.5/src/gtk/dialog.cpp 2.1.5.1 2.1.5.1.4.1
internal/wxPython-2.5/src/gtk/dnd.cpp 2.1.5.1 2.1.5.1.4.1
internal/wxPython-2.5/src/gtk/evtloop.cpp 2.1.5.1 2.1.5.1.4.1
internal/wxPython-2.5/src/gtk/filedlg.cpp 2.1.5.1 2.1.5.1.4.1
internal/wxPython-2.5/src/gtk/font.cpp 2.1.5.1 2.1.5.1.4.1
internal/wxPython-2.5/src/gtk/fontdlg.cpp 2.1.5.1 2.1.5.1.4.1
internal/wxPython-2.5/src/gtk/frame.cpp 2.1.5.1 2.1.5.1.4.1
internal/wxPython-2.5/src/gtk/gauge.cpp 2.1.5.1 2.1.5.1.4.1
internal/wxPython-2.5/src/gtk/gdiobj.cpp 2.1.5.1 2.1.5.1.4.1
internal/wxPython-2.5/src/gtk/glcanvas.cpp 2.1.5.1 2.1.5.1.4.1
internal/wxPython-2.5/src/gtk/gsockgtk.cpp 2.1.5.1 2.1.5.1.4.1
internal/wxPython-2.5/src/gtk/icon.cpp 2.1.5.1 2.1.5.1.4.1
internal/wxPython-2.5/src/gtk/listbox.cpp 2.1.5.1 2.1.5.1.4.1
internal/wxPython-2.5/src/gtk/main.cpp 2.1.5.1 2.1.5.1.4.1
internal/wxPython-2.5/src/gtk/mdi.cpp 2.1.5.1 2.1.5.1.4.1
internal/wxPython-2.5/src/gtk/menu.cpp 2.1.5.1 2.1.5.1.4.1
internal/wxPython-2.5/src/gtk/minifram.cpp 2.1.5.1 2.1.5.1.4.1
internal/wxPython-2.5/src/gtk/msgdlg.cpp 2.1.5.1 2.1.5.1.4.1
internal/wxPython-2.5/src/gtk/notebook.cpp 2.1.5.1 2.1.5.1.4.1
internal/wxPython-2.5/src/gtk/pen.cpp 2.1.5.1 2.1.5.1.4.1
internal/wxPython-2.5/src/gtk/popupwin.cpp 2.1.5.1 2.1.5.1.4.1
internal/wxPython-2.5/src/gtk/radiobox.cpp 2.1.5.1 2.1.5.1.4.1
internal/wxPython-2.5/src/gtk/radiobut.cpp 2.1.5.1 2.1.5.1.4.1
internal/wxPython-2.5/src/gtk/region.cpp 2.1.5.1 2.1.5.1.4.1
internal/wxPython-2.5/src/gtk/renderer.cpp 2.1.5.1 2.1.5.1.4.1
internal/wxPython-2.5/src/gtk/scrolbar.cpp 2.1.5.1 2.1.5.1.4.1
internal/wxPython-2.5/src/gtk/scrolwin.cpp 2.1.5.1 2.1.5.1.4.1
internal/wxPython-2.5/src/gtk/settings.cpp 2.1.5.1 2.1.5.1.4.1
internal/wxPython-2.5/src/gtk/slider.cpp 2.1.5.1 2.1.5.1.4.1
internal/wxPython-2.5/src/gtk/spinbutt.cpp 2.1.5.1 2.1.5.1.4.1
internal/wxPython-2.5/src/gtk/spinctrl.cpp 2.1.5.1 2.1.5.1.4.1
internal/wxPython-2.5/src/gtk/statbmp.cpp 2.1.5.1 2.1.5.1.4.1
internal/wxPython-2.5/src/gtk/statbox.cpp 2.1.5.1 2.1.5.1.4.1
internal/wxPython-2.5/src/gtk/statline.cpp 2.1.5.1 2.1.5.1.4.1
internal/wxPython-2.5/src/gtk/stattext.cpp 2.1.5.1 2.1.5.1.4.1
internal/wxPython-2.5/src/gtk/tbargtk.cpp 2.1.5.1 2.1.5.1.4.1
internal/wxPython-2.5/src/gtk/textctrl.cpp 2.1.5.1 2.1.5.1.4.1
internal/wxPython-2.5/src/gtk/tglbtn.cpp 2.1.5.1 2.1.5.1.4.1
internal/wxPython-2.5/src/gtk/threadno.cpp 2.1.5.1 2.1.5.1.4.1
internal/wxPython-2.5/src/gtk/threadsgi.cpp 2.1.5.1 2.1.5.1.4.1
internal/wxPython-2.5/src/gtk/timer.cpp 2.1.5.1 2.1.5.1.4.1
internal/wxPython-2.5/src/gtk/tooltip.cpp 2.1.5.1 2.1.5.1.4.1
internal/wxPython-2.5/src/gtk/toplevel.cpp 2.1.5.1 2.1.5.1.4.1
internal/wxPython-2.5/src/gtk/treegtk.cpp 2.1.5.1 2.1.5.1.4.1
internal/wxPython-2.5/src/gtk/utilsgtk.cpp 2.1.5.1 2.1.5.1.4.1
internal/wxPython-2.5/src/gtk/utilsres.cpp 2.1.5.1 2.1.5.1.4.1
internal/wxPython-2.5/src/gtk/win_gtk.c 2.1.5.1 2.1.5.1.4.1
internal/wxPython-2.5/src/gtk/window.cpp 2.1.5.1 2.1.5.1.4.1
internal/wxPython-2.5/src/gtk/gsockgtk.c 2.1.5.1 None

Log message:
wxPython 2.5.2.9+chandler changes into branch.

ViewCVS links:
http://cvs.osafoundation.org/index.cgi/internal/wxPython-2.5/src/gtk/artgtk.cpp?rev=1.1.2.1&content-type=text/vnd.viewcvs-markup
http://cvs.osafoundation.org/index.cgi/internal/wxPython-2.5/src/gtk/colordlg.cpp?rev=1.1.2.1&content-type=text/vnd.viewcvs-markup
http://cvs.osafoundation.org/index.cgi/internal/wxPython-2.5/src/gtk/eggtrayicon.c?rev=1.1.2.1&content-type=text/vnd.viewcvs-markup
http://cvs.osafoundation.org/index.cgi/internal/wxPython-2.5/src/gtk/eggtrayicon.h?rev=1.1.2.1&content-type=text/vnd.viewcvs-markup
http://cvs.osafoundation.org/index.cgi/internal/wxPython-2.5/src/gtk/taskbar.cpp?rev=1.1.2.1&content-type=text/vnd.viewcvs-markup
http://cvs.osafoundation.org/index.cgi/internal/wxPython-2.5/src/gtk/app.cpp.diff?r1=text&tr1=2.1.5.1&r2=text&tr2=2.1.5.1.4.1
http://cvs.osafoundation.org/index.cgi/internal/wxPython-2.5/src/gtk/bitmap.cpp.diff?r1=text&tr1=2.1.5.1&r2=text&tr2=2.1.5.1.4.1
http://cvs.osafoundation.org/index.cgi/internal/wxPython-2.5/src/gtk/bmpbuttn.cpp.diff?r1=text&tr1=2.1.5.1&r2=text&tr2=2.1.5.1.4.1
http://cvs.osafoundation.org/index.cgi/internal/wxPython-2.5/src/gtk/brush.cpp.diff?r1=text&tr1=2.1.5.1&r2=text&tr2=2.1.5.1.4.1
http://cvs.osafoundation.org/index.cgi/internal/wxPython-2.5/src/gtk/button.cpp.diff?r1=text&tr1=2.1.5.1&r2=text&tr2=2.1.5.1.4.1
http://cvs.osafoundation.org/index.cgi/internal/wxPython-2.5/src/gtk/checkbox.cpp.diff?r1=text&tr1=2.1.5.1&r2=text&tr2=2.1.5.1.4.1
http://cvs.osafoundation.org/index.cgi/internal/wxPython-2.5/src/gtk/checklst.cpp.diff?r1=text&tr1=2.1.5.1&r2=text&tr2=2.1.5.1.4.1
http://cvs.osafoundation.org/index.cgi/internal/wxPython-2.5/src/gtk/choice.cpp.diff?r1=text&tr1=2.1.5.1&r2=text&tr2=2.1.5.1.4.1
http://cvs.osafoundation.org/index.cgi/internal/wxPython-2.5/src/gtk/clipbrd.cpp.diff?r1=text&tr1=2.1.5.1&r2=text&tr2=2.1.5.1.4.1
http://cvs.osafoundation.org/index.cgi/internal/wxPython-2.5/src/gtk/colour.cpp.diff?r1=text&tr1=2.1.5.1&r2=text&tr2=2.1.5.1.4.1
http://cvs.osafoundation.org/index.cgi/internal/wxPython-2.5/src/gtk/combobox.cpp.diff?r1=text&tr1=2.1.5.1&r2=text&tr2=2.1.5.1.4.1
http://cvs.osafoundation.org/index.cgi/internal/wxPython-2.5/src/gtk/control.cpp.diff?r1=text&tr1=2.1.5.1&r2=text&tr2=2.1.5.1.4.1
http://cvs.osafoundation.org/index.cgi/internal/wxPython-2.5/src/gtk/cursor.cpp.diff?r1=text&tr1=2.1.5.1&r2=text&tr2=2.1.5.1.4.1
http://cvs.osafoundation.org/index.cgi/internal/wxPython-2.5/src/gtk/data.cpp.diff?r1=text&tr1=2.1.5.1&r2=text&tr2=2.1.5.1.4.1
http://cvs.osafoundation.org/index.cgi/internal/wxPython-2.5/src/gtk/dataobj.cpp.diff?r1=text&tr1=2.1.5.1&r2=text&tr2=2.1.5.1.4.1
http://cvs.osafoundation.org/index.cgi/internal/wxPython-2.5/src/gtk/dc.cpp.diff?r1=text&tr1=2.1.5.1&r2=text&tr2=2.1.5.1.4.1
http://cvs.osafoundation.org/index.cgi/internal/wxPython-2.5/src/gtk/dcclient.cpp.diff?r1=text&tr1=2.1.5.1&r2=text&tr2=2.1.5.1.4.1
http://cvs.osafoundation.org/index.cgi/internal/wxPython-2.5/src/gtk/dcmemory.cpp.diff?r1=text&tr1=2.1.5.1&r2=text&tr2=2.1.5.1.4.1
http://cvs.osafoundation.org/index.cgi/internal/wxPython-2.5/src/gtk/dcscreen.cpp.diff?r1=text&tr1=2.1.5.1&r2=text&tr2=2.1.5.1.4.1
http://cvs.osafoundation.org/index.cgi/internal/wxPython-2.5/src/gtk/descrip.mms.diff?r1=text&tr1=2.1.5.1&r2=text&tr2=2.1.5.1.4.1
http://cvs.osafoundation.org/index.cgi/internal/wxPython-2.5/src/gtk/dialog.cpp.diff?r1=text&tr1=2.1.5.1&r2=text&tr2=2.1.5.1.4.1
http://cvs.osafoundation.org/index.cgi/internal/wxPython-2.5/src/gtk/dnd.cpp.diff?r1=text&tr1=2.1.5.1&r2=text&tr2=2.1.5.1.4.1
http://cvs.osafoundation.org/index.cgi/internal/wxPython-2.5/src/gtk/evtloop.cpp.diff?r1=text&tr1=2.1.5.1&r2=text&tr2=2.1.5.1.4.1
http://cvs.osafoundation.org/index.cgi/internal/wxPython-2.5/src/gtk/filedlg.cpp.diff?r1=text&tr1=2.1.5.1&r2=text&tr2=2.1.5.1.4.1
http://cvs.osafoundation.org/index.cgi/internal/wxPython-2.5/src/gtk/font.cpp.diff?r1=text&tr1=2.1.5.1&r2=text&tr2=2.1.5.1.4.1
http://cvs.osafoundation.org/index.cgi/internal/wxPython-2.5/src/gtk/fontdlg.cpp.diff?r1=text&tr1=2.1.5.1&r2=text&tr2=2.1.5.1.4.1
http://cvs.osafoundation.org/index.cgi/internal/wxPython-2.5/src/gtk/frame.cpp.diff?r1=text&tr1=2.1.5.1&r2=text&tr2=2.1.5.1.4.1
http://cvs.osafoundation.org/index.cgi/internal/wxPython-2.5/src/gtk/gauge.cpp.diff?r1=text&tr1=2.1.5.1&r2=text&tr2=2.1.5.1.4.1
http://cvs.osafoundation.org/index.cgi/internal/wxPython-2.5/src/gtk/gdiobj.cpp.diff?r1=text&tr1=2.1.5.1&r2=text&tr2=2.1.5.1.4.1
http://cvs.osafoundation.org/index.cgi/internal/wxPython-2.5/src/gtk/glcanvas.cpp.diff?r1=text&tr1=2.1.5.1&r2=text&tr2=2.1.5.1.4.1
http://cvs.osafoundation.org/index.cgi/internal/wxPython-2.5/src/gtk/gsockgtk.cpp.diff?r1=text&tr1=2.1.5.1&r2=text&tr2=2.1.5.1.4.1
http://cvs.osafoundation.org/index.cgi/internal/wxPython-2.5/src/gtk/icon.cpp.diff?r1=text&tr1=2.1.5.1&r2=text&tr2=2.1.5.1.4.1
http://cvs.osafoundation.org/index.cgi/internal/wxPython-2.5/src/gtk/listbox.cpp.diff?r1=text&tr1=2.1.5.1&r2=text&tr2=2.1.5.1.4.1
http://cvs.osafoundation.org/index.cgi/internal/wxPython-2.5/src/gtk/main.cpp.diff?r1=text&tr1=2.1.5.1&r2=text&tr2=2.1.5.1.4.1
http://cvs.osafoundation.org/index.cgi/internal/wxPython-2.5/src/gtk/mdi.cpp.diff?r1=text&tr1=2.1.5.1&r2=text&tr2=2.1.5.1.4.1
http://cvs.osafoundation.org/index.cgi/internal/wxPython-2.5/src/gtk/menu.cpp.diff?r1=text&tr1=2.1.5.1&r2=text&tr2=2.1.5.1.4.1
http://cvs.osafoundation.org/index.cgi/internal/wxPython-2.5/src/gtk/minifram.cpp.diff?r1=text&tr1=2.1.5.1&r2=text&tr2=2.1.5.1.4.1
http://cvs.osafoundation.org/index.cgi/internal/wxPython-2.5/src/gtk/msgdlg.cpp.diff?r1=text&tr1=2.1.5.1&r2=text&tr2=2.1.5.1.4.1
http://cvs.osafoundation.org/index.cgi/internal/wxPython-2.5/src/gtk/notebook.cpp.diff?r1=text&tr1=2.1.5.1&r2=text&tr2=2.1.5.1.4.1
http://cvs.osafoundation.org/index.cgi/internal/wxPython-2.5/src/gtk/pen.cpp.diff?r1=text&tr1=2.1.5.1&r2=text&tr2=2.1.5.1.4.1
http://cvs.osafoundation.org/index.cgi/internal/wxPython-2.5/src/gtk/popupwin.cpp.diff?r1=text&tr1=2.1.5.1&r2=text&tr2=2.1.5.1.4.1
http://cvs.osafoundation.org/index.cgi/internal/wxPython-2.5/src/gtk/radiobox.cpp.diff?r1=text&tr1=2.1.5.1&r2=text&tr2=2.1.5.1.4.1
http://cvs.osafoundation.org/index.cgi/internal/wxPython-2.5/src/gtk/radiobut.cpp.diff?r1=text&tr1=2.1.5.1&r2=text&tr2=2.1.5.1.4.1
http://cvs.osafoundation.org/index.cgi/internal/wxPython-2.5/src/gtk/region.cpp.diff?r1=text&tr1=2.1.5.1&r2=text&tr2=2.1.5.1.4.1
http://cvs.osafoundation.org/index.cgi/internal/wxPython-2.5/src/gtk/renderer.cpp.diff?r1=text&tr1=2.1.5.1&r2=text&tr2=2.1.5.1.4.1
http://cvs.osafoundation.org/index.cgi/internal/wxPython-2.5/src/gtk/scrolbar.cpp.diff?r1=text&tr1=2.1.5.1&r2=text&tr2=2.1.5.1.4.1
http://cvs.osafoundation.org/index.cgi/internal/wxPython-2.5/src/gtk/scrolwin.cpp.diff?r1=text&tr1=2.1.5.1&r2=text&tr2=2.1.5.1.4.1
http://cvs.osafoundation.org/index.cgi/internal/wxPython-2.5/src/gtk/settings.cpp.diff?r1=text&tr1=2.1.5.1&r2=text&tr2=2.1.5.1.4.1
http://cvs.osafoundation.org/index.cgi/internal/wxPython-2.5/src/gtk/slider.cpp.diff?r1=text&tr1=2.1.5.1&r2=text&tr2=2.1.5.1.4.1
http://cvs.osafoundation.org/index.cgi/internal/wxPython-2.5/src/gtk/spinbutt.cpp.diff?r1=text&tr1=2.1.5.1&r2=text&tr2=2.1.5.1.4.1
http://cvs.osafoundation.org/index.cgi/internal/wxPython-2.5/src/gtk/spinctrl.cpp.diff?r1=text&tr1=2.1.5.1&r2=text&tr2=2.1.5.1.4.1
http://cvs.osafoundation.org/index.cgi/internal/wxPython-2.5/src/gtk/statbmp.cpp.diff?r1=text&tr1=2.1.5.1&r2=text&tr2=2.1.5.1.4.1
http://cvs.osafoundation.org/index.cgi/internal/wxPython-2.5/src/gtk/statbox.cpp.diff?r1=text&tr1=2.1.5.1&r2=text&tr2=2.1.5.1.4.1
http://cvs.osafoundation.org/index.cgi/internal/wxPython-2.5/src/gtk/statline.cpp.diff?r1=text&tr1=2.1.5.1&r2=text&tr2=2.1.5.1.4.1
http://cvs.osafoundation.org/index.cgi/internal/wxPython-2.5/src/gtk/stattext.cpp.diff?r1=text&tr1=2.1.5.1&r2=text&tr2=2.1.5.1.4.1
http://cvs.osafoundation.org/index.cgi/internal/wxPython-2.5/src/gtk/tbargtk.cpp.diff?r1=text&tr1=2.1.5.1&r2=text&tr2=2.1.5.1.4.1
http://cvs.osafoundation.org/index.cgi/internal/wxPython-2.5/src/gtk/textctrl.cpp.diff?r1=text&tr1=2.1.5.1&r2=text&tr2=2.1.5.1.4.1
http://cvs.osafoundation.org/index.cgi/internal/wxPython-2.5/src/gtk/tglbtn.cpp.diff?r1=text&tr1=2.1.5.1&r2=text&tr2=2.1.5.1.4.1
http://cvs.osafoundation.org/index.cgi/internal/wxPython-2.5/src/gtk/threadno.cpp.diff?r1=text&tr1=2.1.5.1&r2=text&tr2=2.1.5.1.4.1
http://cvs.osafoundation.org/index.cgi/internal/wxPython-2.5/src/gtk/threadsgi.cpp.diff?r1=text&tr1=2.1.5.1&r2=text&tr2=2.1.5.1.4.1
http://cvs.osafoundation.org/index.cgi/internal/wxPython-2.5/src/gtk/timer.cpp.diff?r1=text&tr1=2.1.5.1&r2=text&tr2=2.1.5.1.4.1
http://cvs.osafoundation.org/index.cgi/internal/wxPython-2.5/src/gtk/tooltip.cpp.diff?r1=text&tr1=2.1.5.1&r2=text&tr2=2.1.5.1.4.1
http://cvs.osafoundation.org/index.cgi/internal/wxPython-2.5/src/gtk/toplevel.cpp.diff?r1=text&tr1=2.1.5.1&r2=text&tr2=2.1.5.1.4.1
http://cvs.osafoundation.org/index.cgi/internal/wxPython-2.5/src/gtk/treegtk.cpp.diff?r1=text&tr1=2.1.5.1&r2=text&tr2=2.1.5.1.4.1
http://cvs.osafoundation.org/index.cgi/internal/wxPython-2.5/src/gtk/utilsgtk.cpp.diff?r1=text&tr1=2.1.5.1&r2=text&tr2=2.1.5.1.4.1
http://cvs.osafoundation.org/index.cgi/internal/wxPython-2.5/src/gtk/utilsres.cpp.diff?r1=text&tr1=2.1.5.1&r2=text&tr2=2.1.5.1.4.1
http://cvs.osafoundation.org/index.cgi/internal/wxPython-2.5/src/gtk/win_gtk.c.diff?r1=text&tr1=2.1.5.1&r2=text&tr2=2.1.5.1.4.1
http://cvs.osafoundation.org/index.cgi/internal/wxPython-2.5/src/gtk/window.cpp.diff?r1=text&tr1=2.1.5.1&r2=text&tr2=2.1.5.1.4.1
http://cvs.osafoundation.org/index.cgi/internal/wxPython-2.5/src/gtk/gsockgtk.c.diff?r1=text&tr1=2.1.5.1&r2=text&tr2=None

Index: internal/wxPython-2.5/src/gtk/dialog.cpp
diff -u internal/wxPython-2.5/src/gtk/dialog.cpp:2.1.5.1 internal/wxPython-2.5/src/gtk/dialog.cpp:2.1.5.1.4.1
--- internal/wxPython-2.5/src/gtk/dialog.cpp:2.1.5.1	Thu Apr  8 18:16:28 2004
+++ internal/wxPython-2.5/src/gtk/dialog.cpp	Mon Sep 13 18:11:47 2004
@@ -2,7 +2,7 @@
 // Name:        dialog.cpp
 // Purpose:
 // Author:      Robert Roebling
-// Id:          $Id: dialog.cpp,v 2.1.5.1 2004/04/09 01:16:28 markie Exp $
+// Id:          $Id: dialog.cpp,v 2.1.5.1.4.1 2004/09/14 01:11:47 heikki Exp $
 // Copyright:   (c) 1998 Robert Roebling
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
@@ -177,12 +177,6 @@
 
 void wxDialog::SetModal( bool WXUNUSED(flag) )
 {
-/*
-  if (flag)
-    m_windowStyle |= wxDIALOG_MODAL;
-  else
-    if (m_windowStyle & wxDIALOG_MODAL) m_windowStyle -= wxDIALOG_MODAL;
-*/
     wxFAIL_MSG( wxT("wxDialog:SetModal obsolete now") );
 }
 

Index: internal/wxPython-2.5/src/gtk/dcscreen.cpp
diff -u internal/wxPython-2.5/src/gtk/dcscreen.cpp:2.1.5.1 internal/wxPython-2.5/src/gtk/dcscreen.cpp:2.1.5.1.4.1
--- internal/wxPython-2.5/src/gtk/dcscreen.cpp:2.1.5.1	Thu Apr  8 18:16:28 2004
+++ internal/wxPython-2.5/src/gtk/dcscreen.cpp	Mon Sep 13 18:11:47 2004
@@ -2,7 +2,7 @@
 // Name:        dcscreen.cpp
 // Purpose:
 // Author:      Robert Roebling
-// Id:          $Id: dcscreen.cpp,v 2.1.5.1 2004/04/09 01:16:28 markie Exp $
+// Id:          $Id: dcscreen.cpp,v 2.1.5.1.4.1 2004/09/14 01:11:47 heikki Exp $
 // Copyright:   (c) 1998 Robert Roebling
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
@@ -41,6 +41,12 @@
     m_cmap = gdk_colormap_get_system();
     m_window = GDK_ROOT_PARENT();
 
+#ifdef __WXGTK20__
+    m_context = gdk_pango_context_get();
+    m_layout = pango_layout_new( m_context );
+//    m_fontdesc = pango_font_description_copy( widget->style->font_desc );
+#endif
+
     m_isScreenDC = TRUE;
 
     SetUpDC();

Index: internal/wxPython-2.5/src/gtk/dc.cpp
diff -u internal/wxPython-2.5/src/gtk/dc.cpp:2.1.5.1 internal/wxPython-2.5/src/gtk/dc.cpp:2.1.5.1.4.1
--- internal/wxPython-2.5/src/gtk/dc.cpp:2.1.5.1	Thu Apr  8 18:16:27 2004
+++ internal/wxPython-2.5/src/gtk/dc.cpp	Mon Sep 13 18:11:47 2004
@@ -2,7 +2,7 @@
 // Name:        dc.cpp
 // Purpose:
 // Author:      Robert Roebling
-// RCS-ID:      $Id: dc.cpp,v 2.1.5.1 2004/04/09 01:16:27 markie Exp $
+// RCS-ID:      $Id: dc.cpp,v 2.1.5.1.4.1 2004/09/14 01:11:47 heikki Exp $
 // Copyright:   (c) 1998 Robert Roebling
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
@@ -65,11 +65,6 @@
     m_clipY2 = y + height;
 }
 
-void wxDC::DestroyClippingRegion()
-{
-    m_clipping = FALSE;
-}
-
 // ---------------------------------------------------------------------------
 // get DC capabilities
 // ---------------------------------------------------------------------------

Index: internal/wxPython-2.5/src/gtk/utilsgtk.cpp
diff -u internal/wxPython-2.5/src/gtk/utilsgtk.cpp:2.1.5.1 internal/wxPython-2.5/src/gtk/utilsgtk.cpp:2.1.5.1.4.1
--- internal/wxPython-2.5/src/gtk/utilsgtk.cpp:2.1.5.1	Thu Apr  8 18:16:30 2004
+++ internal/wxPython-2.5/src/gtk/utilsgtk.cpp	Mon Sep 13 18:11:47 2004
@@ -2,7 +2,7 @@
 // Name:        src/gtk/utilsgtk.cpp
 // Purpose:
 // Author:      Robert Roebling
-// Id:          $Id: utilsgtk.cpp,v 2.1.5.1 2004/04/09 01:16:30 markie Exp $
+// Id:          $Id: utilsgtk.cpp,v 2.1.5.1.4.1 2004/09/14 01:11:47 heikki Exp $
 // Copyright:   (c) 1998 Robert Roebling
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
@@ -81,6 +81,43 @@
 }
 #endif
 
+#ifdef __WXGTK20__
+// Escapes string so that it is valid Pango markup XML string:
+wxString wxEscapeStringForPangoMarkup(const wxString& str)
+{
+    size_t len = str.length();
+    wxString out;
+    out.Alloc(len);
+    for (size_t i = 0; i < len; i++)
+    {
+        wxChar c = str[i];
+        switch (c)
+        {
+            case _T('&'):
+                out << _T("&amp;");
+                break;
+            case _T('<'):
+                out << _T("&lt;");
+                break;
+            case _T('>'):
+                out << _T("&gt;");
+                break;
+            case _T('\''):
+                out << _T("&apos;");
+                break;
+            case _T('"'):
+                out << _T("&quot;");
+                break;
+            default:
+                out << c;
+                break;
+        }
+    }
+    return out;
+}
+#endif
+
+
 // ----------------------------------------------------------------------------
 // display characterstics
 // ----------------------------------------------------------------------------

Index: internal/wxPython-2.5/src/gtk/colour.cpp
diff -u internal/wxPython-2.5/src/gtk/colour.cpp:2.1.5.1 internal/wxPython-2.5/src/gtk/colour.cpp:2.1.5.1.4.1
--- internal/wxPython-2.5/src/gtk/colour.cpp:2.1.5.1	Thu Apr  8 18:16:27 2004
+++ internal/wxPython-2.5/src/gtk/colour.cpp	Mon Sep 13 18:11:47 2004
@@ -2,7 +2,7 @@
 // Name:        colour.cpp
 // Purpose:
 // Author:      Robert Roebling
-// Id:          $Id: colour.cpp,v 2.1.5.1 2004/04/09 01:16:27 markie Exp $
+// Id:          $Id: colour.cpp,v 2.1.5.1.4.1 2004/09/14 01:11:47 heikki Exp $
 // Copyright:   (c) 1998 Robert Roebling
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
@@ -146,7 +146,8 @@
 
 #define M_COLDATA ((wxColourRefData *)m_refData)
 
-#define SHIFT (8*(sizeof(short int)-sizeof(char)))
+// GDK's values are in 0..65535 range, our are in 0..255
+#define SHIFT  8
 
 IMPLEMENT_DYNAMIC_CLASS(wxColour,wxGDIObject)
 

Index: internal/wxPython-2.5/src/gtk/data.cpp
diff -u internal/wxPython-2.5/src/gtk/data.cpp:2.1.5.1 internal/wxPython-2.5/src/gtk/data.cpp:2.1.5.1.4.1
--- internal/wxPython-2.5/src/gtk/data.cpp:2.1.5.1	Thu Apr  8 18:16:27 2004
+++ internal/wxPython-2.5/src/gtk/data.cpp	Mon Sep 13 18:11:47 2004
@@ -2,7 +2,7 @@
 // Name:        gtk/data.cpp
 // Purpose:     Various global GTK-specific data
 // Author:      Robert Roebling
-// Id:          $Id: data.cpp,v 2.1.5.1 2004/04/09 01:16:27 markie Exp $
+// Id:          $Id: data.cpp,v 2.1.5.1.4.1 2004/09/14 01:11:47 heikki Exp $
 // Copyright:   (c) 1998 Robert Roebling
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////

Index: internal/wxPython-2.5/src/gtk/font.cpp
diff -u internal/wxPython-2.5/src/gtk/font.cpp:2.1.5.1 internal/wxPython-2.5/src/gtk/font.cpp:2.1.5.1.4.1
--- internal/wxPython-2.5/src/gtk/font.cpp:2.1.5.1	Thu Apr  8 18:16:28 2004
+++ internal/wxPython-2.5/src/gtk/font.cpp	Mon Sep 13 18:11:47 2004
@@ -2,7 +2,7 @@
 // Name:        gtk/font.cpp
 // Purpose:
 // Author:      Robert Roebling
-// Id:          $Id: font.cpp,v 2.1.5.1 2004/04/09 01:16:28 markie Exp $
+// Id:          $Id: font.cpp,v 2.1.5.1.4.1 2004/09/14 01:11:47 heikki Exp $
 // Copyright:   (c) 1998 Robert Roebling and Julian Smart
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
@@ -97,7 +97,7 @@
     void SetEncoding(wxFontEncoding encoding);
 
     void SetNoAntiAliasing( bool no = TRUE ) { m_noAA = no; }
-    bool GetNoAntiAliasing() { return m_noAA; }
+    bool GetNoAntiAliasing() const { return m_noAA; }
 
     // and this one also modifies all the other font data fields
     void SetNativeFontInfo(const wxNativeFontInfo& info);
@@ -774,7 +774,7 @@
     return M_FONTDATA->m_encoding;
 }
 
-bool wxFont::GetNoAntiAliasing()
+bool wxFont::GetNoAntiAliasing() const
 {
     wxCHECK_MSG( Ok(), wxFONTENCODING_DEFAULT, wxT("invalid font") );
 
@@ -786,8 +786,13 @@
     wxCHECK_MSG( Ok(), (wxNativeFontInfo *)NULL, wxT("invalid font") );
 
 #ifndef __WXGTK20__
-    if ( M_FONTDATA->m_nativeFontInfo.GetXFontName().empty() )
+    if ( !M_FONTDATA->HasNativeFont() )
+    {
+        // NB: this call has important side-effect: it not only finds
+        //     GdkFont representation, it also initializes m_nativeFontInfo
+        //     by calling its SetXFontName method
         GetInternalFont();
+    }
 #endif
 
     return &(M_FONTDATA->m_nativeFontInfo);
@@ -938,7 +943,7 @@
         if ( !font )
         {
             // do we have the XLFD?
-            if ( M_FONTDATA->HasNativeFont() )
+            if ( int_scale == 100 && M_FONTDATA->HasNativeFont() )
             {
                 font = wxLoadFont(M_FONTDATA->m_nativeFontInfo.GetXFontName());
             }
@@ -955,6 +960,10 @@
                                                M_FONTDATA->m_faceName,
                                                M_FONTDATA->m_encoding,
                                                &xfontname);
+                // NB: wxFont::GetNativeFontInfo relies on this 
+                //     side-effect of GetInternalFont
+                if ( int_scale == 100 )
+                    M_FONTDATA->m_nativeFontInfo.SetXFontName(xfontname);
             }
         }
 

Index: internal/wxPython-2.5/src/gtk/bmpbuttn.cpp
diff -u internal/wxPython-2.5/src/gtk/bmpbuttn.cpp:2.1.5.1 internal/wxPython-2.5/src/gtk/bmpbuttn.cpp:2.1.5.1.4.1
--- internal/wxPython-2.5/src/gtk/bmpbuttn.cpp:2.1.5.1	Thu Apr  8 18:16:27 2004
+++ internal/wxPython-2.5/src/gtk/bmpbuttn.cpp	Mon Sep 13 18:11:47 2004
@@ -2,7 +2,7 @@
 // Name:        gtk/bmpbuttn.cpp
 // Purpose:
 // Author:      Robert Roebling
-// Id:          $Id: bmpbuttn.cpp,v 2.1.5.1 2004/04/09 01:16:27 markie Exp $
+// Id:          $Id: bmpbuttn.cpp,v 2.1.5.1.4.1 2004/09/14 01:11:47 heikki Exp $
 // Copyright:   (c) 1998 Robert Roebling
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
@@ -137,10 +137,7 @@
         return FALSE;
     }
 
-    m_bmpNormal   =
-    m_bmpDisabled =
-    m_bmpFocus    =
-    m_bmpSelected = bitmap;
+    m_bmpNormal = bitmap;
 
     m_widget = gtk_button_new();
 
@@ -149,13 +146,6 @@
 
     if (m_bmpNormal.Ok())
     {
-        wxSize newSize = size;
-        wxSize bestSize = DoGetBestSize();
-        if (newSize.x == -1)
-            newSize.x = bestSize.x;
-        if (newSize.y == -1)
-            newSize.y = bestSize.y;
-        SetSize( newSize.x, newSize.y );
         OnSetBitmap();
     }
 
@@ -173,10 +163,7 @@
 
     m_parent->DoAddChild( this );
 
-    PostCreation();
-    InheritAttributes();
-
-    Show( TRUE );
+    PostCreation(size);
 
     return TRUE;
 }
@@ -203,18 +190,20 @@
     return wxControl::GetLabel();
 }
 
-void wxBitmapButton::ApplyWidgetStyle()
+void wxBitmapButton::DoApplyWidgetStyle(GtkRcStyle *style)
 {
     if ( !BUTTON_CHILD(m_widget) )
         return;
 
-    wxButton::ApplyWidgetStyle();
+    wxButton::DoApplyWidgetStyle(style);
 }
 
 void wxBitmapButton::OnSetBitmap()
 {
     wxCHECK_RET( m_widget != NULL, wxT("invalid bitmap button") );
 
+    InvalidateBestSize();
+    
     wxBitmap the_one;
     if (!m_isEnabled)
         the_one = m_bmpDisabled;
@@ -247,14 +236,30 @@
     if (child == NULL)
     {
         // initial bitmap
-        GtkWidget *pixmap = gtk_pixmap_new(the_one.GetPixmap(), mask);
+        GtkWidget *pixmap;
+#ifdef __WXGTK20__
+        if (the_one.HasPixbuf())
+            pixmap = gtk_image_new_from_pixbuf(the_one.GetPixbuf());
+        else
+            pixmap = gtk_image_new_from_pixmap(the_one.GetPixmap(), mask);
+#else
+        pixmap = gtk_pixmap_new(the_one.GetPixmap(), mask);
+#endif
         gtk_widget_show(pixmap);
         gtk_container_add(GTK_CONTAINER(m_widget), pixmap);
     }
     else
     {   // subsequent bitmaps
-        GtkPixmap *g_pixmap = GTK_PIXMAP(child);
-        gtk_pixmap_set(g_pixmap, the_one.GetPixmap(), mask);
+#ifdef __WXGTK20__
+        GtkImage *pixmap = GTK_IMAGE(child);
+        if (the_one.HasPixbuf())
+            gtk_image_set_from_pixbuf(pixmap, the_one.GetPixbuf());
+        else
+            gtk_image_set_from_pixmap(pixmap, the_one.GetPixmap(), mask);
+#else
+        GtkPixmap *pixmap = GTK_PIXMAP(child);
+        gtk_pixmap_set(pixmap, the_one.GetPixmap(), mask);
+#endif
     }
 }
 
@@ -268,6 +273,7 @@
         best.x = m_bmpNormal.GetWidth()+border;
         best.y = m_bmpNormal.GetHeight()+border;
     }
+    CacheBestSize(best);
     return best;
 }
 

Index: internal/wxPython-2.5/src/gtk/threadno.cpp
diff -u internal/wxPython-2.5/src/gtk/threadno.cpp:2.1.5.1 internal/wxPython-2.5/src/gtk/threadno.cpp:2.1.5.1.4.1
--- internal/wxPython-2.5/src/gtk/threadno.cpp:2.1.5.1	Thu Apr  8 18:16:30 2004
+++ internal/wxPython-2.5/src/gtk/threadno.cpp	Mon Sep 13 18:11:47 2004
@@ -4,7 +4,7 @@
 // Author:      Guilhem Lavaux
 // Modified by:
 // Created:     04/22/98
-// RCS-ID:      $Id: threadno.cpp,v 2.1.5.1 2004/04/09 01:16:30 markie Exp $
+// RCS-ID:      $Id: threadno.cpp,v 2.1.5.1.4.1 2004/09/14 01:11:47 heikki Exp $
 // Copyright:   (c) Wolfram Gloger (1996, 1997); Guilhem Lavaux (1998)
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////

Index: internal/wxPython-2.5/src/gtk/dataobj.cpp
diff -u internal/wxPython-2.5/src/gtk/dataobj.cpp:2.1.5.1 internal/wxPython-2.5/src/gtk/dataobj.cpp:2.1.5.1.4.1
--- internal/wxPython-2.5/src/gtk/dataobj.cpp:2.1.5.1	Thu Apr  8 18:16:27 2004
+++ internal/wxPython-2.5/src/gtk/dataobj.cpp	Mon Sep 13 18:11:47 2004
@@ -2,7 +2,7 @@
 // Name:        dataobj.cpp
 // Purpose:     wxDataObject class
 // Author:      Robert Roebling
-// Id:          $Id: dataobj.cpp,v 2.1.5.1 2004/04/09 01:16:27 markie Exp $
+// Id:          $Id: dataobj.cpp,v 2.1.5.1.4.1 2004/09/14 01:11:47 heikki Exp $
 // Copyright:   (c) 1998 Robert Roebling
 // Licence:     wxWindows licence
 ///////////////////////////////////////////////////////////////////////////////
@@ -80,8 +80,15 @@
     
     m_type = type;
     
+#if wxUSE_UNICODE
+    if (m_type == wxDF_UNICODETEXT)
+        m_format = g_textAtom;
+    else if (m_type == wxDF_TEXT)
+        m_format = g_altTextAtom;
+#else
     if (m_type == wxDF_TEXT || m_type == wxDF_UNICODETEXT)
         m_format = g_textAtom;
+#endif
     else
     if (m_type == wxDF_BITMAP)
         m_format = g_pngAtom;
@@ -111,6 +118,13 @@
     m_format = format;
 
     if (m_format == g_textAtom)
+#if wxUSE_UNICODE
+        m_type = wxDF_UNICODETEXT;
+#else
+        m_type = wxDF_TEXT;
+#endif
+    else
+    if (m_format == g_altTextAtom)
         m_type = wxDF_TEXT;
     else
     if (m_format == g_pngAtom)

Index: internal/wxPython-2.5/src/gtk/statline.cpp
diff -u internal/wxPython-2.5/src/gtk/statline.cpp:2.1.5.1 internal/wxPython-2.5/src/gtk/statline.cpp:2.1.5.1.4.1
--- internal/wxPython-2.5/src/gtk/statline.cpp:2.1.5.1	Thu Apr  8 18:16:29 2004
+++ internal/wxPython-2.5/src/gtk/statline.cpp	Mon Sep 13 18:11:47 2004
@@ -2,7 +2,7 @@
 // Name:        statline.cpp
 // Purpose:
 // Author:      Robert Roebling
-// Id:          $Id: statline.cpp,v 2.1.5.1 2004/04/09 01:16:29 markie Exp $
+// Id:          $Id: statline.cpp,v 2.1.5.1.4.1 2004/09/14 01:11:47 heikki Exp $
 // Copyright:   (c) 1998 Robert Roebling
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
@@ -74,11 +74,16 @@
 
     m_parent->DoAddChild( this );
 
-    PostCreation();
-
-    Show( TRUE );
+    PostCreation(size);
 
     return TRUE;
 }
 
+// static
+wxVisualAttributes
+wxStaticLine::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
+{
+    return GetDefaultAttributesFromGTKWidget(gtk_vseparator_new);
+}
+
 #endif

Index: internal/wxPython-2.5/src/gtk/popupwin.cpp
diff -u internal/wxPython-2.5/src/gtk/popupwin.cpp:2.1.5.1 internal/wxPython-2.5/src/gtk/popupwin.cpp:2.1.5.1.4.1
--- internal/wxPython-2.5/src/gtk/popupwin.cpp:2.1.5.1	Thu Apr  8 18:16:29 2004
+++ internal/wxPython-2.5/src/gtk/popupwin.cpp	Mon Sep 13 18:11:47 2004
@@ -2,7 +2,7 @@
 // Name:        popupwin.cpp
 // Purpose:
 // Author:      Robert Roebling
-// Id:          $Id: popupwin.cpp,v 2.1.5.1 2004/04/09 01:16:29 markie Exp $
+// Id:          $Id: popupwin.cpp,v 2.1.5.1.4.1 2004/09/14 01:11:47 heikki Exp $
 // Copyright:   (c) 1998 Robert Roebling
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
@@ -118,7 +118,7 @@
 
 /* Callback for wxFrame. This very strange beast has to be used because
  * C++ has no virtual methods in a constructor. We have to emulate a
- * virtual function here as wxWindows requires different ways to insert
+ * virtual function here as wxWidgets requires different ways to insert
  * a child in container classes. */
 
 static void wxInsertChildInDialog( wxPopupWindow* parent, wxWindow* child )

Index: internal/wxPython-2.5/src/gtk/threadsgi.cpp
diff -u internal/wxPython-2.5/src/gtk/threadsgi.cpp:2.1.5.1 internal/wxPython-2.5/src/gtk/threadsgi.cpp:2.1.5.1.4.1
--- internal/wxPython-2.5/src/gtk/threadsgi.cpp:2.1.5.1	Thu Apr  8 18:16:30 2004
+++ internal/wxPython-2.5/src/gtk/threadsgi.cpp	Mon Sep 13 18:11:47 2004
@@ -4,7 +4,7 @@
 // Author:      Original from Wolfram Gloger/Guilhem Lavaux
 // Modified by:
 // Created:     04/22/98
-// RCS-ID:      $Id: threadsgi.cpp,v 2.1.5.1 2004/04/09 01:16:30 markie Exp $
+// RCS-ID:      $Id: threadsgi.cpp,v 2.1.5.1.4.1 2004/09/14 01:11:47 heikki Exp $
 // Copyright:   (c) Wolfram Gloger (1996, 1997); Guilhem Lavaux (1998)
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////

Index: internal/wxPython-2.5/src/gtk/evtloop.cpp
diff -u internal/wxPython-2.5/src/gtk/evtloop.cpp:2.1.5.1 internal/wxPython-2.5/src/gtk/evtloop.cpp:2.1.5.1.4.1
--- internal/wxPython-2.5/src/gtk/evtloop.cpp:2.1.5.1	Thu Apr  8 18:16:28 2004
+++ internal/wxPython-2.5/src/gtk/evtloop.cpp	Mon Sep 13 18:11:47 2004
@@ -4,7 +4,7 @@
 // Author:      Vadim Zeitlin
 // Modified by:
 // Created:     10.07.01
-// RCS-ID:      $Id: evtloop.cpp,v 2.1.5.1 2004/04/09 01:16:28 markie Exp $
+// RCS-ID:      $Id: evtloop.cpp,v 2.1.5.1.4.1 2004/09/14 01:11:47 heikki Exp $
 // Copyright:   (c) 2001 Vadim Zeitlin <zeitlin at dptmaths.ens-cachan.fr>
 // License:     wxWindows licence
 ///////////////////////////////////////////////////////////////////////////////
@@ -62,18 +62,13 @@
 // wxEventLoop running and exiting
 // ----------------------------------------------------------------------------
 
-wxEventLoop *wxEventLoop::ms_activeLoop = NULL;
+wxEventLoop *wxEventLoopBase::ms_activeLoop = NULL;
 
 wxEventLoop::~wxEventLoop()
 {
     wxASSERT_MSG( !m_impl, _T("should have been deleted in Run()") );
 }
 
-bool wxEventLoop::IsRunning() const
-{
-    return m_impl != NULL;
-}
-
 int wxEventLoop::Run()
 {
     // event loops are not recursive, you need to create another loop!

Index: internal/wxPython-2.5/src/gtk/region.cpp
diff -u internal/wxPython-2.5/src/gtk/region.cpp:2.1.5.1 internal/wxPython-2.5/src/gtk/region.cpp:2.1.5.1.4.1
--- internal/wxPython-2.5/src/gtk/region.cpp:2.1.5.1	Thu Apr  8 18:16:29 2004
+++ internal/wxPython-2.5/src/gtk/region.cpp	Mon Sep 13 18:11:47 2004
@@ -3,7 +3,7 @@
 // Purpose:
 // Author:      Robert Roebling
 // Modified:    VZ at 05.10.00: use AllocExclusive(), comparison fixed
-// Id:          $Id: region.cpp,v 2.1.5.1 2004/04/09 01:16:29 markie Exp $
+// Id:          $Id: region.cpp,v 2.1.5.1.4.1 2004/09/14 01:11:47 heikki Exp $
 // Copyright:   (c) 1998 Robert Roebling
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////

Index: internal/wxPython-2.5/src/gtk/stattext.cpp
diff -u internal/wxPython-2.5/src/gtk/stattext.cpp:2.1.5.1 internal/wxPython-2.5/src/gtk/stattext.cpp:2.1.5.1.4.1
--- internal/wxPython-2.5/src/gtk/stattext.cpp:2.1.5.1	Thu Apr  8 18:16:29 2004
+++ internal/wxPython-2.5/src/gtk/stattext.cpp	Mon Sep 13 18:11:47 2004
@@ -2,7 +2,7 @@
 // Name:        stattext.cpp
 // Purpose:
 // Author:      Robert Roebling
-// Id:          $Id: stattext.cpp,v 2.1.5.1 2004/04/09 01:16:29 markie Exp $
+// Id:          $Id: stattext.cpp,v 2.1.5.1.4.1 2004/09/14 01:11:47 heikki Exp $
 // Copyright:   (c) 1998 Robert Roebling
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
@@ -61,7 +61,7 @@
     if (!PreCreation( parent, pos, size ) ||
         !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ))
     {
-        wxFAIL_MSG( wxT("wxXX creation failed") );
+        wxFAIL_MSG( wxT("wxStaticText creation failed") );
         return FALSE;
     }
 
@@ -90,7 +90,7 @@
 
     m_parent->DoAddChild( this );
 
-    PostCreation();
+    PostCreation(size);
     
     // the bug below only happens with GTK 2
 #ifdef __WXGTK20__
@@ -109,27 +109,6 @@
     }
 #endif // __WXGTK20__
 
-    ApplyWidgetStyle();
-
-    InheritAttributes();
-//    wxControl::SetFont( parent->GetFont() );
-    
-    wxSize size_best( DoGetBestSize() );
-    wxSize new_size( size );
-    if (new_size.x == -1)
-        new_size.x = size_best.x;
-    if (new_size.y == -1)
-        new_size.y = size_best.y;
-    if ((new_size.x != size.x) || (new_size.y != size.y))
-        SetSize( new_size.x, new_size.y );
-
-//     if (ShouldInheritColours())
-//     {
-//         SetBackgroundColour( parent->GetBackgroundColour() );
-//         SetForegroundColour( parent->GetForegroundColour() );
-//     }
-    Show( TRUE );
-
     return TRUE;
 }
 
@@ -150,11 +129,30 @@
 {
     wxControl::SetLabel(label);
 
-    gtk_label_set( GTK_LABEL(m_widget), wxGTK_CONV( m_label ) );
+#ifdef __WXGTK20__
+    // Build the colorized version of the label (markup only allowed
+    // under GTK2):
+    if (m_foregroundColour.Ok())
+    {
+        // If the color has been set, create a markup string to pass to
+        // the label setter
+        wxString colorlabel;
+        colorlabel.Printf(_T("<span foreground=\"#%02x%02x%02x\">%s</span>"),
+                          m_foregroundColour.Red(), m_foregroundColour.Green(),
+                          m_foregroundColour.Blue(),
+                          wxEscapeStringForPangoMarkup(label).c_str());
+        gtk_label_set_markup( GTK_LABEL(m_widget), wxGTK_CONV( colorlabel ) );
+    }
+    else
+#endif
+        gtk_label_set( GTK_LABEL(m_widget), wxGTK_CONV( m_label ) );
 
     // adjust the label size to the new label unless disabled
     if (!HasFlag(wxST_NO_AUTORESIZE))
+    {
+        InvalidateBestSize();
         SetSize( GetBestSize() );
+    }
 }
 
 bool wxStaticText::SetFont( const wxFont &font )
@@ -163,17 +161,13 @@
 
     // adjust the label size to the new label unless disabled
     if (!HasFlag(wxST_NO_AUTORESIZE))
+    {
+        InvalidateBestSize();
         SetSize( GetBestSize() );
-    
+    }
     return ret;
 }
 
-void wxStaticText::ApplyWidgetStyle()
-{
-    SetWidgetStyle();
-    gtk_widget_set_style( m_widget, m_widgetStyle );
-}
-
 wxSize wxStaticText::DoGetBestSize() const
 {
     // Do not return any arbitrary default value...
@@ -189,7 +183,25 @@
     (* GTK_WIDGET_CLASS( GTK_OBJECT_GET_CLASS(m_widget) )->size_request )
         (m_widget, &req );
 
-    return wxSize(req.width, req.height);
+    wxSize best(req.width, req.height);
+    CacheBestSize(best);
+    return best;
+}
+
+bool wxStaticText::SetForegroundColour(const wxColour& colour)
+{
+    // First, we call the base class member
+    wxControl::SetForegroundColour(colour);
+    // Then, to force the color change, we set the label with the current label
+    SetLabel(GetLabel());
+    return true;
+}
+
+// static
+wxVisualAttributes
+wxStaticText::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
+{
+    return GetDefaultAttributesFromGTKWidget(gtk_label_new);
 }
 
 #endif // wxUSE_STATTEXT

Index: internal/wxPython-2.5/src/gtk/gauge.cpp
diff -u internal/wxPython-2.5/src/gtk/gauge.cpp:2.1.5.1 internal/wxPython-2.5/src/gtk/gauge.cpp:2.1.5.1.4.1
--- internal/wxPython-2.5/src/gtk/gauge.cpp:2.1.5.1	Thu Apr  8 18:16:28 2004
+++ internal/wxPython-2.5/src/gtk/gauge.cpp	Mon Sep 13 18:11:47 2004
@@ -2,7 +2,7 @@
 // Name:        gauge.cpp
 // Purpose:
 // Author:      Robert Roebling
-// Id:          $Id: gauge.cpp,v 2.1.5.1 2004/04/09 01:16:28 markie Exp $
+// Id:          $Id: gauge.cpp,v 2.1.5.1.4.1 2004/09/14 01:11:47 heikki Exp $
 // Copyright:   (c) 1998 Robert Roebling
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
@@ -55,11 +55,9 @@
 
     m_parent->DoAddChild( this );
 
-    PostCreation();
+    PostCreation(size);
     SetBestSize(size);
     
-    Show( TRUE );
-
     return TRUE;
 }
 
@@ -74,7 +72,13 @@
 
 wxSize wxGauge::DoGetBestSize() const
 {
-    return wxSize(100, 28);
+    wxSize best;
+    if (HasFlag(wxGA_VERTICAL))
+        best = wxSize(28, 100);
+    else
+        best = wxSize(100, 28);
+    CacheBestSize(best);
+    return best;
 }
 
 void wxGauge::SetRange( int range )
@@ -105,10 +109,21 @@
     return m_gaugePos;
 }
 
-void wxGauge::ApplyWidgetStyle()
+wxVisualAttributes wxGauge::GetDefaultAttributes() const
+{
+    // Visible gauge colours use a different colour state
+    return GetDefaultAttributesFromGTKWidget(m_widget,
+                                             UseGTKStyleBase(),
+                                             GTK_STATE_ACTIVE);
+
+}
+
+// static
+wxVisualAttributes
+wxGauge::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
 {
-    SetWidgetStyle();
-    gtk_widget_set_style( m_widget, m_widgetStyle );
+    return GetDefaultAttributesFromGTKWidget(gtk_progress_bar_new,
+                                             false, GTK_STATE_ACTIVE);
 }
 
 #endif // wxUSE_GAUGE

Index: internal/wxPython-2.5/src/gtk/scrolbar.cpp
diff -u internal/wxPython-2.5/src/gtk/scrolbar.cpp:2.1.5.1 internal/wxPython-2.5/src/gtk/scrolbar.cpp:2.1.5.1.4.1
--- internal/wxPython-2.5/src/gtk/scrolbar.cpp:2.1.5.1	Thu Apr  8 18:16:29 2004
+++ internal/wxPython-2.5/src/gtk/scrolbar.cpp	Mon Sep 13 18:11:47 2004
@@ -2,7 +2,7 @@
 // Name:        src/gtk/scrolbar.cpp
 // Purpose:
 // Author:      Robert Roebling
-// Id:          $Id: scrolbar.cpp,v 2.1.5.1 2004/04/09 01:16:29 markie Exp $
+// Id:          $Id: scrolbar.cpp,v 2.1.5.1.4.1 2004/09/14 01:11:47 heikki Exp $
 // Copyright:   (c) 1998 Robert Roebling
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
@@ -179,12 +179,7 @@
 
     m_parent->DoAddChild( this );
 
-    PostCreation();
-    InheritAttributes();
-
-    SetBestSize(size);
-
-    Show( TRUE );
+    PostCreation(size);
 
     return TRUE;
 }
@@ -330,15 +325,16 @@
            );
 }
 
-void wxScrollBar::ApplyWidgetStyle()
+wxSize wxScrollBar::DoGetBestSize() const
 {
-    SetWidgetStyle();
-    gtk_widget_set_style( m_widget, m_widgetStyle );
+    return wxControl::DoGetBestSize();
 }
 
-wxSize wxScrollBar::DoGetBestSize() const
+// static
+wxVisualAttributes
+wxScrollBar::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
 {
-    return wxControl::DoGetBestSize();
+    return GetDefaultAttributesFromGTKWidget(gtk_vscrollbar_new);
 }
 
 #endif

Index: internal/wxPython-2.5/src/gtk/clipbrd.cpp
diff -u internal/wxPython-2.5/src/gtk/clipbrd.cpp:2.1.5.1 internal/wxPython-2.5/src/gtk/clipbrd.cpp:2.1.5.1.4.1
--- internal/wxPython-2.5/src/gtk/clipbrd.cpp:2.1.5.1	Thu Apr  8 18:16:27 2004
+++ internal/wxPython-2.5/src/gtk/clipbrd.cpp	Mon Sep 13 18:11:47 2004
@@ -2,7 +2,7 @@
 // Name:        gtk/clipbrd.cpp
 // Purpose:
 // Author:      Robert Roebling
-// Id:          $Id: clipbrd.cpp,v 2.1.5.1 2004/04/09 01:16:27 markie Exp $
+// Id:          $Id: clipbrd.cpp,v 2.1.5.1.4.1 2004/09/14 01:11:47 heikki Exp $
 // Copyright:   (c) 1998 Robert Roebling
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
@@ -250,6 +250,16 @@
 
     wxDataFormat format( selection_data->target );
 
+#ifdef __WXDEBUG__
+    wxLogTrace(TRACE_CLIPBOARD,
+               _T("clipboard data in format %s, GtkSelectionData is target=%s type=%s selection=%s"),
+               format.GetId().c_str(),
+               wxString::FromAscii(gdk_atom_name(selection_data->target)).c_str(),
+               wxString::FromAscii(gdk_atom_name(selection_data->type)).c_str(),
+               wxString::FromAscii(gdk_atom_name(selection_data->selection)).c_str()
+               );
+#endif
+    
     if (!data->IsSupportedFormat( format )) return;
 
     int size = data->GetDataSize( format );
@@ -261,12 +271,27 @@
     // Text data will be in UTF8 in Unicode mode.
     data->GetDataHere( selection_data->target, d );
 
-    gtk_selection_data_set(
-        selection_data,
-        GDK_SELECTION_TYPE_STRING,
-        8*sizeof(gchar),
-        (unsigned char*) d,
-        size );
+#ifdef __WXGTK20__
+    // NB: GTK+ requires special treatment of UTF8_STRING data, the text
+    //     would show as UTF-8 data interpreted as latin1 (?) in other
+    //     GTK+ apps if we used gtk_selection_data_set()
+    if (format == wxDataFormat(wxDF_UNICODETEXT))
+    {
+        gtk_selection_data_set_text(
+            selection_data,
+            (const gchar*)d,
+            size);
+    }
+    else
+#endif
+    {
+        gtk_selection_data_set(
+            selection_data,
+            GDK_SELECTION_TYPE_STRING,
+            8*sizeof(gchar),
+            (unsigned char*) d,
+            size );
+    }
 
     free(d);
 }
@@ -478,11 +503,9 @@
     /* store requested format to be asked for by callbacks */
     m_targetRequested = format;
 
-#if 0
     wxLogTrace( TRACE_CLIPBOARD,
                 wxT("wxClipboard:IsSupported: requested format: %s"),
                 format.GetId().c_str() );
-#endif
 
     wxCHECK_MSG( m_targetRequested, FALSE, wxT("invalid clipboard format") );
 
@@ -515,9 +538,7 @@
     }
 #endif
 
-    if (!m_formatSupported) return FALSE;
-
-    return TRUE;
+    return m_formatSupported;
 }
 
 bool wxClipboard::GetData( wxDataObject& data )

Index: internal/wxPython-2.5/src/gtk/icon.cpp
diff -u internal/wxPython-2.5/src/gtk/icon.cpp:2.1.5.1 internal/wxPython-2.5/src/gtk/icon.cpp:2.1.5.1.4.1
--- internal/wxPython-2.5/src/gtk/icon.cpp:2.1.5.1	Thu Apr  8 18:16:28 2004
+++ internal/wxPython-2.5/src/gtk/icon.cpp	Mon Sep 13 18:11:47 2004
@@ -2,7 +2,7 @@
 // Name:        icon.cpp
 // Purpose:
 // Author:      Robert Roebling
-// Id:          $Id: icon.cpp,v 2.1.5.1 2004/04/09 01:16:28 markie Exp $
+// Id:          $Id: icon.cpp,v 2.1.5.1.4.1 2004/09/14 01:11:47 heikki Exp $
 // Copyright:   (c) 1998 Robert Roebling
 // Licence:   	wxWindows licence
 /////////////////////////////////////////////////////////////////////////////

Index: internal/wxPython-2.5/src/gtk/dcmemory.cpp
diff -u internal/wxPython-2.5/src/gtk/dcmemory.cpp:2.1.5.1 internal/wxPython-2.5/src/gtk/dcmemory.cpp:2.1.5.1.4.1
--- internal/wxPython-2.5/src/gtk/dcmemory.cpp:2.1.5.1	Thu Apr  8 18:16:28 2004
+++ internal/wxPython-2.5/src/gtk/dcmemory.cpp	Mon Sep 13 18:11:47 2004
@@ -2,7 +2,7 @@
 // Name:        dcmemory.cpp
 // Purpose:
 // Author:      Robert Roebling
-// RCS-ID:      $Id: dcmemory.cpp,v 2.1.5.1 2004/04/09 01:16:28 markie Exp $
+// RCS-ID:      $Id: dcmemory.cpp,v 2.1.5.1.4.1 2004/09/14 01:11:47 heikki Exp $
 // Copyright:   (c) 1998 Robert Roebling
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
@@ -71,6 +71,10 @@
             m_window = m_selected.GetBitmap();
         }
 
+#ifdef __WXGTK20__
+        m_selected.PurgeOtherRepresentations(wxBitmap::Pixmap);
+#endif
+
         m_isMemDC = TRUE;
 
         SetUpDC();

Index: internal/wxPython-2.5/src/gtk/spinbutt.cpp
diff -u internal/wxPython-2.5/src/gtk/spinbutt.cpp:2.1.5.1 internal/wxPython-2.5/src/gtk/spinbutt.cpp:2.1.5.1.4.1
--- internal/wxPython-2.5/src/gtk/spinbutt.cpp:2.1.5.1	Thu Apr  8 18:16:29 2004
+++ internal/wxPython-2.5/src/gtk/spinbutt.cpp	Mon Sep 13 18:11:47 2004
@@ -3,7 +3,7 @@
 // Purpose:     wxSpinButton
 // Author:      Robert
 // Modified by:
-// RCS-ID:      $Id: spinbutt.cpp,v 2.1.5.1 2004/04/09 01:16:29 markie Exp $
+// RCS-ID:      $Id: spinbutt.cpp,v 2.1.5.1.4.1 2004/09/14 01:11:47 heikki Exp $
 // Copyright:   (c) Robert Roebling
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
@@ -150,10 +150,7 @@
 
     m_parent->DoAddChild( this );
 
-    PostCreation();
-    InheritAttributes();
-
-    Show( TRUE );
+    PostCreation(new_size);
 
     return TRUE;
 }
@@ -228,15 +225,20 @@
     return GTK_SPIN_BUTTON(m_widget)->panel == window;
 }
 
-void wxSpinButton::ApplyWidgetStyle()
+wxSize wxSpinButton::DoGetBestSize() const
 {
-    SetWidgetStyle();
-    gtk_widget_set_style( m_widget, m_widgetStyle );
+    wxSize best(15, 26); // FIXME
+    CacheBestSize(best);
+    return best;
 }
 
-wxSize wxSpinButton::DoGetBestSize() const
-{
-    return wxSize(15, 26);
+// static
+wxVisualAttributes
+wxSpinButton::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
+{
+    // TODO: overload to accept functions like gtk_spin_button_new?
+    // Until then use a similar type
+    return GetDefaultAttributesFromGTKWidget(gtk_button_new);
 }
 
 #endif

Index: internal/wxPython-2.5/src/gtk/app.cpp
diff -u internal/wxPython-2.5/src/gtk/app.cpp:2.1.5.1 internal/wxPython-2.5/src/gtk/app.cpp:2.1.5.1.4.1
--- internal/wxPython-2.5/src/gtk/app.cpp:2.1.5.1	Thu Apr  8 18:16:27 2004
+++ internal/wxPython-2.5/src/gtk/app.cpp	Mon Sep 13 18:11:47 2004
@@ -2,7 +2,7 @@
 // Name:        app.cpp
 // Purpose:
 // Author:      Robert Roebling
-// Id:          $Id: app.cpp,v 2.1.5.1 2004/04/09 01:16:27 markie Exp $
+// Id:          $Id: app.cpp,v 2.1.5.1.4.1 2004/09/14 01:11:47 heikki Exp $
 // Copyright:   (c) 1998 Robert Roebling, Julian Smart
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
@@ -543,13 +543,15 @@
 
 bool wxApp::Initialize(int& argc, wxChar **argv)
 {
+    bool init_result;
+    
 #if wxUSE_THREADS
     // GTK 1.2 up to version 1.2.3 has broken threads
     if ((gtk_major_version == 1) &&
         (gtk_minor_version == 2) &&
         (gtk_micro_version < 4))
     {
-        printf( "wxWindows warning: GUI threading disabled due to outdated GTK version\n" );
+        printf( "wxWidgets warning: GUI threading disabled due to outdated GTK version\n" );
     }
     else
     {
@@ -588,9 +590,10 @@
     int argcGTK = argc;
     
 #ifdef __WXGPE__
+    init_result = true;  // is there a _check() version of this?
     gpe_application_init( &argcGTK, &argvGTK );
 #else
-    gtk_init( &argcGTK, &argvGTK );
+    init_result = gtk_init_check( &argcGTK, &argvGTK );
 #endif
 
     if ( argcGTK != argc )
@@ -618,9 +621,14 @@
 #else // !wxUSE_UNICODE
     // gtk_init() shouldn't actually change argv itself (just its contents) so
     // it's ok to pass pointer to it
-    gtk_init( &argc, &argv );
+    init_result = gtk_init_check( &argc, &argv );
 #endif // wxUSE_UNICODE/!wxUSE_UNICODE
 
+    if (!init_result) {
+        wxLogError(wxT("Unable to initialize gtk, is DISPLAY set properly?"));
+        return false;
+    }
+    
     // we can not enter threads before gtk_init is done
     gdk_threads_enter();
 
@@ -637,8 +645,6 @@
     wxFont::SetDefaultEncoding(wxLocale::GetSystemEncoding());
 #endif
 
-    wxGetRootWindow();
-
     return true;
 }
 

Index: internal/wxPython-2.5/src/gtk/msgdlg.cpp
diff -u internal/wxPython-2.5/src/gtk/msgdlg.cpp:2.1.5.1 internal/wxPython-2.5/src/gtk/msgdlg.cpp:2.1.5.1.4.1
--- internal/wxPython-2.5/src/gtk/msgdlg.cpp:2.1.5.1	Thu Apr  8 18:16:28 2004
+++ internal/wxPython-2.5/src/gtk/msgdlg.cpp	Mon Sep 13 18:11:47 2004
@@ -4,7 +4,7 @@
 // Author:      Vaclav Slavik
 // Modified by:
 // Created:     2003/02/28
-// RCS-ID:      $Id: msgdlg.cpp,v 2.1.5.1 2004/04/09 01:16:28 markie Exp $
+// RCS-ID:      $Id: msgdlg.cpp,v 2.1.5.1.4.1 2004/09/14 01:11:47 heikki Exp $
 // Copyright:   (c) Vaclav Slavik, 2003
 // Licence:   	wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
@@ -40,11 +40,7 @@
     m_message = message;
     m_dialogStyle = style;
     m_parent = wxGetTopLevelParent(parent);
-}
 
-int wxMessageDialog::ShowModal()
-{
-    GtkWidget *dlg;
     GtkMessageType type = GTK_MESSAGE_ERROR;
     GtkButtonsType buttons = GTK_BUTTONS_OK;
 
@@ -75,27 +71,35 @@
         type = m_dialogStyle & wxYES ? GTK_MESSAGE_QUESTION : GTK_MESSAGE_INFO;
     }
 
-    dlg = gtk_message_dialog_new(m_parent ?
-                                    GTK_WINDOW(m_parent->m_widget) : NULL,
-                                 GTK_DIALOG_MODAL,
-                                 type, buttons,
-                                 "%s", (const char*)wxGTK_CONV(m_message));
+    m_widget = gtk_message_dialog_new(m_parent ?
+                                          GTK_WINDOW(m_parent->m_widget) : NULL,
+                                      GTK_DIALOG_MODAL,
+                                      type, buttons,
+                                      "%s", (const char*)wxGTK_CONV(m_message));
     if (m_caption != wxMessageBoxCaptionStr)
-        gtk_window_set_title(GTK_WINDOW(dlg), wxGTK_CONV(m_caption));
+        gtk_window_set_title(GTK_WINDOW(m_widget), wxGTK_CONV(m_caption));
 
     if (m_dialogStyle & wxYES_NO)
     {
         if (m_dialogStyle & wxCANCEL)
-            gtk_dialog_add_button(GTK_DIALOG(dlg), GTK_STOCK_CANCEL,
+            gtk_dialog_add_button(GTK_DIALOG(m_widget), GTK_STOCK_CANCEL,
                                   GTK_RESPONSE_CANCEL);
         if (m_dialogStyle & wxNO_DEFAULT)
-            gtk_dialog_set_default_response(GTK_DIALOG(dlg), GTK_RESPONSE_NO);
+            gtk_dialog_set_default_response(GTK_DIALOG(m_widget), GTK_RESPONSE_NO);
         else
-            gtk_dialog_set_default_response(GTK_DIALOG(dlg), GTK_RESPONSE_YES);
+            gtk_dialog_set_default_response(GTK_DIALOG(m_widget), GTK_RESPONSE_YES);
     }
 
-    gint result = gtk_dialog_run(GTK_DIALOG(dlg));
-    gtk_widget_destroy(dlg);
+    if (parent)
+        gtk_window_set_transient_for(GTK_WINDOW(m_widget),
+                                     GTK_WINDOW(m_parent->m_widget));
+}
+ 
+int wxMessageDialog::ShowModal()
+{
+    gint result = gtk_dialog_run(GTK_DIALOG(m_widget));
+    gtk_widget_destroy(m_widget);
+    m_widget = NULL;
 
     switch (result)
     {
@@ -104,6 +108,8 @@
             // fall through
 
         case GTK_RESPONSE_CANCEL:
+        case GTK_RESPONSE_DELETE_EVENT:
+        case GTK_RESPONSE_CLOSE:
             return wxID_CANCEL;
         case GTK_RESPONSE_OK:
             return wxID_OK;
@@ -114,5 +120,6 @@
     }
 }
 
+
 #endif // wxUSE_MSGDLG && defined(__WXGTK20__)
 

Index: internal/wxPython-2.5/src/gtk/dcclient.cpp
diff -u internal/wxPython-2.5/src/gtk/dcclient.cpp:2.1.5.1 internal/wxPython-2.5/src/gtk/dcclient.cpp:2.1.5.1.4.1
--- internal/wxPython-2.5/src/gtk/dcclient.cpp:2.1.5.1	Thu Apr  8 18:16:28 2004
+++ internal/wxPython-2.5/src/gtk/dcclient.cpp	Mon Sep 13 18:11:47 2004
@@ -2,7 +2,7 @@
 // Name:        gtk/dcclient.cpp
 // Purpose:
 // Author:      Robert Roebling
-// RCS-ID:      $Id: dcclient.cpp,v 2.1.5.1 2004/04/09 01:16:28 markie Exp $
+// RCS-ID:      $Id: dcclient.cpp,v 2.1.5.1.4.1 2004/09/14 01:11:47 heikki Exp $
 // Copyright:   (c) 1998 Robert Roebling, Chris Breeze
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
@@ -1147,7 +1147,21 @@
     }
     else
     {
-        gdk_draw_pixmap( m_window, m_penGC, use_bitmap.GetPixmap(), 0, 0, xx, yy, -1, -1 );
+#if GTK_CHECK_VERSION(2,2,0)
+        if (use_bitmap.HasPixbuf())
+        {
+            gdk_draw_pixbuf(m_window, m_penGC,
+                            use_bitmap.GetPixbuf(),
+                            0, 0, xx, yy, -1, -1,
+                            GDK_RGB_DITHER_NORMAL, xx, yy);
+        }
+        else
+#endif
+        {
+            gdk_draw_pixmap(m_window, m_penGC,
+                            use_bitmap.GetPixmap(),
+                            0, 0, xx, yy, -1, -1);
+        }
     }
 
     // remove mask again if any
@@ -1467,13 +1481,29 @@
     wxCHECK_RET( m_layout, wxT("no Pango layout") );
     wxCHECK_RET( m_fontdesc, wxT("no Pango font description") );
 
+    bool underlined = m_font.Ok() && m_font.GetUnderlined();
+
 #if wxUSE_UNICODE
     const wxCharBuffer data = wxConvUTF8.cWC2MB( text );
 #else
     const wxWCharBuffer wdata = wxConvLocal.cMB2WC( text );
+    if ( !wdata )
+        return;
     const wxCharBuffer data = wxConvUTF8.cWC2MB( wdata );
 #endif
-    pango_layout_set_text( m_layout, (const char*) data, strlen( (const char*) data ));
+    size_t datalen = strlen((const char*)data);
+    pango_layout_set_text( m_layout, (const char*) data, datalen);
+    
+    if (underlined)
+    {
+        PangoAttrList *attrs = pango_attr_list_new();
+        PangoAttribute *a = pango_attr_underline_new(PANGO_UNDERLINE_SINGLE);
+        a->start_index = 0;
+        a->end_index = datalen;
+        pango_attr_list_insert(attrs, a);
+        pango_layout_set_attributes(m_layout, attrs);
+        pango_attr_list_unref(attrs);
+    }
 
     int w,h;
     
@@ -1520,6 +1550,12 @@
         // Draw layout.
         gdk_draw_layout( m_window, m_textGC, x, y, m_layout );
     }
+
+    if (underlined)
+    {
+        // undo underline attributes setting:
+        pango_layout_set_attributes(m_layout, NULL);
+    }
     
     wxCoord width = w;
     wxCoord height = h;
@@ -1690,29 +1726,48 @@
     // Set layout's text
 #if wxUSE_UNICODE
     const wxCharBuffer data = wxConvUTF8.cWC2MB( string );
-    pango_layout_set_text( m_layout, (const char*) data, strlen( (const char*) data ));
+    const char *dataUTF8 = (const char *)data;
 #else
     const wxWCharBuffer wdata = wxConvLocal.cMB2WC( string );
+    if ( !wdata )
+    {
+        if (width) (*width) = 0;
+        if (height) (*height) = 0;
+        return;
+    }
     const wxCharBuffer data = wxConvUTF8.cWC2MB( wdata );
-    pango_layout_set_text( m_layout, (const char*) data, strlen( (const char*) data ));
+    const char *dataUTF8 = (const char *)data;
 #endif
+
+    if ( !dataUTF8 )
+    {
+        // hardly ideal, but what else can we do if conversion failed?
+        return;
+    }
+
+    pango_layout_set_text( m_layout, dataUTF8, strlen(dataUTF8) );
  
     int w,h;
     pango_layout_get_pixel_size( m_layout, &w, &h );
     
-    if (width) (*width) = (wxCoord) w; 
-    if (height) (*height) = (wxCoord) h;
+    if (width)
+        *width = (wxCoord) w; 
+    if (height)
+        *height = (wxCoord) h;
     if (descent)
     {
-        // Do something about metrics here. TODO.
-        (*descent) = 0;
+        PangoLayoutIter *iter = pango_layout_get_iter(m_layout);
+        int baseline = pango_layout_iter_get_baseline(iter);
+        pango_layout_iter_free(iter);
+        *descent = h - PANGO_PIXELS(baseline);
     }
-    if (externalLeading) (*externalLeading) = 0;  // ??
+    if (externalLeading)
+        *externalLeading = 0;  // ??
     
     // Reset old font description
     if (theFont)
         pango_layout_set_font_description( m_layout, m_fontdesc );
-#else
+#else // GTK+ 1.x
     wxFont fontToUse = m_font;
     if (theFont) fontToUse = *theFont;
     
@@ -1721,7 +1776,7 @@
     if (height) (*height) = wxCoord((font->ascent + font->descent) / m_scaleY);
     if (descent) (*descent) = wxCoord(font->descent / m_scaleY);
     if (externalLeading) (*externalLeading) = 0;  // ??
-#endif
+#endif // GTK+ 2/1
 }
 
 wxCoord wxWindowDC::GetCharWidth() const

Index: internal/wxPython-2.5/src/gtk/settings.cpp
diff -u internal/wxPython-2.5/src/gtk/settings.cpp:2.1.5.1 internal/wxPython-2.5/src/gtk/settings.cpp:2.1.5.1.4.1
--- internal/wxPython-2.5/src/gtk/settings.cpp:2.1.5.1	Thu Apr  8 18:16:29 2004
+++ internal/wxPython-2.5/src/gtk/settings.cpp	Mon Sep 13 18:11:47 2004
@@ -2,7 +2,7 @@
 // Name:        gtk/settings.cpp
 // Purpose:
 // Author:      Robert Roebling
-// Id:          $Id: settings.cpp,v 2.1.5.1 2004/04/09 01:16:29 markie Exp $
+// Id:          $Id: settings.cpp,v 2.1.5.1.4.1 2004/09/14 01:11:47 heikki Exp $
 // Copyright:   (c) 1998 Robert Roebling
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
@@ -308,7 +308,8 @@
                 if ( def && def->font_desc )
                 {  
                     wxNativeFontInfo info;  
-                    info.description = def->font_desc;  
+                    info.description = 
+                        pango_font_description_copy(def->font_desc);
                     gs_objects.m_fontSystem = wxFont(info);  
                 }  
                 else  
@@ -347,9 +348,32 @@
         case wxSYS_HSCROLL_Y:  return 15;
         case wxSYS_VSCROLL_X:  return 15;
 
+#if defined(__WXGTK20__) && GTK_CHECK_VERSION(2, 4, 0)
+        case wxSYS_DCLICK_X:
+        case wxSYS_DCLICK_Y:
+            gint dclick_distance;
+            g_object_get(gtk_settings_get_default(), "gtk-double-click-distance", &dclick_distance, NULL);
+            return dclick_distance * 2;
+#endif
+
+#if defined(__WXGTK20__)
+        case wxSYS_DRAG_X:
+        case wxSYS_DRAG_Y:
+            gint drag_threshold;
+            g_object_get(gtk_settings_get_default(), "gtk-dnd-drag-threshold", &drag_threshold, NULL);
+            return drag_threshold * 2;
+#endif
+
         // VZ: is there any way to get the cursor size with GDK?
+        // Mart Raudsepp: Yes, there is a way to get the default cursor size for a display ever since GDK 2.4
+#if defined(__WXGTK20__) && GTK_CHECK_VERSION(2, 4, 0)
+        case wxSYS_CURSOR_X:
+        case wxSYS_CURSOR_Y:
+            return gdk_display_get_default_cursor_size(gdk_display_get_default());
+#else
         case wxSYS_CURSOR_X:   return 16;
         case wxSYS_CURSOR_Y:   return 16;
+#endif
         // MBN: ditto for icons
         case wxSYS_ICON_X:     return 32;
         case wxSYS_ICON_Y:     return 32;

Index: internal/wxPython-2.5/src/gtk/fontdlg.cpp
diff -u internal/wxPython-2.5/src/gtk/fontdlg.cpp:2.1.5.1 internal/wxPython-2.5/src/gtk/fontdlg.cpp:2.1.5.1.4.1
--- internal/wxPython-2.5/src/gtk/fontdlg.cpp:2.1.5.1	Thu Apr  8 18:16:28 2004
+++ internal/wxPython-2.5/src/gtk/fontdlg.cpp	Mon Sep 13 18:11:47 2004
@@ -2,7 +2,7 @@
 // Name:        gtk/fontdlg.cpp
 // Purpose:     wxFontDialog
 // Author:      Robert Roebling
-// Id:          $Id: fontdlg.cpp,v 2.1.5.1 2004/04/09 01:16:28 markie Exp $
+// Id:          $Id: fontdlg.cpp,v 2.1.5.1.4.1 2004/09/14 01:11:47 heikki Exp $
 // Copyright:   (c) 1998 Robert Roebling
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
@@ -127,9 +127,9 @@
     wxString m_message( _("Choose font") );
     m_widget = gtk_font_selection_dialog_new( wxGTK_CONV( m_message ) );
 
-    int x = (gdk_screen_width () - 400) / 2;
-    int y = (gdk_screen_height () - 400) / 2;
-    gtk_widget_set_uposition( m_widget, x, y );
+    if (parent)
+        gtk_window_set_transient_for(GTK_WINDOW(m_widget),
+                                     GTK_WINDOW(parent->m_widget));
 
     GtkFontSelectionDialog *sel = GTK_FONT_SELECTION_DIALOG(m_widget);
 
@@ -152,7 +152,6 @@
     gtk_signal_connect( GTK_OBJECT(m_widget), "delete_event",
         GTK_SIGNAL_FUNC(gtk_fontdialog_delete_callback), (gpointer)this );
 
-#ifndef __WXGTK20__
     wxFont font = m_fontData.GetInitialFont();
     if( font.Ok() )
     {
@@ -160,14 +159,15 @@
 
         if ( info )
         {
+
+#ifdef __WXGTK20__
+            const wxString& fontname = info->ToString();
+#else
             const wxString& fontname = info->GetXFontName();
             if ( !fontname )
                 font.GetInternalFont();
-            gtk_font_selection_dialog_set_font_name
-            (
-                sel,
-                wxConvCurrent->cWX2MB(fontname)
-            );
+#endif
+            gtk_font_selection_dialog_set_font_name(sel, wxGTK_CONV(fontname));
         }
         else
         {
@@ -175,7 +175,6 @@
             wxFAIL_MSG(_T("font is ok but no native font info?"));
         }
     }
-#endif
 
     return TRUE;
 }

Index: internal/wxPython-2.5/src/gtk/main.cpp
diff -u internal/wxPython-2.5/src/gtk/main.cpp:2.1.5.1 internal/wxPython-2.5/src/gtk/main.cpp:2.1.5.1.4.1
--- internal/wxPython-2.5/src/gtk/main.cpp:2.1.5.1	Thu Apr  8 18:16:28 2004
+++ internal/wxPython-2.5/src/gtk/main.cpp	Mon Sep 13 18:11:47 2004
@@ -4,7 +4,7 @@
 // Author:      Julian Smart
 // Modified by:
 // Created:     17/09/98
-// RCS-ID:      $Id: main.cpp,v 2.1.5.1 2004/04/09 01:16:28 markie Exp $
+// RCS-ID:      $Id: main.cpp,v 2.1.5.1.4.1 2004/09/14 01:11:47 heikki Exp $
 // Copyright:   (c) Julian Smart
 // Licence:   	wxWindows licence
 /////////////////////////////////////////////////////////////////////////////

Index: internal/wxPython-2.5/src/gtk/scrolwin.cpp
diff -u internal/wxPython-2.5/src/gtk/scrolwin.cpp:2.1.5.1 internal/wxPython-2.5/src/gtk/scrolwin.cpp:2.1.5.1.4.1
--- internal/wxPython-2.5/src/gtk/scrolwin.cpp:2.1.5.1	Thu Apr  8 18:16:29 2004
+++ internal/wxPython-2.5/src/gtk/scrolwin.cpp	Mon Sep 13 18:11:47 2004
@@ -4,7 +4,7 @@
 // Author:      Robert Roebling
 // Modified by: Ron Lee
 // Created:     01/02/97
-// RCS-ID:      $Id: scrolwin.cpp,v 2.1.5.1 2004/04/09 01:16:29 markie Exp $
+// RCS-ID:      $Id: scrolwin.cpp,v 2.1.5.1.4.1 2004/09/14 01:11:47 heikki Exp $
 // Copyright:   (c) Robert Roebling
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
@@ -288,7 +288,7 @@
     GtkHConnectEvent();
 
     // these handlers block mouse events to any window during scrolling such as
-    // motion events and prevent GTK and wxWindows from fighting over where the
+    // motion events and prevent GTK and wxWidgets from fighting over where the
     // slider should be
 
     gtk_signal_connect( GTK_OBJECT(scrolledWindow->vscrollbar), "button_press_event",
@@ -453,7 +453,7 @@
 
 // Override this function if you don't want to have wxScrolledWindow
 // automatically change the origin according to the scroll position.
-void wxScrolledWindow::PrepareDC(wxDC& dc)
+void wxScrolledWindow::DoPrepareDC(wxDC& dc)
 {
     dc.SetDeviceOrigin( -m_xScrollPosition * m_xScrollPixelsPerLine,
                         -m_yScrollPosition * m_yScrollPixelsPerLine );
@@ -562,7 +562,7 @@
 
         m_targetWindow->ScrollWindow( (old_x-m_xScrollPosition)*m_xScrollPixelsPerLine, 0 );
 
-        // Just update the scrollbar, don't send any wxWindows event
+        // Just update the scrollbar, don't send any wxWidgets event
         GtkHDisconnectEvent();
         gtk_signal_emit_by_name( GTK_OBJECT(m_hAdjust), "value_changed" );
         GtkHConnectEvent();
@@ -581,7 +581,7 @@
 
         m_targetWindow->ScrollWindow( 0, (old_y-m_yScrollPosition)*m_yScrollPixelsPerLine );
 
-        // Just update the scrollbar, don't send any wxWindows event
+        // Just update the scrollbar, don't send any wxWidgets event
         GtkVDisconnectEvent();
         gtk_signal_emit_by_name( GTK_OBJECT(m_vAdjust), "value_changed" );
         GtkVConnectEvent();
@@ -783,14 +783,14 @@
     {
         if (orient == wxHORIZONTAL)
         {
-            // Just update the scrollbar, don't send any wxWindows event
+            // Just update the scrollbar, don't send any wxWidgets event
             GtkHDisconnectEvent();
             gtk_signal_emit_by_name( GTK_OBJECT(m_hAdjust), "value_changed" );
             GtkHConnectEvent();
         }
         else
         {
-            // Just update the scrollbar, don't send any wxWindows event
+            // Just update the scrollbar, don't send any wxWidgets event
             GtkVDisconnectEvent();
             gtk_signal_emit_by_name( GTK_OBJECT(m_vAdjust), "value_changed" );
             GtkVConnectEvent();

Index: internal/wxPython-2.5/src/gtk/pen.cpp
diff -u internal/wxPython-2.5/src/gtk/pen.cpp:2.1.5.1 internal/wxPython-2.5/src/gtk/pen.cpp:2.1.5.1.4.1
--- internal/wxPython-2.5/src/gtk/pen.cpp:2.1.5.1	Thu Apr  8 18:16:29 2004
+++ internal/wxPython-2.5/src/gtk/pen.cpp	Mon Sep 13 18:11:47 2004
@@ -2,7 +2,7 @@
 // Name:        pen.cpp
 // Purpose:
 // Author:      Robert Roebling
-// Id:          $Id: pen.cpp,v 2.1.5.1 2004/04/09 01:16:29 markie Exp $
+// Id:          $Id: pen.cpp,v 2.1.5.1.4.1 2004/09/14 01:11:47 heikki Exp $
 // Copyright:   (c) 1998 Robert Roebling
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////

Index: internal/wxPython-2.5/src/gtk/tglbtn.cpp
diff -u internal/wxPython-2.5/src/gtk/tglbtn.cpp:2.1.5.1 internal/wxPython-2.5/src/gtk/tglbtn.cpp:2.1.5.1.4.1
--- internal/wxPython-2.5/src/gtk/tglbtn.cpp:2.1.5.1	Thu Apr  8 18:16:30 2004
+++ internal/wxPython-2.5/src/gtk/tglbtn.cpp	Mon Sep 13 18:11:47 2004
@@ -5,7 +5,7 @@
 // Author:      John Norris, minor changes by Axel Schlueter
 // Modified by:
 // Created:     08.02.01
-// RCS-ID:      $Id: tglbtn.cpp,v 2.1.5.1 2004/04/09 01:16:30 markie Exp $
+// RCS-ID:      $Id: tglbtn.cpp,v 2.1.5.1.4.1 2004/09/14 01:11:47 heikki Exp $
 // Copyright:   (c) 2000 Johnny C. Norris II
 // License:     Rocketeer license
 /////////////////////////////////////////////////////////////////////////////
@@ -79,13 +79,6 @@
 
     if (m_bitmap.Ok())
     {
-        wxSize newSize = size;
-        int border = (style & wxNO_BORDER) ? 4 : 10;
-        if (newSize.x == -1)
-            newSize.x = m_bitmap.GetWidth()+border;
-        if (newSize.y == -1)
-            newSize.y = m_bitmap.GetHeight()+border;
-        SetSize( newSize.x, newSize.y );
         OnSetBitmap();
     }
 
@@ -95,10 +88,7 @@
 
     m_parent->DoAddChild(this);
 
-    PostCreation();
-    InheritAttributes();
-
-    Show( TRUE );
+    PostCreation(size);
 
     return TRUE;
 }
@@ -133,6 +123,7 @@
     wxCHECK_RET(m_widget != NULL, wxT("invalid toggle button"));
 
     m_bitmap = label;
+    InvalidateBestSize();
     
     OnSetBitmap();
 }
@@ -169,11 +160,10 @@
     return TRUE;
 }
 
-void wxToggleBitmapButton::ApplyWidgetStyle()
+void wxToggleBitmapButton::DoApplyWidgetStyle(GtkRcStyle *style)
 {
-    SetWidgetStyle();
-    gtk_widget_set_style(m_widget, m_widgetStyle);
-    gtk_widget_set_style(BUTTON_CHILD(m_widget), m_widgetStyle);
+    gtk_widget_modify_style(m_widget, style);
+    gtk_widget_modify_style(BUTTON_CHILD(m_widget), style);
 }
 
 bool wxToggleBitmapButton::IsOwnGtkWindow(GdkWindow *window)
@@ -203,20 +193,31 @@
         UpdateWindowUI(wxUPDATE_UI_FROMIDLE);
 }
 
-// wxSize DoGetBestSize() const
+
 // Get the "best" size for this control.
 wxSize wxToggleBitmapButton::DoGetBestSize() const
 {
-    wxSize ret(wxControl::DoGetBestSize());
-   
-    if (!HasFlag(wxBU_EXACTFIT))
+    wxSize best;
+    
+    if (m_bitmap.Ok())
     {
-        if (ret.x < 80) ret.x = 80;
+        int border = HasFlag(wxNO_BORDER) ? 4 : 10;
+        best.x = m_bitmap.GetWidth()+border;
+        best.y = m_bitmap.GetHeight()+border;
     }
-    
+    CacheBestSize(best);
+    return best;
+}
 
-   return ret;
+
+// static
+wxVisualAttributes
+wxToggleBitmapButton::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
+{
+    return GetDefaultAttributesFromGTKWidget(gtk_toggle_button_new);
 }
+
+
 // ------------------------------------------------------------------------
 // wxToggleButton
 // ------------------------------------------------------------------------
@@ -251,19 +252,7 @@
 
    m_parent->DoAddChild(this);
 
-   PostCreation();
-   InheritAttributes();
-
-   wxSize size_best(DoGetBestSize());
-   wxSize new_size(size);
-   if (new_size.x == -1)
-      new_size.x = size_best.x;
-   if (new_size.y == -1)
-      new_size.y = size_best.y;
-   if ((new_size.x != size.x) || (new_size.y != size.y))
-      SetSize(new_size.x, new_size.y);
-
-   Show(TRUE);
+   PostCreation(size);
 
    return TRUE;
 }
@@ -312,11 +301,10 @@
     return TRUE;
 }
 
-void wxToggleButton::ApplyWidgetStyle()
+void wxToggleButton::DoApplyWidgetStyle(GtkRcStyle *style)
 {
-    SetWidgetStyle();
-    gtk_widget_set_style(m_widget, m_widgetStyle);
-    gtk_widget_set_style(BUTTON_CHILD(m_widget), m_widgetStyle);
+    gtk_widget_modify_style(m_widget, style);
+    gtk_widget_modify_style(BUTTON_CHILD(m_widget), style);
 }
 
 bool wxToggleButton::IsOwnGtkWindow(GdkWindow *window)
@@ -346,7 +334,7 @@
         UpdateWindowUI(wxUPDATE_UI_FROMIDLE);
 }
 
-// wxSize DoGetBestSize() const
+
 // Get the "best" size for this control.
 wxSize wxToggleButton::DoGetBestSize() const
 {
@@ -357,8 +345,15 @@
         if (ret.x < 80) ret.x = 80;
     }
     
+    CacheBestSize(ret);
+    return ret;
+}
 
-   return ret;
+// static
+wxVisualAttributes
+wxToggleButton::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
+{
+    return GetDefaultAttributesFromGTKWidget(gtk_toggle_button_new);
 }
 
 #endif // wxUSE_TOGGLEBTN

Index: internal/wxPython-2.5/src/gtk/listbox.cpp
diff -u internal/wxPython-2.5/src/gtk/listbox.cpp:2.1.5.1 internal/wxPython-2.5/src/gtk/listbox.cpp:2.1.5.1.4.1
--- internal/wxPython-2.5/src/gtk/listbox.cpp:2.1.5.1	Thu Apr  8 18:16:28 2004
+++ internal/wxPython-2.5/src/gtk/listbox.cpp	Mon Sep 13 18:11:47 2004
@@ -2,7 +2,7 @@
 // Name:        listbox.cpp
 // Purpose:
 // Author:      Robert Roebling
-// Id:          $Id: listbox.cpp,v 2.1.5.1 2004/04/09 01:16:28 markie Exp $
+// Id:          $Id: listbox.cpp,v 2.1.5.1.4.1 2004/09/14 01:11:47 heikki Exp $
 // Copyright:   (c) 1998 Robert Roebling
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
@@ -404,16 +404,10 @@
         DoAppend(choices[i]);
     }
 
-    // call it after appending the strings to the listbox, otherwise it doesn't
-    // work correctly
-    SetBestSize( size );
-
     m_parent->DoAddChild( this );
 
-    PostCreation();
-    InheritAttributes();
-
-    Show( TRUE );
+    PostCreation(size);
+    SetBestSize(size); // need this too because this is a wxControlWithItems
 
     return TRUE;
 }
@@ -445,6 +439,8 @@
     wxASSERT_MSG( m_clientList.GetCount() == (size_t)GetCount(),
                   wxT("bug in client data management") );
 
+    InvalidateBestSize();
+
     GList *children = m_list->children;
     int length = g_list_length(children);
 
@@ -501,6 +497,8 @@
 
 int wxListBox::DoAppend( const wxString& item )
 {
+    InvalidateBestSize();
+
     if (m_strings)
     {
         // need to determine the index
@@ -581,12 +579,14 @@
         gtk_widget_realize( GTK_BIN(list_item)->child );
 
         // Apply current widget style to the new list_item
-        if (m_widgetStyle)
+        GtkRcStyle *style = CreateWidgetStyle();
+        if (style)
         {
-            gtk_widget_set_style( GTK_WIDGET( list_item ), m_widgetStyle );
+            gtk_widget_modify_style( GTK_WIDGET( list_item ), style );
             GtkBin *bin = GTK_BIN( list_item );
             GtkWidget *label = GTK_WIDGET( bin->child );
-            gtk_widget_set_style( label, m_widgetStyle );
+            gtk_widget_modify_style( label, style );
+            gtk_rc_style_unref( style );
         }
 
 #if wxUSE_TOOLTIPS
@@ -987,11 +987,9 @@
     return FALSE;
 }
 
-void wxListBox::ApplyWidgetStyle()
+void wxListBox::DoApplyWidgetStyle(GtkRcStyle *style)
 {
-    SetWidgetStyle();
-
-    if (m_backgroundColour.Ok())
+    if (m_hasBgCol && m_backgroundColour.Ok())
     {
         GdkWindow *window = GTK_WIDGET(m_list)->window;
         if ( window )
@@ -1005,11 +1003,11 @@
     GList *child = m_list->children;
     while (child)
     {
-        gtk_widget_set_style( GTK_WIDGET(child->data), m_widgetStyle );
+        gtk_widget_modify_style( GTK_WIDGET(child->data), style );
 
         GtkBin *bin = GTK_BIN( child->data );
         GtkWidget *label = GTK_WIDGET( bin->child );
-        gtk_widget_set_style( label, m_widgetStyle );
+        gtk_widget_modify_style( label, style );
 
         child = child->next;
     }
@@ -1082,7 +1080,9 @@
     // make it too small neither
     lbHeight = (cy+4) * wxMin(wxMax(GetCount(), 3), 10);
 
-    return wxSize(lbWidth, lbHeight);
+    wxSize best(lbWidth, lbHeight);
+    CacheBestSize(best);        
+    return best;
 }
 
 void wxListBox::FixUpMouseEvent(GtkWidget *widget, wxCoord& x, wxCoord& y)
@@ -1093,5 +1093,13 @@
     y += widget->allocation.y;
 }
 
+
+// static
+wxVisualAttributes
+wxListBox::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
+{
+    return GetDefaultAttributesFromGTKWidget(gtk_list_new, true);
+}
+
 #endif // wxUSE_LISTBOX
 

Index: internal/wxPython-2.5/src/gtk/mdi.cpp
diff -u internal/wxPython-2.5/src/gtk/mdi.cpp:2.1.5.1 internal/wxPython-2.5/src/gtk/mdi.cpp:2.1.5.1.4.1
--- internal/wxPython-2.5/src/gtk/mdi.cpp:2.1.5.1	Thu Apr  8 18:16:28 2004
+++ internal/wxPython-2.5/src/gtk/mdi.cpp	Mon Sep 13 18:11:47 2004
@@ -2,7 +2,7 @@
 // Name:        mdi.cpp
 // Purpose:
 // Author:      Robert Roebling
-// Id:          $Id: mdi.cpp,v 2.1.5.1 2004/04/09 01:16:28 markie Exp $
+// Id:          $Id: mdi.cpp,v 2.1.5.1.4.1 2004/09/14 01:11:47 heikki Exp $
 // Copyright:   (c) 1998 Robert Roebling
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
@@ -16,7 +16,7 @@
 
 #include "wx/mdi.h"
 
-#if wxUSE_MDI_ARCHITECTURE
+#if wxUSE_MDI
 
 #include "wx/dialog.h"
 #include "wx/menu.h"
@@ -164,6 +164,16 @@
         GtkNotebook *notebook = GTK_NOTEBOOK(m_clientWindow->m_widget);
         gtk_notebook_set_page( notebook, g_list_length( notebook->children ) - 1 );
 
+    /* need to set the menubar of the child */
+        wxMDIChildFrame *active_child_frame = GetActiveChild();
+        wxMenuBar *menu_bar = active_child_frame->m_menuBar;
+        menu_bar->m_width = m_width;
+        menu_bar->m_height = wxMENU_HEIGHT;
+        gtk_pizza_set_size( GTK_PIZZA(m_mainWidget),
+                            menu_bar->m_widget,
+                            0, 0, m_width, wxMENU_HEIGHT );
+        menu_bar->SetInvokingWindow(active_child_frame);
+
         m_justInserted = false;
         return;
     }

Index: internal/wxPython-2.5/src/gtk/descrip.mms
diff -u internal/wxPython-2.5/src/gtk/descrip.mms:2.1.5.1 internal/wxPython-2.5/src/gtk/descrip.mms:2.1.5.1.4.1
--- internal/wxPython-2.5/src/gtk/descrip.mms:2.1.5.1	Thu Apr  8 18:16:28 2004
+++ internal/wxPython-2.5/src/gtk/descrip.mms	Mon Sep 13 18:11:47 2004
@@ -122,7 +122,7 @@
 	gauge.cpp,\
 	gdiobj.cpp,\
         glcanvas.cpp,\
-	gsockgtk.c,\
+	gsockgtk.cpp,\
         icon.cpp,\
 	listbox.cpp,\
 	main.cpp,\
@@ -162,8 +162,10 @@
 	$(MMS)$(MMSQUALIFIERS) $(OBJECTS)
 .ifdef __WXUNIVERSAL__
 	library [--.lib]libwx_gtk_univ.olb $(OBJECTS)
+	library [--.lib]libwx_gtk_univ.olb [.CXX_REPOSITORY]*.obj
 .else
 	library [--.lib]libwx_gtk.olb $(OBJECTS)
+	library [--.lib]libwx_gtk.olb [.CXX_REPOSITORY]*.obj
 	$(MMS)$(MMSQUALIFIERS) $(OBJECTS0)
 	library [--.lib]libwx_gtk.olb $(OBJECTS0)
 .endif
@@ -196,7 +198,7 @@
 gauge.obj : gauge.cpp
 gdiobj.obj : gdiobj.cpp
 glcanvas.obj : glcanvas.cpp
-gsockgtk.obj : gsockgtk.c
+gsockgtk.obj : gsockgtk.cpp
 icon.obj : icon.cpp
 listbox.obj : listbox.cpp
 main.obj : main.cpp

Index: internal/wxPython-2.5/src/gtk/choice.cpp
diff -u internal/wxPython-2.5/src/gtk/choice.cpp:2.1.5.1 internal/wxPython-2.5/src/gtk/choice.cpp:2.1.5.1.4.1
--- internal/wxPython-2.5/src/gtk/choice.cpp:2.1.5.1	Thu Apr  8 18:16:27 2004
+++ internal/wxPython-2.5/src/gtk/choice.cpp	Mon Sep 13 18:11:47 2004
@@ -2,7 +2,7 @@
 // Name:        choice.cpp
 // Purpose:
 // Author:      Robert Roebling
-// Id:          $Id: choice.cpp,v 2.1.5.1 2004/04/09 01:16:27 markie Exp $
+// Id:          $Id: choice.cpp,v 2.1.5.1.4.1 2004/09/14 01:11:47 heikki Exp $
 // Copyright:   (c) 1998 Robert Roebling
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
@@ -122,12 +122,8 @@
 
     m_parent->DoAddChild( this );
 
-    PostCreation();
-    InheritAttributes();
-
-    SetBestSize(size);
-
-    Show( TRUE );
+    PostCreation(size);
+    SetBestSize(size); // need this too because this is a wxControlWithItems
 
     return TRUE;
 }
@@ -441,19 +437,17 @@
     gtk_option_menu_set_history( GTK_OPTION_MENU(m_widget), (gint)tmp );
 }
 
-void wxChoice::ApplyWidgetStyle()
+void wxChoice::DoApplyWidgetStyle(GtkRcStyle *style)
 {
-    SetWidgetStyle();
-
     GtkMenuShell *menu_shell = GTK_MENU_SHELL( gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) ) );
 
-    gtk_widget_set_style( m_widget, m_widgetStyle );
-    gtk_widget_set_style( GTK_WIDGET( menu_shell ), m_widgetStyle );
+    gtk_widget_modify_style( m_widget, style );
+    gtk_widget_modify_style( GTK_WIDGET( menu_shell ), style );
 
     GList *child = menu_shell->children;
     while (child)
     {
-        gtk_widget_set_style( GTK_WIDGET( child->data ), m_widgetStyle );
+        gtk_widget_modify_style( GTK_WIDGET( child->data ), style );
 
         GtkBin *bin = GTK_BIN( child->data );
         GtkWidget *label = (GtkWidget *) NULL;
@@ -462,7 +456,7 @@
         if (!label)
             label = BUTTON_CHILD(m_widget);
 
-        gtk_widget_set_style( label, m_widgetStyle );
+        gtk_widget_modify_style( label, style );
 
         child = child->next;
     }
@@ -517,7 +511,7 @@
         gtk_widget_realize( menu_item );
         gtk_widget_realize( GTK_BIN(menu_item)->child );
 
-        if (m_widgetStyle) ApplyWidgetStyle();
+        ApplyWidgetStyle();
     }
 
     gtk_signal_connect( GTK_OBJECT( menu_item ), "activate",
@@ -542,7 +536,7 @@
         size_t count = GetCount();
         for ( size_t n = 0; n < count; n++ )
         {
-            GetTextExtent( GetString(n), &width, NULL, NULL, NULL, &m_font );
+            GetTextExtent( GetString(n), &width, NULL, NULL, NULL );
             if ( width > ret.x )
                 ret.x = width;
         }
@@ -564,8 +558,13 @@
     if ( ret.x < 80 )
         ret.x = 80;
 
-    ret.y = 16 + GetCharHeight();
+    // If this request_size is called with no entries then
+    // the returned height is wrong. Give it a reasonable
+    // default value.
+    if (ret.y <= 18)
+        ret.y = 8 + GetCharHeight();
 
+    CacheBestSize(ret);
     return ret;
 }
 
@@ -578,6 +577,13 @@
 #endif
 }
 
+// static
+wxVisualAttributes
+wxChoice::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
+{
+    return GetDefaultAttributesFromGTKWidget(gtk_option_menu_new);
+}
+
 
 #endif // wxUSE_CHOICE
 

Index: internal/wxPython-2.5/src/gtk/notebook.cpp
diff -u internal/wxPython-2.5/src/gtk/notebook.cpp:2.1.5.1 internal/wxPython-2.5/src/gtk/notebook.cpp:2.1.5.1.4.1
--- internal/wxPython-2.5/src/gtk/notebook.cpp:2.1.5.1	Thu Apr  8 18:16:29 2004
+++ internal/wxPython-2.5/src/gtk/notebook.cpp	Mon Sep 13 18:11:47 2004
@@ -2,7 +2,7 @@
 // Name:        notebook.cpp
 // Purpose:
 // Author:      Robert Roebling
-// Id:          $Id: notebook.cpp,v 2.1.5.1 2004/04/09 01:16:29 markie Exp $
+// Id:          $Id: notebook.cpp,v 2.1.5.1.4.1 2004/09/14 01:11:47 heikki Exp $
 // Copyright:   (c) 1998 Robert Roebling, Vadim Zeitlin
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
@@ -72,71 +72,16 @@
         m_image = -1;
         m_page = (GtkNotebookPage *) NULL;
         m_box = (GtkWidget *) NULL;
-        m_labelStyle = (GtkStyle*) NULL;
     }
     
-    ~wxGtkNotebookPage()
-    {
-        if (m_labelStyle)
-            gtk_style_unref( m_labelStyle );
-    }
-    
-    bool SetFont(const wxFont& font);
-
     wxString           m_text;
     int                m_image;
     GtkNotebookPage   *m_page;
     GtkLabel          *m_label;
     GtkWidget         *m_box;     // in which the label and image are packed
-    GtkStyle          *m_labelStyle;
 };
 
 
-bool wxGtkNotebookPage::SetFont(const wxFont& font)
-{
-    if (!m_label)
-		return false;
-
-    if (m_labelStyle)
-    {
-        GtkStyle *remake = gtk_style_copy( m_labelStyle );
-
-#ifndef __WXGTK20__
-        remake->klass = m_labelStyle->klass;
-#endif
-
-        gtk_style_unref( m_labelStyle );
-        m_labelStyle = remake;
-    }
-    else
-    {
-        GtkStyle *def = gtk_rc_get_style( GTK_WIDGET(m_label) );
-
-        if (!def)
-            def = gtk_widget_get_default_style();
-
-        m_labelStyle = gtk_style_copy( def );
-
-        // FIXME: no more klass in 2.0
-#ifndef __WXGTK20__
-        m_labelStyle->klass = def->klass;
-#endif
-    }
-
-#ifdef __WXGTK20__
-	pango_font_description_free( m_labelStyle->font_desc );
-	m_labelStyle->font_desc = pango_font_description_copy( font.GetNativeFontInfo()->description );
-#else
-	gdk_font_unref( m_labelStyle->font );
-	m_labelStyle->font = gdk_font_ref( font.GetInternalFont( 1.0 ) );
-#endif
-
-    gtk_widget_set_style( GTK_WIDGET(m_label), m_labelStyle );
-
-	return true;
-}
-
-
 #include "wx/listimpl.cpp"
 WX_DEFINE_LIST(wxGtkNotebookPagesList);
 
@@ -284,12 +229,19 @@
 
 static void wxInsertChildInNotebook( wxNotebook* parent, wxWindow* child )
 {
-    // Hack alert! We manually set the child window
-    // parent field so that GTK can query the 
-    // notebook's style and font. Without that, GetBestSize could return
-    // incorrect size, see bug #901694 for details
+    // Hack Alert! (Part I): This sets the notebook as the parent of the child
+    // widget, and takes care of some details such as updating the state and
+    // style of the child to reflect its new location.  We do this early
+    // because without it GetBestSize (which is used to set the initial size
+    // of controls if an explicit size is not given) will often report
+    // incorrect sizes since the widget's style context is not fully known.
+    // See bug #901694 for details
     // (http://sourceforge.net/tracker/?func=detail&aid=901694&group_id=9863&atid=109863)
-    child->m_widget->parent = parent->m_widget;
+    gtk_widget_set_parent(child->m_widget, parent->m_widget);
+
+    // NOTE: This should be considered a temporary workaround until we can
+    // work out the details and implement delaying the setting of the initial
+    // size of widgets until the size is really needed.
 }
 
 //-----------------------------------------------------------------------------
@@ -365,15 +317,11 @@
     gtk_signal_connect( GTK_OBJECT(m_widget), "key_press_event",
       GTK_SIGNAL_FUNC(gtk_notebook_key_press_callback), (gpointer)this );
 
-    PostCreation();
-
-    SetFont( parent->GetFont() );
+    PostCreation(size);
 
     gtk_signal_connect( GTK_OBJECT(m_widget), "realize",
                             GTK_SIGNAL_FUNC(gtk_notebook_realized_callback), (gpointer) this );
 
-    Show( TRUE );
-
     return TRUE;
 }
 
@@ -597,23 +545,18 @@
 
     wxASSERT_MSG( GetPageCount() == 0, _T("all pages must have been deleted") );
 
+    InvalidateBestSize();
     return wxNotebookBase::DeleteAllPages();
 }
 
-bool wxNotebook::DeletePage( size_t page )
+wxNotebookPage *wxNotebook::DoRemovePage( size_t page )
 {
-    if ( m_selection == (int)m_pagesData.GetCount() - 1 )
+    if ( m_selection != -1 && (size_t)m_selection >= page )
     {
         // the index will become invalid after the page is deleted
         m_selection = -1;
     }
 
-    // it will call our DoRemovePage() to do the real work
-    return wxNotebookBase::DeletePage(page);
-}
-
-wxNotebookPage *wxNotebook::DoRemovePage( size_t page )
-{
     wxNotebookPage *client = wxNotebookBase::DoRemovePage(page);
     if ( !client )
         return NULL;
@@ -654,8 +597,11 @@
     wxCHECK_MSG( position <= GetPageCount(), FALSE,
                  _T("invalid page index in wxNotebookPage::InsertPage()") );
 
-    // Hack alert part II! See above in InsertChildInNotebook
-    // callback why this has to be done.
+    // Hack Alert! (Part II): See above in wxInsertChildInNotebook callback
+    // why this has to be done.  NOTE: using gtk_widget_unparent here does not
+    // work as it seems to undo too much and will cause errors in the
+    // gtk_notebook_insert_page below, so instead just clear the parent by
+    // hand here.
     win->m_widget->parent = NULL;
 
     // don't receive switch page during addition
@@ -720,9 +666,16 @@
     if (nb_page->m_text.IsEmpty()) nb_page->m_text = wxT("");
 
     nb_page->m_label = GTK_LABEL( gtk_label_new(wxGTK_CONV(nb_page->m_text)) );
-	nb_page->SetFont(GetFont());
     gtk_box_pack_end( GTK_BOX(nb_page->m_box), GTK_WIDGET(nb_page->m_label), FALSE, FALSE, m_padding );
 
+    /* apply current style */
+    GtkRcStyle *style = CreateWidgetStyle();
+    if ( style )
+    {
+        gtk_widget_modify_style(GTK_WIDGET(nb_page->m_label), style);
+        gtk_rc_style_unref(style);
+    }    
+    
     /* show the label */
     gtk_widget_show( GTK_WIDGET(nb_page->m_label) );
     if (select && (m_pagesData.GetCount() > 1))
@@ -739,6 +692,7 @@
     gtk_signal_connect( GTK_OBJECT(m_widget), "switch_page",
       GTK_SIGNAL_FUNC(gtk_notebook_page_change_callback), (gpointer)this );
 
+    InvalidateBestSize();
     return TRUE;
 }
 
@@ -841,12 +795,12 @@
 
 #endif
 
-void wxNotebook::ApplyWidgetStyle()
+void wxNotebook::DoApplyWidgetStyle(GtkRcStyle *style)
 {
-    // TODO, font for labels etc
-
-    SetWidgetStyle();
-    gtk_widget_set_style( m_widget, m_widgetStyle );
+    gtk_widget_modify_style(m_widget, style);
+    size_t cnt = m_pagesData.GetCount();
+    for (size_t i = 0; i < cnt; i++)
+        gtk_widget_modify_style(GTK_WIDGET(GetNotebookPage(i)->m_label), style);
 }
 
 bool wxNotebook::IsOwnGtkWindow( GdkWindow *window )
@@ -855,17 +809,11 @@
             (NOTEBOOK_PANEL(m_widget) == window));
 }
 
-bool  wxNotebook::SetFont(const wxFont& font)
+// static
+wxVisualAttributes
+wxNotebook::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
 {
-	bool rc=wxNotebookBase::SetFont(font);
-
-	if (rc)
-	{
-		size_t i;
-		for (i=0 ; i < m_pagesData.GetCount() ; i++)
-			GetNotebookPage(i)->SetFont(font);
-	}
-	return rc;
+    return GetDefaultAttributesFromGTKWidget(gtk_notebook_new);
 }
 
 //-----------------------------------------------------------------------------

Index: internal/wxPython-2.5/src/gtk/button.cpp
diff -u internal/wxPython-2.5/src/gtk/button.cpp:2.1.5.1 internal/wxPython-2.5/src/gtk/button.cpp:2.1.5.1.4.1
--- internal/wxPython-2.5/src/gtk/button.cpp:2.1.5.1	Thu Apr  8 18:16:27 2004
+++ internal/wxPython-2.5/src/gtk/button.cpp	Mon Sep 13 18:11:47 2004
@@ -2,7 +2,7 @@
 // Name:        button.cpp
 // Purpose:
 // Author:      Robert Roebling
-// Id:          $Id: button.cpp,v 2.1.5.1 2004/04/09 01:16:27 markie Exp $
+// Id:          $Id: button.cpp,v 2.1.5.1.4.1 2004/09/14 01:11:47 heikki Exp $
 // Copyright:   (c) 1998 Robert Roebling
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
@@ -19,6 +19,7 @@
 #if wxUSE_BUTTON
 
 #include "wx/button.h"
+#include "wx/stockitem.h"
 
 #include "wx/gtk/private.h"
 
@@ -108,7 +109,11 @@
     wxControl::SetLabel( label );
 */
 
+#ifdef __WXGTK20__
+    m_widget = gtk_button_new_with_mnemonic("");
+#else
     m_widget = gtk_button_new_with_label("");
+#endif
 
     float x_alignment = 0.5;
     if (HasFlag(wxBU_LEFT))
@@ -122,10 +127,15 @@
     else if (HasFlag(wxBU_BOTTOM))
         y_alignment = 1.0;
 
-    gtk_misc_set_alignment (GTK_MISC (BUTTON_CHILD (m_widget)),
-                            x_alignment, y_alignment);
+#if GTK_CHECK_VERSION(2,4,0)
+    gtk_button_set_alignment(GTK_BUTTON(m_widget), x_alignment, y_alignment);
+#else
+    if (GTK_IS_MISC(BUTTON_CHILD(m_widget)))
+        gtk_misc_set_alignment (GTK_MISC (BUTTON_CHILD (m_widget)),
+                                x_alignment, y_alignment);
+#endif
 
-    SetLabel( label );
+    SetLabel(label);
 
     if (style & wxNO_BORDER)
        gtk_button_set_relief( GTK_BUTTON(m_widget), GTK_RELIEF_NONE );
@@ -135,27 +145,19 @@
 
     m_parent->DoAddChild( this );
 
-    PostCreation();
-    InheritAttributes();
-
-    wxSize best_size( DoGetBestSize() );
-    wxSize new_size( size );
-    if (new_size.x == -1)
-        new_size.x = best_size.x;
-    if (new_size.y == -1)
-        new_size.y = best_size.y;
-    if ((new_size.x != size.x) || (new_size.y != size.y))
-        SetSize( new_size.x, new_size.y );
-
-    SetSize( new_size );
-
-    Show( TRUE );
+    PostCreation(size);
 
-    return TRUE;
+    return true;
 }
+    
 
 void wxButton::SetDefault()
 {
+    wxWindow *parent = GetParent();
+    wxCHECK_RET( parent, _T("button without parent?") );
+
+    parent->SetDefaultItem(this);
+    
     GTK_WIDGET_SET_FLAGS( m_widget, GTK_CAN_DEFAULT );
     gtk_widget_grab_default( m_widget );
 
@@ -163,22 +165,72 @@
 }
 
 /* static */
-wxSize wxButton::GetDefaultSize()
+wxSize wxButtonBase::GetDefaultSize()
 {
+#ifdef __WXGTK20__
+    static wxSize size = wxDefaultSize;
+    if (size == wxDefaultSize)
+    {
+        // NB: Default size of buttons should be same as size of stock
+        //     buttons as used in most GTK+ apps. Unfortunately it's a little
+        //     tricky to obtain this size: stock button's size may be smaller
+        //     than size of button in GtkButtonBox and vice versa,
+        //     GtkButtonBox's minimal button size may be smaller than stock
+        //     button's size. We have to retrieve both values and combine them.
+
+        GtkWidget *wnd = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+        GtkWidget *box = gtk_hbutton_box_new();
+        GtkWidget *btn = gtk_button_new_from_stock(GTK_STOCK_CANCEL);
+        gtk_container_add(GTK_CONTAINER(box), btn);
+        gtk_container_add(GTK_CONTAINER(wnd), box);
+        GtkRequisition req;
+        gtk_widget_size_request(btn, &req);
+
+        gint minwidth, minheight;
+        gtk_widget_style_get(box,
+                             "child-min-width", &minwidth,
+                             "child-min-height", &minheight,
+                             NULL);
+
+        size.x = wxMax(minwidth, req.width);
+        size.y = wxMax(minheight, req.height);
+        
+        gtk_widget_destroy(wnd);
+    }
+    return size;
+#else
     return wxSize(80,26);
+#endif
 }
 
-void wxButton::SetLabel( const wxString &label )
+void wxButton::SetLabel( const wxString &lbl )
 {
     wxCHECK_RET( m_widget != NULL, wxT("invalid button") );
 
-    wxControl::SetLabel( label );
+    wxString label(lbl);
+
+    if (label.empty() && wxIsStockID(m_windowId))
+        label = wxGetStockLabel(m_windowId);
+
+    wxControl::SetLabel(label);
 
 #ifdef __WXGTK20__
-    wxString label2 = PrepareLabelMnemonics( label );
-    gtk_label_set_text_with_mnemonic( GTK_LABEL( BUTTON_CHILD(m_widget) ), wxGTK_CONV( label2 ) );
+    if (wxIsStockID(m_windowId) && wxIsStockLabel(m_windowId, label))
+    {
+        const char *stock = wxGetStockGtkID(m_windowId);
+        if (stock)
+        {
+            gtk_button_set_label(GTK_BUTTON(m_widget), stock);
+            gtk_button_set_use_stock(GTK_BUTTON(m_widget), TRUE);
+            return;
+        }
+    }
+
+    wxString label2 = PrepareLabelMnemonics(label);
+    gtk_button_set_label(GTK_BUTTON(m_widget), wxGTK_CONV(label2));
+    gtk_button_set_use_stock(GTK_BUTTON(m_widget), FALSE);
 #else
-    gtk_label_set( GTK_LABEL( BUTTON_CHILD(m_widget) ), wxGTK_CONV( GetLabel() ) );
+    gtk_label_set(GTK_LABEL(BUTTON_CHILD(m_widget)), wxGTK_CONV(GetLabel()));
 #endif
 }
 
@@ -201,28 +253,54 @@
 #endif
 }
 
-void wxButton::ApplyWidgetStyle()
+void wxButton::DoApplyWidgetStyle(GtkRcStyle *style)
 {
-    SetWidgetStyle();
-    gtk_widget_set_style( m_widget, m_widgetStyle );
-    gtk_widget_set_style( BUTTON_CHILD(m_widget), m_widgetStyle );
+    gtk_widget_modify_style(m_widget, style);
+    gtk_widget_modify_style(BUTTON_CHILD(m_widget), style);
 }
 
 wxSize wxButton::DoGetBestSize() const
 {
+    // the default button in wxGTK is bigger than the other ones because of an
+    // extra border around it, but we don't want to take it into account in
+    // our size calculations (otherwsie the result is visually ugly), so
+    // always return the size of non default button from here
+    const bool isDefault = GTK_WIDGET_HAS_DEFAULT(m_widget);
+    if ( isDefault )
+    {
+        // temporarily unset default flag
+        GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_DEFAULT );
+    }
+
     wxSize ret( wxControl::DoGetBestSize() );
 
+    if ( isDefault )
+    {
+        // set it back again
+        GTK_WIDGET_SET_FLAGS( m_widget, GTK_CAN_DEFAULT );
+    }
+
 #ifndef __WXGTK20__
     ret.x += 10;  // add a few pixels for sloppy (but common) themes
 #endif
     
     if (!HasFlag(wxBU_EXACTFIT))
     {
-        if (ret.x < 80) ret.x = 80;
+        wxSize defaultSize = GetDefaultSize();
+        if (ret.x < defaultSize.x) ret.x = defaultSize.x;
+        if (ret.y < defaultSize.y) ret.y = defaultSize.y;
     }
 
+    CacheBestSize(ret);
     return ret;
 }
 
+// static
+wxVisualAttributes
+wxButton::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
+{
+    return GetDefaultAttributesFromGTKWidget(gtk_button_new);
+}
+
 #endif // wxUSE_BUTTON
 

Index: internal/wxPython-2.5/src/gtk/brush.cpp
diff -u internal/wxPython-2.5/src/gtk/brush.cpp:2.1.5.1 internal/wxPython-2.5/src/gtk/brush.cpp:2.1.5.1.4.1
--- internal/wxPython-2.5/src/gtk/brush.cpp:2.1.5.1	Thu Apr  8 18:16:27 2004
+++ internal/wxPython-2.5/src/gtk/brush.cpp	Mon Sep 13 18:11:47 2004
@@ -2,7 +2,7 @@
 // Name:        src/gtk/brush.cpp
 // Purpose:
 // Author:      Robert Roebling
-// Id:          $Id: brush.cpp,v 2.1.5.1 2004/04/09 01:16:27 markie Exp $
+// Id:          $Id: brush.cpp,v 2.1.5.1.4.1 2004/09/14 01:11:47 heikki Exp $
 // Copyright:   (c) 1998 Robert Roebling
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////

Index: internal/wxPython-2.5/src/gtk/checkbox.cpp
diff -u internal/wxPython-2.5/src/gtk/checkbox.cpp:2.1.5.1 internal/wxPython-2.5/src/gtk/checkbox.cpp:2.1.5.1.4.1
--- internal/wxPython-2.5/src/gtk/checkbox.cpp:2.1.5.1	Thu Apr  8 18:16:27 2004
+++ internal/wxPython-2.5/src/gtk/checkbox.cpp	Mon Sep 13 18:11:47 2004
@@ -2,7 +2,7 @@
 // Name:        checkbox.cpp
 // Purpose:
 // Author:      Robert Roebling
-// Id:          $Id: checkbox.cpp,v 2.1.5.1 2004/04/09 01:16:27 markie Exp $
+// Id:          $Id: checkbox.cpp,v 2.1.5.1.4.1 2004/09/14 01:11:47 heikki Exp $
 // Copyright:   (c) 1998 Robert Roebling
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
@@ -42,7 +42,7 @@
 // "clicked"
 //-----------------------------------------------------------------------------
 
-static void gtk_checkbox_clicked_callback( GtkWidget *WXUNUSED(widget), wxCheckBox *cb )
+static void gtk_checkbox_toggled_callback(GtkWidget *widget, wxCheckBox *cb)
 {
     if (g_isIdle) wxapp_install_idle_handler();
 
@@ -52,8 +52,60 @@
     
     if (cb->m_blockEvent) return;
 
+#ifdef __WXGTK20__
+    // Transitions for 3state checkbox must be done manually, GTK's checkbox
+    // is 2state with additional "undetermined state" flag which isn't
+    // changed automatically:
+    if (cb->Is3State())
+    {
+        GtkToggleButton *toggle = GTK_TOGGLE_BUTTON(widget);
+
+        if (cb->Is3rdStateAllowedForUser())
+        {
+            // The 3 states cycle like this when clicked:
+            // checked -> undetermined -> unchecked -> checked -> ...
+            bool active = gtk_toggle_button_get_active(toggle);
+            bool inconsistent = gtk_toggle_button_get_inconsistent(toggle);
+
+            cb->m_blockEvent = true;
+            
+            if (!active && !inconsistent)
+            {
+                // checked -> undetermined
+                gtk_toggle_button_set_active(toggle, true);
+                gtk_toggle_button_set_inconsistent(toggle, true);
+            }
+            else if (!active && inconsistent)
+            {
+                // undetermined -> unchecked
+                gtk_toggle_button_set_inconsistent(toggle, false);
+            }
+            else if (active && !inconsistent)
+            {
+                // unchecked -> checked
+                // nothing to do
+            }
+            else
+            {
+                wxFAIL_MSG(_T("3state wxCheckBox in unexpected state!"));
+            }
+            
+            cb->m_blockEvent = false;
+        }
+        else
+        {
+            // user's action unsets undetermined state:
+            gtk_toggle_button_set_inconsistent(toggle, false);
+        }
+    }
+#endif
+
     wxCommandEvent event(wxEVT_COMMAND_CHECKBOX_CLICKED, cb->GetId());
-    event.SetInt( cb->GetValue() );
+#ifdef __WXGTK20__
+    event.SetInt(cb->Get3StateValue());
+#else
+    event.SetInt(cb->GetValue());
+#endif
     event.SetEventObject(cb);
     cb->GetEventHandler()->ProcessEvent(event);
 }
@@ -88,6 +140,11 @@
         return FALSE;
     }
 
+    wxASSERT_MSG( (style & wxCHK_ALLOW_3RD_STATE_FOR_USER) == 0 ||
+                  (style & wxCHK_3STATE) != 0,
+                  wxT("Using wxCHK_ALLOW_3RD_STATE_FOR_USER")
+                  wxT(" style flag for a 2-state checkbox is useless") );
+
     if ( style & wxALIGN_RIGHT )
     {
         // VZ: as I don't know a way to create a right aligned checkbox with
@@ -114,25 +171,13 @@
     SetLabel( label );
 
     gtk_signal_connect( GTK_OBJECT(m_widgetCheckbox),
-                        "clicked",
-                        GTK_SIGNAL_FUNC(gtk_checkbox_clicked_callback),
+                        "toggled",
+                        GTK_SIGNAL_FUNC(gtk_checkbox_toggled_callback),
                         (gpointer *)this );
 
     m_parent->DoAddChild( this );
 
-    PostCreation();
-    InheritAttributes();
-
-    wxSize size_best( DoGetBestSize() );
-    wxSize new_size( size );
-    if (new_size.x == -1)
-        new_size.x = size_best.x;
-    if (new_size.y == -1)
-        new_size.y = size_best.y;
-    if ((new_size.x != size.x) || (new_size.y != size.y))
-        SetSize( new_size.x, new_size.y );
-
-    Show( TRUE );
+    PostCreation(size);
 
     return TRUE;
 }
@@ -155,9 +200,34 @@
 {
     wxCHECK_MSG( m_widgetCheckbox != NULL, FALSE, wxT("invalid checkbox") );
 
+#ifdef __WXGTK20__
+    return gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(m_widgetCheckbox));
+#else
     return GTK_TOGGLE_BUTTON(m_widgetCheckbox)->active;
+#endif
+}
+
+#ifdef __WXGTK20__
+void wxCheckBox::DoSet3StateValue(wxCheckBoxState state)
+{
+    SetValue(state != wxCHK_UNCHECKED);
+    gtk_toggle_button_set_inconsistent(GTK_TOGGLE_BUTTON(m_widgetCheckbox),
+                                       state == wxCHK_UNDETERMINED);
 }
 
+wxCheckBoxState wxCheckBox::DoGet3StateValue() const
+{
+    if (gtk_toggle_button_get_inconsistent(GTK_TOGGLE_BUTTON(m_widgetCheckbox)))
+    {
+        return wxCHK_UNDETERMINED;
+    }
+    else
+    {
+        return GetValue() ? wxCHK_CHECKED : wxCHK_UNCHECKED;
+    }
+}
+#endif
+
 void wxCheckBox::SetLabel( const wxString& label )
 {
     wxCHECK_RET( m_widgetLabel != NULL, wxT("invalid checkbox") );
@@ -182,11 +252,10 @@
     return TRUE;
 }
 
-void wxCheckBox::ApplyWidgetStyle()
+void wxCheckBox::DoApplyWidgetStyle(GtkRcStyle *style)
 {
-    SetWidgetStyle();
-    gtk_widget_set_style( m_widgetCheckbox, m_widgetStyle );
-    gtk_widget_set_style( m_widgetLabel, m_widgetStyle );
+    gtk_widget_modify_style(m_widgetCheckbox, style);
+    gtk_widget_modify_style(m_widgetLabel, style);
 }
 
 bool wxCheckBox::IsOwnGtkWindow( GdkWindow *window )
@@ -228,4 +297,11 @@
     return wxControl::DoGetBestSize();
 }
 
+// static
+wxVisualAttributes
+wxCheckBox::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
+{
+    return GetDefaultAttributesFromGTKWidget(gtk_check_button_new);
+}
+
 #endif

Index: internal/wxPython-2.5/src/gtk/frame.cpp
diff -u internal/wxPython-2.5/src/gtk/frame.cpp:2.1.5.1 internal/wxPython-2.5/src/gtk/frame.cpp:2.1.5.1.4.1
--- internal/wxPython-2.5/src/gtk/frame.cpp:2.1.5.1	Thu Apr  8 18:16:28 2004
+++ internal/wxPython-2.5/src/gtk/frame.cpp	Mon Sep 13 18:11:47 2004
@@ -2,7 +2,7 @@
 // Name:        frame.cpp
 // Purpose:
 // Author:      Robert Roebling
-// Id:          $Id: frame.cpp,v 2.1.5.1 2004/04/09 01:16:28 markie Exp $
+// Id:          $Id: frame.cpp,v 2.1.5.1.4.1 2004/09/14 01:11:47 heikki Exp $
 // Copyright:   (c) 1998 Robert Roebling
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
@@ -150,7 +150,7 @@
 
 /* Callback for wxFrame. This very strange beast has to be used because
  * C++ has no virtual methods in a constructor. We have to emulate a
- * virtual function here as wxWindows requires different ways to insert
+ * virtual function here as wxWidgets requires different ways to insert
  * a child in container classes. */
 
 static void wxInsertChildInFrame( wxFrame* parent, wxWindow* child )
@@ -520,7 +520,20 @@
     if (m_frameToolBar) m_frameToolBar->OnInternalIdle();
 #endif
 #if wxUSE_STATUSBAR
-    if (m_frameStatusBar) m_frameStatusBar->OnInternalIdle();
+    if (m_frameStatusBar)
+    {
+        m_frameStatusBar->OnInternalIdle();
+
+        // There may be controls in the status bar that
+        // need to be updated
+        for ( wxWindowList::compatibility_iterator node = m_frameStatusBar->GetChildren().GetFirst();
+          node;
+          node = node->GetNext() )
+        {
+            wxWindow *child = node->GetData();
+            child->OnInternalIdle();
+        }
+    }
 #endif
 }
 
@@ -581,7 +594,7 @@
                 GTK_SIGNAL_FUNC(gtk_menu_detached_callback), (gpointer)this );
         }
         
-        m_frameMenuBar->Show( TRUE );
+        gtk_widget_show( m_frameMenuBar->m_widget );
 
         UpdateMenuBarSize();
     }
@@ -675,6 +688,16 @@
     return wxFrameBase::CreateStatusBar( number, style, id, name );
 }
 
+void wxFrame::SetStatusBar(wxStatusBar *statbar)
+{
+    bool hadStatBar = m_frameStatusBar != NULL;
+    
+    wxFrameBase::SetStatusBar(statbar);
+    
+    if (hadStatBar && !m_frameStatusBar) 
+        GtkUpdateSize();
+}
+
 void wxFrame::PositionStatusBar()
 {
     if ( !m_frameStatusBar )

Index: internal/wxPython-2.5/src/gtk/treegtk.cpp
diff -u internal/wxPython-2.5/src/gtk/treegtk.cpp:2.1.5.1 internal/wxPython-2.5/src/gtk/treegtk.cpp:2.1.5.1.4.1
--- internal/wxPython-2.5/src/gtk/treegtk.cpp:2.1.5.1	Thu Apr  8 18:16:30 2004
+++ internal/wxPython-2.5/src/gtk/treegtk.cpp	Mon Sep 13 18:11:47 2004
@@ -4,7 +4,7 @@
 // Author:      Denis Pershin
 // Modified by:
 // Created:     07/05/98
-// RCS-ID:      $Id: treegtk.cpp,v 2.1.5.1 2004/04/09 01:16:30 markie Exp $
+// RCS-ID:      $Id: treegtk.cpp,v 2.1.5.1.4.1 2004/09/14 01:11:47 heikki Exp $
 // Copyright:   (c) Denis Pershin
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////

Index: internal/wxPython-2.5/src/gtk/statbmp.cpp
diff -u internal/wxPython-2.5/src/gtk/statbmp.cpp:2.1.5.1 internal/wxPython-2.5/src/gtk/statbmp.cpp:2.1.5.1.4.1
--- internal/wxPython-2.5/src/gtk/statbmp.cpp:2.1.5.1	Thu Apr  8 18:16:29 2004
+++ internal/wxPython-2.5/src/gtk/statbmp.cpp	Mon Sep 13 18:11:47 2004
@@ -2,7 +2,7 @@
 // Name:        statbmp.cpp
 // Purpose:
 // Author:      Robert Roebling
-// Id:          $Id: statbmp.cpp,v 2.1.5.1 2004/04/09 01:16:29 markie Exp $
+// Id:          $Id: statbmp.cpp,v 2.1.5.1.4.1 2004/09/14 01:11:47 heikki Exp $
 // Copyright:   (c) 1998 Robert Roebling
 // Licence:           wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
@@ -38,24 +38,14 @@
     Create( parent, id, bitmap, pos, size, style, name );
 }
 
-void wxStaticBitmap::CreatePixmapWidget()
-{
-    wxCHECK_RET( m_bitmap.Ok(), wxT("should only be called if we have a bitmap") );
-
-    GdkBitmap *mask = (GdkBitmap *) NULL;
-    if ( m_bitmap.GetMask() )
-        mask = m_bitmap.GetMask()->GetBitmap();
-    m_widget = gtk_pixmap_new( m_bitmap.GetPixmap(), mask );
-
-    // insert GTK representation
-    (*m_parent->m_insertCallback)(m_parent, this);
-
-    gtk_widget_show( m_widget );
-
-    m_focusWidget = m_widget;
-
-    PostCreation();
-}
+#ifndef __WXGTK20__
+// empty bitmap, so that we can create GtkPixmap widget:
+static char * bogus_xpm[] = {
+"2 2 1 1",
+" 	c None",
+"  ",
+"  "};
+#endif
 
 bool wxStaticBitmap::Create( wxWindow *parent, wxWindowID id, const wxBitmap &bitmap,
                              const wxPoint &pos, const wxSize &size,
@@ -66,62 +56,63 @@
     if (!PreCreation( parent, pos, size ) ||
         !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ))
     {
-        wxFAIL_MSG( wxT("wxXX creation failed") );
-    return FALSE;
+        wxFAIL_MSG( wxT("wxStaticBitmap creation failed") );
+        return false;
     }
 
     m_bitmap = bitmap;
 
-    if (m_bitmap.Ok())
-    {
-        GdkBitmap *mask = (GdkBitmap *) NULL;
-        if ( m_bitmap.GetMask() )
-            mask = m_bitmap.GetMask()->GetBitmap();
-        m_widget = gtk_pixmap_new( m_bitmap.GetPixmap(), mask );
-
-        SetBestSize( size );
-    }
-    else
-    {
-        m_widget = gtk_label_new( "Bitmap" );
-        
-        m_focusWidget = m_widget;
+#ifdef __WXGTK20__
+    m_widget = gtk_image_new();
+#else
+    wxBitmap bmp(bitmap.Ok() ? bitmap : wxBitmap(bogus_xpm));
+    m_widget = gtk_pixmap_new(bmp.GetPixmap(), NULL);
+#endif
 
-        PostCreation();
-    }
+    if (bitmap.Ok())
+        SetBitmap(bitmap);
 
+    PostCreation(size);
     m_parent->DoAddChild( this );
 
-    Show( TRUE );
-
-    return TRUE;
+    return true;
 }
 
 void wxStaticBitmap::SetBitmap( const wxBitmap &bitmap )
 {
-    bool hasWidget = m_bitmap.Ok();
     m_bitmap = bitmap;
 
     if (m_bitmap.Ok())
     {
-        if (!hasWidget)
+        GdkBitmap *mask = (GdkBitmap *) NULL;
+        if (m_bitmap.GetMask())
+            mask = m_bitmap.GetMask()->GetBitmap();
+    
+#ifdef __WXGTK20__
+        if (m_bitmap.HasPixbuf())
         {
-            gtk_widget_destroy( m_widget );
-
-            /* recreate m_widget because we've created a label
-               and not a bitmap above */
-            CreatePixmapWidget();
+            gtk_image_set_from_pixbuf(GTK_IMAGE(m_widget),
+                                      m_bitmap.GetPixbuf());
         }
         else
-        {
-            GdkBitmap *mask = (GdkBitmap *) NULL;
-            if (m_bitmap.GetMask()) mask = m_bitmap.GetMask()->GetBitmap();
-            gtk_pixmap_set( GTK_PIXMAP(m_widget), m_bitmap.GetPixmap(), mask );
-        }
+            gtk_image_set_from_pixmap(GTK_IMAGE(m_widget),
+                                      m_bitmap.GetPixmap(), mask);
+#else
+        gtk_pixmap_set(GTK_PIXMAP(m_widget), m_bitmap.GetPixmap(), mask);
+#endif
 
-        SetBestSize(wxSize(bitmap.GetWidth(), bitmap.GetHeight()));
+        InvalidateBestSize();
+        SetSize(GetBestSize());
     }
 }
 
+// static
+wxVisualAttributes
+wxStaticBitmap::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
+{
+    // TODO: overload to allow using gtk_pixmap_new?
+    return GetDefaultAttributesFromGTKWidget(gtk_label_new);
+}
+
 #endif // wxUSE_STATBMP
 

Index: internal/wxPython-2.5/src/gtk/tbargtk.cpp
diff -u internal/wxPython-2.5/src/gtk/tbargtk.cpp:2.1.5.1 internal/wxPython-2.5/src/gtk/tbargtk.cpp:2.1.5.1.4.1
--- internal/wxPython-2.5/src/gtk/tbargtk.cpp:2.1.5.1	Thu Apr  8 18:16:29 2004
+++ internal/wxPython-2.5/src/gtk/tbargtk.cpp	Mon Sep 13 18:11:47 2004
@@ -3,7 +3,7 @@
 // Purpose:     GTK toolbar
 // Author:      Robert Roebling
 // Modified:    13.12.99 by VZ to derive from wxToolBarBase
-// RCS-ID:      $Id: tbargtk.cpp,v 2.1.5.1 2004/04/09 01:16:29 markie Exp $
+// RCS-ID:      $Id: tbargtk.cpp,v 2.1.5.1.4.1 2004/09/14 01:11:47 heikki Exp $
 // Copyright:   (c) Robert Roebling
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
@@ -50,7 +50,7 @@
 // private functions
 // ----------------------------------------------------------------------------
 
-// translate wxWindows toolbar style flags to GTK orientation and style
+// translate wxWidgets toolbar style flags to GTK orientation and style
 static void GetGtkStyle(long style,
                         GtkOrientation *orient, GtkToolbarStyle *gtkStyle)
 {
@@ -128,6 +128,25 @@
         }
     }
 
+    void SetPixmap(const wxBitmap& bitmap)
+    {
+        if (bitmap.Ok())
+        {
+            GdkBitmap *mask = bitmap.GetMask() ? bitmap.GetMask()->GetBitmap()
+                                               : (GdkBitmap *)NULL;
+#ifdef __WXGTK20__
+            if (bitmap.HasPixbuf())
+                gtk_image_set_from_pixbuf(GTK_IMAGE(m_pixmap),
+                                          bitmap.GetPixbuf());
+            else
+                gtk_image_set_from_pixmap(GTK_IMAGE(m_pixmap),
+                                          bitmap.GetPixmap(), mask);
+#else
+            gtk_pixmap_set(GTK_PIXMAP(m_pixmap), bitmap.GetPixmap(), mask);
+#endif // !__WXGTK20__
+        }
+    }
+
     GtkWidget            *m_item;
     GtkWidget            *m_pixmap;
 
@@ -166,16 +185,7 @@
     {
         tool->Toggle();
 
-        wxBitmap bitmap = tool->GetBitmap();
-        if ( bitmap.Ok() )
-        {
-            GtkPixmap *pixmap = GTK_PIXMAP( tool->m_pixmap );
-
-            GdkBitmap *mask = bitmap.GetMask() ? bitmap.GetMask()->GetBitmap()
-                                               : (GdkBitmap *)NULL;
-
-            gtk_pixmap_set( pixmap, bitmap.GetPixmap(), mask );
-        }
+        tool->SetPixmap(tool->GetBitmap());
 
         if ( tool->IsRadio() && !tool->IsToggled() )
         {
@@ -189,16 +199,7 @@
         // revert back
         tool->Toggle();
 
-        wxBitmap bitmap = tool->GetBitmap();
-        if ( bitmap.Ok() )
-        {
-            GtkPixmap *pixmap = GTK_PIXMAP( tool->m_pixmap );
-
-            GdkBitmap *mask = bitmap.GetMask() ? bitmap.GetMask()->GetBitmap()
-                                               : (GdkBitmap *)NULL;
-
-            gtk_pixmap_set( pixmap, bitmap.GetPixmap(), mask );
-        }
+        tool->SetPixmap(tool->GetBitmap());
     }
 }
 
@@ -269,8 +270,6 @@
 
 void wxToolBar::Init()
 {
-    m_fg =
-    m_bg = (GdkColor *)NULL;
     m_toolbar = (GtkToolbar *)NULL;
     m_blockEvent = FALSE;
     m_defaultWidth = 32;
@@ -279,8 +278,6 @@
 
 wxToolBar::~wxToolBar()
 {
-    delete m_fg;
-    delete m_bg;
 }
 
 bool wxToolBar::Create( wxWindow *parent,
@@ -343,39 +340,9 @@
         gtk_toolbar_set_button_relief( GTK_TOOLBAR(m_toolbar), GTK_RELIEF_NONE );
 #endif
 
-
-    m_fg = new GdkColor;
-    m_fg->red = 0;
-    m_fg->green = 0;
-    m_fg->blue = 0;
-    wxColour fg(0,0,0);
-    fg.CalcPixel( gtk_widget_get_colormap( GTK_WIDGET(m_toolbar) ) );
-    m_fg->pixel = fg.GetPixel();
-
-    m_bg = new GdkColor;
-    m_bg->red = 65535;
-    m_bg->green = 65535;
-    m_bg->blue = 49980;
-    wxColour bg(255,255,196);
-    bg.CalcPixel( gtk_widget_get_colormap( GTK_WIDGET(m_toolbar) ) );
-    m_bg->pixel = bg.GetPixel();
-
-    gtk_tooltips_force_window( GTK_TOOLBAR(m_toolbar)->tooltips );
-
-    GtkStyle *g_style =
-        gtk_style_copy(
-                gtk_widget_get_style(
-                    GTK_TOOLBAR(m_toolbar)->tooltips->tip_window ) );
-
-    g_style->bg[GTK_STATE_NORMAL] = *m_bg;
-
-    gtk_widget_set_style( GTK_TOOLBAR(m_toolbar)->tooltips->tip_window, g_style );
-
     m_parent->DoAddChild( this );
 
-    PostCreation();
-
-    Show( TRUE );
+    PostCreation(size);
 
     return TRUE;
 }
@@ -427,14 +394,21 @@
 
             GtkWidget *tool_pixmap = (GtkWidget *)NULL;
 
+
+#ifdef __WXGTK20__
+            tool_pixmap = gtk_image_new();
+            tool->m_pixmap = tool_pixmap;
+            tool->SetPixmap(bitmap);
+#else
             GdkPixmap *pixmap = bitmap.GetPixmap();
 
             GdkBitmap *mask = (GdkBitmap *)NULL;
             if ( bitmap.GetMask() )
               mask = bitmap.GetMask()->GetBitmap();
-
+            
             tool_pixmap = gtk_pixmap_new( pixmap, mask );
             gtk_pixmap_set_build_insensitive( GTK_PIXMAP(tool_pixmap), TRUE );
+#endif
 
             gtk_misc_set_alignment( GTK_MISC(tool_pixmap), 0.5, 0.5 );
 
@@ -535,6 +509,7 @@
         (m_widget, &req );
     m_width = req.width + m_xMargin;
     m_height = req.height + 2*m_yMargin;
+    InvalidateBestSize();
 
     return TRUE;
 }
@@ -556,6 +531,7 @@
         //case wxTOOL_STYLE_SEPARATOR: -- nothing to do
     }
 
+    InvalidateBestSize();
     return TRUE;
 }
 
@@ -580,16 +556,7 @@
     GtkWidget *item = tool->m_item;
     if ( item && GTK_IS_TOGGLE_BUTTON(item) )
     {
-        wxBitmap bitmap = tool->GetBitmap();
-        if ( bitmap.Ok() )
-        {
-            GtkPixmap *pixmap = GTK_PIXMAP( tool->m_pixmap );
-
-            GdkBitmap *mask = bitmap.GetMask() ? bitmap.GetMask()->GetBitmap()
-                                               : (GdkBitmap *)NULL;
-
-            gtk_pixmap_set( pixmap, bitmap.GetPixmap(), mask );
-        }
+        tool->SetPixmap(tool->GetBitmap());
 
         m_blockEvent = TRUE;
 
@@ -705,4 +672,22 @@
         UpdateWindowUI(wxUPDATE_UI_FROMIDLE);
 }
 
+
+// ----------------------------------------------------------------------------
+
+// static
+wxVisualAttributes
+wxToolBar::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
+{
+#ifdef __WXGTK20__
+    return GetDefaultAttributesFromGTKWidget(gtk_toolbar_new);
+#else
+    wxVisualAttributes attr;
+    GtkWidget* widget = gtk_toolbar_new(GTK_ORIENTATION_HORIZONTAL, GTK_TOOLBAR_BOTH);
+    attr = GetDefaultAttributesFromGTKWidget(widget);
+    gtk_widget_destroy(widget);
+    return attr;
+#endif
+}
+
 #endif // wxUSE_TOOLBAR_NATIVE

Index: internal/wxPython-2.5/src/gtk/utilsres.cpp
diff -u internal/wxPython-2.5/src/gtk/utilsres.cpp:2.1.5.1 internal/wxPython-2.5/src/gtk/utilsres.cpp:2.1.5.1.4.1
--- internal/wxPython-2.5/src/gtk/utilsres.cpp:2.1.5.1	Thu Apr  8 18:16:30 2004
+++ internal/wxPython-2.5/src/gtk/utilsres.cpp	Mon Sep 13 18:11:47 2004
@@ -2,7 +2,7 @@
 // Name:        utilres.cpp
 // Purpose:
 // Author:      Robert Roebling
-// Id:          $Id: utilsres.cpp,v 2.1.5.1 2004/04/09 01:16:30 markie Exp $
+// Id:          $Id: utilsres.cpp,v 2.1.5.1.4.1 2004/09/14 01:11:47 heikki Exp $
 // Copyright:   (c) 1998 Robert Roebling
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////

Index: internal/wxPython-2.5/src/gtk/timer.cpp
diff -u internal/wxPython-2.5/src/gtk/timer.cpp:2.1.5.1 internal/wxPython-2.5/src/gtk/timer.cpp:2.1.5.1.4.1
--- internal/wxPython-2.5/src/gtk/timer.cpp:2.1.5.1	Thu Apr  8 18:16:30 2004
+++ internal/wxPython-2.5/src/gtk/timer.cpp	Mon Sep 13 18:11:47 2004
@@ -2,7 +2,7 @@
 // Name:        gtk/timer.cpp
 // Purpose:     wxTimer implementation
 // Author:      Robert Roebling
-// Id:          $Id: timer.cpp,v 2.1.5.1 2004/04/09 01:16:30 markie Exp $
+// Id:          $Id: timer.cpp,v 2.1.5.1.4.1 2004/09/14 01:11:47 heikki Exp $
 // Copyright:   (c) 1998 Robert Roebling
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
@@ -25,7 +25,7 @@
 // wxTimer
 // ----------------------------------------------------------------------------
 
-IMPLEMENT_ABSTRACT_CLASS(wxTimer, wxObject)
+IMPLEMENT_ABSTRACT_CLASS(wxTimer, wxEvtHandler)
 
 extern "C" gint timeout_callback( gpointer data )
 {

Index: internal/wxPython-2.5/src/gtk/cursor.cpp
diff -u internal/wxPython-2.5/src/gtk/cursor.cpp:2.1.5.1 internal/wxPython-2.5/src/gtk/cursor.cpp:2.1.5.1.4.1
--- internal/wxPython-2.5/src/gtk/cursor.cpp:2.1.5.1	Thu Apr  8 18:16:27 2004
+++ internal/wxPython-2.5/src/gtk/cursor.cpp	Mon Sep 13 18:11:47 2004
@@ -2,7 +2,7 @@
 // Name:        cursor.cpp
 // Purpose:
 // Author:      Robert Roebling
-// Id:          $Id: cursor.cpp,v 2.1.5.1 2004/04/09 01:16:27 markie Exp $
+// Id:          $Id: cursor.cpp,v 2.1.5.1.4.1 2004/09/14 01:11:47 heikki Exp $
 // Copyright:   (c) 1998 Robert Roebling
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////

Index: internal/wxPython-2.5/src/gtk/radiobut.cpp
diff -u internal/wxPython-2.5/src/gtk/radiobut.cpp:2.1.5.1 internal/wxPython-2.5/src/gtk/radiobut.cpp:2.1.5.1.4.1
--- internal/wxPython-2.5/src/gtk/radiobut.cpp:2.1.5.1	Thu Apr  8 18:16:29 2004
+++ internal/wxPython-2.5/src/gtk/radiobut.cpp	Mon Sep 13 18:11:47 2004
@@ -2,7 +2,7 @@
 // Name:        radiobut.cpp
 // Purpose:
 // Author:      Robert Roebling
-// Id:          $Id: radiobut.cpp,v 2.1.5.1 2004/04/09 01:16:29 markie Exp $
+// Id:          $Id: radiobut.cpp,v 2.1.5.1.4.1 2004/09/14 01:11:47 heikki Exp $
 // Copyright:   (c) 1998 Robert Roebling
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
@@ -128,19 +128,7 @@
        
     m_parent->DoAddChild( this );
   
-    PostCreation();
-    InheritAttributes();
-
-    wxSize size_best( DoGetBestSize() );
-    wxSize new_size( size );
-    if (new_size.x == -1)
-        new_size.x = size_best.x;
-    if (new_size.y == -1)
-        new_size.y = size_best.y;
-    if ((new_size.x != size.x) || (new_size.y != size.y))
-        SetSize( new_size.x, new_size.y );
-        
-    Show( TRUE );
+    PostCreation(size);
 
     return TRUE;
 }
@@ -199,11 +187,10 @@
     return TRUE;
 }
 
-void wxRadioButton::ApplyWidgetStyle()
+void wxRadioButton::DoApplyWidgetStyle(GtkRcStyle *style)
 {
-    SetWidgetStyle();
-    gtk_widget_set_style( m_widget, m_widgetStyle );
-    gtk_widget_set_style( BUTTON_CHILD(m_widget), m_widgetStyle );
+    gtk_widget_modify_style(m_widget, style);
+    gtk_widget_modify_style(BUTTON_CHILD(m_widget), style);
 }
 
 bool wxRadioButton::IsOwnGtkWindow( GdkWindow *window )
@@ -245,4 +232,19 @@
     return wxControl::DoGetBestSize();
 }
 
+// static
+wxVisualAttributes
+wxRadioButton::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
+{
+    wxVisualAttributes attr;
+    // NB: we need toplevel window so that GTK+ can find the right style
+    GtkWidget *wnd = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+    GtkWidget* widget = gtk_radio_button_new_with_label(NULL, "");
+    gtk_container_add(GTK_CONTAINER(wnd), widget);
+    attr = GetDefaultAttributesFromGTKWidget(widget);
+    gtk_widget_destroy(wnd);
+    return attr;
+}
+
+
 #endif

Index: internal/wxPython-2.5/src/gtk/dnd.cpp
diff -u internal/wxPython-2.5/src/gtk/dnd.cpp:2.1.5.1 internal/wxPython-2.5/src/gtk/dnd.cpp:2.1.5.1.4.1
--- internal/wxPython-2.5/src/gtk/dnd.cpp:2.1.5.1	Thu Apr  8 18:16:28 2004
+++ internal/wxPython-2.5/src/gtk/dnd.cpp	Mon Sep 13 18:11:47 2004
@@ -2,7 +2,7 @@
 // Name:        dnd.cpp
 // Purpose:     wxDropTarget class
 // Author:      Robert Roebling
-// Id:          $Id: dnd.cpp,v 2.1.5.1 2004/04/09 01:16:28 markie Exp $
+// Id:          $Id: dnd.cpp,v 2.1.5.1.4.1 2004/09/14 01:11:47 heikki Exp $
 // Copyright:   (c) 1998 Robert Roebling
 // Licence:     wxWindows licence
 ///////////////////////////////////////////////////////////////////////////////
@@ -115,7 +115,7 @@
 // ============================================================================
 
 // ----------------------------------------------------------------------------
-// convert between GTK+ and wxWindows DND constants
+// convert between GTK+ and wxWidgets DND constants
 // ----------------------------------------------------------------------------
 
 static wxDragResult ConvertFromGTK(long action)

Index: internal/wxPython-2.5/src/gtk/control.cpp
diff -u internal/wxPython-2.5/src/gtk/control.cpp:2.1.5.1 internal/wxPython-2.5/src/gtk/control.cpp:2.1.5.1.4.1
--- internal/wxPython-2.5/src/gtk/control.cpp:2.1.5.1	Thu Apr  8 18:16:27 2004
+++ internal/wxPython-2.5/src/gtk/control.cpp	Mon Sep 13 18:11:47 2004
@@ -2,7 +2,7 @@
 // Name:        control.cpp
 // Purpose:
 // Author:      Robert Roebling
-// Id:          $Id: control.cpp,v 2.1.5.1 2004/04/09 01:16:27 markie Exp $
+// Id:          $Id: control.cpp,v 2.1.5.1.4.1 2004/09/14 01:11:47 heikki Exp $
 // Copyright:   (c) 1998 Robert Roebling, Julian Smart and Vadim Zeitlin
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
@@ -19,6 +19,8 @@
 #if wxUSE_CONTROLS
 
 #include "wx/control.h"
+#include "wx/fontutil.h"
+#include "wx/settings.h"
 
 #include <gtk/gtk.h>
 
@@ -64,6 +66,7 @@
         }
         m_label << *pc;
     }
+    InvalidateBestSize();    
 }
 
 wxString wxControl::GetLabel() const
@@ -83,9 +86,28 @@
     (* GTK_WIDGET_CLASS( GTK_OBJECT_GET_CLASS(m_widget) )->size_request )
         (m_widget, &req );
 
-    return wxSize(req.width, req.height);
+    wxSize best(req.width, req.height);
+    CacheBestSize(best);
+    return best;
 }
 
+
+void wxControl::PostCreation(const wxSize& size)
+{
+    wxWindow::PostCreation();
+
+    // NB: GetBestSize needs to know the style, otherwise it will assume
+    //     default font and if the user uses a different font, determined
+    //     best size will be different (typically, smaller) than the desired
+    //     size. This call ensure that a style is available at the time
+    //     GetBestSize is called.
+    gtk_widget_ensure_style(m_widget);
+    
+    ApplyWidgetStyle();
+    SetInitialBestSize(size);
+}
+
+
 #ifdef __WXGTK20__
 wxString wxControl::PrepareLabelMnemonics( const wxString &label ) const
 {
@@ -130,5 +152,131 @@
 }
 #endif
 
+
+wxVisualAttributes wxControl::GetDefaultAttributes() const
+{
+    return GetDefaultAttributesFromGTKWidget(m_widget,
+                                             UseGTKStyleBase());
+}
+
+
+#define SHIFT (8*(sizeof(short int)-sizeof(char)))
+
+// static
+wxVisualAttributes
+wxControl::GetDefaultAttributesFromGTKWidget(GtkWidget* widget,
+                                             bool useBase,
+                                             int state)
+{
+    GtkStyle* style;
+    wxVisualAttributes attr;
+
+    style = gtk_rc_get_style(widget);
+    if (!style)
+        style = gtk_widget_get_default_style();
+
+    if (!style)
+    {
+        return wxWindow::GetClassDefaultAttributes(wxWINDOW_VARIANT_NORMAL);
+    }
+
+    if (state == -1)
+        state = GTK_STATE_NORMAL;
+        
+    // get the style's colours
+    attr.colFg = wxColour(style->fg[state].red   >> SHIFT,
+                          style->fg[state].green >> SHIFT,
+                          style->fg[state].blue  >> SHIFT);
+    if (useBase)
+        attr.colBg = wxColour(style->base[state].red   >> SHIFT,
+                              style->base[state].green >> SHIFT,
+                              style->base[state].blue  >> SHIFT);
+    else
+        attr.colBg = wxColour(style->bg[state].red   >> SHIFT,
+                              style->bg[state].green >> SHIFT,
+                              style->bg[state].blue  >> SHIFT);
+
+    // get the style's font
+#ifdef __WXGTK20__
+    if ( !style->font_desc )
+        style = gtk_widget_get_default_style();  
+    if ( style && style->font_desc )
+    {  
+        wxNativeFontInfo info;  
+        info.description = pango_font_description_copy(style->font_desc);
+        attr.font = wxFont(info);  
+    }  
+    else  
+    {  
+        GtkSettings *settings = gtk_settings_get_default();
+        gchar *font_name = NULL;
+        g_object_get ( settings,
+                       "gtk-font-name", 
+                       &font_name,
+                       NULL);
+        if (!font_name)
+            attr.font = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
+        else
+            attr.font = wxFont(wxString::FromAscii(font_name));
+        g_free (font_name);
+    }  
+#else
+    // TODO: isn't there a way to get a standard gtk 1.2 font?
+    attr.font = wxFont( 12, wxSWISS, wxNORMAL, wxNORMAL );
+#endif
+    
+    return attr;
+}
+
+
+//static
+wxVisualAttributes
+wxControl::GetDefaultAttributesFromGTKWidget(GtkWidget* (*widget_new)(void),
+                                             bool useBase,
+                                             int state)
+{
+    wxVisualAttributes attr;
+    // NB: we need toplevel window so that GTK+ can find the right style
+    GtkWidget *wnd = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+    GtkWidget* widget = widget_new();
+    gtk_container_add(GTK_CONTAINER(wnd), widget);
+    attr = GetDefaultAttributesFromGTKWidget(widget, useBase, state);
+    gtk_widget_destroy(wnd);
+    return attr;
+}
+
+//static
+wxVisualAttributes
+wxControl::GetDefaultAttributesFromGTKWidget(GtkWidget* (*widget_new)(const gchar*),
+                                             bool useBase,
+                                             int state)
+{
+    wxVisualAttributes attr;
+    // NB: we need toplevel window so that GTK+ can find the right style
+    GtkWidget *wnd = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+    GtkWidget* widget = widget_new("");
+    gtk_container_add(GTK_CONTAINER(wnd), widget);
+    attr = GetDefaultAttributesFromGTKWidget(widget, useBase, state);
+    gtk_widget_destroy(wnd);
+    return attr;
+}
+
+
+//static
+wxVisualAttributes
+wxControl::GetDefaultAttributesFromGTKWidget(GtkWidget* (*widget_new)(GtkAdjustment*),
+                                             bool useBase,
+                                             int state)
+{
+    wxVisualAttributes attr;
+    // NB: we need toplevel window so that GTK+ can find the right style
+    GtkWidget *wnd = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+    GtkWidget* widget = widget_new(NULL);
+    gtk_container_add(GTK_CONTAINER(wnd), widget);
+    attr = GetDefaultAttributesFromGTKWidget(widget, useBase, state);
+    gtk_widget_destroy(wnd);
+    return attr;
+}
+
 #endif // wxUSE_CONTROLS
 

Index: internal/wxPython-2.5/src/gtk/statbox.cpp
diff -u internal/wxPython-2.5/src/gtk/statbox.cpp:2.1.5.1 internal/wxPython-2.5/src/gtk/statbox.cpp:2.1.5.1.4.1
--- internal/wxPython-2.5/src/gtk/statbox.cpp:2.1.5.1	Thu Apr  8 18:16:29 2004
+++ internal/wxPython-2.5/src/gtk/statbox.cpp	Mon Sep 13 18:11:47 2004
@@ -2,7 +2,7 @@
 // Name:        gtk/statbox.cpp
 // Purpose:
 // Author:      Robert Roebling
-// Id:          $Id: statbox.cpp,v 2.1.5.1 2004/04/09 01:16:29 markie Exp $
+// Id:          $Id: statbox.cpp,v 2.1.5.1.4.1 2004/09/14 01:11:47 heikki Exp $
 // Copyright:   (c) 1998 Robert Roebling
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
@@ -66,9 +66,7 @@
 
     m_parent->DoAddChild( this );
 
-    PostCreation();
-
-    InheritAttributes();
+    PostCreation(size);
 
     // need to set non default alignment?
     gfloat xalign;
@@ -82,8 +80,6 @@
     if ( xalign )
         gtk_frame_set_label_align(GTK_FRAME( m_widget ), xalign, 0.0);
 
-    Show( TRUE );
-
     return TRUE;
 }
 
@@ -95,10 +91,19 @@
                          m_label.empty() ? (char *)NULL : (const char*) wxGTK_CONV( m_label ) );
 }
 
-void wxStaticBox::ApplyWidgetStyle()
+void wxStaticBox::DoApplyWidgetStyle(GtkRcStyle *style)
+{
+    gtk_widget_modify_style(m_widget, style);
+#ifdef __WXGTK20__
+    gtk_widget_modify_style(GTK_FRAME(m_widget)->label_widget, style);
+#endif
+}
+
+// static
+wxVisualAttributes
+wxStaticBox::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
 {
-    SetWidgetStyle();
-    gtk_widget_set_style( m_widget, m_widgetStyle );
+    return GetDefaultAttributesFromGTKWidget(gtk_frame_new);
 }
 
 #endif // wxUSE_STATBOX

Index: internal/wxPython-2.5/src/gtk/slider.cpp
diff -u internal/wxPython-2.5/src/gtk/slider.cpp:2.1.5.1 internal/wxPython-2.5/src/gtk/slider.cpp:2.1.5.1.4.1
--- internal/wxPython-2.5/src/gtk/slider.cpp:2.1.5.1	Thu Apr  8 18:16:29 2004
+++ internal/wxPython-2.5/src/gtk/slider.cpp	Mon Sep 13 18:11:47 2004
@@ -2,7 +2,7 @@
 // Name:        gtk/slider.cpp
 // Purpose:
 // Author:      Robert Roebling
-// Id:          $Id: slider.cpp,v 2.1.5.1 2004/04/09 01:16:29 markie Exp $
+// Id:          $Id: slider.cpp,v 2.1.5.1.4.1 2004/09/14 01:11:47 heikki Exp $
 // Copyright:   (c) 1998 Robert Roebling
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
@@ -141,10 +141,7 @@
 
     m_parent->DoAddChild( this );
 
-    PostCreation();
-    InheritAttributes();
-
-    Show( TRUE );
+    PostCreation(size);
 
     return TRUE;
 }
@@ -268,12 +265,6 @@
 #endif
 }
 
-void wxSlider::ApplyWidgetStyle()
-{
-    SetWidgetStyle();
-    gtk_widget_set_style( m_widget, m_widgetStyle );
-}
-
 void wxSlider::GtkDisableEvents()
 {
     gtk_signal_disconnect_by_func( GTK_OBJECT(m_adjust),
@@ -289,4 +280,11 @@
                         (gpointer) this );
 }
 
+// static
+wxVisualAttributes
+wxSlider::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
+{
+    return GetDefaultAttributesFromGTKWidget(gtk_vscale_new);
+}
+
 #endif

Index: internal/wxPython-2.5/src/gtk/gdiobj.cpp
diff -u internal/wxPython-2.5/src/gtk/gdiobj.cpp:2.1.5.1 internal/wxPython-2.5/src/gtk/gdiobj.cpp:2.1.5.1.4.1
--- internal/wxPython-2.5/src/gtk/gdiobj.cpp:2.1.5.1	Thu Apr  8 18:16:28 2004
+++ internal/wxPython-2.5/src/gtk/gdiobj.cpp	Mon Sep 13 18:11:47 2004
@@ -2,7 +2,7 @@
 // Name:        gdiobj.cpp
 // Purpose:     wxGDIObject class
 // Author:      Julian Smart
-// RCS-ID:      $Id: gdiobj.cpp,v 2.1.5.1 2004/04/09 01:16:28 markie Exp $
+// RCS-ID:      $Id: gdiobj.cpp,v 2.1.5.1.4.1 2004/09/14 01:11:47 heikki Exp $
 // Copyright:   (c) Julian Smart
 // Licence:   	wxWindows licence
 /////////////////////////////////////////////////////////////////////////////

Index: internal/wxPython-2.5/src/gtk/combobox.cpp
diff -u internal/wxPython-2.5/src/gtk/combobox.cpp:2.1.5.1 internal/wxPython-2.5/src/gtk/combobox.cpp:2.1.5.1.4.1
--- internal/wxPython-2.5/src/gtk/combobox.cpp:2.1.5.1	Thu Apr  8 18:16:27 2004
+++ internal/wxPython-2.5/src/gtk/combobox.cpp	Mon Sep 13 18:11:47 2004
@@ -2,7 +2,7 @@
 // Name:        combobox.cpp
 // Purpose:
 // Author:      Robert Roebling
-// Id:          $Id: combobox.cpp,v 2.1.5.1 2004/04/09 01:16:27 markie Exp $
+// Id:          $Id: combobox.cpp,v 2.1.5.1.4.1 2004/09/14 01:11:47 heikki Exp $
 // Copyright:   (c) 1998 Robert Roebling
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
@@ -171,8 +171,7 @@
 
     m_focusWidget = combo->entry;
 
-    PostCreation();
-    InheritAttributes();
+    PostCreation(size);
 
     ConnectWidget( combo->button );
 
@@ -189,24 +188,12 @@
     gtk_signal_connect( GTK_OBJECT(combo->list), "select-child",
       GTK_SIGNAL_FUNC(gtk_combo_select_child_callback), (gpointer)this );
 
-    wxSize size_best( DoGetBestSize() );
-    wxSize new_size( size );
-    if (new_size.x == -1)
-        new_size.x = size_best.x;
-    if (new_size.y == -1)
-        new_size.y = size_best.y;
-    if (new_size.y > size_best.y)
-        new_size.y = size_best.y;
-    if ((new_size.x != size.x) || (new_size.y != size.y))
-    {
-        SetSize( new_size.x, new_size.y );
-
-        // This is required for tool bar support
-        gtk_widget_set_usize( m_widget, new_size.x, new_size.y );
-    }
-
-    Show( TRUE );
+    SetBestSize(size); // need this too because this is a wxControlWithItems
 
+    // This is required for tool bar support
+    wxSize setsize = GetSize();
+    gtk_widget_set_usize( m_widget, setsize.x, setsize.y );
+    
     return TRUE;
 }
 
@@ -252,7 +239,7 @@
         gtk_widget_realize( list_item );
         gtk_widget_realize( GTK_BIN(list_item)->child );
 
-        if (m_widgetStyle) ApplyWidgetStyle();
+        ApplyWidgetStyle();
     }
 
     gtk_widget_show( list_item );
@@ -297,8 +284,7 @@
         gtk_widget_realize( list_item );
         gtk_widget_realize( GTK_BIN(list_item)->child );
 
-        if (m_widgetStyle)
-            ApplyWidgetStyle();
+        ApplyWidgetStyle();
     }
 
     gtk_widget_show( list_item );
@@ -557,13 +543,14 @@
     EnableEvents();
 }
 
-void wxComboBox::SetStringSelection( const wxString &string )
+bool wxComboBox::SetStringSelection( const wxString &string )
 {
-    wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") );
+    wxCHECK_MSG( m_widget != NULL, false, wxT("invalid combobox") );
 
     int res = FindString( string );
-    if (res == -1) return;
+    if (res == -1) return false;
     SetSelection( res );
+    return true;
 }
 
 wxString wxComboBox::GetValue() const
@@ -734,22 +721,20 @@
 #endif // 0
 }
 
-void wxComboBox::ApplyWidgetStyle()
+void wxComboBox::DoApplyWidgetStyle(GtkRcStyle *style)
 {
-    SetWidgetStyle();
-
-//    gtk_widget_set_style( GTK_COMBO(m_widget)->button, m_widgetStyle );
-    gtk_widget_set_style( GTK_COMBO(m_widget)->entry, m_widgetStyle );
-    gtk_widget_set_style( GTK_COMBO(m_widget)->list, m_widgetStyle );
+//    gtk_widget_modify_style( GTK_COMBO(m_widget)->button, syle );
+    gtk_widget_modify_style( GTK_COMBO(m_widget)->entry, style );
+    gtk_widget_modify_style( GTK_COMBO(m_widget)->list, style );
 
     GtkList *list = GTK_LIST( GTK_COMBO(m_widget)->list );
     GList *child = list->children;
     while (child)
     {
-        gtk_widget_set_style( GTK_WIDGET(child->data), m_widgetStyle );
+        gtk_widget_modify_style( GTK_WIDGET(child->data), style );
 
         GtkBin *bin = GTK_BIN(child->data);
-        gtk_widget_set_style( bin->child, m_widgetStyle );
+        gtk_widget_modify_style( bin->child, style );
 
         child = child->next;
     }
@@ -779,7 +764,7 @@
         size_t count = GetCount();
         for ( size_t n = 0; n < count; n++ )
         {
-            GetTextExtent( GetString(n), &width, NULL, NULL, NULL, &m_font );
+            GetTextExtent( GetString(n), &width, NULL, NULL, NULL );
             if ( width > ret.x )
                 ret.x = width;
         }
@@ -788,7 +773,16 @@
     // empty combobox should have some reasonable default size too
     if ( ret.x < 100 )
         ret.x = 100;
+
+    CacheBestSize(ret);
     return ret;
 }
 
+// static
+wxVisualAttributes
+wxComboBox::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
+{
+    return GetDefaultAttributesFromGTKWidget(gtk_combo_new, true);
+}
+
 #endif

Index: internal/wxPython-2.5/src/gtk/radiobox.cpp
diff -u internal/wxPython-2.5/src/gtk/radiobox.cpp:2.1.5.1 internal/wxPython-2.5/src/gtk/radiobox.cpp:2.1.5.1.4.1
--- internal/wxPython-2.5/src/gtk/radiobox.cpp:2.1.5.1	Thu Apr  8 18:16:29 2004
+++ internal/wxPython-2.5/src/gtk/radiobox.cpp	Mon Sep 13 18:11:47 2004
@@ -2,7 +2,7 @@
 // Name:        radiobox.cpp
 // Purpose:
 // Author:      Robert Roebling
-// Id:          $Id: radiobox.cpp,v 2.1.5.1 2004/04/09 01:16:29 markie Exp $
+// Id:          $Id: radiobox.cpp,v 2.1.5.1.4.1 2004/09/14 01:11:47 heikki Exp $
 // Copyright:   (c) 1998 Robert Roebling
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
@@ -243,29 +243,16 @@
 
     m_parent->DoAddChild( this );
 
-    PostCreation();
-    InheritAttributes();
-
-    ApplyWidgetStyle();
+    bool wasShown = IsShown();
+    if ( wasShown )
+        Hide(); // prevent PostCreation() from showing us
 
     SetLabel( title );
 
-    SetFont( parent->GetFont() );
-
-    wxSize ls = LayoutItems();
-
-    GtkRequisition req;
-    req.width = 2;
-    req.height = 2;
-    (* GTK_WIDGET_CLASS( GTK_OBJECT_GET_CLASS(m_widget) )->size_request ) (m_widget, &req );
-    if (req.width > ls.x) ls.x = req.width;
-
-    wxSize newSize = size;
-    if (newSize.x == -1) newSize.x = ls.x;
-    if (newSize.y == -1) newSize.y = ls.y;
-    SetSize( newSize.x, newSize.y );
+    PostCreation(size);
 
-    Show( TRUE );
+    if ( wasShown )
+        Show();
 
     return TRUE;
 }
@@ -285,25 +272,35 @@
 {
     wxWindow::DoSetSize( x, y, width, height, sizeFlags );
 
-    LayoutItems();
+    LayoutItems(false);
 }
 
-wxSize wxRadioBox::LayoutItems()
+wxSize wxRadioBox::DoGetBestSize() const
 {
-    int x = 7;
-    int y = 15;
+    wxSize size = LayoutItems(true);
 
-    if ( m_majorDim == 0 )
-    {
-        // avoid dividing by 0 below
-        wxFAIL_MSG( wxT("dimension of radiobox should not be 0!") );
+    GtkRequisition req;
+    req.width = 2;
+    req.height = 2;
+    (* GTK_WIDGET_CLASS( GTK_OBJECT_GET_CLASS(m_widget) )->size_request ) (m_widget, &req );
+    if (req.width > size.x)
+        size.x = req.width;
 
-        m_majorDim = 1;
-    }
+    CacheBestSize(size);
+    return size;
+}
+
+wxSize wxRadioBox::LayoutItems(bool justCalc) const
+{
+    wxSize res( 0, 0 );
+
+    // avoid dividing by 0 below
+    wxCHECK_MSG( m_majorDim, res, wxT("dimension of radiobox should not be 0!") );
 
     int num_per_major = (m_boxes.GetCount() - 1) / m_majorDim +1;
 
-    wxSize res( 0, 0 );
+    int x = 7;
+    int y = 15;
 
     int num_of_cols = 0;
     int num_of_rows = 0;
@@ -342,7 +339,8 @@
                       
                 if (req.width > max_len) max_len = req.width;
 
-                gtk_pizza_move( GTK_PIZZA(m_parent->m_wxwindow), button, m_x+x, m_y+y );
+                if ( !justCalc )
+                    gtk_pizza_move( GTK_PIZZA(m_parent->m_wxwindow), button, m_x+x, m_y+y );
                 y += req.height;
 
                 node = node->GetNext();
@@ -356,7 +354,8 @@
             {
                 GtkWidget *button = GTK_WIDGET( node->GetData() );
 
-                gtk_pizza_resize( GTK_PIZZA(m_parent->m_wxwindow), button, max_len, lineheight );
+                if ( !justCalc )
+                    gtk_pizza_resize( GTK_PIZZA(m_parent->m_wxwindow), button, max_len, lineheight );
 
                 node = node->GetNext();
                 if (!node) break;
@@ -395,7 +394,8 @@
         {
             GtkWidget *button = GTK_WIDGET( node->GetData() );
 
-            gtk_pizza_set_size( GTK_PIZZA(m_parent->m_wxwindow), button, m_x+x, m_y+y, max, lineheight );
+            if ( !justCalc )
+                gtk_pizza_set_size( GTK_PIZZA(m_parent->m_wxwindow), button, m_x+x, m_y+y, max, lineheight );
             x += max;
 
             node = node->GetNext();
@@ -417,7 +417,7 @@
         return FALSE;
     }
 
-    if ((m_windowStyle & wxNO_BORDER) != 0)
+    if ( HasFlag(wxNO_BORDER) )
         gtk_widget_hide( m_widget );
 
     wxList::compatibility_iterator node = m_boxes.GetFirst();
@@ -682,19 +682,21 @@
     }
 }
 
-void wxRadioBox::ApplyWidgetStyle()
+void wxRadioBox::DoApplyWidgetStyle(GtkRcStyle *style)
 {
-    SetWidgetStyle();
+    gtk_widget_modify_style( m_widget, style );
 
-    gtk_widget_set_style( m_widget, m_widgetStyle );
+#ifdef __WXGTK20__
+    gtk_widget_modify_style(GTK_FRAME(m_widget)->label_widget, style);
+#endif
 
     wxList::compatibility_iterator node = m_boxes.GetFirst();
     while (node)
     {
         GtkWidget *widget = GTK_WIDGET( node->GetData() );
-        gtk_widget_set_style( widget, m_widgetStyle );
 
-        gtk_widget_set_style( BUTTON_CHILD(node->GetData()), m_widgetStyle );
+        gtk_widget_modify_style( widget, style );
+        gtk_widget_modify_style( BUTTON_CHILD(node->GetData()), style );
 
         node = node->GetNext();
     }
@@ -753,5 +755,19 @@
     }
 }
 
+// static
+wxVisualAttributes
+wxRadioBox::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
+{
+    wxVisualAttributes attr;
+    // NB: we need toplevel window so that GTK+ can find the right style
+    GtkWidget *wnd = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+    GtkWidget* widget = gtk_radio_button_new_with_label(NULL, "");
+    gtk_container_add(GTK_CONTAINER(wnd), widget);
+    attr = GetDefaultAttributesFromGTKWidget(widget);
+    gtk_widget_destroy(wnd);
+    return attr;
+}
+
 #endif // wxUSE_RADIOBOX
 

Index: internal/wxPython-2.5/src/gtk/checklst.cpp
diff -u internal/wxPython-2.5/src/gtk/checklst.cpp:2.1.5.1 internal/wxPython-2.5/src/gtk/checklst.cpp:2.1.5.1.4.1
--- internal/wxPython-2.5/src/gtk/checklst.cpp:2.1.5.1	Thu Apr  8 18:16:27 2004
+++ internal/wxPython-2.5/src/gtk/checklst.cpp	Mon Sep 13 18:11:47 2004
@@ -2,7 +2,7 @@
 // Name:        checklst.cpp
 // Purpose:
 // Author:      Robert Roebling
-// Id:          $Id: checklst.cpp,v 2.1.5.1 2004/04/09 01:16:27 markie Exp $
+// Id:          $Id: checklst.cpp,v 2.1.5.1.4.1 2004/09/14 01:11:47 heikki Exp $
 // Copyright:   (c) 1998 Robert Roebling
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////

Index: internal/wxPython-2.5/src/gtk/minifram.cpp
diff -u internal/wxPython-2.5/src/gtk/minifram.cpp:2.1.5.1 internal/wxPython-2.5/src/gtk/minifram.cpp:2.1.5.1.4.1
--- internal/wxPython-2.5/src/gtk/minifram.cpp:2.1.5.1	Thu Apr  8 18:16:28 2004
+++ internal/wxPython-2.5/src/gtk/minifram.cpp	Mon Sep 13 18:11:47 2004
@@ -2,7 +2,7 @@
 // Name:        minifram.cpp
 // Purpose:
 // Author:      Robert Roebling
-// Id:          $Id: minifram.cpp,v 2.1.5.1 2004/04/09 01:16:28 markie Exp $
+// Id:          $Id: minifram.cpp,v 2.1.5.1.4.1 2004/09/14 01:11:47 heikki Exp $
 // Copyright:   (c) 1998 Robert Roebling
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////

Index: internal/wxPython-2.5/src/gtk/toplevel.cpp
diff -u internal/wxPython-2.5/src/gtk/toplevel.cpp:2.1.5.1 internal/wxPython-2.5/src/gtk/toplevel.cpp:2.1.5.1.4.1
--- internal/wxPython-2.5/src/gtk/toplevel.cpp:2.1.5.1	Thu Apr  8 18:16:30 2004
+++ internal/wxPython-2.5/src/gtk/toplevel.cpp	Mon Sep 13 18:11:47 2004
@@ -2,7 +2,7 @@
 // Name:        toplevel.cpp
 // Purpose:
 // Author:      Robert Roebling
-// Id:          $Id: toplevel.cpp,v 2.1.5.1 2004/04/09 01:16:30 markie Exp $
+// Id:          $Id: toplevel.cpp,v 2.1.5.1.4.1 2004/09/14 01:11:47 heikki Exp $
 // Copyright:   (c) 1998 Robert Roebling
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
@@ -106,7 +106,6 @@
 
         win->m_width = alloc->width;
         win->m_height = alloc->height;
-        win->m_queuedFullRedraw = TRUE;
         win->GtkUpdateSize();
     }
 }
@@ -265,7 +264,7 @@
 
 /* Callback for wxTopLevelWindowGTK. This very strange beast has to be used because
  * C++ has no virtual methods in a constructor. We have to emulate a
- * virtual function here as wxWindows requires different ways to insert
+ * virtual function here as wxWidgets requires different ways to insert
  * a child in container classes. */
 
 static void wxInsertChildInTopLevelWindow( wxTopLevelWindowGTK* parent, wxWindow* child )
@@ -345,23 +344,34 @@
 
     m_insertCallback = (wxInsertChildFunction) wxInsertChildInTopLevelWindow;
 
-    GtkWindowType win_type = GTK_WINDOW_TOPLEVEL;
+    // NB: m_widget may be !=NULL if it was created by derived class' Create,
+    //     e.g. in wxTaskBarIconAreaGTK
+    if (m_widget == NULL)
+    {
+        GtkWindowType win_type = GTK_WINDOW_TOPLEVEL;
+        if (style & wxFRAME_TOOL_WINDOW)
+            win_type = GTK_WINDOW_POPUP;
 
-    if (style & wxFRAME_TOOL_WINDOW)
-        win_type = GTK_WINDOW_POPUP;
-
-    if (GetExtraStyle() & wxTOPLEVEL_EX_DIALOG)
-    {
-        // there is no more GTK_WINDOW_DIALOG in 2.0
+        if (GetExtraStyle() & wxTOPLEVEL_EX_DIALOG)
+        {
 #ifdef __WXGTK20__
-        win_type = GTK_WINDOW_TOPLEVEL;
+            m_widget = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+            // Tell WM that this is a dialog window and make it center
+            // on parent by default (this is what GtkDialog ctor does):
+            gtk_window_set_type_hint(GTK_WINDOW(m_widget),
+                                     GDK_WINDOW_TYPE_HINT_DIALOG);
+            gtk_window_set_position(GTK_WINDOW(m_widget),
+                                    GTK_WIN_POS_CENTER_ON_PARENT);
 #else
-        win_type = GTK_WINDOW_DIALOG;
+            m_widget = gtk_window_new(GTK_WINDOW_DIALOG);
 #endif
+        }
+        else
+        {
+            m_widget = gtk_window_new(win_type);
+        }
     }
 
-    m_widget = gtk_window_new( win_type );
-
     if (m_parent && (((GTK_IS_WINDOW(m_parent->m_widget)) &&
 		      (GetExtraStyle() & wxTOPLEVEL_EX_DIALOG)) ||
 		     (style & wxFRAME_FLOAT_ON_PARENT)))
@@ -369,6 +379,13 @@
         gtk_window_set_transient_for( GTK_WINDOW(m_widget), GTK_WINDOW(m_parent->m_widget) );
     }
 
+#if GTK_CHECK_VERSION(2,2,0)
+    if (style & wxFRAME_NO_TASKBAR)
+    {
+        gtk_window_set_skip_taskbar_hint(GTK_WINDOW(m_widget), TRUE);
+    }
+#endif
+
     if (!name.IsEmpty())
         gtk_window_set_wmclass( GTK_WINDOW(m_widget), wxGTK_CONV( name ), wxGTK_CONV( name ) );
 
@@ -866,21 +883,6 @@
     gtk_window_set_title( GTK_WINDOW(m_widget), wxGTK_CONV( title ) );
 }
 
-void wxTopLevelWindowGTK::DoSetIcon( const wxIcon &icon )
-{
-    if ( !icon.Ok() )
-        return;
-
-    if (!m_widget->window)
-        return;
-
-    wxMask *mask = icon.GetMask();
-    GdkBitmap *bm = (GdkBitmap *) NULL;
-    if (mask) bm = mask->GetBitmap();
-
-    gdk_window_set_icon( m_widget->window, (GdkWindow *) NULL, icon.GetPixmap(), bm );
-}
-
 void wxTopLevelWindowGTK::SetIcon( const wxIcon &icon )
 {
     SetIcons( wxIconBundle( icon ) );
@@ -889,16 +891,41 @@
 void wxTopLevelWindowGTK::SetIcons( const wxIconBundle &icons )
 {
     wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") );
-    GdkWindow* window = m_widget->window;
 
     wxTopLevelWindowBase::SetIcons( icons );
 
-    DoSetIcon( icons.GetIcon( -1 ) );
-    if ( window )
+#ifdef __WXGTK20__
+    GList *list = NULL;
+    size_t max = icons.m_icons.GetCount();
+
+    for (size_t i = 0; i < max; i++)
     {
-        wxSetIconsX11( (WXDisplay*)GDK_WINDOW_XDISPLAY( window ),
-                       (WXWindow)GDK_WINDOW_XWINDOW( window ), icons );
+        if (icons.m_icons[i].Ok())
+        {
+            list = g_list_prepend(list, icons.m_icons[i].GetPixbuf());
+        }
     }
+    gtk_window_set_icon_list(GTK_WINDOW(m_widget), list);
+    g_list_free(list);
+    
+#else // !__WXGTK20__
+    GdkWindow* window = m_widget->window;
+    if (!window)
+        return;
+
+    wxIcon icon = icons.GetIcon(-1);
+    if (icon.Ok())
+    {
+        wxMask *mask = icon.GetMask();
+        GdkBitmap *bm = (GdkBitmap *) NULL;
+        if (mask) bm = mask->GetBitmap();
+
+        gdk_window_set_icon( m_widget->window, (GdkWindow *) NULL, icon.GetPixmap(), bm );
+    }
+
+    wxSetIconsX11( (WXDisplay*)GDK_WINDOW_XDISPLAY( window ),
+                   (WXWindow)GDK_WINDOW_XWINDOW( window ), icons );
+#endif // !__WXGTK20__
 }
 
 // ----------------------------------------------------------------------------
@@ -919,15 +946,22 @@
 
 bool wxTopLevelWindowGTK::IsMaximized() const
 {
+#ifdef __WXGTK20__
+    if(!m_widget->window)
+        return false;
+
+    return gdk_window_get_state(m_widget->window) & GDK_WINDOW_STATE_MAXIMIZED;
+#else
   //    wxFAIL_MSG( _T("not implemented") );
 
     // This is an approximation
     return FALSE;
+#endif
 }
 
 void wxTopLevelWindowGTK::Restore()
 {
-#ifdef __GTK20__
+#ifdef __WXGTK20__
     // "Present" seems similar enough to "restore"
     gtk_window_present( GTK_WINDOW( m_widget ) );
 #else

Index: internal/wxPython-2.5/src/gtk/renderer.cpp
diff -u internal/wxPython-2.5/src/gtk/renderer.cpp:2.1.5.1 internal/wxPython-2.5/src/gtk/renderer.cpp:2.1.5.1.4.1
--- internal/wxPython-2.5/src/gtk/renderer.cpp:2.1.5.1	Thu Apr  8 18:16:29 2004
+++ internal/wxPython-2.5/src/gtk/renderer.cpp	Mon Sep 13 18:11:47 2004
@@ -4,9 +4,9 @@
 // Author:      Vadim Zeitlin
 // Modified by:
 // Created:     20.07.2003
-// RCS-ID:      $Id: renderer.cpp,v 2.1.5.1 2004/04/09 01:16:29 markie Exp $
+// RCS-ID:      $Id: renderer.cpp,v 2.1.5.1.4.1 2004/09/14 01:11:47 heikki Exp $
 // Copyright:   (c) 2003 Vadim Zeitlin <vadim at wxwindows.org>
-// License:     wxWindows license
+// License:     wxWindows licence
 ///////////////////////////////////////////////////////////////////////////////
 
 // ============================================================================
@@ -285,7 +285,7 @@
 {
     if ( !win->m_wxwindow->window )
     {
-        // VZ: this happens on startup -- why?
+        // window not realized yet
         return;
     }
 
@@ -296,12 +296,12 @@
     GdkRectangle erase_rect;
     if ( isVert )
     {
-    int h = win->GetClientSize().GetHeight();
+        int h = win->GetClientSize().GetHeight();
     
         rect.x = position;
-        rect.y = h/2 - 14/2;
+        rect.y = 0;
         rect.width = SASH_FULL_SIZE;
-        rect.height = 14;
+        rect.height = h;
     
         erase_rect.x = position;
         erase_rect.y = 0;
@@ -310,12 +310,12 @@
     }
     else // horz
     {
-    int w = win->GetClientSize().GetWidth();
+        int w = win->GetClientSize().GetWidth();
     
-        rect.x = w/2 - 14/2;
+        rect.x = 0;
         rect.y = position;
         rect.height = SASH_FULL_SIZE;
-        rect.width = 14;
+        rect.width = w;
     
         erase_rect.y = position;
         erase_rect.x = 0;
@@ -356,7 +356,7 @@
         rect.y,
         rect.width,
         rect.height,
-        !isVert ? GTK_ORIENTATION_VERTICAL : GTK_ORIENTATION_HORIZONTAL
+        isVert ? GTK_ORIENTATION_VERTICAL : GTK_ORIENTATION_HORIZONTAL
     );
 #else // GTK+ 1.x
 

Index: internal/wxPython-2.5/src/gtk/gsockgtk.cpp
diff -u internal/wxPython-2.5/src/gtk/gsockgtk.cpp:2.1.5.1 internal/wxPython-2.5/src/gtk/gsockgtk.cpp:2.1.5.1.4.1
--- internal/wxPython-2.5/src/gtk/gsockgtk.cpp:2.1.5.1	Thu Apr  8 18:16:28 2004
+++ internal/wxPython-2.5/src/gtk/gsockgtk.cpp	Mon Sep 13 18:11:47 2004
@@ -3,7 +3,7 @@
  * Name:    gsockgtk.c
  * Purpose: GSocket: GTK part
  * Licence: The wxWindows licence
- * CVSID:   $Id: gsockgtk.cpp,v 2.1.5.1 2004/04/09 01:16:28 markie Exp $
+ * CVSID:   $Id: gsockgtk.cpp,v 2.1.5.1.4.1 2004/09/14 01:11:47 heikki Exp $
  * -------------------------------------------------------------------------
  */
 #include "wx/setup.h"
@@ -28,21 +28,24 @@
   GSocket *socket = (GSocket *)data;
 
   if (condition & GDK_INPUT_READ)
-    socket->m_functions->Detected_Read(socket);
+    socket->Detected_Read();
   if (condition & GDK_INPUT_WRITE)
-    socket->m_functions->Detected_Write(socket);
+    socket->Detected_Write();
 }
 
-int _GSocket_GUI_Init(void)
+bool GSocketGUIFunctionsTableConcrete::CanUseEventLoop()
+{   return true; }
+
+bool GSocketGUIFunctionsTableConcrete::OnInit(void)
 {
     return 1;
 }
 
-void _GSocket_GUI_Cleanup(void)
+void GSocketGUIFunctionsTableConcrete::OnExit(void)
 {
 }
     
-int _GSocket_GUI_Init_Socket(GSocket *socket)
+bool GSocketGUIFunctionsTableConcrete::Init_Socket(GSocket *socket)
 {
   gint *m_id;
 
@@ -55,12 +58,12 @@
   return TRUE;
 }
 
-void _GSocket_GUI_Destroy_Socket(GSocket *socket)
+void GSocketGUIFunctionsTableConcrete::Destroy_Socket(GSocket *socket)
 {
   free(socket->m_gui_dependent);
 }
 
-void _GSocket_Install_Callback(GSocket *socket, GSocketEvent event)
+void GSocketGUIFunctionsTableConcrete::Install_Callback(GSocket *socket, GSocketEvent event)
 {
   gint *m_id = (gint *)(socket->m_gui_dependent);
   int c;
@@ -86,7 +89,7 @@
                           (gpointer)socket);
 }
 
-void _GSocket_Uninstall_Callback(GSocket *socket, GSocketEvent event)
+void GSocketGUIFunctionsTableConcrete::Uninstall_Callback(GSocket *socket, GSocketEvent event)
 {
   gint *m_id = (gint *)(socket->m_gui_dependent);
   int c;
@@ -108,16 +111,16 @@
   m_id[c] = -1;
 }
 
-void _GSocket_Enable_Events(GSocket *socket)
+void GSocketGUIFunctionsTableConcrete::Enable_Events(GSocket *socket)
 {
-  _GSocket_Install_Callback(socket, GSOCK_INPUT);
-  _GSocket_Install_Callback(socket, GSOCK_OUTPUT);
+  Install_Callback(socket, GSOCK_INPUT);
+  Install_Callback(socket, GSOCK_OUTPUT);
 }
 
-void _GSocket_Disable_Events(GSocket *socket)
+void GSocketGUIFunctionsTableConcrete::Disable_Events(GSocket *socket)
 {
-  _GSocket_Uninstall_Callback(socket, GSOCK_INPUT);
-  _GSocket_Uninstall_Callback(socket, GSOCK_OUTPUT);
+  Uninstall_Callback(socket, GSOCK_INPUT);
+  Uninstall_Callback(socket, GSOCK_OUTPUT);
 }
 
 #else /* !wxUSE_SOCKETS */

Index: internal/wxPython-2.5/src/gtk/glcanvas.cpp
diff -u internal/wxPython-2.5/src/gtk/glcanvas.cpp:2.1.5.1 internal/wxPython-2.5/src/gtk/glcanvas.cpp:2.1.5.1.4.1
--- internal/wxPython-2.5/src/gtk/glcanvas.cpp:2.1.5.1	Thu Apr  8 18:16:28 2004
+++ internal/wxPython-2.5/src/gtk/glcanvas.cpp	Mon Sep 13 18:11:47 2004
@@ -1,10 +1,10 @@
 /////////////////////////////////////////////////////////////////////////////
 // Name:        gtk/glcanvas.cpp
-// Purpose:     wxGLCanvas, for using OpenGL/Mesa with wxWindows and GTK
+// Purpose:     wxGLCanvas, for using OpenGL/Mesa with wxWidgets and GTK
 // Author:      Robert Roebling
 // Modified by:
 // Created:     17/08/98
-// RCS-ID:      $Id: glcanvas.cpp,v 2.1.5.1 2004/04/09 01:16:28 markie Exp $
+// RCS-ID:      $Id: glcanvas.cpp,v 2.1.5.1.4.1 2004/09/14 01:11:47 heikki Exp $
 // Copyright:   (c) Robert Roebling
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
@@ -160,10 +160,16 @@
 static gint
 gtk_glwindow_realized_callback( GtkWidget * WXUNUSED(widget), wxGLCanvas *win )
 {
-    wxGLContext *share= win->m_sharedContext;
-    if (share==NULL && win->m_sharedContextOf) share=win->m_sharedContextOf->GetContext();
+    // VZ: apparently in some cases we're called twice -- no idea why,
+    //     but a check doesn't hurt
+    if ( !win->m_glContext )
+    {
+        wxGLContext *share = win->m_sharedContext;
+        if ( !share && win->m_sharedContextOf )
+            share = win->m_sharedContextOf->GetContext();
 
-    win->m_glContext = new wxGLContext( TRUE, win, wxNullPalette, share );
+        win->m_glContext = new wxGLContext( TRUE, win, wxNullPalette, share );
+    }
 
     return FALSE;
 }
@@ -365,7 +371,7 @@
     XVisualInfo *vi = (XVisualInfo *) m_vi;
 
     if (vi && m_canFreeVi) XFree( vi );
-    if (m_glContext) delete m_glContext;
+    delete m_glContext;
 }
 
 void* wxGLCanvas::ChooseGLVisual(int *attribList)

Index: internal/wxPython-2.5/src/gtk/tooltip.cpp
diff -u internal/wxPython-2.5/src/gtk/tooltip.cpp:2.1.5.1 internal/wxPython-2.5/src/gtk/tooltip.cpp:2.1.5.1.4.1
--- internal/wxPython-2.5/src/gtk/tooltip.cpp:2.1.5.1	Thu Apr  8 18:16:30 2004
+++ internal/wxPython-2.5/src/gtk/tooltip.cpp	Mon Sep 13 18:11:47 2004
@@ -2,7 +2,7 @@
 // Name:        tooltip.cpp
 // Purpose:     wxToolTip implementation
 // Author:      Robert Roebling
-// Id:          $Id: tooltip.cpp,v 2.1.5.1 2004/04/09 01:16:30 markie Exp $
+// Id:          $Id: tooltip.cpp,v 2.1.5.1.4.1 2004/09/14 01:11:47 heikki Exp $
 // Copyright:   (c) 1998 Robert Roebling
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
@@ -23,15 +23,11 @@
 
 #include "wx/gtk/private.h"
 
-extern GdkFont *GtkGetDefaultGuiFont();
-
 //-----------------------------------------------------------------------------
 // global data
 //-----------------------------------------------------------------------------
 
 static GtkTooltips *ss_tooltips = (GtkTooltips*) NULL;
-static GdkColor     ss_bg;
-static GdkColor     ss_fg;
 
 //-----------------------------------------------------------------------------
 // wxToolTip
@@ -58,27 +54,6 @@
     if (!ss_tooltips)
     {
         ss_tooltips = gtk_tooltips_new();
-
-        ss_fg.red = 0;
-        ss_fg.green = 0;
-        ss_fg.blue = 0;
-        gdk_color_alloc( gtk_widget_get_default_colormap(), &ss_fg );
-
-        ss_bg.red = 65535;
-        ss_bg.green = 65535;
-        ss_bg.blue = 50000;
-        gdk_color_alloc( gtk_widget_get_default_colormap(), &ss_bg );
-
-        gtk_tooltips_force_window( ss_tooltips );
-
-        GtkStyle *g_style =
-          gtk_style_copy(
-            gtk_widget_get_style( ss_tooltips->tip_window ) );
-
-        g_style->fg[GTK_STATE_NORMAL] = ss_fg;
-        g_style->bg[GTK_STATE_NORMAL] = ss_bg;
-
-        gtk_widget_set_style( ss_tooltips->tip_window, g_style );
     }
 
     m_window = win;

Index: internal/wxPython-2.5/src/gtk/filedlg.cpp
diff -u internal/wxPython-2.5/src/gtk/filedlg.cpp:2.1.5.1 internal/wxPython-2.5/src/gtk/filedlg.cpp:2.1.5.1.4.1
--- internal/wxPython-2.5/src/gtk/filedlg.cpp:2.1.5.1	Thu Apr  8 18:16:28 2004
+++ internal/wxPython-2.5/src/gtk/filedlg.cpp	Mon Sep 13 18:11:47 2004
@@ -2,7 +2,7 @@
 // Name:        gtk/filedlg.cpp
 // Purpose:
 // Author:      Robert Roebling
-// Id:          $Id: filedlg.cpp,v 2.1.5.1 2004/04/09 01:16:28 markie Exp $
+// Id:          $Id: filedlg.cpp,v 2.1.5.1.4.1 2004/09/14 01:11:47 heikki Exp $
 // Copyright:   (c) 1998 Robert Roebling
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
@@ -133,7 +133,7 @@
     m_needParent = FALSE;
 
     if (!PreCreation( parent, pos, wxDefaultSize ) ||
-        !CreateBase( parent, -1, pos, wxDefaultSize, style | wxDIALOG_MODAL, wxDefaultValidator, wxT("filedialog") ))
+        !CreateBase( parent, wxID_ANY, pos, wxDefaultSize, style, wxDefaultValidator, wxT("filedialog") ))
     {
         wxFAIL_MSG( wxT("wxXX creation failed") );
         return;

Index: internal/wxPython-2.5/src/gtk/win_gtk.c
diff -u internal/wxPython-2.5/src/gtk/win_gtk.c:2.1.5.1 internal/wxPython-2.5/src/gtk/win_gtk.c:2.1.5.1.4.1
--- internal/wxPython-2.5/src/gtk/win_gtk.c:2.1.5.1	Thu Apr  8 18:16:30 2004
+++ internal/wxPython-2.5/src/gtk/win_gtk.c	Mon Sep 13 18:11:47 2004
@@ -1,12 +1,12 @@
 /* ///////////////////////////////////////////////////////////////////////////
 // Name:        win_gtk.c
-// Purpose:     Native GTK+ widget for wxWindows, based on GtkLayout and
+// Purpose:     Native GTK+ widget for wxWidgets, based on GtkLayout and
 //              GtkFixed. It makes use of the gravity window property and
 //              therefore does not work with GTK 1.0.
 // Author:      Robert Roebling
-// Id:          $Id: win_gtk.c,v 2.1.5.1 2004/04/09 01:16:30 markie Exp $
+// Id:          $Id: win_gtk.c,v 2.1.5.1.4.1 2004/09/14 01:11:47 heikki Exp $
 // Copyright:   (c) 1998 Robert Roebling
-// Licence:     wxWindows licence
+// Licence:     wxWidgets licence
 /////////////////////////////////////////////////////////////////////////// */
 
 #ifdef VMS
@@ -60,6 +60,8 @@
 #endif /* __WXGTK20__ */
 static gint gtk_pizza_expose        (GtkWidget        *widget,
                                      GdkEventExpose   *event);
+static void gtk_pizza_style_set     (GtkWidget *widget,
+                                     GtkStyle  *previous_style);
 static void gtk_pizza_add           (GtkContainer     *container,
                                      GtkWidget        *widget);
 static void gtk_pizza_remove        (GtkContainer     *container,
@@ -143,6 +145,47 @@
     return pizza_type;
 }
 
+#if __WXGTK20__
+// Marshaller needed for set_scroll_adjustments signal,
+//   generated with GLib-2.4.6 glib-genmarshal
+#define g_marshal_value_peek_object(v)   g_value_get_object (v)
+static void
+g_cclosure_user_marshal_VOID__OBJECT_OBJECT (GClosure     *closure,
+                                             GValue       *return_value,
+                                             guint         n_param_values,
+                                             const GValue *param_values,
+                                             gpointer      invocation_hint,
+                                             gpointer      marshal_data)
+{
+  typedef void (*GMarshalFunc_VOID__OBJECT_OBJECT) (gpointer     data1,
+                                                    gpointer     arg_1,
+                                                    gpointer     arg_2,
+                                                    gpointer     data2);
+  register GMarshalFunc_VOID__OBJECT_OBJECT callback;
+  register GCClosure *cc = (GCClosure*) closure;
+  register gpointer data1, data2;
+
+  g_return_if_fail (n_param_values == 3);
+
+  if (G_CCLOSURE_SWAP_DATA (closure))
+    {
+      data1 = closure->data;
+      data2 = g_value_peek_pointer (param_values + 0);
+    }
+  else
+    {
+      data1 = g_value_peek_pointer (param_values + 0);
+      data2 = closure->data;
+    }
+  callback = (GMarshalFunc_VOID__OBJECT_OBJECT) (marshal_data ? marshal_data : cc->callback);
+
+  callback (data1,
+            g_marshal_value_peek_object (param_values + 1),
+            g_marshal_value_peek_object (param_values + 2),
+            data2);
+}
+#endif // __WXGTK20__
+
 static void
 gtk_pizza_class_init (GtkPizzaClass *klass)
 {
@@ -164,6 +207,7 @@
     widget_class->draw = gtk_pizza_draw;
 #endif
     widget_class->expose_event = gtk_pizza_expose;
+    widget_class->style_set = gtk_pizza_style_set;
 
     container_class->add = gtk_pizza_add;
     container_class->remove = gtk_pizza_remove;
@@ -174,16 +218,27 @@
     klass->set_scroll_adjustments = gtk_pizza_scroll_set_adjustments;
 
     widget_class->set_scroll_adjustments_signal =
+#if __WXGTK20__
+        g_signal_new(
+            "set_scroll_adjustments",
+            G_TYPE_FROM_CLASS(object_class),
+            G_SIGNAL_RUN_LAST,
+            G_STRUCT_OFFSET(GtkPizzaClass, set_scroll_adjustments),
+            NULL,
+            NULL,
+            g_cclosure_user_marshal_VOID__OBJECT_OBJECT,
+            G_TYPE_NONE,
+            2,
+            GTK_TYPE_ADJUSTMENT,
+            GTK_TYPE_ADJUSTMENT);
+#else
     gtk_signal_new ("set_scroll_adjustments",
                     GTK_RUN_LAST,
-#ifdef __WXGTK20__
-                    GTK_CLASS_TYPE(object_class),
-#else
                     object_class->type,
-#endif
                     GTK_SIGNAL_OFFSET (GtkPizzaClass, set_scroll_adjustments),
                     gtk_marshal_NONE__POINTER_POINTER,
                     GTK_TYPE_NONE, 2, GTK_TYPE_ADJUSTMENT, GTK_TYPE_ADJUSTMENT);
+#endif // __WXGTK20__
 }
 
 static GtkType
@@ -587,7 +642,7 @@
     widget->style = gtk_style_attach (widget->style, widget->window);
     gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
     gtk_style_set_background (widget->style, pizza->bin_window, GTK_STATE_NORMAL );
-    
+ 
 /*
     gdk_window_set_back_pixmap( widget->window, NULL, FALSE );
     gdk_window_set_back_pixmap( pizza->bin_window, NULL, FALSE );
@@ -808,6 +863,18 @@
 }
 
 static void
+gtk_pizza_style_set(GtkWidget *widget, GtkStyle  *previous_style)
+{
+    if (GTK_WIDGET_REALIZED(widget))
+    {
+        gtk_style_set_background(widget->style, widget->window, GTK_STATE_NORMAL);
+        gtk_style_set_background(widget->style, GTK_PIZZA(widget)->bin_window, GTK_STATE_NORMAL );
+    }
+
+    (* GTK_WIDGET_CLASS (pizza_parent_class)->style_set) (widget, previous_style);
+}
+
+static void
 gtk_pizza_add (GtkContainer *container,
                GtkWidget    *widget)
 {

Index: internal/wxPython-2.5/src/gtk/spinctrl.cpp
diff -u internal/wxPython-2.5/src/gtk/spinctrl.cpp:2.1.5.1 internal/wxPython-2.5/src/gtk/spinctrl.cpp:2.1.5.1.4.1
--- internal/wxPython-2.5/src/gtk/spinctrl.cpp:2.1.5.1	Thu Apr  8 18:16:29 2004
+++ internal/wxPython-2.5/src/gtk/spinctrl.cpp	Mon Sep 13 18:11:47 2004
@@ -3,7 +3,7 @@
 // Purpose:     wxSpinCtrl
 // Author:      Robert
 // Modified by:
-// RCS-ID:      $Id: spinctrl.cpp,v 2.1.5.1 2004/04/09 01:16:29 markie Exp $
+// RCS-ID:      $Id: spinctrl.cpp,v 2.1.5.1.4.1 2004/09/14 01:11:47 heikki Exp $
 // Copyright:   (c) Robert Roebling
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
@@ -126,24 +126,10 @@
     
     m_parent->DoAddChild( this );
 
-    PostCreation();
-    InheritAttributes();
-
-    wxSize size_best( DoGetBestSize() );
-    wxSize new_size( size );
-    if (new_size.x == -1)
-        new_size.x = size_best.x;
-    if (new_size.y == -1)
-        new_size.y = size_best.y;
-    if (new_size.y > size_best.y)
-        new_size.y = size_best.y;
-    if ((new_size.x != size.x) || (new_size.y != size.y))
-        SetSize( new_size.x, new_size.y );
+    PostCreation(size);
 
     SetValue( value );
 
-    Show( TRUE );
-
     return TRUE;
 }
 
@@ -230,7 +216,7 @@
 
 void wxSpinCtrl::SetSelection(long from, long to)
 {
-    // translate from wxWindows conventions to GTK+ ones: (-1, -1) means the
+    // translate from wxWidgets conventions to GTK+ ones: (-1, -1) means the
     // entire range
     if ( from == -1 && to == -1 )
     {
@@ -312,16 +298,21 @@
     return FALSE;
 }
 
-void wxSpinCtrl::ApplyWidgetStyle()
-{
-    SetWidgetStyle();
-    gtk_widget_set_style( m_widget, m_widgetStyle );
-}
-
 wxSize wxSpinCtrl::DoGetBestSize() const
 {
     wxSize ret( wxControl::DoGetBestSize() );
-    return wxSize(95, ret.y);
+    wxSize best(95, ret.y);
+    CacheBestSize(best);
+    return best;
+}
+
+// static
+wxVisualAttributes
+wxSpinCtrl::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
+{
+    // TODO: overload to accept functions like gtk_spin_button_new?
+    // Until then use a similar type
+    return GetDefaultAttributesFromGTKWidget(gtk_entry_new, true);
 }
 
 #endif

Index: internal/wxPython-2.5/src/gtk/menu.cpp
diff -u internal/wxPython-2.5/src/gtk/menu.cpp:2.1.5.1 internal/wxPython-2.5/src/gtk/menu.cpp:2.1.5.1.4.1
--- internal/wxPython-2.5/src/gtk/menu.cpp:2.1.5.1	Thu Apr  8 18:16:28 2004
+++ internal/wxPython-2.5/src/gtk/menu.cpp	Mon Sep 13 18:11:47 2004
@@ -2,7 +2,7 @@
 // Name:        menu.cpp
 // Purpose:
 // Author:      Robert Roebling
-// Id:          $Id: menu.cpp,v 2.1.5.1 2004/04/09 01:16:28 markie Exp $
+// Id:          $Id: menu.cpp,v 2.1.5.1.4.1 2004/09/14 01:11:47 heikki Exp $
 // Copyright:   (c) 1998 Robert Roebling
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
@@ -46,6 +46,9 @@
     #define ACCEL_OBJ_CAST(obj) GTK_OBJECT(obj)
 #endif
 
+// we use normal item but with a special id for the menu title
+static const int wxGTK_TITLE_ID = -3;
+
 //-----------------------------------------------------------------------------
 // idle system
 //-----------------------------------------------------------------------------
@@ -136,9 +139,9 @@
         }
         ++pc;
     }
-    
+
     // wxPrintf( wxT("before %s after %s\n"), title.c_str(), str.c_str() );
-    
+
     return str;
 }
 
@@ -307,7 +310,7 @@
     wxWindow *top_frame = win;
     while (top_frame->GetParent() && !(top_frame->IsTopLevel()))
         top_frame = top_frame->GetParent();
-        
+
 #ifndef __WXGTK20__
     // support for native key accelerators indicated by underscroes
     gtk_accel_group_detach( m_accel, ACCEL_OBJ_CAST(top_frame->m_widget) );
@@ -330,7 +333,7 @@
     return GtkAppend(menu, title);
 }
 
-bool wxMenuBar::GtkAppend(wxMenu *menu, const wxString& title)
+bool wxMenuBar::GtkAppend(wxMenu *menu, const wxString& title, int pos)
 {
     wxString str( wxReplaceUnderscore( title ) );
 
@@ -359,11 +362,14 @@
 #endif
 
     gtk_widget_show( menu->m_owner );
-    
+
     gtk_menu_item_set_submenu( GTK_MENU_ITEM(menu->m_owner), menu->m_menu );
-    
-    gtk_menu_shell_append( GTK_MENU_SHELL(m_menubar), menu->m_owner );
-    
+
+    if (pos == -1)
+        gtk_menu_shell_append( GTK_MENU_SHELL(m_menubar), menu->m_owner );
+    else
+        gtk_menu_shell_insert( GTK_MENU_SHELL(m_menubar), menu->m_owner, pos );
+
     gtk_signal_connect( GTK_OBJECT(menu->m_owner), "activate",
                         GTK_SIGNAL_FUNC(gtk_menu_open_callback),
                         (gpointer)menu );
@@ -395,8 +401,8 @@
         return FALSE;
 
     // TODO
-    
-    if ( !GtkAppend(menu, title) )
+
+    if ( !GtkAppend(menu, title, (int)pos) )
         return FALSE;
 
     return TRUE;
@@ -415,53 +421,17 @@
     return menuOld;
 }
 
-static wxMenu *CopyMenu (wxMenu *menu)
-{
-    wxMenu *menucopy = new wxMenu ();
-    wxMenuItemList::compatibility_iterator node = menu->GetMenuItems().GetFirst();
-    while (node)
-    {
-        wxMenuItem *item = node->GetData();
-        int itemid = item->GetId();
-        wxString text = item->GetText();
-        text.Replace(wxT("_"), wxT("&"));
-        wxMenu *submenu = item->GetSubMenu();
-        if (!submenu)
-        {
-            wxMenuItem* itemcopy = new wxMenuItem(menucopy,
-                                        itemid, text,
-                                        menu->GetHelpString(itemid));
-            itemcopy->SetBitmap(item->GetBitmap());
-            itemcopy->SetCheckable(item->IsCheckable());
-            menucopy->Append(itemcopy);
-        }
-        else
-          menucopy->Append (itemid, text, CopyMenu(submenu),
-                            menu->GetHelpString(itemid));
-
-        node = node->GetNext();
-    }
-
-    return menucopy;
-}
-
 wxMenu *wxMenuBar::Remove(size_t pos)
 {
     wxMenu *menu = wxMenuBarBase::Remove(pos);
     if ( !menu )
         return (wxMenu*) NULL;
 
-    wxMenu *menucopy = CopyMenu( menu );
-
-    // unparent calls unref() and that would delete the widget so we raise
-    // the ref count to 2 artificially before invoking unparent.
-    gtk_widget_ref( menu->m_menu );
-    gtk_widget_unparent( menu->m_menu );
+    gtk_menu_item_remove_submenu( GTK_MENU_ITEM(menu->m_owner) );
+    gtk_container_remove(GTK_CONTAINER(m_menubar), menu->m_owner);
 
     gtk_widget_destroy( menu->m_owner );
-    delete menu;
-
-    menu = menucopy;
+    menu->m_owner = NULL;
 
     if (m_invokingWindow)
     {
@@ -636,6 +606,12 @@
     wxMenuItem* item = menu->FindChildItem( id );
     wxCHECK_RET( item, wxT("error in menu item callback") );
 
+    if ( item->GetId() == wxGTK_TITLE_ID )
+    {
+        // ignore events from the menu title
+        return;
+    }
+
     if (item->IsCheckable())
     {
         bool isReallyChecked = item->IsChecked(),
@@ -657,13 +633,8 @@
 
     // Is this menu on a menubar?  (possibly nested)
     wxFrame* frame = NULL;
-    wxMenu*  pm = menu;
-    while ( pm && !frame )
-    {
-        if ( pm->IsAttached() )
-            frame = pm->GetMenuBar()->GetFrame();
-        pm = pm->GetParent();
-    }
+    if(menu->IsAttached())
+        frame = menu->GetMenuBar()->GetFrame();
 
     // FIXME: why do we have to call wxFrame::GetEventHandler() directly here?
     //        normally wxMenu::SendEvent() should be enough, if it doesn't work
@@ -802,6 +773,9 @@
 
     for ( const wxChar *pc = text.c_str(); *pc; pc++ )
     {
+        if ( *pc == wxT('\t'))
+            break;
+
         if ( *pc == wxT('_') )
         {
             // GTK 1.2 escapes "xxx_xxx" to "xxx__xxx"
@@ -890,7 +864,7 @@
         {
             m_text << wxT("__");
         }
-        else 
+        else
         {
             m_text << *pc;
         }
@@ -976,25 +950,28 @@
 {
     m_accel = gtk_accel_group_new();
     m_menu = gtk_menu_new();
+    // NB: keep reference to the menu so that it is not destroyed behind
+    //     our back by GTK+ e.g. when it is removed from menubar:
+    gtk_widget_ref(m_menu);
 
     m_owner = (GtkWidget*) NULL;
 
     // Tearoffs are entries, just like separators. So if we want this
     // menu to be a tear-off one, we just append a tearoff entry
     // immediately.
-    if(m_style & wxMENU_TEAROFF)
+    if ( m_style & wxMENU_TEAROFF )
     {
-		GtkWidget *tearoff = gtk_tearoff_menu_item_new();
+        GtkWidget *tearoff = gtk_tearoff_menu_item_new();
 
-		gtk_menu_append(GTK_MENU(m_menu), tearoff);
-	}
+        gtk_menu_append(GTK_MENU(m_menu), tearoff);
+    }
 
-	m_prevRadio = NULL;
+    m_prevRadio = NULL;
 
     // append the title as the very first entry if we have it
-    if ( !!m_title )
+    if ( !m_title.empty() )
     {
-        Append(-2, m_title);
+        Append(wxGTK_TITLE_ID, m_title);
         AppendSeparator();
     }
 }
@@ -1004,10 +981,13 @@
    WX_CLEAR_LIST(wxMenuItemList, m_items);
 
    if ( GTK_IS_WIDGET( m_menu ))
+   {
+       gtk_widget_unref( m_menu ); // see wxMenu::Init
        gtk_widget_destroy( m_menu );
+   }
 }
 
-bool wxMenu::GtkAppend(wxMenuItem *mitem)
+bool wxMenu::GtkAppend(wxMenuItem *mitem, int pos)
 {
     GtkWidget *menuItem;
 
@@ -1019,8 +999,10 @@
         // TODO
         menuItem = gtk_menu_item_new();
 #endif
-        gtk_menu_shell_append(GTK_MENU_SHELL(m_menu), menuItem);
-
+        if (pos == -1)
+            gtk_menu_shell_append(GTK_MENU_SHELL(m_menu), menuItem);
+        else
+            gtk_menu_shell_insert(GTK_MENU_SHELL(m_menu), menuItem, pos);
     }
     else if ( mitem->IsSubMenu() )
     {
@@ -1048,8 +1030,11 @@
 #endif
 
         gtk_menu_item_set_submenu( GTK_MENU_ITEM(menuItem), mitem->GetSubMenu()->m_menu );
-        gtk_menu_shell_append(GTK_MENU_SHELL(m_menu), menuItem);
- 
+        if (pos == -1)
+            gtk_menu_shell_append(GTK_MENU_SHELL(m_menu), menuItem);
+        else
+            gtk_menu_shell_insert(GTK_MENU_SHELL(m_menu), menuItem, pos);
+
         gtk_widget_show( mitem->GetSubMenu()->m_menu );
 
         // if adding a submenu to a menu already existing in the menu bar, we
@@ -1066,20 +1051,23 @@
         const wxBitmap *bitmap = &mitem->GetBitmap();
         GdkPixmap *gdk_pixmap = bitmap->GetPixmap();
         GdkBitmap *gdk_bitmap = bitmap->GetMask() ? bitmap->GetMask()->GetBitmap() : (GdkBitmap*) NULL;
-        
+
 #ifdef __WXGTK20__
         menuItem = gtk_image_menu_item_new_with_mnemonic( wxGTK_CONV( text ) );
-        
+
         GtkWidget *image = gtk_image_new_from_pixmap( gdk_pixmap, gdk_bitmap );
         gtk_widget_show(image);
-        
+
         gtk_image_menu_item_set_image( GTK_IMAGE_MENU_ITEM(menuItem), image );
-        
+
         gtk_signal_connect( GTK_OBJECT(menuItem), "activate",
                             GTK_SIGNAL_FUNC(gtk_menu_clicked_callback),
                             (gpointer)this );
 
-        gtk_menu_shell_append(GTK_MENU_SHELL(m_menu), menuItem);
+        if (pos == -1)
+            gtk_menu_shell_append(GTK_MENU_SHELL(m_menu), menuItem);
+        else
+            gtk_menu_shell_insert(GTK_MENU_SHELL(m_menu), menuItem, pos);
 #else
 
         menuItem = gtk_pixmap_menu_item_new ();
@@ -1128,7 +1116,10 @@
                             GTK_SIGNAL_FUNC(gtk_menu_clicked_callback),
                             (gpointer)this );
 
-        gtk_menu_append( GTK_MENU(m_menu), menuItem );
+        if (pos == -1)
+            gtk_menu_append( GTK_MENU(m_menu), menuItem );
+        else
+            gtk_menu_insert( GTK_MENU(m_menu), menuItem, pos );
         gtk_widget_show( menuItem );
 #endif
 
@@ -1253,26 +1244,29 @@
                             GTK_SIGNAL_FUNC(gtk_menu_clicked_callback),
                             (gpointer)this );
 
-        gtk_menu_shell_append(GTK_MENU_SHELL(m_menu), menuItem);
+        if (pos == -1)
+            gtk_menu_shell_append(GTK_MENU_SHELL(m_menu), menuItem);
+        else
+            gtk_menu_shell_insert(GTK_MENU_SHELL(m_menu), menuItem, pos);
     }
-    
+
     guint accel_key;
     GdkModifierType accel_mods;
     wxCharBuffer buf = wxGTK_CONV( GetHotKey(*mitem) );
-    
-    // wxPrintf( wxT("item: %s hotkey %s\n"), mitem->GetText().c_str(), GetHotKey(*mitem).c_str() ); 
-    
+
+    // wxPrintf( wxT("item: %s hotkey %s\n"), mitem->GetText().c_str(), GetHotKey(*mitem).c_str() );
+
     gtk_accelerator_parse( (const char*) buf, &accel_key, &accel_mods);
     if (accel_key != 0)
     {
-        gtk_widget_add_accelerator (GTK_WIDGET(menuItem), 
-                                    "activate", 
+        gtk_widget_add_accelerator (GTK_WIDGET(menuItem),
+                                    "activate",
                                     m_accel,
-                                    accel_key, 
+                                    accel_key,
                                     accel_mods,
                                     GTK_ACCEL_VISIBLE);
     }
- 
+
     gtk_widget_show( menuItem );
 
     if ( !mitem->IsSeparator() )
@@ -1303,7 +1297,7 @@
 {
     if (!GtkAppend(mitem))
         return NULL;
-        
+
     return wxMenuBase::DoAppend(mitem);
 }
 
@@ -1313,7 +1307,7 @@
         return NULL;
 
     // TODO
-    if ( !GtkAppend(item) )
+    if ( !GtkAppend(item, (int)pos) )
         return NULL;
 
     return item;
@@ -1381,7 +1375,7 @@
             case WXK_F10:
             case WXK_F11:
             case WXK_F12:
-                hotkey << wxT('F') << code - WXK_F1 + 1;
+                hotkey += wxString::Format(wxT("F%d"), code - WXK_F1 + 1);
                 break;
 
                 // TODO: we should use gdk_keyval_name() (a.k.a.

Index: internal/wxPython-2.5/src/gtk/textctrl.cpp
diff -u internal/wxPython-2.5/src/gtk/textctrl.cpp:2.1.5.1 internal/wxPython-2.5/src/gtk/textctrl.cpp:2.1.5.1.4.1
--- internal/wxPython-2.5/src/gtk/textctrl.cpp:2.1.5.1	Thu Apr  8 18:16:30 2004
+++ internal/wxPython-2.5/src/gtk/textctrl.cpp	Mon Sep 13 18:11:47 2004
@@ -2,7 +2,7 @@
 // Name:        textctrl.cpp
 // Purpose:
 // Author:      Robert Roebling
-// Id:          $Id: textctrl.cpp,v 2.1.5.1 2004/04/09 01:16:30 markie Exp $
+// Id:          $Id: textctrl.cpp,v 2.1.5.1.4.1 2004/09/14 01:11:47 heikki Exp $
 // Copyright:   (c) 1998 Robert Roebling, Vadim Zeitlin
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
@@ -155,7 +155,9 @@
         wxapp_install_idle_handler();
 
     win->SetModified();
+#ifndef __WXGTK20__
     win->UpdateFontIfNeeded();
+#endif // !__WXGTK20__
 
     wxCommandEvent event( wxEVT_COMMAND_TEXT_UPDATED, win->GetId() );
     event.SetEventObject( win );
@@ -239,7 +241,7 @@
 {
     m_ignoreNextUpdate =
     m_modified = FALSE;
-    m_updateFont = FALSE;
+    SetUpdateFont(FALSE);
     m_text =
     m_vScrollbar = (GtkWidget *)NULL;
 }
@@ -303,7 +305,7 @@
         gtk_container_add( GTK_CONTAINER(m_widget), m_text );
 
         // Global settings which can be overridden by tags, I guess.
-        if (HasFlag( wxHSCROLL ))
+        if (HasFlag( wxHSCROLL ) || HasFlag( wxTE_DONTWRAP ))
             gtk_text_view_set_wrap_mode( GTK_TEXT_VIEW( m_text ), GTK_WRAP_NONE );
         else
             gtk_text_view_set_wrap_mode( GTK_TEXT_VIEW( m_text ), GTK_WRAP_WORD );
@@ -348,17 +350,7 @@
 
     m_focusWidget = m_text;
 
-    PostCreation();
-    InheritAttributes();
-
-    wxSize size_best( DoGetBestSize() );
-    wxSize new_size( size );
-    if (new_size.x == -1)
-        new_size.x = size_best.x;
-    if (new_size.y == -1)
-        new_size.y = size_best.y;
-    if ((new_size.x != size.x) || (new_size.y != size.y))
-        SetSize( new_size.x, new_size.y );
+    PostCreation(size);
 
     if (multi_line)
         gtk_widget_show(m_text);
@@ -425,16 +417,36 @@
 #ifdef __WXGTK20__
         else
             gtk_text_view_set_editable( GTK_TEXT_VIEW( m_text), FALSE);
-    }
 #else
     }
     else
     {
         if (multi_line)
             gtk_text_set_editable( GTK_TEXT(m_text), 1 );
-    }
 #endif
+    }
 
+#ifdef __WXGTK20__
+    if (multi_line)
+    {
+        if (style & wxTE_RIGHT)
+            gtk_text_view_set_justification( GTK_TEXT_VIEW(m_text), GTK_JUSTIFY_RIGHT );
+        else if (style & wxTE_CENTRE)
+            gtk_text_view_set_justification( GTK_TEXT_VIEW(m_text), GTK_JUSTIFY_CENTER );
+        // Left justify (alignment) is the default and we don't need to apply GTK_JUSTIFY_LEFT
+    }
+    // gtk_entry_set_alignment was introduced in gtk+-2.3.5
+#if GTK_CHECK_VERSION(2, 3, 5)
+    else
+    {
+        if (style & wxTE_RIGHT)
+            gtk_entry_set_alignment( GTK_ENTRY(m_text), 1.0 );
+        else if (style & wxTE_CENTRE)
+            gtk_entry_set_alignment( GTK_ENTRY(m_text), 0.5 );
+    }
+#endif // gtk+-2.3.5
+#endif // __WXGTK20__
+    
     // We want to be notified about text changes.
 #ifdef __WXGTK20__
     if (multi_line)
@@ -444,28 +456,21 @@
     }
     else
 #endif
+    
     {
         gtk_signal_connect( GTK_OBJECT(m_text), "changed",
             GTK_SIGNAL_FUNC(gtk_text_changed_callback), (gpointer)this);
     }
 
-    // we don't set a valid background colour, because the window
-    // manager should use a default one
-    m_backgroundColour = wxColour();
-
-    wxColour colFg = parent->GetForegroundColour();
-    SetForegroundColour( colFg );
-
     m_cursor = wxCursor( wxCURSOR_IBEAM );
 
-    wxTextAttr attrDef( colFg, m_backgroundColour, parent->GetFont() );
+    wxTextAttr attrDef(GetForegroundColour(), GetBackgroundColour(), GetFont());
     SetDefaultStyle( attrDef );
 
-    Show( TRUE );
-
     return TRUE;
 }
 
+
 void wxTextCtrl::CalculateScrollbar()
 {
 #ifndef __WXGTK20__
@@ -560,7 +565,7 @@
     }
 
     // GRG, Jun/2000: Changed this after a lot of discussion in
-    //   the lists. wxWindows 2.2 will have a set of flags to
+    //   the lists. wxWidgets 2.2 will have a set of flags to
     //   customize this behaviour.
     SetInsertionPoint(0);
 
@@ -574,6 +579,11 @@
     if ( text.empty() )
         return;
 
+    // gtk_text_changed_callback() will set m_modified to true but m_modified
+    // shouldn't be changed by the program writing to the text control itself,
+    // so save the old value and restore when we're done
+    bool oldModified = m_modified;
+
     if ( m_windowStyle & wxTE_MULTILINE )
     {
 #ifdef __WXGTK20__
@@ -583,6 +593,12 @@
 #else
         wxCharBuffer buffer( wxConvUTF8.cWC2MB( wxConvLocal.cWX2WC( text ) ) );
 #endif
+        if ( !buffer )
+        {
+            // what else can we do? at least don't crash...
+            return;
+        }
+
         GtkTextBuffer *text_buffer = gtk_text_view_get_buffer( GTK_TEXT_VIEW(m_text) );
 
         // TODO: Call whatever is needed to delete the selection.
@@ -609,7 +625,7 @@
         // in UpdateFontIfNeeded() any longer
         if ( !text.empty() )
         {
-            m_updateFont = FALSE;
+            SetUpdateFont(FALSE);
         }
 
         // Bring editable's cursor back uptodate.
@@ -641,7 +657,7 @@
         gtk_entry_set_position( GTK_ENTRY(m_text), len );
     }
 
-    m_modified = TRUE;
+    m_modified = oldModified;
 }
 
 void wxTextCtrl::AppendText( const wxString &text )
@@ -805,14 +821,19 @@
 {
     wxCHECK_RET( m_text != NULL, wxT("invalid text ctrl") );
 
-    if (m_windowStyle & wxTE_MULTILINE)
+    if ( IsMultiLine() )
     {
 #ifdef __WXGTK20__
         GtkTextBuffer *text_buffer = gtk_text_view_get_buffer( GTK_TEXT_VIEW(m_text) );
         GtkTextIter iter;
         gtk_text_buffer_get_iter_at_offset( text_buffer, &iter, pos );
         gtk_text_buffer_place_cursor( text_buffer, &iter );
-#else
+        gtk_text_view_scroll_mark_onscreen
+        (
+            GTK_TEXT_VIEW(m_text),
+            gtk_text_buffer_get_insert( text_buffer )
+        );
+#else // GTK+ 1.x
         gtk_signal_disconnect_by_func( GTK_OBJECT(m_text),
           GTK_SIGNAL_FUNC(gtk_text_changed_callback), (gpointer)this);
 
@@ -829,7 +850,7 @@
 
         // bring editable's cursor uptodate. Bug in GTK.
         SET_EDITABLE_POS(m_text, gtk_text_get_point( GTK_TEXT(m_text) ));
-#endif
+#endif // GTK+ 2/1
     }
     else
     {
@@ -1054,6 +1075,36 @@
     }
 }
 
+#ifdef __WXGTK20__
+
+wxTextCtrlHitTestResult
+wxTextCtrl::HitTest(const wxPoint& pt, long *pos) const
+{
+    if ( !IsMultiLine() )
+    {
+        // not supported
+        return wxTE_HT_UNKNOWN;
+    }
+
+    int x, y;
+    gtk_text_view_window_to_buffer_coords
+    (
+        GTK_TEXT_VIEW(m_text),
+        GTK_TEXT_WINDOW_TEXT,
+        pt.x, pt.y,
+        &x, &y
+    );
+
+    GtkTextIter iter;
+    gtk_text_view_get_iter_at_location(GTK_TEXT_VIEW(m_text), &iter, x, y);
+    if ( pos )
+        *pos = gtk_text_iter_get_offset(&iter);
+
+    return wxTE_HT_ON_TEXT;
+}
+
+#endif // __WXGTK20__
+
 long wxTextCtrl::GetInsertionPoint() const
 {
     wxCHECK_MSG( m_text != NULL, 0, wxT("invalid text ctrl") );
@@ -1154,27 +1205,36 @@
 {
     wxCHECK_RET( m_text != NULL, wxT("invalid text ctrl") );
 
-#ifndef __WXGTK20__
-    gtk_editable_cut_clipboard( GTK_EDITABLE(m_text) DUMMY_CLIPBOARD_ARG );
+#ifdef __WXGTK20__
+    if (m_windowStyle & wxTE_MULTILINE)
+        g_signal_emit_by_name(m_text, "cut-clipboard");
+    else
 #endif
+        gtk_editable_cut_clipboard(GTK_EDITABLE(m_text) DUMMY_CLIPBOARD_ARG);
 }
 
 void wxTextCtrl::Copy()
 {
     wxCHECK_RET( m_text != NULL, wxT("invalid text ctrl") );
 
-#ifndef __WXGTK20__
-    gtk_editable_copy_clipboard( GTK_EDITABLE(m_text) DUMMY_CLIPBOARD_ARG );
+#ifdef __WXGTK20__
+    if (m_windowStyle & wxTE_MULTILINE)
+        g_signal_emit_by_name(m_text, "copy-clipboard");
+    else
 #endif
+        gtk_editable_copy_clipboard(GTK_EDITABLE(m_text) DUMMY_CLIPBOARD_ARG);
 }
 
 void wxTextCtrl::Paste()
 {
     wxCHECK_RET( m_text != NULL, wxT("invalid text ctrl") );
 
-#ifndef __WXGTK20__
-    gtk_editable_paste_clipboard( GTK_EDITABLE(m_text) DUMMY_CLIPBOARD_ARG );
+#ifdef __WXGTK20__
+    if (m_windowStyle & wxTE_MULTILINE)
+        g_signal_emit_by_name(m_text, "paste-clipboard");
+    else
 #endif
+        gtk_editable_paste_clipboard(GTK_EDITABLE(m_text) DUMMY_CLIPBOARD_ARG);
 }
 
 // Undo/redo
@@ -1359,7 +1419,7 @@
 
     if ( m_windowStyle & wxTE_MULTILINE )
     {
-        m_updateFont = TRUE;
+        SetUpdateFont(TRUE);
 
         m_defaultStyle.SetFont(font);
 
@@ -1373,25 +1433,37 @@
 {
     // this method is very inefficient and hence should be called as rarely as
     // possible!
+    //
+    // TODO: it can be implemented much more efficiently for GTK2
+#ifndef __WXGTK20__
     wxASSERT_MSG( (m_windowStyle & wxTE_MULTILINE) && m_updateFont,
+
                   _T("shouldn't be called for single line controls") );
+#else
+    wxASSERT_MSG( (m_windowStyle & wxTE_MULTILINE),
+                  _T("shouldn't be called for single line controls") );
+#endif
 
     wxString value = GetValue();
     if ( !value.IsEmpty() )
     {
-        m_updateFont = FALSE;
+        SetUpdateFont(FALSE);
 
         Clear();
         AppendText(value);
     }
 }
 
+#ifndef __WXGTK20__
+
 void wxTextCtrl::UpdateFontIfNeeded()
 {
     if ( m_updateFont )
         ChangeFontGlobally();
 }
 
+#endif // GTK+ 1.x
+
 bool wxTextCtrl::SetForegroundColour(const wxColour& colour)
 {
     if ( !wxControl::SetForegroundColour(colour) )
@@ -1413,14 +1485,6 @@
     if (!m_widget->window)
         return FALSE;
 
-    wxColour sysbg = wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE );
-    if (sysbg.Red() == colour.Red() &&
-        sysbg.Green() == colour.Green() &&
-        sysbg.Blue() == colour.Blue())
-    {
-        return FALSE; // FIXME or TRUE?
-    }
-
     if (!m_backgroundColour.Ok())
         return FALSE;
 
@@ -1532,17 +1596,9 @@
     }
 }
 
-void wxTextCtrl::ApplyWidgetStyle()
+void wxTextCtrl::DoApplyWidgetStyle(GtkRcStyle *style)
 {
-    if (m_windowStyle & wxTE_MULTILINE)
-    {
-        // how ?
-    }
-    else
-    {
-        SetWidgetStyle();
-        gtk_widget_set_style( m_text, m_widgetStyle );
-    }
+    gtk_widget_modify_style(m_text, style);
 }
 
 void wxTextCtrl::OnCut(wxCommandEvent& WXUNUSED(event))
@@ -1638,7 +1694,9 @@
 {
     // FIXME should be different for multi-line controls...
     wxSize ret( wxControl::DoGetBestSize() );
-    return wxSize(80, ret.y);
+    wxSize best(80, ret.y);
+    CacheBestSize(best);
+    return best;
 }
 
 // ----------------------------------------------------------------------------
@@ -1673,16 +1731,18 @@
 
 GtkAdjustment *wxTextCtrl::GetVAdj() const
 {
+    if ( !IsMultiLine() )
+        return NULL;
+
 #ifdef __WXGTK20__
-    return NULL;
+    return gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(m_widget));
 #else
-    return HasFlag(wxTE_MULTILINE) ? GTK_TEXT(m_text)->vadj : NULL;
+    return GTK_TEXT(m_text)->vadj;
 #endif
 }
 
 bool wxTextCtrl::DoScroll(GtkAdjustment *adj, int diff)
 {
-#ifndef __WXGTK20__
     float value = adj->value + diff;
 
     if ( value < 0 )
@@ -1701,38 +1761,44 @@
 
     adj->value = value;
 
+#ifdef __WXGTK20__
+    gtk_adjustment_value_changed(GTK_ADJUSTMENT(adj));
+#else
     gtk_signal_emit_by_name(GTK_OBJECT(adj), "value_changed");
-
 #endif
+
     return TRUE;
 }
 
 bool wxTextCtrl::ScrollLines(int lines)
 {
-#ifdef __WXGTK20__
-    return FALSE;
-#else
     GtkAdjustment *adj = GetVAdj();
     if ( !adj )
         return FALSE;
 
+#ifdef __WXGTK20__
+    int diff = (int)ceil(lines*adj->step_increment);
+#else
     // this is hardcoded to 10 in GTK+ 1.2 (great idea)
-    static const int KEY_SCROLL_PIXELS = 10;
-
-    return DoScroll(adj, lines*KEY_SCROLL_PIXELS);
+    int diff = 10*lines;
 #endif
+
+    return DoScroll(adj, diff);
 }
 
 bool wxTextCtrl::ScrollPages(int pages)
 {
-#ifdef __WXGTK20__
-    return FALSE;
-#else
     GtkAdjustment *adj = GetVAdj();
     if ( !adj )
         return FALSE;
 
     return DoScroll(adj, (int)ceil(pages*adj->page_increment));
-#endif
 }
 
+
+// static
+wxVisualAttributes
+wxTextCtrl::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
+{
+    return GetDefaultAttributesFromGTKWidget(gtk_entry_new, true);
+}

Index: internal/wxPython-2.5/src/gtk/bitmap.cpp
diff -u internal/wxPython-2.5/src/gtk/bitmap.cpp:2.1.5.1 internal/wxPython-2.5/src/gtk/bitmap.cpp:2.1.5.1.4.1
--- internal/wxPython-2.5/src/gtk/bitmap.cpp:2.1.5.1	Thu Apr  8 18:16:27 2004
+++ internal/wxPython-2.5/src/gtk/bitmap.cpp	Mon Sep 13 18:11:47 2004
@@ -2,7 +2,7 @@
 // Name:        bitmap.cpp
 // Purpose:
 // Author:      Robert Roebling
-// RCS-ID:      $Id: bitmap.cpp,v 2.1.5.1 2004/04/09 01:16:27 markie Exp $
+// RCS-ID:      $Id: bitmap.cpp,v 2.1.5.1.4.1 2004/09/14 01:11:47 heikki Exp $
 // Copyright:   (c) 1998 Robert Roebling
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
@@ -239,6 +239,9 @@
 
     GdkPixmap      *m_pixmap;
     GdkBitmap      *m_bitmap;
+#ifdef __WXGTK20__
+    GdkPixbuf      *m_pixbuf;
+#endif
     wxMask         *m_mask;
     int             m_width;
     int             m_height;
@@ -250,6 +253,9 @@
 {
     m_pixmap = (GdkPixmap *) NULL;
     m_bitmap = (GdkBitmap *) NULL;
+#ifdef __WXGTK20__
+    m_pixbuf = (GdkPixbuf *) NULL;
+#endif
     m_mask = (wxMask *) NULL;
     m_width = 0;
     m_height = 0;
@@ -263,6 +269,10 @@
         gdk_pixmap_unref( m_pixmap );
     if (m_bitmap)
         gdk_bitmap_unref( m_bitmap );
+#ifdef __WXGTK20__
+    if (m_pixbuf)
+        gdk_pixbuf_unref( m_pixbuf );
+#endif
     delete m_mask;
     delete m_palette;
 }
@@ -352,136 +362,91 @@
 
     if (newy==M_BMPDATA->m_width && newy==M_BMPDATA->m_height)
         return *this;
-        
-    GdkImage *img = (GdkImage*) NULL;
-    if (GetPixmap())
-        img = gdk_image_get( GetPixmap(), 0, 0, GetWidth(), GetHeight() );
-    else if (GetBitmap())
-        img = gdk_image_get( GetBitmap(), 0, 0, GetWidth(), GetHeight() );
-    else
-        wxFAIL_MSG( wxT("Ill-formed bitmap") );
-
-    wxCHECK_MSG( img, wxNullBitmap, wxT("couldn't create image") );
-
-    wxBitmap bmp;
-    int bpp = -1;
-
+    
     int width = wxMax(newx, 1);
     int height = wxMax(newy, 1);
     width = wxMin(width, clipwidth);
     height = wxMin(height, clipheight);
-    
-    GdkGC *gc = NULL;
-    GdkPixmap *dstpix = NULL;
-    if (GetPixmap())
-    {
-        GdkVisual *visual = gdk_window_get_visual( GetPixmap() );
-        if (visual == NULL)
-            visual = wxTheApp->GetGdkVisual();
-
-        bpp = visual->depth;
-        bmp = wxBitmap(width,height,bpp);
-        dstpix = bmp.GetPixmap();
-        gc = gdk_gc_new( dstpix );
-    }
+        
+    wxBitmap bmp;
 
-    char *dst = NULL;
-    long dstbyteperline = 0;
-    
-    if (GetBitmap())
+#ifdef __WXGTK20__
+    if (HasPixbuf())
     {
-        bpp = 1;
-        dstbyteperline = width/8*M_BMPDATA->m_bpp;
-        if (width*M_BMPDATA->m_bpp % 8 != 0)
-            dstbyteperline++;
-        dst = (char*) malloc(dstbyteperline*height);
-    }
-             
-    // be careful to use the right scaling factor
-    float scx = (float)M_BMPDATA->m_width/(float)newx;
-    float scy = (float)M_BMPDATA->m_height/(float)newy;
-    // prepare accel-tables
-    int *tablex = (int *)calloc(width,sizeof(int));
-    int *tabley = (int *)calloc(height,sizeof(int));
-
-    // accel table filled with clipped values
-    for (int x = 0; x < width; x++)
-        tablex[x] = (int) (scx * (x+clipx));
-    for (int y = 0; y < height; y++)
-        tabley[y] = (int) (scy * (y+clipy));
-
-    // Main rescaling routine starts here
-    for (int h = 0; h < height; h++)
+        bmp.SetWidth(width);
+        bmp.SetHeight(height);
+        bmp.SetDepth(GetDepth());
+        bmp.SetPixbuf(gdk_pixbuf_new(GDK_COLORSPACE_RGB,
+                                     gdk_pixbuf_get_has_alpha(GetPixbuf()),
+                                     8, width, height));
+        gdk_pixbuf_scale(GetPixbuf(), bmp.GetPixbuf(),
+                         0, 0, width, height,
+                         clipx, clipy, 
+                         (double)newx/GetWidth(), (double)newy/GetHeight(),
+                         GDK_INTERP_BILINEAR);
+    }
+    else
+#endif // __WXGTK20__
     {
-        char outbyte = 0;
-        int old_x = -1;
-        guint32 old_pixval = 0;
+        GdkImage *img = (GdkImage*) NULL;
+        if (GetPixmap())
+            img = gdk_image_get( GetPixmap(), 0, 0, GetWidth(), GetHeight() );
+        else if (GetBitmap())
+            img = gdk_image_get( GetBitmap(), 0, 0, GetWidth(), GetHeight() );
+        else
+            wxFAIL_MSG( wxT("Ill-formed bitmap") );
+
+        wxCHECK_MSG( img, wxNullBitmap, wxT("couldn't create image") );
+
+        int bpp = -1;
 
-        for (int w = 0; w < width; w++)
+        
+        GdkGC *gc = NULL;
+        GdkPixmap *dstpix = NULL;
+        if (GetPixmap())
         {
-            guint32 pixval;
-            int x = tablex[w];
-            if (x == old_x)
-                pixval = old_pixval;
-            else
-            {
-                pixval = gdk_image_get_pixel( img, x, tabley[h] );
-                old_pixval = pixval;
-                old_x = x;
-            }
-                
-            if (bpp == 1)
-            {
-                if (!pixval)
-                {
-                    char bit=1;
-                    char shift = bit << w % 8;
-                    outbyte |= shift;
-                }
-                
-                if ((w+1)%8==0)
-                {
-                    dst[h*dstbyteperline+w/8] = outbyte;
-                    outbyte = 0;
-                }
-            }
-            else
-            {
-                GdkColor col;
-                col.pixel = pixval;
-                gdk_gc_set_foreground( gc, &col );
-                gdk_draw_point( dstpix, gc, w, h);
-            }
+            GdkVisual *visual = gdk_window_get_visual( GetPixmap() );
+            if (visual == NULL)
+                visual = wxTheApp->GetGdkVisual();
+
+            bpp = visual->depth;
+            bmp = wxBitmap(width,height,bpp);
+            dstpix = bmp.GetPixmap();
+            gc = gdk_gc_new( dstpix );
         }
-    
-        // do not forget the last byte
-        if ((bpp == 1) && (width % 8 != 0))
-            dst[h*dstbyteperline+width/8] = outbyte;
-    }
-    
-    gdk_image_destroy( img );
-    if (gc) gdk_gc_unref( gc );
 
-    if (bpp == 1)
-    {
-        bmp = wxBitmap( (const char *)dst, width, height, 1 );
-        free( dst );
-    }
-    
-    if (GetMask())
-    {
-        dstbyteperline = width/8;
-        if (width % 8 != 0)
-            dstbyteperline++;
-        dst = (char*) malloc(dstbyteperline*height);
-        img = gdk_image_get( GetMask()->GetBitmap(), 0, 0, GetWidth(), GetHeight() );
+        char *dst = NULL;
+        long dstbyteperline = 0;
+        
+        if (GetBitmap())
+        {
+            bpp = 1;
+            dstbyteperline = width/8*M_BMPDATA->m_bpp;
+            if (width*M_BMPDATA->m_bpp % 8 != 0)
+                dstbyteperline++;
+            dst = (char*) malloc(dstbyteperline*height);
+        }
+                 
+        // be careful to use the right scaling factor
+        float scx = (float)M_BMPDATA->m_width/(float)newx;
+        float scy = (float)M_BMPDATA->m_height/(float)newy;
+        // prepare accel-tables
+        int *tablex = (int *)calloc(width,sizeof(int));
+        int *tabley = (int *)calloc(height,sizeof(int));
+
+        // accel table filled with clipped values
+        for (int x = 0; x < width; x++)
+            tablex[x] = (int) (scx * (x+clipx));
+        for (int y = 0; y < height; y++)
+            tabley[y] = (int) (scy * (y+clipy));
 
+        // Main rescaling routine starts here
         for (int h = 0; h < height; h++)
         {
             char outbyte = 0;
             int old_x = -1;
             guint32 old_pixval = 0;
-    
+
             for (int w = 0; w < width; w++)
             {
                 guint32 pixval;
@@ -494,530 +459,695 @@
                     old_pixval = pixval;
                     old_x = x;
                 }
-                
-                if (pixval)
+                    
+                if (bpp == 1)
                 {
-                    char bit=1;
-                    char shift = bit << w % 8;
-                    outbyte |= shift;
+                    if (!pixval)
+                    {
+                        char bit=1;
+                        char shift = bit << w % 8;
+                        outbyte |= shift;
+                    }
+                    
+                    if ((w+1)%8==0)
+                    {
+                        dst[h*dstbyteperline+w/8] = outbyte;
+                        outbyte = 0;
+                    }
                 }
-                
-                if ((w+1)%8 == 0)
+                else
                 {
-                    dst[h*dstbyteperline+w/8] = outbyte;
-                    outbyte = 0;
+                    GdkColor col;
+                    col.pixel = pixval;
+                    gdk_gc_set_foreground( gc, &col );
+                    gdk_draw_point( dstpix, gc, w, h);
                 }
             }
         
             // do not forget the last byte
-            if (width % 8 != 0)
+            if ((bpp == 1) && (width % 8 != 0))
                 dst[h*dstbyteperline+width/8] = outbyte;
         }
-        wxMask* mask = new wxMask;
-        mask->m_bitmap = gdk_bitmap_create_from_data( wxGetRootWindow()->window, (gchar *) dst, width, height );
-        bmp.SetMask(mask);
-
-        free( dst );
+        
         gdk_image_destroy( img );
-    }
+        if (gc) gdk_gc_unref( gc );
 
-    free( tablex );
-    free( tabley );
+        if (bpp == 1)
+        {
+            bmp = wxBitmap( (const char *)dst, width, height, 1 );
+            free( dst );
+        }
+        
+        if (GetMask())
+        {
+            dstbyteperline = width/8;
+            if (width % 8 != 0)
+                dstbyteperline++;
+            dst = (char*) malloc(dstbyteperline*height);
+            img = gdk_image_get( GetMask()->GetBitmap(), 0, 0, GetWidth(), GetHeight() );
+
+            for (int h = 0; h < height; h++)
+            {
+                char outbyte = 0;
+                int old_x = -1;
+                guint32 old_pixval = 0;
+        
+                for (int w = 0; w < width; w++)
+                {
+                    guint32 pixval;
+                    int x = tablex[w];
+                    if (x == old_x)
+                        pixval = old_pixval;
+                    else
+                    {
+                        pixval = gdk_image_get_pixel( img, x, tabley[h] );
+                        old_pixval = pixval;
+                        old_x = x;
+                    }
+                    
+                    if (pixval)
+                    {
+                        char bit=1;
+                        char shift = bit << w % 8;
+                        outbyte |= shift;
+                    }
+                    
+                    if ((w+1)%8 == 0)
+                    {
+                        dst[h*dstbyteperline+w/8] = outbyte;
+                        outbyte = 0;
+                    }
+                }
+            
+                // do not forget the last byte
+                if (width % 8 != 0)
+                    dst[h*dstbyteperline+width/8] = outbyte;
+            }
+            wxMask* mask = new wxMask;
+            mask->m_bitmap = gdk_bitmap_create_from_data( wxGetRootWindow()->window, (gchar *) dst, width, height );
+            bmp.SetMask(mask);
+
+            free( dst );
+            gdk_image_destroy( img );
+        }
+
+        free( tablex );
+        free( tabley );
+    }
     
     return bmp; 
 }
 
-bool wxBitmap::CreateFromImage( const wxImage& image, int depth )
+bool wxBitmap::CreateFromImage(const wxImage& image, int depth)
 {
     UnRef();
 
     wxCHECK_MSG( image.Ok(), FALSE, wxT("invalid image") )
     wxCHECK_MSG( depth == -1 || depth == 1, FALSE, wxT("invalid bitmap depth") )
 
-    int width = image.GetWidth();
-    int height = image.GetHeight();
+    if (image.GetWidth() <= 0 || image.GetHeight() <= 0)
+        return false;
+    
+    m_refData = new wxBitmapRefData();
 
-    if ( width <= 0 || height <= 0 )
+    if (depth == 1)
     {
-        return false;
+        return CreateFromImageAsBitmap(image);
     }
+    else
+    {
+#ifdef __WXGTK20__
+        if (image.HasAlpha())
+            return CreateFromImageAsPixbuf(image);
+#endif
+        return CreateFromImageAsPixmap(image);
+    }
+}
 
-    m_refData = new wxBitmapRefData();
+// conversion to mono bitmap:
+bool wxBitmap::CreateFromImageAsBitmap(const wxImage& img)
+{
+    // convert alpha channel to mask, if it is present:
+    wxImage image(img);
+    image.ConvertAlphaToMask();
+    
+    int width = image.GetWidth();
+    int height = image.GetHeight();
 
     SetHeight( height );
     SetWidth( width );
 
-    // ------
-    // conversion to mono bitmap:
-    // ------
-    if (depth == 1)
-    {
-        SetBitmap( gdk_pixmap_new( wxGetRootWindow()->window, width, height, 1 ) );
+    SetBitmap( gdk_pixmap_new( wxGetRootWindow()->window, width, height, 1 ) );
 
-        SetDepth( 1 );
+    SetDepth( 1 );
 
-        GdkVisual *visual = wxTheApp->GetGdkVisual();
+    GdkVisual *visual = wxTheApp->GetGdkVisual();
 
-        // Create picture image
+    // Create picture image
 
-        unsigned char *data_data = (unsigned char*)malloc( ((width >> 3)+8) * height );
+    unsigned char *data_data = (unsigned char*)malloc( ((width >> 3)+8) * height );
 
-        GdkImage *data_image =
-            gdk_image_new_bitmap( visual, data_data, width, height );
+    GdkImage *data_image =
+        gdk_image_new_bitmap( visual, data_data, width, height );
 
-        // Create mask image
+    // Create mask image
 
-        GdkImage *mask_image = (GdkImage*) NULL;
+    GdkImage *mask_image = (GdkImage*) NULL;
 
-        if (image.HasMask())
-        {
-            unsigned char *mask_data = (unsigned char*)malloc( ((width >> 3)+8) * height );
+    if (image.HasMask())
+    {
+        unsigned char *mask_data = (unsigned char*)malloc( ((width >> 3)+8) * height );
 
-            mask_image =  gdk_image_new_bitmap( visual, mask_data, width, height );
+        mask_image =  gdk_image_new_bitmap( visual, mask_data, width, height );
 
-            wxMask *mask = new wxMask();
-            mask->m_bitmap = gdk_pixmap_new( wxGetRootWindow()->window, width, height, 1 );
+        wxMask *mask = new wxMask();
+        mask->m_bitmap = gdk_pixmap_new( wxGetRootWindow()->window, width, height, 1 );
 
-            SetMask( mask );
-        }
+        SetMask( mask );
+    }
 
-        int r_mask = image.GetMaskRed();
-        int g_mask = image.GetMaskGreen();
-        int b_mask = image.GetMaskBlue();
+    int r_mask = image.GetMaskRed();
+    int g_mask = image.GetMaskGreen();
+    int b_mask = image.GetMaskBlue();
 
-        unsigned char* data = image.GetData();
+    unsigned char* data = image.GetData();
 
-        int index = 0;
-        for (int y = 0; y < height; y++)
+    int index = 0;
+    for (int y = 0; y < height; y++)
+    {
+        for (int x = 0; x < width; x++)
         {
-            for (int x = 0; x < width; x++)
-            {
-                int r = data[index];
-                index++;
-                int g = data[index];
-                index++;
-                int b = data[index];
-                index++;
+            int r = data[index];
+            index++;
+            int g = data[index];
+            index++;
+            int b = data[index];
+            index++;
 
-                if (image.HasMask())
-                {
-                    if ((r == r_mask) && (b == b_mask) && (g == g_mask))
-                        gdk_image_put_pixel( mask_image, x, y, 1 );
-                    else
-                        gdk_image_put_pixel( mask_image, x, y, 0 );
-                }
-
-                if ((r == 255) && (b == 255) && (g == 255))
-                    gdk_image_put_pixel( data_image, x, y, 1 );
+            if (image.HasMask())
+            {
+                if ((r == r_mask) && (b == b_mask) && (g == g_mask))
+                    gdk_image_put_pixel( mask_image, x, y, 1 );
                 else
-                    gdk_image_put_pixel( data_image, x, y, 0 );
+                    gdk_image_put_pixel( mask_image, x, y, 0 );
+            }
 
-            } // for
-        }  // for
+            if ((r == 255) && (b == 255) && (g == 255))
+                gdk_image_put_pixel( data_image, x, y, 1 );
+            else
+                gdk_image_put_pixel( data_image, x, y, 0 );
 
-        // Blit picture
+        } // for
+    }  // for
 
-        GdkGC *data_gc = gdk_gc_new( GetBitmap() );
+    // Blit picture
 
-        gdk_draw_image( GetBitmap(), data_gc, data_image, 0, 0, 0, 0, width, height );
+    GdkGC *data_gc = gdk_gc_new( GetBitmap() );
 
-        gdk_image_destroy( data_image );
-        gdk_gc_unref( data_gc );
+    gdk_draw_image( GetBitmap(), data_gc, data_image, 0, 0, 0, 0, width, height );
 
-        // Blit mask
+    gdk_image_destroy( data_image );
+    gdk_gc_unref( data_gc );
 
-        if (image.HasMask())
-        {
-            GdkGC *mask_gc = gdk_gc_new( GetMask()->GetBitmap() );
+    // Blit mask
 
-            gdk_draw_image( GetMask()->GetBitmap(), mask_gc, mask_image, 0, 0, 0, 0, width, height );
+    if (image.HasMask())
+    {
+        GdkGC *mask_gc = gdk_gc_new( GetMask()->GetBitmap() );
 
-            gdk_image_destroy( mask_image );
-            gdk_gc_unref( mask_gc );
-        }
+        gdk_draw_image( GetMask()->GetBitmap(), mask_gc, mask_image, 0, 0, 0, 0, width, height );
+
+        gdk_image_destroy( mask_image );
+        gdk_gc_unref( mask_gc );
     }
 
-    // ------
-    // conversion to colour bitmap:
-    // ------
-    else
-    {
-        SetPixmap( gdk_pixmap_new( wxGetRootWindow()->window, width, height, -1 ) );
+    return true;
+}
+    
+// conversion to colour bitmap:
+bool wxBitmap::CreateFromImageAsPixmap(const wxImage& img)
+{
+    // convert alpha channel to mask, if it is present:
+    wxImage image(img);
+    image.ConvertAlphaToMask();
+    
+    int width = image.GetWidth();
+    int height = image.GetHeight();
 
-        GdkVisual *visual = wxTheApp->GetGdkVisual();
+    SetHeight( height );
+    SetWidth( width );
 
-        int bpp = visual->depth;
+    SetPixmap( gdk_pixmap_new( wxGetRootWindow()->window, width, height, -1 ) );
 
-        SetDepth( bpp );
+    GdkVisual *visual = wxTheApp->GetGdkVisual();
+
+    int bpp = visual->depth;
 
-        if ((bpp == 16) && (visual->red_mask != 0xf800))
-            bpp = 15;
-        else if (bpp < 8)
-            bpp = 8;
+    SetDepth( bpp );
+
+    if ((bpp == 16) && (visual->red_mask != 0xf800))
+        bpp = 15;
+    else if (bpp < 8)
+        bpp = 8;
 
-        // We handle 8-bit bitmaps ourselves using the colour cube, 12-bit
-        // visuals are not supported by GDK so we do these ourselves, too.
-        // 15-bit and 16-bit should actually work and 24-bit certainly does.
+    // We handle 8-bit bitmaps ourselves using the colour cube, 12-bit
+    // visuals are not supported by GDK so we do these ourselves, too.
+    // 15-bit and 16-bit should actually work and 24-bit certainly does.
 #ifdef __sgi
-        if (!image.HasMask() && (bpp > 16))
+    if (!image.HasMask() && (bpp > 16))
 #else
-        if (!image.HasMask() && (bpp > 12))
+    if (!image.HasMask() && (bpp > 12))
 #endif
-        {
-            static bool s_hasInitialized = FALSE;
+    {
+        static bool s_hasInitialized = FALSE;
 
-            if (!s_hasInitialized)
-            {
-                gdk_rgb_init();
-                s_hasInitialized = TRUE;
-            }
+        if (!s_hasInitialized)
+        {
+            gdk_rgb_init();
+            s_hasInitialized = TRUE;
+        }
 
-            GdkGC *gc = gdk_gc_new( GetPixmap() );
+        GdkGC *gc = gdk_gc_new( GetPixmap() );
 
-            gdk_draw_rgb_image( GetPixmap(),
-                                gc,
-                                0, 0,
-                                width, height,
-                                GDK_RGB_DITHER_NONE,
-                                image.GetData(),
-                                width*3 );
+        gdk_draw_rgb_image( GetPixmap(),
+                            gc,
+                            0, 0,
+                            width, height,
+                            GDK_RGB_DITHER_NONE,
+                            image.GetData(),
+                            width*3 );
 
-            gdk_gc_unref( gc );
-            return TRUE;
-        }
+        gdk_gc_unref( gc );
+        return TRUE;
+    }
 
-        // Create picture image
+    // Create picture image
 
-        GdkImage *data_image =
-            gdk_image_new( GDK_IMAGE_FASTEST, visual, width, height );
+    GdkImage *data_image =
+        gdk_image_new( GDK_IMAGE_FASTEST, visual, width, height );
 
-        // Create mask image
+    // Create mask image
 
-        GdkImage *mask_image = (GdkImage*) NULL;
+    GdkImage *mask_image = (GdkImage*) NULL;
 
-        if (image.HasMask())
-        {
-            unsigned char *mask_data = (unsigned char*)malloc( ((width >> 3)+8) * height );
+    if (image.HasMask())
+    {
+        unsigned char *mask_data = (unsigned char*)malloc( ((width >> 3)+8) * height );
 
-            mask_image =  gdk_image_new_bitmap( visual, mask_data, width, height );
+        mask_image =  gdk_image_new_bitmap( visual, mask_data, width, height );
 
-            wxMask *mask = new wxMask();
-            mask->m_bitmap = gdk_pixmap_new( wxGetRootWindow()->window, width, height, 1 );
+        wxMask *mask = new wxMask();
+        mask->m_bitmap = gdk_pixmap_new( wxGetRootWindow()->window, width, height, 1 );
 
-            SetMask( mask );
-        }
+        SetMask( mask );
+    }
 
-        // Render
+    // Render
 
-        enum byte_order { RGB, RBG, BRG, BGR, GRB, GBR };
-        byte_order b_o = RGB;
+    enum byte_order { RGB, RBG, BRG, BGR, GRB, GBR };
+    byte_order b_o = RGB;
 
-        if (bpp > 8)
-        {
-            if ((visual->red_mask > visual->green_mask) && (visual->green_mask > visual->blue_mask))      b_o = RGB;
-            else if ((visual->red_mask > visual->blue_mask) && (visual->blue_mask > visual->green_mask))  b_o = RBG;
-            else if ((visual->blue_mask > visual->red_mask) && (visual->red_mask > visual->green_mask))   b_o = BRG;
-            else if ((visual->blue_mask > visual->green_mask) && (visual->green_mask > visual->red_mask)) b_o = BGR;
-            else if ((visual->green_mask > visual->red_mask) && (visual->red_mask > visual->blue_mask))   b_o = GRB;
-            else if ((visual->green_mask > visual->blue_mask) && (visual->blue_mask > visual->red_mask))  b_o = GBR;
-        }
+    if (bpp > 8)
+    {
+        if ((visual->red_mask > visual->green_mask) && (visual->green_mask > visual->blue_mask))      b_o = RGB;
+        else if ((visual->red_mask > visual->blue_mask) && (visual->blue_mask > visual->green_mask))  b_o = RBG;
+        else if ((visual->blue_mask > visual->red_mask) && (visual->red_mask > visual->green_mask))   b_o = BRG;
+        else if ((visual->blue_mask > visual->green_mask) && (visual->green_mask > visual->red_mask)) b_o = BGR;
+        else if ((visual->green_mask > visual->red_mask) && (visual->red_mask > visual->blue_mask))   b_o = GRB;
+        else if ((visual->green_mask > visual->blue_mask) && (visual->blue_mask > visual->red_mask))  b_o = GBR;
+    }
 
-        int r_mask = image.GetMaskRed();
-        int g_mask = image.GetMaskGreen();
-        int b_mask = image.GetMaskBlue();
+    int r_mask = image.GetMaskRed();
+    int g_mask = image.GetMaskGreen();
+    int b_mask = image.GetMaskBlue();
 
-        unsigned char* data = image.GetData();
+    unsigned char* data = image.GetData();
 
-        int index = 0;
-        for (int y = 0; y < height; y++)
+    int index = 0;
+    for (int y = 0; y < height; y++)
+    {
+        for (int x = 0; x < width; x++)
         {
-            for (int x = 0; x < width; x++)
+            int r = data[index];
+            index++;
+            int g = data[index];
+            index++;
+            int b = data[index];
+            index++;
+
+            if (image.HasMask())
             {
-                int r = data[index];
-                index++;
-                int g = data[index];
-                index++;
-                int b = data[index];
-                index++;
+                if ((r == r_mask) && (b == b_mask) && (g == g_mask))
+                    gdk_image_put_pixel( mask_image, x, y, 1 );
+                else
+                    gdk_image_put_pixel( mask_image, x, y, 0 );
+            }
 
-                if (image.HasMask())
+            switch (bpp)
+            {
+                case 8:
                 {
-                    if ((r == r_mask) && (b == b_mask) && (g == g_mask))
-                        gdk_image_put_pixel( mask_image, x, y, 1 );
+                    int pixel = -1;
+                    if (wxTheApp->m_colorCube)
+                    {
+                        pixel = wxTheApp->m_colorCube[ ((r & 0xf8) << 7) + ((g & 0xf8) << 2) + ((b & 0xf8) >> 3) ];
+                    }
                     else
-                        gdk_image_put_pixel( mask_image, x, y, 0 );
-                }
-
-                switch (bpp)
-                {
-                    case 8:
                     {
-                        int pixel = -1;
-                        if (wxTheApp->m_colorCube)
-                        {
-                            pixel = wxTheApp->m_colorCube[ ((r & 0xf8) << 7) + ((g & 0xf8) << 2) + ((b & 0xf8) >> 3) ];
-                        }
-                        else
+                        GdkColormap *cmap = gtk_widget_get_default_colormap();
+                        GdkColor *colors = cmap->colors;
+                        int max = 3 * (65536);
+
+                        for (int i = 0; i < cmap->size; i++)
                         {
-                            GdkColormap *cmap = gtk_widget_get_default_colormap();
-                            GdkColor *colors = cmap->colors;
-                            int max = 3 * (65536);
-
-                            for (int i = 0; i < cmap->size; i++)
-                            {
-                                int rdiff = (r << 8) - colors[i].red;
-                                int gdiff = (g << 8) - colors[i].green;
-                                int bdiff = (b << 8) - colors[i].blue;
-                                int sum = ABS (rdiff) + ABS (gdiff) + ABS (bdiff);
-                                if (sum < max) { pixel = i; max = sum; }
-                            }
+                            int rdiff = (r << 8) - colors[i].red;
+                            int gdiff = (g << 8) - colors[i].green;
+                            int bdiff = (b << 8) - colors[i].blue;
+                            int sum = ABS (rdiff) + ABS (gdiff) + ABS (bdiff);
+                            if (sum < max) { pixel = i; max = sum; }
                         }
+                    }
 
-                        gdk_image_put_pixel( data_image, x, y, pixel );
+                    gdk_image_put_pixel( data_image, x, y, pixel );
 
-                        break;
-                    }
-                    case 12:  // SGI only
+                    break;
+                }
+                case 12:  // SGI only
+                {
+                    guint32 pixel = 0;
+                    switch (b_o)
                     {
-                        guint32 pixel = 0;
-                        switch (b_o)
-                        {
-                            case RGB: pixel = ((r & 0xf0) << 4) | (g & 0xf0) | ((b & 0xf0) >> 4); break;
-                            case RBG: pixel = ((r & 0xf0) << 4) | (b & 0xf0) | ((g & 0xf0) >> 4); break;
-                            case GRB: pixel = ((g & 0xf0) << 4) | (r & 0xf0) | ((b & 0xf0) >> 4); break;
-                            case GBR: pixel = ((g & 0xf0) << 4) | (b & 0xf0) | ((r & 0xf0) >> 4); break;
-                            case BRG: pixel = ((b & 0xf0) << 4) | (r & 0xf0) | ((g & 0xf0) >> 4); break;
-                            case BGR: pixel = ((b & 0xf0) << 4) | (g & 0xf0) | ((r & 0xf0) >> 4); break;
-                        }
-                        gdk_image_put_pixel( data_image, x, y, pixel );
-                        break;
+                        case RGB: pixel = ((r & 0xf0) << 4) | (g & 0xf0) | ((b & 0xf0) >> 4); break;
+                        case RBG: pixel = ((r & 0xf0) << 4) | (b & 0xf0) | ((g & 0xf0) >> 4); break;
+                        case GRB: pixel = ((g & 0xf0) << 4) | (r & 0xf0) | ((b & 0xf0) >> 4); break;
+                        case GBR: pixel = ((g & 0xf0) << 4) | (b & 0xf0) | ((r & 0xf0) >> 4); break;
+                        case BRG: pixel = ((b & 0xf0) << 4) | (r & 0xf0) | ((g & 0xf0) >> 4); break;
+                        case BGR: pixel = ((b & 0xf0) << 4) | (g & 0xf0) | ((r & 0xf0) >> 4); break;
                     }
-                    case 15:
+                    gdk_image_put_pixel( data_image, x, y, pixel );
+                    break;
+                }
+                case 15:
+                {
+                    guint32 pixel = 0;
+                    switch (b_o)
                     {
-                        guint32 pixel = 0;
-                        switch (b_o)
-                        {
-                            case RGB: pixel = ((r & 0xf8) << 7) | ((g & 0xf8) << 2) | ((b & 0xf8) >> 3); break;
-                            case RBG: pixel = ((r & 0xf8) << 7) | ((b & 0xf8) << 2) | ((g & 0xf8) >> 3); break;
-                            case GRB: pixel = ((g & 0xf8) << 7) | ((r & 0xf8) << 2) | ((b & 0xf8) >> 3); break;
-                            case GBR: pixel = ((g & 0xf8) << 7) | ((b & 0xf8) << 2) | ((r & 0xf8) >> 3); break;
-                            case BRG: pixel = ((b & 0xf8) << 7) | ((r & 0xf8) << 2) | ((g & 0xf8) >> 3); break;
-                            case BGR: pixel = ((b & 0xf8) << 7) | ((g & 0xf8) << 2) | ((r & 0xf8) >> 3); break;
-                        }
-                        gdk_image_put_pixel( data_image, x, y, pixel );
-                        break;
+                        case RGB: pixel = ((r & 0xf8) << 7) | ((g & 0xf8) << 2) | ((b & 0xf8) >> 3); break;
+                        case RBG: pixel = ((r & 0xf8) << 7) | ((b & 0xf8) << 2) | ((g & 0xf8) >> 3); break;
+                        case GRB: pixel = ((g & 0xf8) << 7) | ((r & 0xf8) << 2) | ((b & 0xf8) >> 3); break;
+                        case GBR: pixel = ((g & 0xf8) << 7) | ((b & 0xf8) << 2) | ((r & 0xf8) >> 3); break;
+                        case BRG: pixel = ((b & 0xf8) << 7) | ((r & 0xf8) << 2) | ((g & 0xf8) >> 3); break;
+                        case BGR: pixel = ((b & 0xf8) << 7) | ((g & 0xf8) << 2) | ((r & 0xf8) >> 3); break;
                     }
-                    case 16:
+                    gdk_image_put_pixel( data_image, x, y, pixel );
+                    break;
+                }
+                case 16:
+                {
+                    // I actually don't know if for 16-bit displays, it is alway the green
+                    // component or the second component which has 6 bits.
+                    guint32 pixel = 0;
+                    switch (b_o)
                     {
-                        // I actually don't know if for 16-bit displays, it is alway the green
-                        // component or the second component which has 6 bits.
-                        guint32 pixel = 0;
-                        switch (b_o)
-                        {
-                            case RGB: pixel = ((r & 0xf8) << 8) | ((g & 0xfc) << 3) | ((b & 0xf8) >> 3); break;
-                            case RBG: pixel = ((r & 0xf8) << 8) | ((b & 0xfc) << 3) | ((g & 0xf8) >> 3); break;
-                            case GRB: pixel = ((g & 0xf8) << 8) | ((r & 0xfc) << 3) | ((b & 0xf8) >> 3); break;
-                            case GBR: pixel = ((g & 0xf8) << 8) | ((b & 0xfc) << 3) | ((r & 0xf8) >> 3); break;
-                            case BRG: pixel = ((b & 0xf8) << 8) | ((r & 0xfc) << 3) | ((g & 0xf8) >> 3); break;
-                            case BGR: pixel = ((b & 0xf8) << 8) | ((g & 0xfc) << 3) | ((r & 0xf8) >> 3); break;
-                        }
-                        gdk_image_put_pixel( data_image, x, y, pixel );
-                        break;
+                        case RGB: pixel = ((r & 0xf8) << 8) | ((g & 0xfc) << 3) | ((b & 0xf8) >> 3); break;
+                        case RBG: pixel = ((r & 0xf8) << 8) | ((b & 0xfc) << 3) | ((g & 0xf8) >> 3); break;
+                        case GRB: pixel = ((g & 0xf8) << 8) | ((r & 0xfc) << 3) | ((b & 0xf8) >> 3); break;
+                        case GBR: pixel = ((g & 0xf8) << 8) | ((b & 0xfc) << 3) | ((r & 0xf8) >> 3); break;
+                        case BRG: pixel = ((b & 0xf8) << 8) | ((r & 0xfc) << 3) | ((g & 0xf8) >> 3); break;
+                        case BGR: pixel = ((b & 0xf8) << 8) | ((g & 0xfc) << 3) | ((r & 0xf8) >> 3); break;
                     }
-                    case 32:
-                    case 24:
+                    gdk_image_put_pixel( data_image, x, y, pixel );
+                    break;
+                }
+                case 32:
+                case 24:
+                {
+                    guint32 pixel = 0;
+                    switch (b_o)
                     {
-                        guint32 pixel = 0;
-                        switch (b_o)
-                        {
-                            case RGB: pixel = (r << 16) | (g << 8) | b; break;
-                            case RBG: pixel = (r << 16) | (b << 8) | g; break;
-                            case BRG: pixel = (b << 16) | (r << 8) | g; break;
-                            case BGR: pixel = (b << 16) | (g << 8) | r; break;
-                            case GRB: pixel = (g << 16) | (r << 8) | b; break;
-                            case GBR: pixel = (g << 16) | (b << 8) | r; break;
-                        }
-                        gdk_image_put_pixel( data_image, x, y, pixel );
+                        case RGB: pixel = (r << 16) | (g << 8) | b; break;
+                        case RBG: pixel = (r << 16) | (b << 8) | g; break;
+                        case BRG: pixel = (b << 16) | (r << 8) | g; break;
+                        case BGR: pixel = (b << 16) | (g << 8) | r; break;
+                        case GRB: pixel = (g << 16) | (r << 8) | b; break;
+                        case GBR: pixel = (g << 16) | (b << 8) | r; break;
                     }
-                    default: break;
+                    gdk_image_put_pixel( data_image, x, y, pixel );
                 }
-            } // for
-        }  // for
+                default: break;
+            }
+        } // for
+    }  // for
 
-        // Blit picture
+    // Blit picture
 
-        GdkGC *data_gc = gdk_gc_new( GetPixmap() );
+    GdkGC *data_gc = gdk_gc_new( GetPixmap() );
 
-        gdk_draw_image( GetPixmap(), data_gc, data_image, 0, 0, 0, 0, width, height );
+    gdk_draw_image( GetPixmap(), data_gc, data_image, 0, 0, 0, 0, width, height );
 
-        gdk_image_destroy( data_image );
-        gdk_gc_unref( data_gc );
+    gdk_image_destroy( data_image );
+    gdk_gc_unref( data_gc );
 
-        // Blit mask
+    // Blit mask
 
-        if (image.HasMask())
-        {
-            GdkGC *mask_gc = gdk_gc_new( GetMask()->GetBitmap() );
+    if (image.HasMask())
+    {
+        GdkGC *mask_gc = gdk_gc_new( GetMask()->GetBitmap() );
 
-            gdk_draw_image( GetMask()->GetBitmap(), mask_gc, mask_image, 0, 0, 0, 0, width, height );
+        gdk_draw_image( GetMask()->GetBitmap(), mask_gc, mask_image, 0, 0, 0, 0, width, height );
 
-            gdk_image_destroy( mask_image );
-            gdk_gc_unref( mask_gc );
-        }
+        gdk_image_destroy( mask_image );
+        gdk_gc_unref( mask_gc );
     }
 
-    return TRUE;
+    return true;
 }
 
-wxImage wxBitmap::ConvertToImage() const
+#ifdef __WXGTK20__
+bool wxBitmap::CreateFromImageAsPixbuf(const wxImage& image)
 {
-    // the colour used as transparent one in wxImage and the one it is replaced
-    // with when it really occurs in the bitmap
-    static const int MASK_RED = 1;
-    static const int MASK_GREEN = 2;
-    static const int MASK_BLUE = 3;
-    static const int MASK_BLUE_REPLACEMENT = 2;
+    int width = image.GetWidth();
+    int height = image.GetHeight();
 
-    wxImage image;
+    GdkPixbuf *pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB,
+                                       image.HasAlpha(),
+                                       8 /* bits per sample */,
+                                       width, height);
+    if (!pixbuf)
+        return false;
 
-    wxCHECK_MSG( Ok(), wxNullImage, wxT("invalid bitmap") );
+    wxASSERT( image.HasAlpha() ); // for now
+    wxASSERT( gdk_pixbuf_get_n_channels(pixbuf) == 4 );
+    wxASSERT( gdk_pixbuf_get_width(pixbuf) == width );
+    wxASSERT( gdk_pixbuf_get_height(pixbuf) == height );
+    
+    M_BMPDATA->m_pixbuf = pixbuf;
+    SetHeight(height);
+    SetWidth(width);
+    SetDepth(wxTheApp->GetGdkVisual()->depth);
+ 
+    // Copy the data:
+    unsigned char *in = image.GetData();
+    unsigned char *out = gdk_pixbuf_get_pixels(pixbuf);
+    unsigned char *alpha = image.GetAlpha();
+    
+    int rowinc = gdk_pixbuf_get_rowstride(pixbuf) - 4 * width;
 
-    GdkImage *gdk_image = (GdkImage*) NULL;
-    if (GetPixmap())
+    for (int y = 0; y < height; y++, out += rowinc)
     {
-        gdk_image = gdk_image_get( GetPixmap(),
-                                   0, 0,
-                                   GetWidth(), GetHeight() );
-    }
-    else if (GetBitmap())
-    {
-        gdk_image = gdk_image_get( GetBitmap(),
-                                   0, 0,
-                                   GetWidth(), GetHeight() );
-    }
-    else
-    {
-        wxFAIL_MSG( wxT("Ill-formed bitmap") );
+        for (int x = 0; x < width; x++, alpha++, out += 4, in += 3)
+        {
+            out[0] = in[0];
+            out[1] = in[1];
+            out[2] = in[2];
+            out[3] = *alpha;
+        }
     }
+    
+    return true;
+}
+#endif // __WXGTK20__
 
-    wxCHECK_MSG( gdk_image, wxNullImage, wxT("couldn't create image") );
+wxImage wxBitmap::ConvertToImage() const
+{
+    wxImage image;
 
-    image.Create( GetWidth(), GetHeight() );
-    char unsigned *data = image.GetData();
+    wxCHECK_MSG( Ok(), wxNullImage, wxT("invalid bitmap") );
+    
+    image.Create(GetWidth(), GetHeight());
+    unsigned char *data = image.GetData();
 
     if (!data)
     {
-        gdk_image_destroy( gdk_image );
         wxFAIL_MSG( wxT("couldn't create image") );
         return wxNullImage;
     }
 
-    GdkImage *gdk_image_mask = (GdkImage*) NULL;
-    if (GetMask())
+#ifdef __WXGTK20__
+    if (HasPixbuf())
     {
-        gdk_image_mask = gdk_image_get( GetMask()->GetBitmap(),
-                                        0, 0,
-                                        GetWidth(), GetHeight() );
+        GdkPixbuf *pixbuf = GetPixbuf();
+        wxASSERT( gdk_pixbuf_get_has_alpha(pixbuf) );
+        
+        int w = GetWidth();
+        int h = GetHeight();
+        
+        image.SetAlpha();
+
+        unsigned char *alpha = image.GetAlpha();
+        unsigned char *in = gdk_pixbuf_get_pixels(pixbuf);
+        unsigned char *out = data;
+        int rowinc = gdk_pixbuf_get_rowstride(pixbuf) - 4 * w;
 
-        image.SetMaskColour( MASK_RED, MASK_GREEN, MASK_BLUE );
+        for (int y = 0; y < h; y++, in += rowinc)
+        {
+            for (int x = 0; x < w; x++, in += 4, out += 3, alpha++)
+            {
+                out[0] = in[0];
+                out[1] = in[1];
+                out[2] = in[2];
+                *alpha = in[3];
+            }
+        }
     }
+    else
+#endif // __WXGTK20__
+    {
+        // the colour used as transparent one in wxImage and the one it is
+        // replaced with when it really occurs in the bitmap
+        static const int MASK_RED = 1;
+        static const int MASK_GREEN = 2;
+        static const int MASK_BLUE = 3;
+        static const int MASK_BLUE_REPLACEMENT = 2;
 
-    int bpp = -1;
-    int red_shift_right = 0;
-    int green_shift_right = 0;
-    int blue_shift_right = 0;
-    int red_shift_left = 0;
-    int green_shift_left = 0;
-    int blue_shift_left = 0;
-    bool use_shift = FALSE;
+        GdkImage *gdk_image = (GdkImage*) NULL;
 
-    if (GetPixmap())
-    {
-        GdkVisual *visual = gdk_window_get_visual( GetPixmap() );
-        if (visual == NULL)
-            visual = wxTheApp->GetGdkVisual();
+        if (HasPixmap())
+        {
+            gdk_image = gdk_image_get( GetPixmap(),
+                                       0, 0,
+                                       GetWidth(), GetHeight() );
+        }
+        else if (GetBitmap())
+        {
+            gdk_image = gdk_image_get( GetBitmap(),
+                                       0, 0,
+                                       GetWidth(), GetHeight() );
+        }
+        else
+        {
+            wxFAIL_MSG( wxT("Ill-formed bitmap") );
+        }
 
-        bpp = visual->depth;
-        if (bpp == 16)
-            bpp = visual->red_prec + visual->green_prec + visual->blue_prec;
-        red_shift_right = visual->red_shift;
-        red_shift_left = 8-visual->red_prec;
-        green_shift_right = visual->green_shift;
-        green_shift_left = 8-visual->green_prec;
-        blue_shift_right = visual->blue_shift;
-        blue_shift_left = 8-visual->blue_prec;
+        wxCHECK_MSG( gdk_image, wxNullImage, wxT("couldn't create image") );
 
-        use_shift = (visual->type == GDK_VISUAL_TRUE_COLOR) || (visual->type == GDK_VISUAL_DIRECT_COLOR);
-    }
-    if (GetBitmap())
-    {
-        bpp = 1;
-    }
+        GdkImage *gdk_image_mask = (GdkImage*) NULL;
+        if (GetMask())
+        {
+            gdk_image_mask = gdk_image_get( GetMask()->GetBitmap(),
+                                            0, 0,
+                                            GetWidth(), GetHeight() );
 
+            image.SetMaskColour( MASK_RED, MASK_GREEN, MASK_BLUE );
+        }
 
-    GdkColormap *cmap = gtk_widget_get_default_colormap();
+        int bpp = -1;
+        int red_shift_right = 0;
+        int green_shift_right = 0;
+        int blue_shift_right = 0;
+        int red_shift_left = 0;
+        int green_shift_left = 0;
+        int blue_shift_left = 0;
+        bool use_shift = FALSE;
 
-    long pos = 0;
-    for (int j = 0; j < GetHeight(); j++)
-    {
-        for (int i = 0; i < GetWidth(); i++)
+        if (GetPixmap())
         {
-            wxUint32 pixel = gdk_image_get_pixel( gdk_image, i, j );
-            if (bpp == 1)
+            GdkVisual *visual = gdk_window_get_visual( GetPixmap() );
+            if (visual == NULL)
+                visual = wxTheApp->GetGdkVisual();
+
+            bpp = visual->depth;
+            if (bpp == 16)
+                bpp = visual->red_prec + visual->green_prec + visual->blue_prec;
+            red_shift_right = visual->red_shift;
+            red_shift_left = 8-visual->red_prec;
+            green_shift_right = visual->green_shift;
+            green_shift_left = 8-visual->green_prec;
+            blue_shift_right = visual->blue_shift;
+            blue_shift_left = 8-visual->blue_prec;
+
+            use_shift = (visual->type == GDK_VISUAL_TRUE_COLOR) || (visual->type == GDK_VISUAL_DIRECT_COLOR);
+        }
+        if (GetBitmap())
+        {
+            bpp = 1;
+        }
+
+
+        GdkColormap *cmap = gtk_widget_get_default_colormap();
+
+        long pos = 0;
+        for (int j = 0; j < GetHeight(); j++)
+        {
+            for (int i = 0; i < GetWidth(); i++)
             {
-                if (pixel == 0)
+                wxUint32 pixel = gdk_image_get_pixel( gdk_image, i, j );
+                if (bpp == 1)
                 {
-                    data[pos]   = 0;
-                    data[pos+1] = 0;
-                    data[pos+2] = 0;
+                    if (pixel == 0)
+                    {
+                        data[pos]   = 0;
+                        data[pos+1] = 0;
+                        data[pos+2] = 0;
+                    }
+                    else
+                    {
+                        data[pos]   = 255;
+                        data[pos+1] = 255;
+                        data[pos+2] = 255;
+                    }
                 }
-                else
+                else if (use_shift)
                 {
-                    data[pos]   = 255;
-                    data[pos+1] = 255;
-                    data[pos+2] = 255;
+                    data[pos] =   (pixel >> red_shift_right)   << red_shift_left;
+                    data[pos+1] = (pixel >> green_shift_right) << green_shift_left;
+                    data[pos+2] = (pixel >> blue_shift_right)  << blue_shift_left;
                 }
-            }
-            else if (use_shift)
-            {
-                data[pos] =   (pixel >> red_shift_right)   << red_shift_left;
-                data[pos+1] = (pixel >> green_shift_right) << green_shift_left;
-                data[pos+2] = (pixel >> blue_shift_right)  << blue_shift_left;
-            }
-            else if (cmap->colors)
-            {
-                data[pos] =   cmap->colors[pixel].red   >> 8;
-                data[pos+1] = cmap->colors[pixel].green >> 8;
-                data[pos+2] = cmap->colors[pixel].blue  >> 8;
-            }
-            else
-            {
-                wxFAIL_MSG( wxT("Image conversion failed. Unknown visual type.") );
-            }
-
-            if (gdk_image_mask)
-            {
-                int mask_pixel = gdk_image_get_pixel( gdk_image_mask, i, j );
-                if (mask_pixel == 0)
+                else if (cmap->colors)
                 {
-                    data[pos] = MASK_RED;
-                    data[pos+1] = MASK_GREEN;
-                    data[pos+2] = MASK_BLUE;
+                    data[pos] =   cmap->colors[pixel].red   >> 8;
+                    data[pos+1] = cmap->colors[pixel].green >> 8;
+                    data[pos+2] = cmap->colors[pixel].blue  >> 8;
                 }
-                else if ( data[pos] == MASK_RED &&
-                            data[pos+1] == MASK_GREEN &&
-                                data[pos+2] == MASK_BLUE )
+                else
                 {
-                    data[pos+2] = MASK_BLUE_REPLACEMENT;
+                    wxFAIL_MSG( wxT("Image conversion failed. Unknown visual type.") );
                 }
-            }
 
-            pos += 3;
+                if (gdk_image_mask)
+                {
+                    int mask_pixel = gdk_image_get_pixel( gdk_image_mask, i, j );
+                    if (mask_pixel == 0)
+                    {
+                        data[pos] = MASK_RED;
+                        data[pos+1] = MASK_GREEN;
+                        data[pos+2] = MASK_BLUE;
+                    }
+                    else if ( data[pos] == MASK_RED &&
+                                data[pos+1] == MASK_GREEN &&
+                                    data[pos+2] == MASK_BLUE )
+                    {
+                        data[pos+2] = MASK_BLUE_REPLACEMENT;
+                    }
+                }
+
+                pos += 3;
+            }
         }
-    }
 
-    gdk_image_destroy( gdk_image );
-    if (gdk_image_mask) gdk_image_destroy( gdk_image_mask );
+        gdk_image_destroy( gdk_image );
+        if (gdk_image_mask) gdk_image_destroy( gdk_image_mask );
+    }
 
     return image;
 }
@@ -1079,7 +1209,13 @@
 
 bool wxBitmap::Ok() const
 {
-    return (m_refData != NULL) && (M_BMPDATA->m_bitmap || M_BMPDATA->m_pixmap);
+    return (m_refData != NULL) && 
+           (
+#ifdef __WXGTK20__
+              M_BMPDATA->m_pixbuf ||
+#endif
+              M_BMPDATA->m_bitmap || M_BMPDATA->m_pixmap 
+           );
 }
 
 int wxBitmap::GetHeight() const
@@ -1135,22 +1271,37 @@
     wxBitmap ret( rect.width, rect.height, M_BMPDATA->m_bpp );
     wxASSERT_MSG( ret.Ok(), wxT("GetSubBitmap error") );
 
-    if (ret.GetPixmap())
+#ifdef __WXGTK20__
+    if (HasPixbuf())
     {
-        GdkGC *gc = gdk_gc_new( ret.GetPixmap() );
-        gdk_draw_pixmap( ret.GetPixmap(), gc, GetPixmap(), rect.x, rect.y, 0, 0, rect.width, rect.height );
-        gdk_gc_destroy( gc );
+        GdkPixbuf *pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB,
+                                           gdk_pixbuf_get_has_alpha(GetPixbuf()),
+                                           8, GetWidth(), GetHeight());
+        ret.SetPixbuf(pixbuf);
+        gdk_pixbuf_copy_area(GetPixbuf(),
+                             rect.x, rect.y, rect.width, rect.height,
+                             pixbuf, 0, 0);
     }
     else
+#endif // __WXGTK20__
     {
-        GdkGC *gc = gdk_gc_new( ret.GetBitmap() );
-        GdkColor col;
-        col.pixel = 0xFFFFFF;
-        gdk_gc_set_foreground( gc, &col );
-        col.pixel = 0;
-        gdk_gc_set_background( gc, &col );
-        gdk_wx_draw_bitmap( ret.GetBitmap(), gc, GetBitmap(), rect.x, rect.y, 0, 0, rect.width, rect.height );
-        gdk_gc_destroy( gc );
+        if (ret.GetPixmap())
+        {
+            GdkGC *gc = gdk_gc_new( ret.GetPixmap() );
+            gdk_draw_pixmap( ret.GetPixmap(), gc, GetPixmap(), rect.x, rect.y, 0, 0, rect.width, rect.height );
+            gdk_gc_destroy( gc );
+        }
+        else
+        {
+            GdkGC *gc = gdk_gc_new( ret.GetBitmap() );
+            GdkColor col;
+            col.pixel = 0xFFFFFF;
+            gdk_gc_set_foreground( gc, &col );
+            col.pixel = 0;
+            gdk_gc_set_background( gc, &col );
+            gdk_wx_draw_bitmap( ret.GetBitmap(), gc, GetBitmap(), rect.x, rect.y, 0, 0, rect.width, rect.height );
+            gdk_gc_destroy( gc );
+        }
     }
 
     if (GetMask())
@@ -1269,6 +1420,9 @@
         m_refData = new wxBitmapRefData();
 
     M_BMPDATA->m_pixmap = pixmap;
+#ifdef __WXGTK20__
+    PurgeOtherRepresentations(Pixmap);
+#endif
 }
 
 void wxBitmap::SetBitmap( GdkPixmap *bitmap )
@@ -1277,18 +1431,123 @@
         m_refData = new wxBitmapRefData();
 
     M_BMPDATA->m_bitmap = bitmap;
+#ifdef __WXGTK20__
+    PurgeOtherRepresentations(Pixmap);
+#endif
 }
 
 GdkPixmap *wxBitmap::GetPixmap() const
 {
     wxCHECK_MSG( Ok(), (GdkPixmap *) NULL, wxT("invalid bitmap") );
 
+#ifdef __WXGTK20__
+    // create the pixmap on the fly if we use Pixbuf representation:
+    if (HasPixbuf() && !HasPixmap())
+    {
+        delete M_BMPDATA->m_mask;
+        M_BMPDATA->m_mask = new wxMask();
+        gdk_pixbuf_render_pixmap_and_mask(M_BMPDATA->m_pixbuf,
+                                          &M_BMPDATA->m_pixmap,
+                                          &M_BMPDATA->m_mask->m_bitmap,
+                                          128 /*threshold*/);
+    }
+#endif // __WXGTK20__
+
     return M_BMPDATA->m_pixmap;
 }
 
+bool wxBitmap::HasPixmap() const
+{
+    wxCHECK_MSG( Ok(), false, wxT("invalid bitmap") );
+
+    return M_BMPDATA->m_pixmap != NULL;
+}
+
 GdkBitmap *wxBitmap::GetBitmap() const
 {
     wxCHECK_MSG( Ok(), (GdkBitmap *) NULL, wxT("invalid bitmap") );
 
     return M_BMPDATA->m_bitmap;
 }
+
+#ifdef __WXGTK20__
+GdkPixbuf *wxBitmap::GetPixbuf() const
+{
+    wxCHECK_MSG( Ok(), NULL, wxT("invalid bitmap") );
+
+    if (HasPixmap() && !HasPixbuf())
+    {
+        int width = GetWidth();
+        int height = GetHeight();
+        
+        GdkPixbuf *pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB,
+                                           GetMask() != NULL,
+                                           8, width, height);
+        M_BMPDATA->m_pixbuf = 
+            gdk_pixbuf_get_from_drawable(pixbuf, M_BMPDATA->m_pixmap, NULL,
+                                         0, 0, 0, 0, width, height);
+        
+        // apply the mask to created pixbuf:
+        if (M_BMPDATA->m_pixbuf && M_BMPDATA->m_mask)
+        {
+            GdkPixbuf *pmask = 
+                gdk_pixbuf_get_from_drawable(NULL,
+                                             M_BMPDATA->m_mask->GetBitmap(),
+                                             NULL,
+                                             0, 0, 0, 0, width, height);
+            if (pmask)
+            {
+                guchar *bmp = gdk_pixbuf_get_pixels(pixbuf);
+                guchar *mask = gdk_pixbuf_get_pixels(pmask);
+                int bmprowinc = gdk_pixbuf_get_rowstride(pixbuf) - 4 * width;
+                int maskrowinc = gdk_pixbuf_get_rowstride(pmask) - 3 * width;
+
+                for (int y = 0; y < height;
+                     y++, bmp += bmprowinc, mask += maskrowinc)
+                {
+                    for (int x = 0; x < width; x++, bmp += 4, mask += 3)
+                    {
+                        if (mask[0] == 0 /*black pixel*/)
+                            bmp[3] = 0;
+                    }
+                }
+                    
+                gdk_pixbuf_unref(pmask);
+            }
+        }
+    }
+
+    return M_BMPDATA->m_pixbuf;
+}
+
+bool wxBitmap::HasPixbuf() const
+{
+    wxCHECK_MSG( Ok(), false, wxT("invalid bitmap") );
+
+    return M_BMPDATA->m_pixbuf != NULL;
+}
+
+void wxBitmap::SetPixbuf( GdkPixbuf *pixbuf )
+{
+    if (!m_refData)
+        m_refData = new wxBitmapRefData();
+
+    M_BMPDATA->m_pixbuf = pixbuf;
+    PurgeOtherRepresentations(Pixbuf);
+}
+
+void wxBitmap::PurgeOtherRepresentations(wxBitmap::Representation keep)
+{
+    if (keep == Pixmap && HasPixbuf())
+    {
+        gdk_pixbuf_unref( M_BMPDATA->m_pixbuf );
+        M_BMPDATA->m_pixbuf = NULL;
+    }
+    if (keep == Pixbuf && HasPixmap())
+    {
+        gdk_pixmap_unref( M_BMPDATA->m_pixmap );
+        M_BMPDATA->m_pixmap = NULL;
+    }
+}
+
+#endif // __WXGTK20__

Index: internal/wxPython-2.5/src/gtk/window.cpp
diff -u internal/wxPython-2.5/src/gtk/window.cpp:2.1.5.1 internal/wxPython-2.5/src/gtk/window.cpp:2.1.5.1.4.1
--- internal/wxPython-2.5/src/gtk/window.cpp:2.1.5.1	Thu Apr  8 18:16:30 2004
+++ internal/wxPython-2.5/src/gtk/window.cpp	Mon Sep 13 18:11:47 2004
@@ -2,7 +2,7 @@
 // Name:        gtk/window.cpp
 // Purpose:
 // Author:      Robert Roebling
-// Id:          $Id: window.cpp,v 2.1.5.1 2004/04/09 01:16:30 markie Exp $
+// Id:          $Id: window.cpp,v 2.1.5.1.4.1 2004/09/14 01:11:47 heikki Exp $
 // Copyright:   (c) 1998 Robert Roebling, Julian Smart
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
@@ -95,7 +95,7 @@
 
 /*
    I have been asked several times about writing some documentation about
-   the GTK port of wxWindows, especially its internal structures. Obviously,
+   the GTK port of wxWidgets, especially its internal structures. Obviously,
    you cannot understand wxGTK without knowing a little about the GTK, but
    some more information about what the wxWindow, which is the base class
    for all other window classes, does seems required as well.
@@ -129,14 +129,14 @@
 
    6) Display a border (sunken, raised, simple or none).
 
-   Normally one might expect, that one wxWindows window would always correspond
+   Normally one might expect, that one wxWidgets window would always correspond
    to one GTK widget. Under GTK, there is no such allround widget that has all
    the functionality. Moreover, the GTK defines a client area as a different
    widget from the actual widget you are handling. Last but not least some
    special classes (e.g. wxFrame) handle different categories of widgets and
    still have the possibility to draw something in the client area.
    It was therefore required to write a special purpose GTK widget, that would
-   represent a client area in the sense of wxWindows capable to do the jobs
+   represent a client area in the sense of wxWidgets capable to do the jobs
    2), 3) and 4). I have written this class and it resides in win_gtk.c of
    this directory.
 
@@ -145,7 +145,7 @@
    thw wxWindow class has a member variable called m_widget which holds a
    pointer to this widget. When the window class represents a GTK native widget,
    this is (in most cases) the only GTK widget the class manages. E.g. the
-   wxStatitText class handles only a GtkLabel widget a pointer to which you
+   wxStaticText class handles only a GtkLabel widget a pointer to which you
    can find in m_widget (defined in wxWindow)
 
    When the class has a client area for drawing into and for containing children
@@ -165,18 +165,18 @@
    one is (in the GTK sense) a child of the GtkScrolledWindow.
 
    If the m_wxwindow field is set, then all input to this widget is inter-
-   cepted and sent to the wxWindows class. If not, all input to the widget
+   cepted and sent to the wxWidgets class. If not, all input to the widget
    that gets pointed to by m_widget gets intercepted and sent to the class.
 
    II)
 
-   The design of scrolling in wxWindows is markedly different from that offered
+   The design of scrolling in wxWidgets is markedly different from that offered
    by the GTK itself and therefore we cannot simply take it as it is. In GTK,
    clicking on a scrollbar belonging to scrolled window will inevitably move
-   the window. In wxWindows, the scrollbar will only emit an event, send this
+   the window. In wxWidgets, the scrollbar will only emit an event, send this
    to (normally) a wxScrolledWindow and that class will call ScrollWindow()
    which actually moves the window and its subchildren. Note that GtkPizza
-   memorizes how much it has been scrolled but that wxWindows forgets this
+   memorizes how much it has been scrolled but that wxWidgets forgets this
    so that the two coordinates systems have to be kept in synch. This is done
    in various places using the pizza->xoffset and pizza->yoffset values.
 
@@ -267,10 +267,6 @@
 // debug
 //-----------------------------------------------------------------------------
 
-#ifndef __WXGTK20__
-#define DISABLE_STYLE_IF_BROKEN_THEME 0
-#endif
-
 #ifdef __WXDEBUG__
 
 #if wxUSE_THREADS
@@ -636,7 +632,7 @@
 #ifndef __WXUNIVERSAL__
     GtkPizza *pizza = GTK_PIZZA (widget);
 
-    if (win->GetThemeEnabled())
+    if (win->GetThemeEnabled() && win->GetBackgroundStyle() == wxBG_STYLE_SYSTEM)
     {
         wxWindow *parent = win->GetParent();
         while (parent && !parent->IsTopLevel())
@@ -969,6 +965,30 @@
     return ks < 256;
 }
 
+static void wxFillOtherKeyEventFields(wxKeyEvent& event,
+                                      wxWindowGTK *win,
+                                      GdkEventKey *gdk_event)
+{
+    int x = 0;
+    int y = 0;
+    GdkModifierType state;
+    if (gdk_event->window)
+        gdk_window_get_pointer(gdk_event->window, &x, &y, &state);
+
+    event.SetTimestamp( gdk_event->time );
+    event.m_shiftDown = (gdk_event->state & GDK_SHIFT_MASK) != 0;
+    event.m_controlDown = (gdk_event->state & GDK_CONTROL_MASK) != 0;
+    event.m_altDown = (gdk_event->state & GDK_MOD1_MASK) != 0;
+    event.m_metaDown = (gdk_event->state & GDK_MOD2_MASK) != 0;
+    event.m_scanCode = gdk_event->keyval;
+    event.m_rawCode = (wxUint32) gdk_event->keyval;
+    event.m_rawFlags = 0;
+    event.m_x = x;
+    event.m_y = y;
+    event.SetEventObject( win );
+}
+
+
 static bool
 wxTranslateGTKKeyEventToWx(wxKeyEvent& event,
                            wxWindowGTK *win,
@@ -1064,29 +1084,32 @@
         return FALSE;
 
     // now fill all the other fields
-    int x = 0;
-    int y = 0;
-    GdkModifierType state;
-    if (gdk_event->window)
-        gdk_window_get_pointer(gdk_event->window, &x, &y, &state);
-
-    event.SetTimestamp( gdk_event->time );
-    event.m_shiftDown = (gdk_event->state & GDK_SHIFT_MASK) != 0;
-    event.m_controlDown = (gdk_event->state & GDK_CONTROL_MASK) != 0;
-    event.m_altDown = (gdk_event->state & GDK_MOD1_MASK) != 0;
-    event.m_metaDown = (gdk_event->state & GDK_MOD2_MASK) != 0;
+    wxFillOtherKeyEventFields(event, win, gdk_event);
+    
     event.m_keyCode = key_code;
-    event.m_scanCode = gdk_event->keyval;
-    event.m_rawCode = (wxUint32) gdk_event->keyval;
-    event.m_rawFlags = 0;
-    event.m_x = x;
-    event.m_y = y;
-    event.SetEventObject( win );
 
     return TRUE;
 }
 
 
+#ifdef __WXGTK20__
+struct wxGtkIMData
+{
+    GtkIMContext *context;
+    GdkEventKey  *lastKeyEvent;
+
+    wxGtkIMData()
+    {
+        context = gtk_im_multicontext_new();
+        lastKeyEvent = NULL;
+    }
+    ~wxGtkIMData()
+    {
+        g_object_unref(context);
+    }
+};
+#endif
+
 static gint gtk_window_key_press_callback( GtkWidget *widget,
                                            GdkEventKey *gdk_event,
                                            wxWindow *win )
@@ -1100,12 +1123,43 @@
         return FALSE;
     if (g_blockEventsOnDrag)
         return FALSE;
-
-
+    
+#ifdef __WXGTK20__
+    // We have to pass key press events through GTK+'s Input Method context
+    // object in order to get correct characters. By doing so, we loose the
+    // ability to let other GTK+'s handlers (namely, widgets' default signal
+    // handlers) handle the signal by returning false from this callback.
+    // Because GTK+ sends the events to parent widgets as well, we can't
+    // afford loosing it, otherwise native widgets inserted into wxPanel
+    // would break in subtle ways (e.g. spacebar would no longer toggle
+    // wxCheckButton's state). Therefore, we only pass the event to IM if it
+    // originated in this window's widget, which we detect by checking if we've
+    // seen the same event before (no events from children are lost this way,
+    // because gtk_window_key_press_callback is installed for native controls
+    // as well and the wxKeyEvent it creates propagates upwards).
+    static GdkEventKey s_lastEvent;
+    
+    bool useIM = (win->m_imData != NULL) &&
+                 memcmp(gdk_event, &s_lastEvent, sizeof(GdkEventKey)) != 0;
+    
+    s_lastEvent = *gdk_event;
+#endif
+    
     wxKeyEvent event( wxEVT_KEY_DOWN );
     if ( !wxTranslateGTKKeyEventToWx(event, win, gdk_event) )
     {
         // unknown key pressed, ignore (the event would be useless anyhow)
+#ifdef __WXGTK20__
+        if ( useIM )
+        {
+            // it may be useful for the input method, though:
+            win->m_imData->lastKeyEvent = gdk_event;
+            bool ret = gtk_im_context_filter_keypress(win->m_imData->context,
+                                                      gdk_event);
+            win->m_imData->lastKeyEvent = NULL;
+            return ret;
+        }
+#endif
         return FALSE;
     }
 
@@ -1136,58 +1190,63 @@
     // will only be sent if it is not in an accelerator table.
     if (!ret)
     {
-        long key_code;
-        KeySym keysym = gdk_event->keyval;
 #ifdef __WXGTK20__
-        // In GTK 2.0, we need to hand over the key event to an input method
-        // and the IM will emit a "commit" event containing the actual utf8
-        // character.  In that case the EVT_CHAR events will be sent from
-        // there.  But only do it this way for non-KeySym keys.
-        key_code = wxTranslateKeySymToWXKey(gdk_event->keyval, FALSE /* isChar */);
-        if ( !key_code && win->m_imContext )
+        if (useIM)
         {
-            gtk_im_context_filter_keypress ( (GtkIMContext*) win->m_imContext, gdk_event );
-            ret = TRUE;
+            // In GTK 2.0, we need to hand over the key event to an input method
+            // and the IM will emit a "commit" event containing the actual utf8
+            // character.  In that case the EVT_CHAR events will be sent from
+            // there.
+            win->m_imData->lastKeyEvent = gdk_event;
+            if ( gtk_im_context_filter_keypress(win->m_imData->context,
+                                                gdk_event) )
+            {
+                win->m_imData->lastKeyEvent = NULL;
+                wxLogTrace(TRACE_KEYS, _T("Key event intercepted by IM"));
+                return TRUE;
+            }
+            else
+                win->m_imData->lastKeyEvent = NULL;
         }
-        else
 #endif
+
+        long key_code;
+        KeySym keysym = gdk_event->keyval;
+        // Find key code for EVT_CHAR and EVT_CHAR_HOOK events
+        key_code = wxTranslateKeySymToWXKey(keysym, TRUE /* isChar */);
+        if ( !key_code )
         {
-            // Find key code for EVT_CHAR and EVT_CHAR_HOOK events
-            key_code = wxTranslateKeySymToWXKey(keysym, TRUE /* isChar */);
-            if ( !key_code )
+            if ( gdk_event->length == 1 )
             {
-                if ( gdk_event->length == 1 )
-                {
-                    key_code = (unsigned char)gdk_event->string[0];
-                }
-                else if ( wxIsAsciiKeysym(keysym) )
-                {
-                    // ASCII key
-                    key_code = (unsigned char)keysym;
-                }
+                key_code = (unsigned char)gdk_event->string[0];
             }
-
-            if ( key_code )
+            else if ( wxIsAsciiKeysym(keysym) )
             {
-                wxLogTrace(TRACE_KEYS, _T("Char event: %ld"), key_code);
+                // ASCII key
+                key_code = (unsigned char)keysym;
+            }
+        }
 
-                event.m_keyCode = key_code;
+        if ( key_code )
+        {
+            wxLogTrace(TRACE_KEYS, _T("Char event: %ld"), key_code);
 
-                // Implement OnCharHook by checking ancesteror top level windows
-                wxWindow *parent = win;
-                while (parent && !parent->IsTopLevel())
-                    parent = parent->GetParent();
-                if (parent)
-                {
-                    event.SetEventType( wxEVT_CHAR_HOOK );
-                    ret = parent->GetEventHandler()->ProcessEvent( event );
-                }
+            event.m_keyCode = key_code;
 
-                if (!ret)
-                {
-                    event.SetEventType(wxEVT_CHAR);
-                    ret = win->GetEventHandler()->ProcessEvent( event );
-                }
+            // Implement OnCharHook by checking ancesteror top level windows
+            wxWindow *parent = win;
+            while (parent && !parent->IsTopLevel())
+                parent = parent->GetParent();
+            if (parent)
+            {
+                event.SetEventType( wxEVT_CHAR_HOOK );
+                ret = parent->GetEventHandler()->ProcessEvent( event );
+            }
+
+            if (!ret)
+            {
+                event.SetEventType(wxEVT_CHAR);
+                ret = win->GetEventHandler()->ProcessEvent( event );
             }
         }
     }
@@ -1198,9 +1257,12 @@
 // VZ: testing for wxTE_PROCESS_TAB shouldn't be done here the control may
 //     have this style, yet choose not to process this particular TAB in which
 //     case TAB must still work as a navigational character
-#if 0
-         !win->HasFlag(wxTE_PROCESS_TAB) &&
-#endif // 0
+// JS: enabling again to make consistent with other platforms
+//     (with wxTE_PROCESS_TAB you have to call Navigate to get default
+//     navigation behaviour)
+#if wxUSE_TEXTCTRL
+         (! (win->HasFlag(wxTE_PROCESS_TAB) && win->IsKindOf(CLASSINFO(wxTextCtrl)) )) &&
+#endif
          win->GetParent() && (win->GetParent()->HasFlag( wxTAB_TRAVERSAL)) )
     {
         wxNavigationKeyEvent new_event;
@@ -1264,43 +1326,53 @@
                            const gchar  *str,
                            wxWindow     *window)
 {
-    bool ret = FALSE;
-
     wxKeyEvent event( wxEVT_KEY_DOWN );
 
-#if wxUSE_UNICODE
-    event.m_uniChar = g_utf8_get_char( str );
+    // take modifiers, cursor position, timestamp etc. from the last
+    // key_press_event that was fed into Input Method:
+    if (window->m_imData->lastKeyEvent)
+    {
+        wxFillOtherKeyEventFields(event,
+                                  window, window->m_imData->lastKeyEvent);
+    }
 
-    // Backward compatible for ISO-8859
-    if (event.m_uniChar < 256)
-        event.m_keyCode = event.m_uniChar;
+#if wxUSE_UNICODE
+    const wxWCharBuffer data = wxConvUTF8.cMB2WC( (char*)str );
 #else
-    gunichar uniChar = g_utf8_get_char( str );
-    // We cannot handle Unicode in non-Unicode mode
-    if (uniChar > 255) return;
-
-    event.m_keyCode = uniChar;
-#endif
-
-
-    // TODO:  We still need to set all the extra attributes of the
-    //        event, modifiers and such...
+    const wxWCharBuffer wdata = wxConvUTF8.cMB2WC( (char*)str );
+    const wxCharBuffer data = wxConvLocal.cWC2MB( wdata );
+#endif // wxUSE_UNICODE
+    if( !(const wxChar*)data )
+        return;
 
+    bool ret = false;
 
     // Implement OnCharHook by checking ancestor top level windows
     wxWindow *parent = window;
     while (parent && !parent->IsTopLevel())
         parent = parent->GetParent();
-    if (parent)
-    {
-        event.SetEventType( wxEVT_CHAR_HOOK );
-        ret = parent->GetEventHandler()->ProcessEvent( event );
-    }
 
-    if (!ret)
+    for( const wxChar* pstr = data; *pstr; pstr++ )
     {
-        event.SetEventType(wxEVT_CHAR);
-        ret = window->GetEventHandler()->ProcessEvent( event );
+#if wxUSE_UNICODE
+        event.m_uniChar = *pstr;
+        // Backward compatible for ISO-8859
+        event.m_keyCode = *pstr < 256 ? event.m_uniChar : 0;
+        wxLogTrace(TRACE_KEYS, _T("IM sent character '%c'"), event.m_uniChar);
+#else
+        event.m_keyCode = *pstr;
+#endif  // wxUSE_UNICODE
+        if (parent)
+        {
+            event.SetEventType( wxEVT_CHAR_HOOK );
+            ret = parent->GetEventHandler()->ProcessEvent( event );
+        }
+
+        if (!ret)
+        {
+            event.SetEventType(wxEVT_CHAR);
+            ret = window->GetEventHandler()->ProcessEvent( event );
+        }
     }
 }
 #endif
@@ -1347,39 +1419,37 @@
 // mouse event processing helpers
 // ----------------------------------------------------------------------------
 
-// init wxMouseEvent with the info from gdk_event
-//
-// NB: this has to be a macro as gdk_event type is different for different
-//     events we're used with
-#define InitMouseEvent(/* wxWindowGTK * */ win,                               \
-                       /* wxMouseEvent& */ event,                             \
-                       /* GdkEventXXX * */ gdk_event)                         \
-{                                                                             \
-    event.SetTimestamp( gdk_event->time );                                    \
-    event.m_shiftDown = (gdk_event->state & GDK_SHIFT_MASK);                  \
-    event.m_controlDown = (gdk_event->state & GDK_CONTROL_MASK);              \
-    event.m_altDown = (gdk_event->state & GDK_MOD1_MASK);                     \
-    event.m_metaDown = (gdk_event->state & GDK_MOD2_MASK);                    \
-    event.m_leftDown = (gdk_event->state & GDK_BUTTON1_MASK);                 \
-    event.m_middleDown = (gdk_event->state & GDK_BUTTON2_MASK);               \
-    event.m_rightDown = (gdk_event->state & GDK_BUTTON3_MASK);                \
-    if (event.GetEventType()==wxEVT_MOUSEWHEEL)                               \
-    {                                                                         \
-       event.m_linesPerAction = 3;                                            \
-       if (((GdkEventButton*)gdk_event)->button == 4)                         \
-           event.m_wheelRotation = 120;                                       \
-       else if (((GdkEventButton*)gdk_event)->button == 5)                    \
-           event.m_wheelRotation = -120;                                      \
-    }                                                                         \
-                                                                              \
-    wxPoint pt = win->GetClientAreaOrigin();                                  \
-    event.m_x = (wxCoord)gdk_event->x - pt.x;                                 \
-    event.m_y = (wxCoord)gdk_event->y - pt.y;                                 \
-                                                                              \
-    event.SetEventObject( win );                                              \
-    event.SetId( win->GetId() );                                              \
-    event.SetTimestamp( gdk_event->time );                                    \
-}                                                                             \
+// init wxMouseEvent with the info from GdkEventXXX struct
+template<typename T> void InitMouseEvent(wxWindowGTK *win,
+                                         wxMouseEvent& event,
+                                         T *gdk_event)
+{
+    event.SetTimestamp( gdk_event->time );
+    event.m_shiftDown = (gdk_event->state & GDK_SHIFT_MASK);
+    event.m_controlDown = (gdk_event->state & GDK_CONTROL_MASK);
+    event.m_altDown = (gdk_event->state & GDK_MOD1_MASK);
+    event.m_metaDown = (gdk_event->state & GDK_MOD2_MASK);
+    event.m_leftDown = (gdk_event->state & GDK_BUTTON1_MASK);
+    event.m_middleDown = (gdk_event->state & GDK_BUTTON2_MASK);
+    event.m_rightDown = (gdk_event->state & GDK_BUTTON3_MASK);
+    if (event.GetEventType() == wxEVT_MOUSEWHEEL)
+    {
+       event.m_linesPerAction = 3;
+       event.m_wheelDelta = 120;
+       if (((GdkEventButton*)gdk_event)->button == 4)
+           event.m_wheelRotation = 120;
+       else if (((GdkEventButton*)gdk_event)->button == 5)
+           event.m_wheelRotation = -120;
+    }
+
+    wxPoint pt = win->GetClientAreaOrigin();
+    event.m_x = (wxCoord)gdk_event->x - pt.x;
+    event.m_y = (wxCoord)gdk_event->y - pt.y;
+
+    event.SetEventObject( win );
+    event.SetId( win->GetId() );
+    event.SetTimestamp( gdk_event->time );
+}
 
 static void AdjustEventButtonState(wxMouseEvent& event)
 {
@@ -1538,8 +1608,8 @@
 
     wxEventType event_type = wxEVT_NULL;
 
-    // GdkDisplay is a GTK+ 2.1.0 thing
-#if defined(__WXGTK20__) && GTK_CHECK_VERSION(2, 1, 0)
+    // GdkDisplay is a GTK+ 2.2.0 thing
+#if defined(__WXGTK20__) && GTK_CHECK_VERSION(2, 2, 0)
     if ( gdk_event->type == GDK_2BUTTON_PRESS &&
             gdk_event->button >= 1 && gdk_event->button <= 3 )
     {
@@ -1555,7 +1625,7 @@
     if (gdk_event->button == 1)
     {
         // note that GDK generates triple click events which are not supported
-        // by wxWindows but still have to be passed to the app as otherwise
+        // by wxWidgets but still have to be passed to the app as otherwise
         // clicks would simply go missing
         switch (gdk_event->type)
         {
@@ -1634,6 +1704,21 @@
     // a chance to correct this
     win->FixUpMouseEvent(widget, event.m_x, event.m_y);
 
+    if ( event_type == wxEVT_RIGHT_DOWN )
+    {
+        // generate a "context menu" event: this is similar to right mouse
+        // click under many GUIs except that it is generated differently
+        // (right up under MSW, ctrl-click under Mac, right down here) and
+        //
+        // (a) it's a command event and so is propagated to the parent
+        // (b) under MSW it can be generated from kbd too
+        // (c) it uses screen coords (because of (a))
+        wxContextMenuEvent evtCtx(wxEVT_CONTEXT_MENU,
+                                  win->GetId(),
+                                  win->ClientToScreen(event.GetPosition()));
+        (void)win->GetEventHandler()->ProcessEvent(evtCtx);
+    }
+
     // find the correct window to send the event too: it may be a different one
     // from the one which got it at GTK+ level because some control don't have
     // their own X window and thus cannot get any events.
@@ -1642,13 +1727,6 @@
 
     gs_timeLastClick = gdk_event->time;
 
-/*
-    wxPrintf( wxT("2) OnButtonPress from ") );
-    if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
-        wxPrintf( win->GetClassInfo()->GetClassName() );
-    wxPrintf( wxT(".\n") );
-*/
-
 #ifndef __WXGTK20__
     if (event_type == wxEVT_LEFT_DCLICK)
     {
@@ -1720,20 +1798,6 @@
     // same wxListBox hack as above
     win->FixUpMouseEvent(widget, event.m_x, event.m_y);
 
-    if ( event_type == wxEVT_RIGHT_UP )
-    {
-        // generate a "context menu" event: this is similar to wxEVT_RIGHT_UP
-        // except that:
-        //
-        // (a) it's a command event and so is propagated to the parent
-        // (b) under MSW it can be generated from kbd too
-        // (c) it uses screen coords (because of (a))
-        wxContextMenuEvent evtCtx(wxEVT_CONTEXT_MENU,
-                                  win->GetId(),
-                                  win->ClientToScreen(event.GetPosition()));
-        (void)win->GetEventHandler()->ProcessEvent(evtCtx);
-    }
-
     if ( !g_captureWindow )
         win = FindWindowForMouseEvent(win, event.m_x, event.m_y);
 
@@ -1853,6 +1917,7 @@
     event.m_middleDown = (gdk_event->state & GDK_BUTTON2_MASK);
     event.m_rightDown = (gdk_event->state & GDK_BUTTON3_MASK);
     event.m_linesPerAction = 3;
+    event.m_wheelDelta = 120;
     if (gdk_event->direction == GDK_SCROLL_UP)
         event.m_wheelRotation = 120;
     else
@@ -1904,6 +1969,11 @@
     if (g_isIdle)
         wxapp_install_idle_handler();
 
+#ifdef __WXGTK20__
+    if (win->m_imData)
+        gtk_im_context_focus_in(win->m_imData->context);
+#endif
+
     if (!win->m_hasVMT) return FALSE;
     if (g_blockEventsOnDrag) return FALSE;
 
@@ -1992,6 +2062,11 @@
     if (g_isIdle)
         wxapp_install_idle_handler();
 
+#ifdef __WXGTK20__
+    if (win->m_imData)
+        gtk_im_context_focus_out(win->m_imData->context);
+#endif
+
     if (!win->m_hasVMT) return FALSE;
     if (g_blockEventsOnDrag) return FALSE;
 
@@ -2311,17 +2386,12 @@
     if (g_isIdle)
         wxapp_install_idle_handler();
         
-    if (win->m_delayedBackgroundColour && !win->GetThemeEnabled())
-        win->GtkSetBackgroundColour( win->GetBackgroundColour() );
-
-    if (win->m_delayedForegroundColour && !win->GetThemeEnabled())
-        win->GtkSetForegroundColour( win->GetForegroundColour() );
-
 #ifdef __WXGTK20__
-    if (win->m_imContext)
+    if (win->m_imData)
     {
         GtkPizza *pizza = GTK_PIZZA( m_widget );
-        gtk_im_context_set_client_window( (GtkIMContext*) win->m_imContext, pizza->bin_window );
+        gtk_im_context_set_client_window( win->m_imData->context,
+                                          pizza->bin_window );
     }
 #endif
 
@@ -2569,7 +2639,6 @@
     m_oldClientHeight = 0;
 
     m_resizing = FALSE;
-    m_widgetStyle = (GtkStyle*) NULL;
 
     m_insertCallback = (wxInsertChildFunction) NULL;
 
@@ -2578,14 +2647,14 @@
 
     m_clipPaintRegion = FALSE;
 
-    m_cursor = *wxSTANDARD_CURSOR;
+    m_needsStyleChange = false;
 
-    m_delayedForegroundColour = FALSE;
-    m_delayedBackgroundColour = FALSE;
+    m_cursor = *wxSTANDARD_CURSOR;
 
 #ifdef __WXGTK20__
-    m_imContext = NULL;
+    m_imData = NULL;
     m_x11Context = NULL;
+    m_dirtyTabOrder = false;
 #else
 #ifdef HAVE_XIM
     m_ic = (GdkIC*) NULL;
@@ -2627,9 +2696,6 @@
 
     m_insertCallback = wxInsertChildInWindow;
 
-    // always needed for background clearing
-    m_delayedBackgroundColour = TRUE;
-
     m_widget = gtk_scrolled_window_new( (GtkAdjustment *) NULL, (GtkAdjustment *) NULL );
     GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_FOCUS );
 
@@ -2688,7 +2754,7 @@
     gtk_signal_emit_by_name( GTK_OBJECT(m_hAdjust), "changed" );
 
     // these handlers block mouse events to any window during scrolling such as
-    // motion events and prevent GTK and wxWindows from fighting over where the
+    // motion events and prevent GTK and wxWidgets from fighting over where the
     // slider should be
 
     gtk_signal_connect( GTK_OBJECT(scrolledWindow->vscrollbar), "button_press_event",
@@ -2712,17 +2778,6 @@
     gtk_signal_connect( GTK_OBJECT(m_vAdjust), "value_changed",
           (GtkSignalFunc) gtk_window_vscroll_callback, (gpointer) this );
 
-#ifdef __WXGTK20__
-    // Create input method handler
-    m_imContext = (GtkIMMulticontext*) gtk_im_multicontext_new ();
-
-    // Cannot handle drawing preedited text yet
-    gtk_im_context_set_use_preedit( (GtkIMContext*) m_imContext, FALSE );
-
-    g_signal_connect (G_OBJECT (m_imContext), "commit",
-        G_CALLBACK (gtk_wxwindow_commit_cb), this);
-#endif
-
     gtk_widget_show( m_wxwindow );
 
     if (m_parent)
@@ -2732,8 +2787,6 @@
 
     PostCreation();
 
-    Show( TRUE );
-
     return TRUE;
 }
 
@@ -2765,16 +2818,6 @@
         gdk_ic_attr_destroy (m_icattr);
 #endif
 
-    if (m_widgetStyle)
-    {
-#if DISABLE_STYLE_IF_BROKEN_THEME
-        // don't delete if it's a pixmap theme style
-        if (!m_widgetStyle->engine_data)
-            gtk_style_unref( m_widgetStyle );
-#endif
-        m_widgetStyle = (GtkStyle*) NULL;
-    }
-
     if (m_wxwindow)
     {
         gtk_widget_destroy( m_wxwindow );
@@ -2786,6 +2829,10 @@
         gtk_widget_destroy( m_widget );
         m_widget = (GtkWidget*) NULL;
     }
+
+#ifdef __WXGTK20__
+    delete m_imData;
+#endif
 }
 
 bool wxWindowGTK::PreCreation( wxWindowGTK *parent, const wxPoint &pos,  const wxSize &size )
@@ -2800,21 +2847,6 @@
     m_x = (int)pos.x;
     m_y = (int)pos.y;
 
-    // some reasonable defaults
-    if (!parent)
-    {
-        if (m_x == -1)
-        {
-            m_x = (gdk_screen_width () - m_width) / 2;
-            if (m_x < 10) m_x = 10;
-        }
-        if (m_y == -1)
-        {
-            m_y = (gdk_screen_height () - m_height) / 2;
-            if (m_y < 10) m_y = 10;
-        }
-    }
-
     return TRUE;
 }
 
@@ -2826,7 +2858,7 @@
     {
         if (!m_noExpose)
         {
-            // these get reported to wxWindows -> wxPaintEvent
+            // these get reported to wxWidgets -> wxPaintEvent
 
             gtk_pizza_set_external( GTK_PIZZA(m_wxwindow), TRUE );
 
@@ -2845,18 +2877,18 @@
 #else
             // gtk_widget_set_redraw_on_allocate( GTK_WIDGET(m_wxwindow), !HasFlag( wxFULL_REPAINT_ON_RESIZE ) );
 #endif
+        }
 
 #ifdef __WXGTK20__
         // Create input method handler
-        m_imContext = (GtkIMMulticontext*) gtk_im_multicontext_new ();
+        m_imData = new wxGtkIMData;
 
         // Cannot handle drawing preedited text yet
-        gtk_im_context_set_use_preedit( (GtkIMContext*) m_imContext, FALSE );
+        gtk_im_context_set_use_preedit( m_imData->context, FALSE );
 
-        g_signal_connect (G_OBJECT (m_imContext), "commit",
-            G_CALLBACK (gtk_wxwindow_commit_cb), this);
+        g_signal_connect (G_OBJECT (m_imData->context), "commit",
+                          G_CALLBACK (gtk_wxwindow_commit_cb), this);
 #endif
-        }
 
         // these are called when the "sunken" or "raised" borders are drawn
         gtk_signal_connect( GTK_OBJECT(m_widget), "expose_event",
@@ -2917,7 +2949,14 @@
                             (gpointer) this );
     }
 
+    InheritAttributes();
+
     m_hasVMT = TRUE;
+
+    // unless the window was created initially hidden (i.e. Hide() had been
+    // called before Create()), we should show it at GTK+ level as well
+    if ( IsShown() )
+        gtk_widget_show( m_widget );
 }
 
 void wxWindowGTK::ConnectWidget( GtkWidget *widget )
@@ -3004,18 +3043,22 @@
             m_x = x + pizza->xoffset;
             m_y = y + pizza->yoffset;
         }
-        if (width != -1) m_width = width;
-        if (height != -1) m_height = height;
 
-        if ((sizeFlags & wxSIZE_AUTO_WIDTH) == wxSIZE_AUTO_WIDTH)
-        {
-             if (width == -1) m_width = 80;
+        // calculate the best size if we should auto size the window
+        if ( ((sizeFlags & wxSIZE_AUTO_WIDTH) && width == -1) ||
+                ((sizeFlags & wxSIZE_AUTO_HEIGHT) && height == -1) )
+        {
+            const wxSize sizeBest = GetBestSize();
+            if ( (sizeFlags & wxSIZE_AUTO_WIDTH) && width == -1 )
+                width = sizeBest.x;
+            if ( (sizeFlags & wxSIZE_AUTO_HEIGHT) && height == -1 )
+                height = sizeBest.y;
         }
 
-        if ((sizeFlags & wxSIZE_AUTO_HEIGHT) == wxSIZE_AUTO_HEIGHT)
-        {
-             if (height == -1) m_height = 26;
-        }
+        if (width != -1)
+            m_width = width;
+        if (height != -1)
+            m_height = height;
 
         int minWidth = GetMinWidth(),
             minHeight = GetMinHeight(),
@@ -3075,6 +3118,18 @@
 
 void wxWindowGTK::OnInternalIdle()
 {
+#ifdef __WXGTK20__
+    if ( m_dirtyTabOrder )
+        RealizeTabOrder();
+#endif
+    // Update style if the window was not yet realized
+    // and SetBackgroundStyle(wxBG_STYLE_CUSTOM) was called
+    if (m_needsStyleChange)
+    {
+        SetBackgroundStyle(GetBackgroundStyle());
+        m_needsStyleChange = false;
+    }
+
     // Update invalidated regions.
     GtkUpdate();
 
@@ -3421,7 +3476,8 @@
 {
     wxCHECK_MSG( (m_widget != NULL), 12, wxT("invalid window") );
 
-    wxCHECK_MSG( m_font.Ok(), 12, wxT("invalid font") );
+    wxFont font = GetFont();
+    wxCHECK_MSG( font.Ok(), 12, wxT("invalid font") );
 
 #ifdef __WXGTK20__
     PangoContext *context = NULL;
@@ -3431,7 +3487,7 @@
     if (!context)
         return 0;
 
-    PangoFontDescription *desc = m_font.GetNativeFontInfo()->description;
+    PangoFontDescription *desc = font.GetNativeFontInfo()->description;
     PangoLayout *layout = pango_layout_new(context);
     pango_layout_set_font_description(layout, desc);
     pango_layout_set_text(layout, "H", 1);
@@ -3442,11 +3498,11 @@
 
     g_object_unref( G_OBJECT( layout ) );
 
-    return (int) (rect.height / PANGO_SCALE);
+    return (int) PANGO_PIXELS(rect.height);
 #else
-    GdkFont *font = m_font.GetInternalFont( 1.0 );
+    GdkFont *gfont = font.GetInternalFont( 1.0 );
 
-    return font->ascent + font->descent;
+    return gfont->ascent + gfont->descent;
 #endif
 }
 
@@ -3454,7 +3510,8 @@
 {
     wxCHECK_MSG( (m_widget != NULL), 8, wxT("invalid window") );
 
-    wxCHECK_MSG( m_font.Ok(), 8, wxT("invalid font") );
+    wxFont font = GetFont();
+    wxCHECK_MSG( font.Ok(), 8, wxT("invalid font") );
 
 #ifdef __WXGTK20__
     PangoContext *context = NULL;
@@ -3464,7 +3521,7 @@
     if (!context)
         return 0;
 
-    PangoFontDescription *desc = m_font.GetNativeFontInfo()->description;
+    PangoFontDescription *desc = font.GetNativeFontInfo()->description;
     PangoLayout *layout = pango_layout_new(context);
     pango_layout_set_font_description(layout, desc);
     pango_layout_set_text(layout, "g", 1);
@@ -3475,11 +3532,11 @@
 
     g_object_unref( G_OBJECT( layout ) );
 
-    return (int) (rect.width / PANGO_SCALE);
+    return (int) PANGO_PIXELS(rect.width);
 #else
-    GdkFont *font = m_font.GetInternalFont( 1.0 );
+    GdkFont *gfont = font.GetInternalFont( 1.0 );
 
-    return gdk_string_width( font, "g" );
+    return gdk_string_width( gfont, "g" );
 #endif
 }
 
@@ -3490,8 +3547,7 @@
                               int *externalLeading,
                               const wxFont *theFont ) const
 {
-    wxFont fontToUse = m_font;
-    if (theFont) fontToUse = *theFont;
+    wxFont fontToUse = theFont ? *theFont : GetFont();
 
     wxCHECK_RET( fontToUse.Ok(), wxT("invalid font") );
 
@@ -3527,17 +3583,18 @@
         pango_layout_set_text(layout, (const char*) data, strlen( (const char*) data ));
 #endif
     }
-    PangoLayoutLine *line = (PangoLayoutLine *)pango_layout_get_lines(layout)->data;
 
     PangoRectangle rect;
-    pango_layout_line_get_extents(line, NULL, &rect);
+    pango_layout_get_extents(layout, NULL, &rect);
 
-    if (x) (*x) = (wxCoord) (rect.width / PANGO_SCALE);
-    if (y) (*y) = (wxCoord) (rect.height / PANGO_SCALE);
+    if (x) (*x) = (wxCoord) PANGO_PIXELS(rect.width);
+    if (y) (*y) = (wxCoord) PANGO_PIXELS(rect.height);
     if (descent)
     {
-        // Do something about metrics here
-        (*descent) = 0;
+        PangoLayoutIter *iter = pango_layout_get_iter(layout);
+        int baseline = pango_layout_iter_get_baseline(iter);
+        pango_layout_iter_free(iter);
+        *descent = *y - PANGO_PIXELS(baseline);
     }
     if (externalLeading) (*externalLeading) = 0;  // ??
 
@@ -3554,7 +3611,6 @@
 void wxWindowGTK::SetFocus()
 {
     wxCHECK_RET( m_widget != NULL, wxT("invalid window") );
-
     if ( m_hasFocus )
     {
         // don't do anything if we already have focus
@@ -3661,6 +3717,62 @@
     (*m_insertCallback)(this, child);
 }
 
+#ifdef __WXGTK20__
+
+void wxWindowGTK::AddChild(wxWindowBase *child)
+{
+    wxWindowBase::AddChild(child);
+    m_dirtyTabOrder = true;
+    if (g_isIdle)
+        wxapp_install_idle_handler();
+}
+
+void wxWindowGTK::RemoveChild(wxWindowBase *child)
+{
+    wxWindowBase::RemoveChild(child);
+    m_dirtyTabOrder = true;
+    if (g_isIdle)
+        wxapp_install_idle_handler();
+}
+    
+void wxWindowGTK::DoMoveInTabOrder(wxWindow *win, MoveKind move)
+{
+    wxWindowBase::DoMoveInTabOrder(win, move);
+    m_dirtyTabOrder = true;
+    if (g_isIdle)
+        wxapp_install_idle_handler();
+}
+
+void wxWindowGTK::RealizeTabOrder()
+{
+    if (m_wxwindow)
+    {
+        if (m_children.size() > 0)
+        {
+            GList *chain = NULL;
+            
+            for (wxWindowList::const_iterator i = m_children.begin();
+                    i != m_children.end(); ++i)
+            {
+                chain = g_list_prepend(chain, (*i)->m_widget);
+            }
+            
+            chain = g_list_reverse(chain);
+            
+            gtk_container_set_focus_chain(GTK_CONTAINER(m_wxwindow), chain);
+            g_list_free(chain);
+        }
+        else
+        {
+            gtk_container_unset_focus_chain(GTK_CONTAINER(m_wxwindow));
+        }
+    }
+    
+    m_dirtyTabOrder = false;
+}
+
+#endif // __WXGTK20__
+
 void wxWindowGTK::Raise()
 {
     wxCHECK_RET( (m_widget != NULL), wxT("invalid window") );
@@ -3829,12 +3941,10 @@
     // Clip to paint region in wxClientDC
     m_clipPaintRegion = TRUE;
 
-#ifndef __WXGTK20__
     // widget to draw on
     GtkPizza *pizza = GTK_PIZZA (m_wxwindow);
 
-    // later for GTK 2.0, too.
-    if (GetThemeEnabled())
+    if (GetThemeEnabled() && GetBackgroundStyle() == wxBG_STYLE_SYSTEM)
     {
         // find ancestor from which to steal background
         wxWindow *parent = GetParent();
@@ -3854,7 +3964,7 @@
 
             gtk_paint_flat_box( parent->m_widget->style,
                         pizza->bin_window,
-                        GTK_STATE_NORMAL,
+                        (GtkStateType)GTK_WIDGET_STATE(m_wxwindow),
                         GTK_SHADOW_NONE,
                         &rect,
                         parent->m_widget,
@@ -3865,7 +3975,6 @@
         }
     }
     else
-#endif
 
 #ifdef __WXGTK20__
     {
@@ -3889,14 +3998,14 @@
         wxEraseEvent erase_event( GetId(), &dc );
         erase_event.SetEventObject( this );
 
-        if (!GetEventHandler()->ProcessEvent(erase_event))
+        if (!GetEventHandler()->ProcessEvent(erase_event) && GetBackgroundStyle() != wxBG_STYLE_CUSTOM)
         {
             if (!g_eraseGC)
             {
                 g_eraseGC = gdk_gc_new( pizza->bin_window );
                 gdk_gc_set_fill( g_eraseGC, GDK_SOLID );
             }
-            gdk_gc_set_foreground( g_eraseGC, m_backgroundColour.GetColor() );
+            gdk_gc_set_foreground( g_eraseGC, GetBackgroundColour().GetColor() );
 
             wxRegionIterator upd( m_clearRegion );
             while (upd)
@@ -3923,7 +4032,7 @@
 #ifndef __WXUNIVERSAL__
 #ifndef __WXGTK20__
     // The following code will result in all window-less widgets
-    // being redrawn because the wxWindows class is allowed to
+    // being redrawn because the wxWidgets class is allowed to
     // paint over the window-less widgets.
 
     GList *children = pizza->children;
@@ -4000,68 +4109,25 @@
 }
 #endif // wxUSE_TOOLTIPS
 
-void wxWindowGTK::GtkSetBackgroundColour( const wxColour &colour )
-{
-    GdkWindow *window = (GdkWindow*) NULL;
-    if (m_wxwindow)
-        window = GTK_PIZZA(m_wxwindow)->bin_window;
-    else
-        window = GetConnectWidget()->window;
-
-    wxASSERT( window );
-
-    // We need the pixel value e.g. for background clearing.
-    m_backgroundColour.CalcPixel( gdk_window_get_colormap( window ) );
-
-    if (m_wxwindow)
-    {
-        // wxMSW doesn't clear the window here, either.
-        gdk_window_set_background( window, m_backgroundColour.GetColor() );
-    }
-
-    ApplyWidgetStyle();
-}
-
 bool wxWindowGTK::SetBackgroundColour( const wxColour &colour )
 {
     wxCHECK_MSG( m_widget != NULL, FALSE, wxT("invalid window") );
 
     if (!wxWindowBase::SetBackgroundColour(colour))
-        return FALSE;
-
-    GdkWindow *window = (GdkWindow*) NULL;
-    if (m_wxwindow)
-        window = GTK_PIZZA(m_wxwindow)->bin_window;
-    else
-        window = GetConnectWidget()->window;
+        return false;
 
-    if (!window)
+    if (colour.Ok())
     {
-        // indicate that a new style has been set
-        // but it couldn't get applied as the
-        // widget hasn't been realized yet.
-        m_delayedBackgroundColour = TRUE;
-        return TRUE;
-    }
-    else
-    {
-        GtkSetBackgroundColour( colour );
+        // We need the pixel value e.g. for background clearing.
+        m_backgroundColour.CalcPixel(gtk_widget_get_colormap(m_widget));
     }
 
-    return TRUE;
-}
+    // apply style change (forceStyle=true so that new style is applied
+    // even if the bg colour changed from valid to wxNullColour)
+    if (GetBackgroundStyle() != wxBG_STYLE_CUSTOM)
+        ApplyWidgetStyle(true);
 
-void wxWindowGTK::GtkSetForegroundColour( const wxColour &colour )
-{
-    GdkWindow *window = (GdkWindow*) NULL;
-    if (m_wxwindow)
-        window = GTK_PIZZA(m_wxwindow)->bin_window;
-    else
-        window = GetConnectWidget()->window;
-
-    wxASSERT( window );
-
-    ApplyWidgetStyle();
+    return true;
 }
 
 bool wxWindowGTK::SetForegroundColour( const wxColour &colour )
@@ -4070,30 +4136,20 @@
 
     if (!wxWindowBase::SetForegroundColour(colour))
     {
-        // don't leave if the GTK widget has just
-        // been realized
-        if (!m_delayedForegroundColour) return FALSE;
-    }
-
-    GdkWindow *window = (GdkWindow*) NULL;
-    if (m_wxwindow)
-        window = GTK_PIZZA(m_wxwindow)->bin_window;
-    else
-        window = GetConnectWidget()->window;
-
-    if (!window)
-    {
-        // indicate that a new style has been set
-        // but it couldn't get applied as the
-        // widget hasn't been realized yet.
-        m_delayedForegroundColour = TRUE;
+        return false;
     }
-    else
+    
+    if (colour.Ok())
     {
-       GtkSetForegroundColour( colour );
+        // We need the pixel value e.g. for background clearing.
+        m_foregroundColour.CalcPixel(gtk_widget_get_colormap(m_widget));
     }
 
-    return TRUE;
+    // apply style change (forceStyle=true so that new style is applied
+    // even if the bg colour changed from valid to wxNullColour):
+    ApplyWidgetStyle(true);
+
+    return true;
 }
 
 #ifdef __WXGTK20__
@@ -4110,135 +4166,128 @@
     return m_x11Context;
 }
 #endif
-
-GtkStyle *wxWindowGTK::GetWidgetStyle()
+ 
+GtkRcStyle *wxWindowGTK::CreateWidgetStyle(bool forceStyle)
 {
-    if (m_widgetStyle)
+    // do we need to apply any changes at all?
+    if ( !forceStyle &&
+         !m_font.Ok() &&
+         !m_foregroundColour.Ok() && !m_backgroundColour.Ok() )
     {
-        GtkStyle *remake = gtk_style_copy( m_widgetStyle );
+        return NULL;
+    }
 
-        // FIXME: no more klass in 2.0
-#ifndef __WXGTK20__
-        remake->klass = m_widgetStyle->klass;
-#endif
+    GtkRcStyle *style = gtk_rc_style_new();
 
-        gtk_style_unref( m_widgetStyle );
-        m_widgetStyle = remake;
-    }
-    else
+    if ( m_font.Ok() )
     {
-        GtkStyle *def = gtk_rc_get_style( m_widget );
+#ifdef __WXGTK20__
+        style->font_desc = 
+            pango_font_description_copy( m_font.GetNativeFontInfo()->description );
+#else
+        wxString xfontname = m_font.GetNativeFontInfo()->GetXFontName();
+        style->fontset_name = g_strdup(xfontname.c_str());
+#endif
+    }
 
-        if (!def)
-            def = gtk_widget_get_default_style();
+    if ( m_foregroundColour.Ok() )
+    {
+        GdkColor *fg = m_foregroundColour.GetColor();
+        
+        style->fg[GTK_STATE_NORMAL] = *fg;
+        style->color_flags[GTK_STATE_NORMAL] = GTK_RC_FG;
+        
+        style->fg[GTK_STATE_PRELIGHT] = *fg;
+        style->color_flags[GTK_STATE_PRELIGHT] = GTK_RC_FG;
+        
+        style->fg[GTK_STATE_ACTIVE] = *fg;
+        style->color_flags[GTK_STATE_ACTIVE] = GTK_RC_FG;
+    }
 
-        m_widgetStyle = gtk_style_copy( def );
+    if ( m_backgroundColour.Ok() )
+    {
+        GdkColor *bg = m_backgroundColour.GetColor();
 
-        // FIXME: no more klass in 2.0
-#ifndef __WXGTK20__
-        m_widgetStyle->klass = def->klass;
-#endif
+        style->bg[GTK_STATE_NORMAL] = *bg;
+        style->base[GTK_STATE_NORMAL] = *bg;
+        style->color_flags[GTK_STATE_NORMAL] = (GtkRcFlags)
+            (style->color_flags[GTK_STATE_NORMAL] | GTK_RC_BG | GTK_RC_BASE);
+        
+        style->bg[GTK_STATE_PRELIGHT] = *bg;
+        style->base[GTK_STATE_PRELIGHT] = *bg;
+        style->color_flags[GTK_STATE_PRELIGHT] = (GtkRcFlags)
+            (style->color_flags[GTK_STATE_PRELIGHT] | GTK_RC_BG | GTK_RC_BASE);
+        
+        style->bg[GTK_STATE_ACTIVE] = *bg;
+        style->base[GTK_STATE_ACTIVE] = *bg;
+        style->color_flags[GTK_STATE_ACTIVE] = (GtkRcFlags)
+            (style->color_flags[GTK_STATE_ACTIVE] | GTK_RC_BG | GTK_RC_BASE);
+        
+        style->bg[GTK_STATE_INSENSITIVE] = *bg;
+        style->base[GTK_STATE_INSENSITIVE] = *bg;
+        style->color_flags[GTK_STATE_INSENSITIVE] = (GtkRcFlags)
+            (style->color_flags[GTK_STATE_INSENSITIVE] | GTK_RC_BG | GTK_RC_BASE);
     }
-
-    return m_widgetStyle;
+    
+    return style;
 }
 
-void wxWindowGTK::SetWidgetStyle()
+void wxWindowGTK::ApplyWidgetStyle(bool forceStyle)
 {
-#if DISABLE_STYLE_IF_BROKEN_THEME
-    if (m_widget->style->engine_data)
+    GtkRcStyle *style = CreateWidgetStyle(forceStyle);
+    if ( style )
     {
-        static bool s_warningPrinted = FALSE;
-        if (!s_warningPrinted)
-        {
-            printf( "wxWindows warning: Widget styles disabled due to buggy GTK theme.\n" );
-            s_warningPrinted = TRUE;
-        }
-        m_widgetStyle = m_widget->style;
-        return;
+        DoApplyWidgetStyle(style);
+        gtk_rc_style_unref(style);
     }
-#endif
 
-    GtkStyle *style = GetWidgetStyle();
+    // Style change may affect GTK+'s size calculation:
+    InvalidateBestSize();
+}
 
-    if (m_font != wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT ))
-    {
-#ifdef __WXGTK20__
-        pango_font_description_free( style->font_desc );
-        style->font_desc = pango_font_description_copy( m_font.GetNativeFontInfo()->description );
-#else
-        gdk_font_unref( style->font );
-        style->font = gdk_font_ref( m_font.GetInternalFont( 1.0 ) );
-#endif
-    }
+void wxWindowGTK::DoApplyWidgetStyle(GtkRcStyle *style)
+{
+    if (m_wxwindow)
+        gtk_widget_modify_style(m_wxwindow, style);
+    gtk_widget_modify_style(m_widget, style);
+}
 
-    if (m_foregroundColour.Ok())
+bool wxWindowGTK::SetBackgroundStyle(wxBackgroundStyle style)
+{
+    wxWindowBase::SetBackgroundStyle(style);
+    
+    if (style == wxBG_STYLE_CUSTOM)
     {
-        m_foregroundColour.CalcPixel( gtk_widget_get_colormap( m_widget ) );
-        if (m_foregroundColour != wxSystemSettings::GetColour(wxSYS_COLOUR_BTNTEXT))
-        {
-            style->fg[GTK_STATE_NORMAL] = *m_foregroundColour.GetColor();
-            style->fg[GTK_STATE_PRELIGHT] = *m_foregroundColour.GetColor();
-            style->fg[GTK_STATE_ACTIVE] = *m_foregroundColour.GetColor();
-        }
+        GdkWindow *window = (GdkWindow*) NULL;
+        if (m_wxwindow)
+            window = GTK_PIZZA(m_wxwindow)->bin_window;
         else
-        {
-            // Try to restore the gtk default style.  This is still a little
-            // oversimplified for what is probably really needed here for controls
-            // other than buttons, but is better than not being able to (re)set a
-            // control's foreground colour to *wxBLACK -- RL
-            GtkStyle *def = gtk_rc_get_style( m_widget );
-
-            if (!def)
-                def = gtk_widget_get_default_style();
-
-            style->fg[GTK_STATE_NORMAL] = def->fg[GTK_STATE_NORMAL];
-            style->fg[GTK_STATE_PRELIGHT] = def->fg[GTK_STATE_PRELIGHT];
-            style->fg[GTK_STATE_ACTIVE] = def->fg[GTK_STATE_ACTIVE];
-        }
-    }
+            window = GetConnectWidget()->window;
 
-    if (m_backgroundColour.Ok())
-    {
-        m_backgroundColour.CalcPixel( gtk_widget_get_colormap( m_widget ) );
-        if (m_backgroundColour != wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE))
-        {
-            style->bg[GTK_STATE_NORMAL] = *m_backgroundColour.GetColor();
-            style->base[GTK_STATE_NORMAL] = *m_backgroundColour.GetColor();
-            style->bg[GTK_STATE_PRELIGHT] = *m_backgroundColour.GetColor();
-            style->base[GTK_STATE_PRELIGHT] = *m_backgroundColour.GetColor();
-            style->bg[GTK_STATE_ACTIVE] = *m_backgroundColour.GetColor();
-            style->base[GTK_STATE_ACTIVE] = *m_backgroundColour.GetColor();
-            style->bg[GTK_STATE_INSENSITIVE] = *m_backgroundColour.GetColor();
-            style->base[GTK_STATE_INSENSITIVE] = *m_backgroundColour.GetColor();
-        }
-        else
+        if (window)
         {
-            // Try to restore the gtk default style.  This is still a little
-            // oversimplified for what is probably really needed here for controls
-            // other than buttons, but is better than not being able to (re)set a
-            // control's background colour to default grey and means resetting a
-            // button to wxSYS_COLOUR_BTNFACE will restore its usual highlighting
-            // behavior -- RL
-            GtkStyle *def = gtk_rc_get_style( m_widget );
-
-            if (!def)
-                def = gtk_widget_get_default_style();
-
-            style->bg[GTK_STATE_NORMAL] = def->bg[GTK_STATE_NORMAL];
-            style->base[GTK_STATE_NORMAL] = def->base[GTK_STATE_NORMAL];
-            style->bg[GTK_STATE_PRELIGHT] = def->bg[GTK_STATE_PRELIGHT];
-            style->base[GTK_STATE_PRELIGHT] = def->base[GTK_STATE_PRELIGHT];
-            style->bg[GTK_STATE_ACTIVE] = def->bg[GTK_STATE_ACTIVE];
-            style->base[GTK_STATE_ACTIVE] = def->base[GTK_STATE_ACTIVE];
-            style->bg[GTK_STATE_INSENSITIVE] = def->bg[GTK_STATE_INSENSITIVE];
-            style->base[GTK_STATE_INSENSITIVE] = def->base[GTK_STATE_INSENSITIVE];
+            // Make sure GDK/X11 doesn't refresh the window
+            // automatically.
+            gdk_window_set_back_pixmap( window, None, False );
+#ifdef __X__
+            Display* display = GDK_WINDOW_DISPLAY(window);
+            XFlush(display);
+#endif
+            m_needsStyleChange = false;
         }
+        else
+            // Do in OnIdle, because the window is not yet available
+            m_needsStyleChange = true;
+        
+        // Don't apply widget style, or we get a grey background
     }
-}
-
-void wxWindowGTK::ApplyWidgetStyle()
-{
+    else
+    {
+        // apply style change (forceStyle=true so that new style is applied
+        // even if the bg colour changed from valid to wxNullColour):
+        ApplyWidgetStyle(true);
+    }
+    return true;
 }
 
 //-----------------------------------------------------------------------------
@@ -4269,61 +4318,66 @@
     }
 }
 
-// used to pass the coordinates from wxWindowGTK::DoPopupMenu() to
-// wxPopupMenuPositionCallback()
-//
-// should be safe even in the MT case as the user can hardly popup 2 menus
-// simultaneously, can he?
-static gint gs_pop_x = 0;
-static gint gs_pop_y = 0;
-
 extern "C" void wxPopupMenuPositionCallback( GtkMenu *menu,
                                              gint *x, gint *y,
 #ifdef __WXGTK20__
                                              gboolean * WXUNUSED(whatever),
 #endif
-                                             gpointer WXUNUSED(user_data) )
+                                             gpointer user_data )
 {
     // ensure that the menu appears entirely on screen
     GtkRequisition req;
     gtk_widget_get_child_requisition(GTK_WIDGET(menu), &req);
 
     wxSize sizeScreen = wxGetDisplaySize();
+    wxPoint *pos = (wxPoint*)user_data;
 
     gint xmax = sizeScreen.x - req.width,
          ymax = sizeScreen.y - req.height;
 
-    *x = gs_pop_x < xmax ? gs_pop_x : xmax;
-    *y = gs_pop_y < ymax ? gs_pop_y : ymax;
+    *x = pos->x < xmax ? pos->x : xmax;
+    *y = pos->y < ymax ? pos->y : ymax;
 }
 
 bool wxWindowGTK::DoPopupMenu( wxMenu *menu, int x, int y )
 {
-    wxCHECK_MSG( m_widget != NULL, FALSE, wxT("invalid window") );
+    wxCHECK_MSG( m_widget != NULL, false, wxT("invalid window") );
 
-    wxCHECK_MSG( menu != NULL, FALSE, wxT("invalid popup-menu") );
+    wxCHECK_MSG( menu != NULL, false, wxT("invalid popup-menu") );
 
     SetInvokingWindow( menu, this );
 
     menu->UpdateUI();
 
-    gs_pop_x = x;
-    gs_pop_y = y;
-    ClientToScreen( &gs_pop_x, &gs_pop_y );
-
-    bool is_waiting = TRUE;
-
-    gtk_signal_connect( GTK_OBJECT(menu->m_menu),
-                        "hide",
-                        GTK_SIGNAL_FUNC(gtk_pop_hide_callback),
-                        (gpointer)&is_waiting );
+    bool is_waiting = true;
+
+    gulong handler = gtk_signal_connect( GTK_OBJECT(menu->m_menu),
+                                         "hide",
+                                         GTK_SIGNAL_FUNC(gtk_pop_hide_callback),
+                                         (gpointer)&is_waiting );
+
+    wxPoint pos;
+    gpointer userdata;
+    GtkMenuPositionFunc posfunc;
+    if ( x == -1 && y == -1 )
+    {
+        // use GTK's default positioning algorithm
+        userdata = NULL;
+        posfunc = NULL;
+    }
+    else
+    {
+        pos = ClientToScreen(wxPoint(x, y));
+        userdata = &pos;
+        posfunc = wxPopupMenuPositionCallback;
+    }
 
     gtk_menu_popup(
                   GTK_MENU(menu->m_menu),
                   (GtkWidget *) NULL,           // parent menu shell
                   (GtkWidget *) NULL,           // parent menu item
-                  wxPopupMenuPositionCallback,  // function to position it
-                  NULL,                         // client data
+                  posfunc,                      // function to position it
+                  userdata,                     // client data
                   0,                            // button used to activate it
 #ifdef __WXGTK20__
                   gtk_get_current_event_time()
@@ -4337,7 +4391,9 @@
         gtk_main_iteration();
     }
 
-    return TRUE;
+    gtk_signal_disconnect(GTK_OBJECT(menu->m_menu), handler);
+
+    return true;
 }
 
 #endif // wxUSE_MENUS_NATIVE
@@ -4378,24 +4434,16 @@
 
 bool wxWindowGTK::SetFont( const wxFont &font )
 {
-    if (!wxWindowBase::SetFont(font) || !m_widget)
-    {
-        return FALSE;
-    }
+    wxCHECK_MSG( m_widget != NULL, FALSE, wxT("invalid window") );
 
-    wxColour sysbg = wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE );
-    if ( sysbg == m_backgroundColour )
-    {
-        m_backgroundColour = wxNullColour;
-        ApplyWidgetStyle();
-        m_backgroundColour = sysbg;
-    }
-    else
-    {
-        ApplyWidgetStyle();
-    }
+    if (!wxWindowBase::SetFont(font))
+        return false;
 
-    return TRUE;
+    // apply style change (forceStyle=true so that new style is applied
+    // even if the font changed from valid to wxNullFont):
+    ApplyWidgetStyle(true);    
+
+    return true;
 }
 
 void wxWindowGTK::DoCaptureMouse()



More information about the Commits mailing list