[gtk+/native-layout-incubator-2: 314/314] Merge branch 'master' into native-layout-incubator-2
- From: Tristan Van Berkom <tvb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/native-layout-incubator-2: 314/314] Merge branch 'master' into native-layout-incubator-2
- Date: Wed, 4 Aug 2010 21:20:45 +0000 (UTC)
commit 39a3914fe2b49d3d8b8184008e5e739e2e8ca855
Merge: 04a8eba 7df17ad
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date: Wed Aug 4 17:20:50 2010 -0400
Merge branch 'master' into native-layout-incubator-2
Conflicts:
gtk/gtkbox.c
gtk/gtkcellrenderer.c
gtk/gtkcellrenderertext.c
gtk/gtkexpander.c
gtk/gtkscrolledwindow.c
gtk/gtksizerequest.c
gtk/gtktreeview.c
gtk/gtktreeviewcolumn.c
NEWS | 52 +
configure.ac | 30 +-
demos/gtk-demo/changedisplay.c | 16 +-
demos/gtk-demo/colorsel.c | 19 +-
demos/gtk-demo/combobox.c | 2 +-
demos/gtk-demo/dialog.c | 5 +-
demos/gtk-demo/drawingarea.c | 81 +-
demos/gtk-demo/entry_buffer.c | 5 +-
demos/gtk-demo/entry_completion.c | 5 +-
demos/gtk-demo/expander.c | 5 +-
demos/gtk-demo/offscreen_window.c | 14 +-
demos/gtk-demo/offscreen_window2.c | 15 +-
demos/gtk-demo/panes.c | 36 +-
demos/gtk-demo/pixbufs.c | 17 +-
demos/gtk-demo/search_entry.c | 5 +-
demos/gtk-demo/sizegroup.c | 5 +-
demos/gtk-demo/spinner.c | 5 +-
demos/pixbuf-demo.c | 22 +-
demos/testpixbuf-color.c | 2 -
demos/testpixbuf-scale.c | 13 +-
demos/testpixbuf.c | 13 +-
docs/faq/Makefile.am | 2 +
docs/reference/gdk/Makefile.am | 1 -
docs/reference/gdk/gdk3-sections.txt | 4 +-
docs/reference/gdk/tmpl/cursors.sgml | 9 +
docs/reference/gdk/tmpl/keys.sgml | 9 +
docs/reference/gtk/Makefile.am | 2 -
docs/reference/gtk/gtk-docs.sgml | 2 +-
docs/reference/gtk/gtk3-sections.txt | 5 +-
docs/reference/gtk/tmpl/.gitignore | 5 +
docs/reference/gtk/tmpl/gtkactiongroup.sgml | 401 --
docs/reference/gtk/tmpl/gtkbutton.sgml | 398 --
docs/reference/gtk/tmpl/gtkcalendar.sgml | 315 --
docs/reference/gtk/tmpl/gtkcelleditable.sgml | 83 -
docs/reference/gtk/tmpl/gtkfontsel.sgml | 5 -
docs/reference/gtk/tmpl/gtkicontheme.sgml | 4 +-
docs/reference/gtk/tmpl/gtknotebook.sgml | 6 -
docs/reference/gtk/tmpl/gtkpaned.sgml | 2 +-
docs/reference/gtk/tmpl/gtkrecentmanager.sgml | 482 --
docs/reference/gtk/tmpl/gtktable.sgml | 3 +-
docs/tools/widgets.c | 10 +-
docs/tutorial/Makefile.am | 6 +-
examples/colorsel/colorsel.c | 4 +-
gdk/Makefile.am | 83 +-
gdk/directfb/gdkcolor-directfb.c | 3 -
gdk/directfb/gdkcursor-directfb.c | 5 -
gdk/directfb/gdkdisplay-directfb.c | 6 -
gdk/directfb/gdkdnd-directfb.c | 4 -
gdk/directfb/gdkdrawable-directfb.c | 6 -
gdk/directfb/gdkevents-directfb.c | 9 -
gdk/directfb/gdkgc-directfb.c | 4 -
gdk/directfb/gdkgeometry-directfb.c | 4 -
gdk/directfb/gdkglobals-directfb.c | 4 -
gdk/directfb/gdkimage-directfb.c | 4 -
gdk/directfb/gdkinput-directfb.c | 5 -
gdk/directfb/gdkkeys-directfb.c | 24 +-
gdk/directfb/gdkmain-directfb.c | 4 -
gdk/directfb/gdkpixmap-directfb.c | 4 -
gdk/directfb/gdkproperty-directfb.c | 3 -
gdk/directfb/gdkscreen-directfb.c | 4 -
gdk/directfb/gdkselection-directfb.c | 4 -
gdk/directfb/gdkspawn-directfb.c | 4 -
gdk/directfb/gdktestutils-directfb.c | 4 -
gdk/directfb/gdkvisual-directfb.c | 4 -
gdk/directfb/gdkwindow-directfb.c | 5 -
gdk/gdk.c | 4 -
gdk/gdk.symbols | 4 +
gdk/gdkapplaunchcontext.c | 4 -
gdk/gdkcairo.c | 6 +-
gdk/gdkcolor.c | 4 -
gdk/gdkcursor.c | 20 +-
gdk/gdkcursor.h | 1 +
gdk/gdkdevice.c | 5 +-
gdk/gdkdevicemanager.c | 9 +-
gdk/gdkdisplay.c | 5 +-
gdk/gdkdisplaymanager.c | 9 +-
gdk/gdkdnd.c | 5 +-
gdk/gdkdraw.c | 9 +-
gdk/gdkenumtypes.c.template | 4 +-
gdk/gdkevents.c | 9 +-
gdk/gdkgc.c | 35 +-
gdk/gdkglobals.c | 2 +-
gdk/gdkimage.c | 4 -
gdk/gdkinternals.h | 5 +-
gdk/gdkkeynames.c | 4 -
gdk/gdkkeys.c | 5 +-
gdk/gdkkeys.h | 1 +
gdk/gdkkeyuni.c | 5 +-
gdk/gdkoffscreenwindow.c | 18 +-
gdk/gdkpango.c | 5 +-
gdk/gdkpixbuf-drawable.c | 5 +-
gdk/gdkpixbuf-render.c | 114 +-
gdk/gdkpixmap.c | 17 +-
gdk/gdkrectangle.c | 9 +-
gdk/gdkrgb.c | 4 -
gdk/gdkscreen.c | 5 +-
gdk/gdkselection.c | 5 +-
gdk/gdkvisual.c | 5 +-
gdk/gdkwindow.c | 232 +-
gdk/gdkwindow.h | 63 +-
gdk/gdkwindowimpl.c | 5 -
gdk/makefile.msc | 8 -
gdk/makegdkalias.pl | 136 -
gdk/pltcheck.sh | 17 -
gdk/quartz/gdkevents-quartz.c | 7 -
gdk/quartz/gdkkeys-quartz.c | 7 +
gdk/win32/gdkdrawable-win32.c | 42 +-
gdk/win32/gdkgc-win32.c | 31 +-
gdk/win32/gdkgeometry-win32.c | 2 +-
gdk/win32/gdkkeys-win32.c | 6 +
gdk/win32/gdkmain-win32.c | 10 +-
gdk/win32/gdkprivate-win32.h | 8 +-
gdk/win32/gdktestutils-win32.c | 2 +-
gdk/win32/gdkwindow-win32.c | 8 +-
gdk/x11/gdkapplaunchcontext-x11.c | 1 -
gdk/x11/gdkasync.c | 5 +-
gdk/x11/gdkcolor-x11.c | 5 +-
gdk/x11/gdkcursor-x11.c | 4 -
gdk/x11/gdkdevicemanager-core.c | 4 -
gdk/x11/gdkdevicemanager-xi.c | 5 -
gdk/x11/gdkdevicemanager-xi2.c | 4 -
gdk/x11/gdkdisplay-x11.c | 4 -
gdk/x11/gdkdnd-x11.c | 4 -
gdk/x11/gdkdrawable-x11.c | 6 +-
gdk/x11/gdkeventsource.c | 5 +-
gdk/x11/gdkeventtranslator.c | 5 +-
gdk/x11/gdkgc-x11.c | 4 -
gdk/x11/gdkgeometry-x11.c | 5 +-
gdk/x11/gdkglobals-x11.c | 2 +-
gdk/x11/gdkim-x11.c | 4 -
gdk/x11/gdkimage-x11.c | 6 +-
gdk/x11/gdkinput.c | 5 +-
gdk/x11/gdkkeys-x11.c | 42 +-
gdk/x11/gdkmain-x11.c | 4 -
gdk/x11/gdkpixmap-x11.c | 5 +-
gdk/x11/gdkproperty-x11.c | 5 +-
gdk/x11/gdkscreen-x11.c | 4 -
gdk/x11/gdkselection-x11.c | 5 +-
gdk/x11/gdkspawn-x11.c | 7 +-
gdk/x11/gdktestutils-x11.c | 4 -
gdk/x11/gdkvisual-x11.c | 5 +-
gdk/x11/gdkwindow-x11.c | 4 -
gdk/x11/gdkxid.c | 4 -
git.mk | 13 +-
gtk/Makefile.am | 27 +-
gtk/aliasfilescheck.sh | 11 -
gtk/gtk.symbols | 4 +-
gtk/gtkaboutdialog.c | 5 -
gtk/gtkaccelgroup.c | 5 +-
gtk/gtkaccellabel.c | 5 +-
gtk/gtkaccelmap.c | 14 +-
gtk/gtkaccessible.c | 32 +-
gtk/gtkaccessible.h | 8 +-
gtk/gtkaction.c | 10 +-
gtk/gtkaction.h | 3 +-
gtk/gtkactiongroup.c | 113 +-
gtk/gtkactiongroup.h | 54 +-
gtk/gtkactivatable.c | 4 -
gtk/gtkadjustment.c | 5 +-
gtk/gtkalignment.c | 201 +-
gtk/gtkalignment.h | 8 +-
gtk/gtkapplication.c | 89 +-
gtk/gtkapplication.h | 25 +-
gtk/gtkarrow.c | 94 +-
gtk/gtkarrow.h | 10 +-
gtk/gtkaspectframe.c | 122 +-
gtk/gtkaspectframe.h | 10 +-
gtk/gtkassistant.c | 244 +-
gtk/gtkassistant.h | 9 +-
gtk/gtkbbox.c | 225 +-
gtk/gtkbbox.h | 9 +-
gtk/gtkbin.c | 85 +-
gtk/gtkbin.h | 7 +-
gtk/gtkbindings.c | 4 -
gtk/gtkbox.c | 238 +-
gtk/gtkbox.h | 43 +-
gtk/gtkbuildable.c | 4 -
gtk/gtkbuilder.c | 5 +-
gtk/gtkbuilder.h | 2 +-
gtk/gtkbuilderparser.c | 2 +-
gtk/gtkbutton.c | 173 +-
gtk/gtkcalendar.c | 265 +-
gtk/gtkcelleditable.c | 19 +-
gtk/gtkcelllayout.c | 5 +-
gtk/gtkcellrenderer.c | 246 +-
gtk/gtkcellrenderer.h | 21 +-
gtk/gtkcellrendereraccel.c | 120 +-
gtk/gtkcellrendereraccel.h | 10 +-
gtk/gtkcellrenderercombo.c | 140 +-
gtk/gtkcellrenderercombo.h | 9 +-
gtk/gtkcellrendererpixbuf.c | 262 +-
gtk/gtkcellrendererpixbuf.h | 7 +-
gtk/gtkcellrendererprogress.c | 35 +-
gtk/gtkcellrendererprogress.h | 2 +-
gtk/gtkcellrendererspin.c | 30 +-
gtk/gtkcellrendererspin.h | 3 +
gtk/gtkcellrendererspinner.c | 16 +-
gtk/gtkcellrendererspinner.h | 2 +
gtk/gtkcellrenderertext.c | 504 ++-
gtk/gtkcellrenderertext.h | 32 +-
gtk/gtkcellrenderertoggle.c | 128 +-
gtk/gtkcellrenderertoggle.h | 7 +-
gtk/gtkcellsizerequest.c | 5 -
gtk/gtkcellview.c | 26 +-
gtk/gtkcellview.h | 2 +-
gtk/gtkcheckbutton.c | 51 +-
gtk/gtkcheckmenuitem.c | 104 +-
gtk/gtkcheckmenuitem.h | 12 +-
gtk/gtkclipboard-quartz.c | 5 +-
gtk/gtkclipboard.c | 4 -
gtk/gtkcolorbutton.c | 285 +-
gtk/gtkcolorbutton.h | 3 +-
gtk/gtkcolorsel.c | 6 -
gtk/gtkcolorsel.h | 4 +-
gtk/gtkcolorseldialog.c | 109 +-
gtk/gtkcolorseldialog.h | 7 +-
gtk/gtkcombobox.c | 176 +-
gtk/gtkcombobox.h | 2 +-
gtk/gtkcomboboxentry.c | 42 +-
gtk/gtkcomboboxentry.h | 2 +-
gtk/gtkcontainer.c | 158 +-
gtk/gtkcontainer.h | 21 +-
gtk/gtkcustompaperunixdialog.c | 30 +-
gtk/gtkcustompaperunixdialog.h | 4 +-
gtk/gtkdialog.c | 156 +-
gtk/gtkdialog.h | 7 +-
gtk/gtkdnd-quartz.c | 4 -
gtk/gtkdnd.c | 34 +-
gtk/gtkdrawingarea.c | 4 -
gtk/gtkeditable.c | 4 -
gtk/gtkentry.c | 19 +-
gtk/gtkentrybuffer.c | 4 -
gtk/gtkentrycompletion.c | 47 +-
gtk/gtkentrycompletion.h | 2 +-
gtk/gtkeventbox.c | 43 +-
gtk/gtkexpander.c | 56 +-
gtk/gtkexpander.h | 2 +-
gtk/gtkfilechooser.c | 4 -
gtk/gtkfilechooserbutton.c | 10 +-
gtk/gtkfilechooserbutton.h | 4 +-
gtk/gtkfilechooserdefault.c | 171 +-
gtk/gtkfilechooserdialog.c | 38 +-
gtk/gtkfilechooserdialog.h | 2 +-
gtk/gtkfilechooserembed.c | 1 -
gtk/gtkfilechooserentry.c | 1 -
gtk/gtkfilechoosersettings.c | 1 -
gtk/gtkfilechooserutils.c | 2 +-
gtk/gtkfilechooserwidget.c | 4 -
gtk/gtkfilechooserwidget.h | 2 +-
gtk/gtkfilefilter.c | 5 -
gtk/gtkfilesystem.c | 2 -
gtk/gtkfilesystemmodel.c | 1 -
gtk/gtkfixed.c | 73 +-
gtk/gtkfixed.h | 5 +-
gtk/gtkfontbutton.c | 13 +-
gtk/gtkfontbutton.h | 2 +-
gtk/gtkfontsel.c | 476 ++-
gtk/gtkfontsel.h | 40 +-
gtk/gtkframe.c | 254 +-
gtk/gtkframe.h | 10 +-
gtk/gtkgc.c | 4 -
gtk/gtkhandlebox.c | 527 ++-
gtk/gtkhandlebox.h | 22 +-
gtk/gtkhbbox.c | 4 -
gtk/gtkhbox.c | 4 -
gtk/gtkhpaned.c | 5 +-
gtk/gtkhruler.c | 5 +-
gtk/gtkhscale.c | 4 -
gtk/gtkhscrollbar.c | 5 +-
gtk/gtkhseparator.c | 5 +-
gtk/gtkhsv.c | 181 +-
gtk/gtkhsv.h | 9 +-
gtk/gtkiconcache.c | 1 -
gtk/gtkiconfactory.c | 42 +-
gtk/gtkiconfactory.h | 7 +-
gtk/gtkicontheme.c | 11 +-
gtk/gtkicontheme.h | 2 +-
gtk/gtkiconview.c | 75 +-
gtk/gtkiconview.h | 3 +-
gtk/gtkimage.c | 784 ++--
gtk/gtkimage.h | 25 +-
gtk/gtkimagemenuitem.c | 186 +-
gtk/gtkimagemenuitem.h | 4 +-
gtk/gtkimcontext.c | 4 -
gtk/gtkimcontextsimple.c | 242 +-
gtk/gtkimcontextsimple.h | 11 +-
gtk/gtkimmodule.c | 1 -
gtk/gtkimmulticontext.c | 155 +-
gtk/gtkimmulticontext.h | 7 +-
gtk/gtkinfobar.c | 34 +-
gtk/gtkinvisible.c | 53 +-
gtk/gtkinvisible.h | 5 +-
gtk/gtkitem.c | 4 -
gtk/gtkkeyhash.c | 1 -
gtk/gtklabel.c | 1216 +++---
gtk/gtklabel.h | 27 +-
gtk/gtklayout.c | 298 +-
gtk/gtklayout.h | 22 +-
gtk/gtklinkbutton.c | 12 +-
gtk/gtklinkbutton.h | 2 +-
gtk/gtkliststore.c | 446 ++-
gtk/gtkliststore.h | 15 +-
gtk/gtkmain.c | 4 -
gtk/gtkmenu.c | 69 +-
gtk/gtkmenubar.c | 54 +-
gtk/gtkmenubar.h | 8 +-
gtk/gtkmenuitem.c | 105 +-
gtk/gtkmenushell.c | 45 +-
gtk/gtkmenutoolbutton.c | 12 +-
gtk/gtkmenutoolbutton.h | 2 +-
gtk/gtkmessagedialog.c | 145 +-
gtk/gtkmessagedialog.h | 9 +-
gtk/gtkmisc.c | 118 +-
gtk/gtkmisc.h | 8 +-
gtk/gtkmnemonichash.c | 1 -
gtk/gtkmodules.c | 1 -
gtk/gtkmountoperation-x11.c | 3 -
gtk/gtkmountoperation.c | 16 +-
gtk/gtknotebook.c | 1509 ++++---
gtk/gtknotebook.h | 38 +-
gtk/gtkobject.c | 6 -
gtk/gtkoffscreenwindow.c | 30 +-
gtk/gtkorientable.c | 4 -
gtk/gtkpagesetup.c | 4 -
gtk/gtkpagesetupunixdialog.c | 26 +-
gtk/gtkpagesetupunixdialog.h | 4 +-
gtk/gtkpaned.c | 799 ++--
gtk/gtkpaned.h | 31 +-
gtk/gtkpapersize.c | 5 -
gtk/gtkpathbar.c | 17 +-
gtk/gtkplug-stub.c | 1 -
gtk/gtkplug-win32.c | 1 -
gtk/gtkplug-x11.c | 1 -
gtk/gtkplug.c | 36 +-
gtk/gtkprint-win32.c | 5 -
gtk/gtkprintbackend.c | 23 +-
gtk/gtkprintcontext.c | 5 -
gtk/gtkprinter.c | 13 +-
gtk/gtkprinter.h | 3 +-
gtk/gtkprinteroption.c | 5 -
gtk/gtkprinteroptionset.c | 5 -
gtk/gtkprinteroptionwidget.c | 4 -
gtk/gtkprintjob.c | 5 -
gtk/gtkprintoperation-unix.c | 5 +-
gtk/gtkprintoperation-win32.c | 6 +-
gtk/gtkprintoperation.c | 9 +-
gtk/gtkprintoperation.h | 3 +-
gtk/gtkprintoperationpreview.c | 5 -
gtk/gtkprintsettings.c | 5 -
gtk/gtkprintunixdialog.c | 48 +-
gtk/gtkprintunixdialog.h | 3 +-
gtk/gtkprintutils.c | 1 -
gtk/gtkprogressbar.c | 422 +-
gtk/gtkprogressbar.h | 25 +-
gtk/gtkquartz.c | 1 -
gtk/gtkradioaction.c | 29 +-
gtk/gtkradioaction.h | 3 +-
gtk/gtkradiobutton.c | 112 +-
gtk/gtkradiobutton.h | 4 +-
gtk/gtkradiomenuitem.c | 94 +-
gtk/gtkradiomenuitem.h | 4 +-
gtk/gtkradiotoolbutton.c | 5 +-
gtk/gtkrange.c | 7 +-
gtk/gtkrbtree.c | 1 -
gtk/gtkrc.c | 5 -
gtk/gtkrecentaction.c | 33 +-
gtk/gtkrecentaction.h | 2 +-
gtk/gtkrecentchooser.c | 5 -
gtk/gtkrecentchooserdefault.c | 2 +-
gtk/gtkrecentchooserdialog.c | 32 +-
gtk/gtkrecentchooserdialog.h | 4 +-
gtk/gtkrecentchoosermenu.c | 20 +-
gtk/gtkrecentchoosermenu.h | 4 +-
gtk/gtkrecentchooserutils.c | 1 -
gtk/gtkrecentchooserwidget.c | 5 -
gtk/gtkrecentchooserwidget.h | 4 +-
gtk/gtkrecentfilter.c | 5 -
gtk/gtkrecentmanager.c | 173 +-
gtk/gtkrecentmanager.h | 35 +-
gtk/gtkruler.c | 275 +-
gtk/gtkruler.h | 18 +-
gtk/gtkscale.c | 133 +-
gtk/gtkscale.h | 6 +-
gtk/gtkscalebutton.c | 43 +-
gtk/gtkscalebutton.h | 5 +-
gtk/gtkscrollbar.c | 5 -
gtk/gtkscrolledwindow.c | 94 +-
gtk/gtkselection.c | 5 -
gtk/gtkseparator.c | 6 -
gtk/gtkseparatormenuitem.c | 5 -
gtk/gtkseparatortoolitem.c | 217 +-
gtk/gtkseparatortoolitem.h | 2 +-
gtk/gtksettings.c | 5 -
gtk/gtkshow.c | 7 -
gtk/gtksizegroup.c | 133 +-
gtk/gtksizegroup.h | 11 +-
gtk/gtksizerequest.c | 4 -
gtk/gtksocket-stub.c | 1 -
gtk/gtksocket-win32.c | 1 -
gtk/gtksocket-x11.c | 1 -
gtk/gtksocket.c | 12 +-
gtk/gtkspinbutton.c | 581 ++-
gtk/gtkspinbutton.h | 26 +-
gtk/gtkspinner.c | 14 +-
gtk/gtkspinner.h | 2 +
gtk/gtkstatusbar.c | 310 +-
gtk/gtkstatusbar.h | 21 +-
gtk/gtkstatusicon.c | 13 +-
gtk/gtkstatusicon.h | 2 +-
gtk/gtkstock.c | 7 +-
gtk/gtkstock.h | 2 +-
gtk/gtkstyle.c | 165 +-
gtk/gtkstyle.h | 1 -
gtk/gtktable.c | 685 ++--
gtk/gtktable.h | 11 +-
gtk/gtktearoffmenuitem.c | 46 +-
gtk/gtktearoffmenuitem.h | 4 +-
gtk/gtktestutils.c | 25 +-
gtk/gtktextbtree.c | 4 -
gtk/gtktextbuffer.c | 199 +-
gtk/gtktextbuffer.h | 18 +-
gtk/gtktextbufferrichtext.c | 4 -
gtk/gtktextbufferserialize.c | 17 +-
gtk/gtktextchild.c | 4 -
gtk/gtktextdisplay.c | 185 +-
gtk/gtktextiter.c | 5 +-
gtk/gtktextlayout.c | 4 -
gtk/gtktextmark.c | 5 +-
gtk/gtktextsegment.c | 4 -
gtk/gtktexttag.c | 4 -
gtk/gtktexttagtable.c | 4 -
gtk/gtktexttypes.c | 4 -
gtk/gtktextutil.c | 56 +-
gtk/gtktextview.c | 1922 +++++----
gtk/gtktextview.h | 91 +-
gtk/gtkthemes.c | 5 +-
gtk/gtktoggleaction.c | 32 +-
gtk/gtktoggleaction.h | 7 +-
gtk/gtktoggleactionprivate.h | 43 -
gtk/gtktogglebutton.c | 7 +-
gtk/gtktoggletoolbutton.c | 11 +-
gtk/gtktoggletoolbutton.h | 2 +-
gtk/gtktoolbar.c | 89 +-
gtk/gtktoolbutton.c | 20 +-
gtk/gtktoolbutton.h | 2 +-
gtk/gtktoolitem.c | 34 +-
gtk/gtktoolitem.h | 2 +-
gtk/gtktoolitemgroup.c | 19 +-
gtk/gtktoolpalette.c | 18 +-
gtk/gtktoolshell.c | 5 +-
gtk/gtktooltip.c | 5 -
gtk/gtktrayicon-x11.c | 10 +-
gtk/gtktreedatalist.c | 1 -
gtk/gtktreednd.c | 4 -
gtk/gtktreemodel.c | 20 +-
gtk/gtktreemodelfilter.c | 13 +-
gtk/gtktreemodelfilter.h | 2 +-
gtk/gtktreemodelsort.c | 9 +-
gtk/gtktreeprivate.h | 6 +-
gtk/gtktreeselection.c | 9 +-
gtk/gtktreesortable.c | 5 +-
gtk/gtktreestore.c | 19 +-
gtk/gtktreeview.c | 386 +-
gtk/gtktreeview.h | 3 +-
gtk/gtktreeviewcolumn.c | 53 +-
gtk/gtktypebuiltins.c.template | 4 +-
gtk/gtktypeutils.c | 5 +-
gtk/gtkuimanager.c | 9 +-
gtk/gtkuimanager.h | 3 +-
gtk/gtkvbbox.c | 6 +-
gtk/gtkvbox.c | 5 +-
gtk/gtkviewport.c | 205 +-
gtk/gtkviewport.h | 8 +-
gtk/gtkvolumebutton.c | 20 +-
gtk/gtkvpaned.c | 5 +-
gtk/gtkvruler.c | 5 +-
gtk/gtkvscale.c | 5 +-
gtk/gtkvscrollbar.c | 5 +-
gtk/gtkvseparator.c | 5 +-
gtk/gtkwidget.c | 49 +-
gtk/gtkwidget.h | 1 +
gtk/gtkwin32embed.c | 1 -
gtk/gtkwin32embedwidget.c | 4 -
gtk/gtkwindow-decorate.c | 80 +-
gtk/gtkwindow.c | 144 +-
gtk/gtkwindow.h | 2 +-
gtk/gtkxembed.c | 2 +-
gtk/makefile.msc.in | 8 +-
gtk/makegtkalias.pl | 143 -
gtk/pltcheck.sh | 17 -
gtk/tests/builder.c | 36 +-
gtk/tests/expander.c | 4 +-
gtk/tests/testing.c | 27 +-
modules/engines/pixbuf/pixbuf-render.c | 69 +-
modules/input/gtkimcontextxim.c | 27 +-
modules/other/gail/gail.c | 12 +-
modules/other/gail/gailbox.c | 2 +-
modules/other/gail/gailbutton.c | 88 +-
modules/other/gail/gailcheckmenuitem.c | 4 +-
modules/other/gail/gailchecksubmenuitem.c | 4 +-
modules/other/gail/gailcombobox.c | 37 +-
modules/other/gail/gailcontainer.c | 5 +-
modules/other/gail/gailentry.c | 65 +-
modules/other/gail/gailexpander.c | 36 +-
modules/other/gail/gailframe.c | 2 +-
modules/other/gail/gailimage.c | 12 +-
modules/other/gail/gailimagecell.c | 2 +-
modules/other/gail/gailitem.c | 24 +-
modules/other/gail/gaillabel.c | 42 +-
modules/other/gail/gailmenu.c | 4 +-
modules/other/gail/gailmenuitem.c | 27 +-
modules/other/gail/gailmenushell.c | 12 +-
modules/other/gail/gailnotebook.c | 41 +-
modules/other/gail/gailnotebookpage.c | 8 +-
modules/other/gail/gailnotebookpage.h | 4 +
modules/other/gail/gailpaned.c | 18 +-
modules/other/gail/gailradiobutton.c | 2 +-
modules/other/gail/gailradiomenuitem.c | 2 +-
modules/other/gail/gailradiosubmenuitem.c | 2 +-
modules/other/gail/gailrange.c | 13 +-
modules/other/gail/gailscale.c | 22 +-
modules/other/gail/gailscalebutton.c | 12 +-
modules/other/gail/gailscrollbar.c | 2 +-
modules/other/gail/gailscrolledwindow.c | 40 +-
modules/other/gail/gailseparator.c | 2 +-
modules/other/gail/gailspinbutton.c | 14 +-
modules/other/gail/gailstatusbar.c | 31 +-
modules/other/gail/gailsubmenuitem.c | 12 +-
modules/other/gail/gailtextcell.c | 158 +-
modules/other/gail/gailtextview.c | 96 +-
modules/other/gail/gailtogglebutton.c | 2 +-
modules/other/gail/gailtoplevel.c | 11 +-
modules/other/gail/gailtreeview.c | 79 +-
modules/other/gail/gailutil.c | 4 +-
modules/other/gail/gailwidget.c | 44 +-
modules/other/gail/gailwindow.c | 20 +-
modules/other/gail/libgail-util/gailmisc.c | 2 +-
modules/other/gail/libgail-util/gailmisc.h | 2 +-
modules/other/gail/tests/ferret.c | 28 +-
modules/other/gail/tests/testaction.c | 2 +-
modules/other/gail/tests/testbutton.c | 2 +-
modules/other/gail/tests/testcombo.c | 2 +-
modules/other/gail/tests/testimage.c | 23 +-
modules/other/gail/tests/testlib.c | 6 +-
modules/other/gail/tests/testmenuitem.c | 6 +-
modules/other/gail/tests/testnotebook.c | 9 +-
modules/other/gail/tests/testobject.c | 4 +-
modules/other/gail/tests/testpaned.c | 2 +-
modules/other/gail/tests/testselection.c | 2 +-
modules/other/gail/tests/testtext.c | 5 +-
modules/printbackends/cups/gtkprintbackendcups.c | 4 +-
po-properties/br.po | 4426 +++++++++---------
po-properties/de.po | 5374 ++++++++++------------
po-properties/es.po | 3171 +++++++-------
po-properties/gl.po | 3417 +++++++-------
po-properties/he.po | 3165 +++++++-------
po-properties/sl.po | 4923 ++++++++++----------
po-properties/zh_CN.po | 3803 ++++++++--------
po-properties/zh_HK.po | 3795 ++++++++--------
po-properties/zh_TW.po | 3686 ++++++++--------
po/POTFILES.in | 6 +
po/ast.po | 1753 ++++----
po/cs.po | 1730 ++++----
po/de.po | 1794 ++++----
po/eo.po | 1883 ++++----
po/es.po | 1743 ++++----
po/et.po | 1257 +-----
po/gl.po | 1728 ++++----
po/he.po | 785 ++--
po/id.po | 2226 ++++------
po/kk.po | 2724 ++++++-----
po/nb.po | 1799 ++++----
po/sl.po | 1903 ++++----
po/zh_CN.po | 1774 ++++----
po/zh_HK.po | 1756 ++++----
po/zh_TW.po | 1721 ++++----
tests/gtkoffscreenbox.c | 14 +-
tests/prop-editor.c | 6 +-
tests/testassistant.c | 4 +-
tests/testcombochange.c | 7 +-
tests/testfilechooserbutton.c | 15 +-
tests/testframe.c | 23 +-
tests/testgtk.c | 571 ++-
tests/testinput.c | 71 +-
tests/testmenubars.c | 10 +-
tests/testmultidisplay.c | 14 +-
tests/testoffscreen.c | 47 +-
tests/testrgb.c | 12 +-
tests/testselection.c | 13 +-
tests/teststatusicon.c | 9 +-
tests/testtooltips.c | 5 +-
tests/testtreeflow.c | 2 +-
tests/testwindows.c | 19 +-
593 files changed, 43742 insertions(+), 46274 deletions(-)
---
diff --cc gtk/gtkbox.c
index c3db663,c372a1d..88c6ecb
--- a/gtk/gtkbox.c
+++ b/gtk/gtkbox.c
@@@ -98,18 -98,62 +98,46 @@@ enum
CHILD_PROP_POSITION
};
-
+ struct _GtkBoxPriv
+ {
+ GtkOrientation orientation;
- typedef struct _GtkBoxPrivate GtkBoxPrivate;
+ GList *children;
- struct _GtkBoxPrivate
- {
- GtkOrientation orientation;
- guint default_expand : 1;
- guint spacing_set : 1;
+ gint16 spacing;
+
+ guint default_expand : 1;
+ guint homogeneous : 1;
+ guint spacing_set : 1;
};
- #define GTK_BOX_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GTK_TYPE_BOX, GtkBoxPrivate))
-
-typedef struct _GtkBoxDesiredSizes GtkBoxDesiredSizes;
-typedef struct _GtkBoxSpreading GtkBoxSpreading;
+ typedef struct _GtkBoxChild GtkBoxChild;
+
+ /*
+ * GtkBoxChild:
+ * @widget: the child widget, packed into the GtkBox.
+ * @padding: the number of extra pixels to put between this child and its
+ * neighbors, set when packed, zero by default.
+ * @expand: flag indicates whether extra space should be given to this child.
+ * Any extra space given to the parent GtkBox is divided up among all children
+ * with this attribute set to %TRUE; set when packed, %TRUE by default.
+ * @fill: flag indicates whether any extra space given to this child due to its
+ * @expand attribute being set is actually allocated to the child, rather than
+ * being used as padding around the widget; set when packed, %TRUE by default.
+ * @pack: one of #GtkPackType indicating whether the child is packed with
+ * reference to the start (top/left) or end (bottom/right) of the GtkBox.
+ */
+ struct _GtkBoxChild
+ {
+ GtkWidget *widget;
+
+ guint16 padding;
+
+ guint expand : 1;
+ guint fill : 1;
+ guint pack : 1;
+ };
-struct _GtkBoxDesiredSizes
-{
- gint minimum_size;
- gint natural_size;
-};
-
-struct _GtkBoxSpreading
-{
- GtkBoxChild *child;
- gint index;
-};
-
static void gtk_box_size_allocate (GtkWidget *widget,
GtkAllocation *allocation);
@@@ -377,10 -453,11 +413,10 @@@ gtk_box_size_allocate (GtkWidget *w
if (nvis_children > 0)
{
- gint border_width = GTK_CONTAINER (box)->border_width;
+ guint border_width = gtk_container_get_border_width (GTK_CONTAINER (box));
GtkTextDirection direction = gtk_widget_get_direction (widget);
GtkAllocation child_allocation;
- GtkBoxSpreading *spreading = g_newa (GtkBoxSpreading, nvis_children);
- GtkBoxDesiredSizes *sizes = g_newa (GtkBoxDesiredSizes, nvis_children);
+ GtkRequestedSize *sizes = g_newa (GtkRequestedSize, nvis_children);
GtkPackType packing;
@@@ -895,15 -1012,17 +931,15 @@@ gtk_box_compute_size_for_opposing_orien
if (nvis_children > 0)
{
- GtkBoxSpreading *spreading = g_newa (GtkBoxSpreading, nvis_children);
- GtkBoxDesiredSizes *sizes = g_newa (GtkBoxDesiredSizes, nvis_children);
- GtkPackType packing;
- gint size;
- gint extra, i;
- gint child_size, child_minimum, child_natural;
+ GtkRequestedSize *sizes = g_newa (GtkRequestedSize, nvis_children);
+ GtkPackType packing;
+ gint size, extra, i;
+ gint child_size, child_minimum, child_natural;
- size = avail_size - border_width * 2 - (nvis_children - 1) * box->spacing;
+ size = avail_size - border_width * 2 - (nvis_children - 1) * private->spacing;
/* Retrieve desired size for visible children */
- for (i = 0, children = box->children; children; children = children->next)
+ for (i = 0, children = private->children; children; children = children->next)
{
child = children->data;
diff --cc gtk/gtkcellrenderer.c
index 793cd02,17744e8..8c940f2
--- a/gtk/gtkcellrenderer.c
+++ b/gtk/gtkcellrenderer.c
@@@ -24,10 -23,8 +24,10 @@@
#include "gtkmarshalers.h"
#include "gtkprivate.h"
#include "gtktreeprivate.h"
- #include "gtkalias.h"
+
+static void gtk_cell_renderer_init (GtkCellRenderer *cell);
+static void gtk_cell_renderer_class_init (GtkCellRendererClass *class);
static void gtk_cell_renderer_get_property (GObject *object,
guint param_id,
GValue *value,
@@@ -39,34 -36,26 +39,48 @@@ static void gtk_cell_renderer_set_prope
static void set_cell_bg_color (GtkCellRenderer *cell,
GdkColor *color);
+/* Fallback GtkCellSizeRequest implementation to use remaining ->get_size() implementations */
+static void gtk_cell_renderer_cell_size_request_init (GtkCellSizeRequestIface *iface);
+static void gtk_cell_renderer_get_width (GtkCellSizeRequest *cell,
+ GtkWidget *widget,
+ gint *minimum_size,
+ gint *natural_size);
+static void gtk_cell_renderer_get_height (GtkCellSizeRequest *cell,
+ GtkWidget *widget,
+ gint *minimum_size,
+ gint *natural_size);
+static void gtk_cell_renderer_get_height_for_width (GtkCellSizeRequest *cell,
+ GtkWidget *widget,
+ gint width,
+ gint *minimum_height,
+ gint *natural_height);
+static void gtk_cell_renderer_get_width_for_height (GtkCellSizeRequest *cell,
+ GtkWidget *widget,
+ gint height,
+ gint *minimum_width,
+ gint *natural_width);
+
+
- #define GTK_CELL_RENDERER_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GTK_TYPE_CELL_RENDERER, GtkCellRendererPrivate))
-
- typedef struct _GtkCellRendererPrivate GtkCellRendererPrivate;
- struct _GtkCellRendererPrivate
+ struct _GtkCellRendererPriv
{
+ gfloat xalign;
+ gfloat yalign;
+
+ gint width;
+ gint height;
+
+ guint16 xpad;
+ guint16 ypad;
+
+ guint mode : 2;
+ guint visible : 1;
+ guint is_expander : 1;
+ guint is_expanded : 1;
+ guint cell_background_set : 1;
+ guint sensitive : 1;
+ guint editing : 1;
+
GdkColor cell_background;
};
@@@ -1028,130 -1035,3 +1093,131 @@@ gtk_cell_renderer_stop_editing (GtkCell
g_signal_emit (cell, cell_renderer_signals[EDITING_CANCELED], 0);
}
}
+
+static void
+gtk_cell_renderer_cell_size_request_init (GtkCellSizeRequestIface *iface)
+{
+ iface->get_width = gtk_cell_renderer_get_width;
+ iface->get_height = gtk_cell_renderer_get_height;
+
+ iface->get_width_for_height = gtk_cell_renderer_get_width_for_height;
+ iface->get_height_for_width = gtk_cell_renderer_get_height_for_width;
+}
+
+static void
+gtk_cell_renderer_get_desired_size (GtkCellSizeRequest *cell,
+ GtkWidget *widget,
+ GtkOrientation orientation,
+ gint *minimum_size,
+ gint *natural_size)
+{
+ GtkRequisition min_req;
+
+ /* Fallback on the old API to get the size. */
+ if (GTK_CELL_RENDERER_GET_CLASS (cell)->get_size)
+ GTK_CELL_RENDERER_GET_CLASS (cell)->get_size (GTK_CELL_RENDERER (cell), widget, NULL, NULL, NULL,
+ &min_req.width, &min_req.height);
+ else
+ {
+ min_req.width = 0;
+ min_req.height = 0;
+ }
+
+ if (orientation == GTK_ORIENTATION_HORIZONTAL)
+ {
+ if (minimum_size)
+ *minimum_size = min_req.width;
+
+ if (natural_size)
+ *natural_size = min_req.width;
+ }
+ else
+ {
+ if (minimum_size)
+ *minimum_size = min_req.height;
+
+ if (natural_size)
+ *natural_size = min_req.height;
+ }
+}
+
+static void
+gtk_cell_renderer_get_width (GtkCellSizeRequest *cell,
+ GtkWidget *widget,
+ gint *minimum_size,
+ gint *natural_size)
+{
+ gtk_cell_renderer_get_desired_size (cell, widget, GTK_ORIENTATION_HORIZONTAL,
+ minimum_size, natural_size);
+}
+
+static void
+gtk_cell_renderer_get_height (GtkCellSizeRequest *cell,
+ GtkWidget *widget,
+ gint *minimum_size,
+ gint *natural_size)
+{
+ gtk_cell_renderer_get_desired_size (cell, widget, GTK_ORIENTATION_VERTICAL,
+ minimum_size, natural_size);
+}
+
+
+static void
+gtk_cell_renderer_get_height_for_width (GtkCellSizeRequest *cell,
+ GtkWidget *widget,
+ gint width,
+ gint *minimum_height,
+ gint *natural_height)
+{
+ /* Fall back on the height reported from ->get_size() */
+ gtk_cell_size_request_get_height (cell, widget, minimum_height, natural_height);
+}
+
+static void
+gtk_cell_renderer_get_width_for_height (GtkCellSizeRequest *cell,
+ GtkWidget *widget,
+ gint height,
+ gint *minimum_width,
+ gint *natural_width)
+{
+ /* Fall back on the width reported from ->get_size() */
+ gtk_cell_size_request_get_width (cell, widget, minimum_width, natural_width);
+}
+
+/* An internal convenience function for some containers to peek at the
+ * cell alignment in a target allocation (used to draw focus and align
+ * cells in the icon view).
+ *
+ * Note this is only a trivial 'align * (allocation - request)' operation.
+ */
+void
+_gtk_cell_renderer_calc_offset (GtkCellRenderer *cell,
+ const GdkRectangle *cell_area,
+ GtkTextDirection direction,
+ gint width,
+ gint height,
+ gint *x_offset,
+ gint *y_offset)
- {
++{
++ GtkCellRendererPriv *priv;
++
+ g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
+ g_return_if_fail (cell_area != NULL);
+ g_return_if_fail (x_offset || y_offset);
+
++ priv = cell->priv;
++
+ if (x_offset)
+ {
+ *x_offset = (((direction == GTK_TEXT_DIR_RTL) ?
- (1.0 - cell->xalign) : cell->xalign) *
++ (1.0 - priv->xalign) : priv->xalign) *
+ (cell_area->width - width));
+ *x_offset = MAX (*x_offset, 0);
+ }
+ if (y_offset)
+ {
- *y_offset = (cell->yalign *
++ *y_offset = (priv->yalign *
+ (cell_area->height - height));
+ *y_offset = MAX (*y_offset, 0);
+ }
+}
-
- #define __GTK_CELL_RENDERER_C__
- #include "gtkaliasdef.c"
diff --cc gtk/gtkcellrenderertext.c
index c2df04b,46c5211..8199bb0
--- a/gtk/gtkcellrenderertext.c
+++ b/gtk/gtkcellrenderertext.c
@@@ -132,36 -123,53 +132,55 @@@ static guint text_cell_renderer_signal
#define GTK_CELL_RENDERER_TEXT_PATH "gtk-cell-renderer-text-path"
- #define GTK_CELL_RENDERER_TEXT_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GTK_TYPE_CELL_RENDERER_TEXT, GtkCellRendererTextPrivate))
-
- typedef struct _GtkCellRendererTextPrivate GtkCellRendererTextPrivate;
- struct _GtkCellRendererTextPrivate
+ struct _GtkCellRendererTextPriv
{
- guint single_paragraph : 1;
- guint language_set : 1;
- guint markup_set : 1;
- guint ellipsize_set : 1;
- guint align_set : 1;
-
- gulong focus_out_id;
- PangoLanguage *language;
- PangoEllipsizeMode ellipsize;
- PangoWrapMode wrap_mode;
- PangoAlignment align;
-
- gulong populate_popup_id;
- gulong entry_menu_popdown_timeout;
+ GtkWidget *entry;
+
+ PangoAlignment align;
+ PangoAttrList *extra_attrs;
+ PangoColor foreground;
+ PangoColor background;
+ PangoEllipsizeMode ellipsize;
+ PangoFontDescription *font;
+ PangoLanguage *language;
+ PangoUnderline underline_style;
+ PangoWrapMode wrap_mode;
+
gboolean in_entry_menu;
-
+
+ gchar *text;
+
+ gdouble font_scale;
+
+ gint rise;
+ gint fixed_height_rows;
gint width_chars;
gint wrap_width;
-
- GtkWidget *entry;
+
+ guint strikethrough : 1;
+ guint editable : 1;
+ guint scale_set : 1;
+ guint foreground_set : 1;
+ guint background_set : 1;
+ guint underline_set : 1;
+ guint rise_set : 1;
+ guint strikethrough_set : 1;
+ guint editable_set : 1;
+ guint calc_fixed_height : 1;
+ guint single_paragraph : 1;
+ guint language_set : 1;
+ guint markup_set : 1;
+ guint ellipsize_set : 1;
+ guint align_set : 1;
+
+ gulong focus_out_id;
+ gulong populate_popup_id;
+ gulong entry_menu_popdown_timeout;
};
-G_DEFINE_TYPE (GtkCellRendererText, gtk_cell_renderer_text, GTK_TYPE_CELL_RENDERER)
+G_DEFINE_TYPE_WITH_CODE (GtkCellRendererText, gtk_cell_renderer_text, GTK_TYPE_CELL_RENDERER,
+ G_IMPLEMENT_INTERFACE (GTK_TYPE_CELL_SIZE_REQUEST,
+ gtk_cell_renderer_text_cell_size_request_init))
static void
gtk_cell_renderer_text_init (GtkCellRendererText *celltext)
@@@ -1372,20 -1382,18 +1392,21 @@@ add_attr (PangoAttrList *attr_list
static PangoLayout*
get_layout (GtkCellRendererText *celltext,
GtkWidget *widget,
- gboolean will_render,
+ GdkRectangle *cell_area,
GtkCellRendererState flags)
{
+ GtkCellRendererTextPriv *priv = celltext->priv;
PangoAttrList *attr_list;
PangoLayout *layout;
PangoUnderline uline;
- GtkCellRendererTextPrivate *priv;
++ gint xpad;
- priv = GTK_CELL_RENDERER_TEXT_GET_PRIVATE (celltext);
-
- layout = gtk_widget_create_pango_layout (widget, celltext->text);
+ layout = gtk_widget_create_pango_layout (widget, priv->text);
+
++ gtk_cell_renderer_get_padding (GTK_CELL_RENDERER (celltext), &xpad, NULL);
+
- if (celltext->extra_attrs)
- attr_list = pango_attr_list_copy (celltext->extra_attrs);
+ if (priv->extra_attrs)
+ attr_list = pango_attr_list_copy (priv->extra_attrs);
else
attr_list = pango_attr_list_new ();
@@@ -1459,12 -1467,7 +1480,12 @@@
if (priv->wrap_width != -1)
{
- pango_layout_set_width (layout, priv->wrap_width * PANGO_SCALE);
+ if (cell_area)
+ pango_layout_set_width (layout,
- (cell_area->width - GTK_CELL_RENDERER (celltext)->xpad * 2) * PANGO_SCALE);
++ (cell_area->width - xpad * 2) * PANGO_SCALE);
+ else
+ pango_layout_set_width (layout, priv->wrap_width * PANGO_SCALE);
+
pango_layout_set_wrap (layout, priv->wrap_mode);
}
else
@@@ -1620,19 -1644,18 +1649,18 @@@ gtk_cell_renderer_text_render (GtkCellR
GtkCellRendererState flags)
{
- GtkCellRendererText *celltext = (GtkCellRendererText *) cell;
+ GtkCellRendererText *celltext = GTK_CELL_RENDERER_TEXT (cell);
+ GtkCellRendererTextPriv *priv = celltext->priv;
PangoLayout *layout;
GtkStateType state;
-- gint x_offset;
-- gint y_offset;
- GtkCellRendererTextPrivate *priv;
-
- priv = GTK_CELL_RENDERER_TEXT_GET_PRIVATE (cell);
++ gint x_offset = 0;
++ gint y_offset = 0;
+ gint xpad, ypad;
- layout = get_layout (celltext, widget, TRUE, flags);
+ layout = get_layout (celltext, widget, cell_area, flags);
get_size (cell, widget, cell_area, layout, &x_offset, &y_offset, NULL, NULL);
- if (!cell->sensitive)
+ if (!gtk_cell_renderer_get_sensitive (cell))
{
state = GTK_STATE_INSENSITIVE;
}
@@@ -1927,152 -1961,7 +1966,149 @@@ gtk_cell_renderer_text_set_fixed_height
}
else
{
- renderer->fixed_height_rows = number_of_rows;
- renderer->calc_fixed_height = TRUE;
+ priv->fixed_height_rows = number_of_rows;
+ priv->calc_fixed_height = TRUE;
}
}
+
+static void
+gtk_cell_renderer_text_cell_size_request_init (GtkCellSizeRequestIface *iface)
+{
+ iface->get_width = gtk_cell_renderer_text_get_width;
+ iface->get_height = gtk_cell_renderer_text_get_height;
+ iface->get_height_for_width = gtk_cell_renderer_text_get_height_for_width;
+}
+
+static void
+gtk_cell_renderer_text_get_width (GtkCellSizeRequest *cell,
+ GtkWidget *widget,
+ gint *minimum_size,
+ gint *natural_size)
+{
- GtkCellRendererTextPrivate *priv;
++ GtkCellRendererTextPriv *priv;
+ GtkCellRendererText *celltext;
+ PangoLayout *layout;
+ PangoContext *context;
+ PangoFontMetrics *metrics;
+ PangoRectangle rect;
+ gint char_width, digit_width, char_pixels, text_width, ellipsize_chars, guess_width, xpad;
+
+ /* "width-chars" Hard-coded minimum width:
+ * - minimum size should be MAX (width-chars, strlen ("..."));
+ * - natural size should be MAX (width-chars, strlen (label->text));
+ *
+ * "wrap-width" User specified natural wrap width
+ * - minimum size should be MAX (width-chars, 0)
+ * - natural size should be MIN (wrap-width, strlen (label->text))
+ */
+
+ celltext = GTK_CELL_RENDERER_TEXT (cell);
- priv = GTK_CELL_RENDERER_TEXT_GET_PRIVATE (cell);
- xpad = GTK_CELL_RENDERER (cell)->xpad;
++ priv = celltext->priv;
++
++ gtk_cell_renderer_get_padding (GTK_CELL_RENDERER (cell), &xpad, NULL);
++
+
+ layout = get_layout (celltext, widget, NULL, 0);
+
+ /* Get the layout with the text possibly wrapping at wrap_width */
+ pango_layout_get_pixel_extents (layout, NULL, &rect);
+ guess_width = rect.width;
+
+ /* Fetch the length of the complete unwrapped text */
+ pango_layout_set_width (layout, -1);
+ pango_layout_get_extents (layout, NULL, &rect);
+ text_width = rect.width;
+
+ /* Fetch the average size of a charachter */
+ context = pango_layout_get_context (layout);
+ metrics = pango_context_get_metrics (context, widget->style->font_desc,
+ pango_context_get_language (context));
+
+ char_width = pango_font_metrics_get_approximate_char_width (metrics);
+ digit_width = pango_font_metrics_get_approximate_digit_width (metrics);
+ char_pixels = MAX (char_width, digit_width);
+
+ pango_font_metrics_unref (metrics);
+ g_object_unref (layout);
+
+ /* enforce minimum width for ellipsized labels at ~3 chars */
+ if (priv->ellipsize_set && priv->ellipsize != PANGO_ELLIPSIZE_NONE)
+ ellipsize_chars = 3;
+ else
+ ellipsize_chars = 0;
+
+ if (minimum_size)
+ {
+ if ((priv->ellipsize_set && priv->ellipsize != PANGO_ELLIPSIZE_NONE) || priv->width_chars > 0)
+ *minimum_size =
+ xpad * 2 + (PANGO_PIXELS (char_width) * MAX (priv->width_chars, ellipsize_chars));
+ /* If no width-chars set, minimum for wrapping text will be the wrap-width */
+ else if (priv->wrap_width > -1)
+ *minimum_size = xpad * 2 + rect.x + priv->wrap_width;
+ else
+ *minimum_size = xpad * 2 + rect.x + guess_width;
+ }
+
+ if (natural_size)
+ {
+ if (priv->wrap_width > -1)
+ *natural_size = xpad * 2 +
+ MIN (priv->wrap_width, PANGO_PIXELS (text_width));
+ else /* Natural size is full text here regardless of ellipsize */
+ *natural_size = xpad * 2 +
+ MAX ((PANGO_PIXELS (char_width) * priv->width_chars), PANGO_PIXELS (text_width));
+ }
+}
+
+static void
+gtk_cell_renderer_text_get_height_for_width (GtkCellSizeRequest *cell,
+ GtkWidget *widget,
+ gint width,
+ gint *minimum_height,
+ gint *natural_height)
+{
- GtkCellRendererTextPrivate *priv;
++ GtkCellRendererTextPriv *priv;
+ GtkCellRendererText *celltext;
+ PangoLayout *layout;
+ gint text_height, xpad, ypad;
+
+
+ celltext = GTK_CELL_RENDERER_TEXT (cell);
- priv = GTK_CELL_RENDERER_TEXT_GET_PRIVATE (cell);
++ priv = celltext->priv;
+
- xpad = GTK_CELL_RENDERER (cell)->xpad;
- ypad = GTK_CELL_RENDERER (cell)->ypad;
++ gtk_cell_renderer_get_padding (GTK_CELL_RENDERER (cell), &xpad, &ypad);
+
+ layout = get_layout (celltext, widget, FALSE, 0);
+
+ pango_layout_set_width (layout, (width - xpad * 2) * PANGO_SCALE);
+ pango_layout_get_pixel_size (layout, NULL, &text_height);
+
+ if (minimum_height)
+ *minimum_height = text_height + ypad * 2;
+
+ if (natural_height)
+ *natural_height = text_height + ypad * 2;
+
+ g_object_unref (layout);
+}
+
+static void
+gtk_cell_renderer_text_get_height (GtkCellSizeRequest *cell,
+ GtkWidget *widget,
+ gint *minimum_size,
+ gint *natural_size)
+{
+ gint min_width;
+
+ /* Thankfully cell renderers dont rotate, so they only have to do
+ * height-for-width and not the opposite. Here we have only to return
+ * the height for the base minimum width of the renderer.
+ *
+ * Note this code path wont be followed by GtkTreeView which is
+ * height-for-width specifically.
+ */
+ gtk_cell_size_request_get_width (cell, widget, &min_width, NULL);
+ gtk_cell_renderer_text_get_height_for_width (cell, widget, min_width,
+ minimum_size, natural_size);
+}
+
-
-
- #define __GTK_CELL_RENDERER_TEXT_C__
- #include "gtkaliasdef.c"
diff --cc gtk/gtkcellsizerequest.c
index 9274bb3,0000000..a09c45e
mode 100644,000000..100644
--- a/gtk/gtkcellsizerequest.c
+++ b/gtk/gtkcellsizerequest.c
@@@ -1,340 -1,0 +1,335 @@@
+/* gtkcellsizerequest.c
+ * Copyright (C) 2010 Openismus GmbH
+ *
+ * Author:
+ * Tristan Van Berkom <tristan van berkom gmail com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+
+#include <config.h>
+#include "gtkcellrenderer.h"
+#include "gtkcellsizerequest.h"
+#include "gtkintl.h"
- #include "gtkalias.h"
+
+
+#define DEBUG_CELL_SIZE_REQUEST 0
+
+GType
+gtk_cell_size_request_get_type (void)
+{
+ static GType cell_size_request_type = 0;
+
+ if (G_UNLIKELY(!cell_size_request_type))
+ {
+ cell_size_request_type =
+ g_type_register_static_simple (G_TYPE_INTERFACE, I_("GtkCellSizeRequest"),
+ sizeof (GtkCellSizeRequestIface),
+ NULL, 0, NULL, 0);
+
+ g_type_interface_add_prerequisite (cell_size_request_type, GTK_TYPE_CELL_RENDERER);
+ }
+ return cell_size_request_type;
+}
+
+/**
+ * gtk_cell_size_request_get_request_mode:
+ * @cell: a #GtkCellSizeRequest instance
+ *
+ * Gets whether the cell renderer prefers a height-for-width layout
+ * or a width-for-height layout.
+ *
+ * Returns: The #GtkSizeRequestMode preferred by this renderer.
+ *
+ * Since: 3.0
+ */
+GtkSizeRequestMode
+gtk_cell_size_request_get_request_mode (GtkCellSizeRequest *cell)
+{
+ GtkCellSizeRequestIface *iface;
+
+ g_return_val_if_fail (GTK_IS_CELL_SIZE_REQUEST (cell), FALSE);
+
+ iface = GTK_CELL_SIZE_REQUEST_GET_IFACE (cell);
+ if (iface->get_request_mode)
+ return iface->get_request_mode (cell);
+
+ /* By default cell renderers are height-for-width. */
+ return GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH;
+}
+
+/**
+ * gtk_cell_size_request_get_width:
+ * @cell: a #GtkCellSizeRequest instance
+ * @widget: the #GtkWidget this cell will be rendering to
+ * @minimum_size: location to store the minimum size, or %NULL
+ * @natural_size: location to store the natural size, or %NULL
+ *
+ * Retreives a renderer's natural size when rendered to @widget.
+ *
+ * Since: 3.0
+ */
+void
+gtk_cell_size_request_get_width (GtkCellSizeRequest *cell,
+ GtkWidget *widget,
+ gint *minimum_size,
+ gint *natural_size)
+{
+ GtkCellSizeRequestIface *iface;
+ gint width;
+
+ g_return_if_fail (GTK_IS_CELL_SIZE_REQUEST (cell));
+ g_return_if_fail (GTK_IS_WIDGET (widget));
+ g_return_if_fail (NULL != minimum_size || NULL != natural_size);
+
+ gtk_cell_renderer_get_fixed_size (GTK_CELL_RENDERER (cell), &width, NULL);
+
+ if (width < 0)
+ {
+ iface = GTK_CELL_SIZE_REQUEST_GET_IFACE (cell);
+ iface->get_width (cell, widget, minimum_size, natural_size);
+ }
+ else
+ {
+ if (minimum_size)
+ *minimum_size = width;
+ if (natural_size)
+ *natural_size = width;
+ }
+
+#if DEBUG_CELL_SIZE_REQUEST
+ g_message ("%s returning minimum width: %d and natural width: %d",
+ G_OBJECT_TYPE_NAME (cell),
+ minimum_size ? *minimum_size : 20000,
+ natural_size ? *natural_size : 20000);
+#endif
+}
+
+
+/**
+ * gtk_cell_size_request_get_height:
+ * @cell: a #GtkCellSizeRequest instance
+ * @widget: the #GtkWidget this cell will be rendering to
+ * @minimum_size: location to store the minimum size, or %NULL
+ * @natural_size: location to store the natural size, or %NULL
+ *
+ * Retreives a renderer's natural size when rendered to @widget.
+ *
+ * Since: 3.0
+ */
+void
+gtk_cell_size_request_get_height (GtkCellSizeRequest *cell,
+ GtkWidget *widget,
+ gint *minimum_size,
+ gint *natural_size)
+{
+ GtkCellSizeRequestIface *iface;
+ gint height;
+
+ g_return_if_fail (GTK_IS_CELL_SIZE_REQUEST (cell));
+ g_return_if_fail (GTK_IS_WIDGET (widget));
+ g_return_if_fail (NULL != minimum_size || NULL != natural_size);
+
+ gtk_cell_renderer_get_fixed_size (GTK_CELL_RENDERER (cell), NULL, &height);
+
+ if (height < 0)
+ {
+ iface = GTK_CELL_SIZE_REQUEST_GET_IFACE (cell);
+ iface->get_height (cell, widget, minimum_size, natural_size);
+ }
+ else
+ {
+ if (minimum_size)
+ *minimum_size = height;
+ if (natural_size)
+ *natural_size = height;
+ }
+
+#if DEBUG_CELL_SIZE_REQUEST
+ g_message ("%s returning minimum height: %d and natural height: %d",
+ G_OBJECT_TYPE_NAME (cell),
+ minimum_size ? *minimum_size : 20000,
+ natural_size ? *natural_size : 20000);
+#endif
+}
+
+
+/**
+ * gtk_cell_size_request_get_width_for_height:
+ * @cell: a #GtkCellSizeRequest instance
+ * @widget: the #GtkWidget this cell will be rendering to
+ * @height: the size which is available for allocation
+ * @minimum_width: location for storing the minimum size, or %NULL
+ * @natural_width: location for storing the preferred size, or %NULL
+ *
+ * Retreives a cell renderers's minimum and natural width if it were rendered to
+ * @widget with the specified @height.
+ *
+ * Since: 3.0
+ */
+void
+gtk_cell_size_request_get_width_for_height (GtkCellSizeRequest *cell,
+ GtkWidget *widget,
+ gint height,
+ gint *minimum_width,
+ gint *natural_width)
+{
+ GtkCellSizeRequestIface *iface;
+ gint width;
+
+ g_return_if_fail (GTK_IS_CELL_SIZE_REQUEST (cell));
+ g_return_if_fail (GTK_IS_WIDGET (widget));
+ g_return_if_fail (NULL != minimum_width || NULL != natural_width);
+
+ gtk_cell_renderer_get_fixed_size (GTK_CELL_RENDERER (cell), &width, NULL);
+
+ if (width < 0)
+ {
+ iface = GTK_CELL_SIZE_REQUEST_GET_IFACE (cell);
+ iface->get_width_for_height (cell, widget, height, minimum_width, natural_width);
+ }
+ else
+ {
+ if (minimum_width)
+ *minimum_width = width;
+ if (natural_width)
+ *natural_width = width;
+ }
+
+#if DEBUG_CELL_SIZE_REQUEST
+ g_message ("%s width for height: %d is minimum %d and natural: %d",
+ G_OBJECT_TYPE_NAME (cell), height,
+ minimum_width ? *minimum_width : 20000,
+ natural_width ? *natural_width : 20000);
+#endif
+}
+
+/**
+ * gtk_cell_size_request_get_height_for_width:
+ * @cell: a #GtkCellSizeRequest instance
+ * @widget: the #GtkWidget this cell will be rendering to
+ * @width: the size which is available for allocation
+ * @minimum_height: location for storing the minimum size, or %NULL
+ * @natural_height: location for storing the preferred size, or %NULL
+ *
+ * Retreives a cell renderers's minimum and natural height if it were rendered to
+ * @widget with the specified @width.
+ *
+ * Since: 3.0
+ */
+void
+gtk_cell_size_request_get_height_for_width (GtkCellSizeRequest *cell,
+ GtkWidget *widget,
+ gint width,
+ gint *minimum_height,
+ gint *natural_height)
+{
+ GtkCellSizeRequestIface *iface;
+ gint height;
+
+ g_return_if_fail (GTK_IS_CELL_SIZE_REQUEST (cell));
+ g_return_if_fail (GTK_IS_WIDGET (widget));
+ g_return_if_fail (NULL != minimum_height || NULL != natural_height);
+
+ gtk_cell_renderer_get_fixed_size (GTK_CELL_RENDERER (cell), NULL, &height);
+
+ if (height < 0)
+ {
+ iface = GTK_CELL_SIZE_REQUEST_GET_IFACE (cell);
+ iface->get_height_for_width (cell, widget, width, minimum_height, natural_height);
+ }
+ else
+ {
+ if (minimum_height)
+ *minimum_height = height;
+ if (natural_height)
+ *natural_height = height;
+ }
+
+#if DEBUG_CELL_SIZE_REQUEST
+ g_message ("%s height for width: %d is minimum %d and natural: %d",
+ G_OBJECT_TYPE_NAME (cell), width,
+ minimum_height ? *minimum_height : 20000,
+ natural_height ? *natural_height : 20000);
+#endif
+}
+
+/**
+ * gtk_cell_size_request_get_size:
+ * @cell: a #GtkCellSizeRequest instance
+ * @widget: the #GtkWidget this cell will be rendering to
+ * @request_natural: Whether to base the contextual request off of the
+ * base natural or the base minimum
+ * @minimum_size: (out) (allow-none): location for storing the minimum size, or %NULL
+ * @natural_size: (out) (allow-none): location for storing the natural size, or %NULL
+ *
+ * Retrieves the minimum and natural size of a cell taking
+ * into account the widget's preference for height-for-width management.
+ *
+ * If request_natural is specified, the non-contextual natural value will
+ * be used to make the contextual request; otherwise the minimum will be used.
+ *
+ * Since: 3.0
+ */
+void
+gtk_cell_size_request_get_size (GtkCellSizeRequest *cell,
+ GtkWidget *widget,
+ GtkRequisition *minimum_size,
+ GtkRequisition *natural_size)
+{
+ gint min_width, nat_width;
+ gint min_height, nat_height;
+
+ g_return_if_fail (GTK_IS_CELL_SIZE_REQUEST (cell));
+
+ if (gtk_cell_size_request_get_request_mode (cell) == GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH)
+ {
+ gtk_cell_size_request_get_width (cell, widget, &min_width, &nat_width);
+
+ if (minimum_size)
+ {
+ minimum_size->width = min_width;
+ gtk_cell_size_request_get_height_for_width (cell, widget, min_width,
+ &minimum_size->height, NULL);
+ }
+
+ if (natural_size)
+ {
+ natural_size->width = nat_width;
+ gtk_cell_size_request_get_height_for_width (cell, widget, nat_width,
+ NULL, &natural_size->height);
+ }
+ }
+ else /* GTK_SIZE_REQUEST_WIDTH_FOR_HEIGHT */
+ {
+ gtk_cell_size_request_get_height (cell, widget, &min_height, &nat_height);
+
+ if (minimum_size)
+ {
+ minimum_size->height = min_height;
+ gtk_cell_size_request_get_width_for_height (cell, widget, min_height,
+ &minimum_size->width, NULL);
+ }
+
+ if (natural_size)
+ {
+ natural_size->height = nat_height;
+ gtk_cell_size_request_get_width_for_height (cell, widget, nat_height,
+ NULL, &natural_size->width);
+ }
+ }
+}
-
-
- #define __GTK_CELL_SIZE_REQUEST_C__
- #include "gtkaliasdef.c"
diff --cc gtk/gtkexpander.c
index 04fd2ff,d0bc602..ce49601
--- a/gtk/gtkexpander.c
+++ b/gtk/gtkexpander.c
@@@ -547,27 -592,25 +547,27 @@@ gtk_expander_size_allocate (GtkWidge
GtkAllocation *allocation)
{
GtkExpander *expander;
- GtkBin *bin;
- GtkExpanderPrivate *priv;
- GtkRequisition child_requisition;
GtkWidget *child;
+ GtkExpanderPrivate *priv;
gboolean child_visible = FALSE;
- gint border_width;
+ guint border_width;
gint expander_size;
gint expander_spacing;
gboolean interior_focus;
gint focus_width;
gint focus_pad;
- gint label_height;
+ gint label_height, top_min_height;
+ gint label_xpad, label_xoffset;
+ gint child_ypad, child_yoffset;
expander = GTK_EXPANDER (widget);
- bin = GTK_BIN (widget);
- priv = expander->priv;
+ child = gtk_bin_get_child (GTK_BIN (widget));
+ priv = expander->priv;
- border_width = GTK_CONTAINER (widget)->border_width;
+ border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
+ widget->allocation = *allocation;
+
gtk_widget_style_get (widget,
"interior-focus", &interior_focus,
"focus-line-width", &focus_width,
@@@ -1224,233 -1279,6 +1228,233 @@@ gtk_expander_activate (GtkExpander *exp
gtk_expander_set_expanded (expander, !expander->priv->expanded);
}
+
+static void
+gtk_expander_size_request_init (GtkSizeRequestIface *iface)
+{
+ iface->get_width = gtk_expander_get_width;
+ iface->get_height = gtk_expander_get_height;
+ iface->get_height_for_width = gtk_expander_get_height_for_width;
+ iface->get_width_for_height = gtk_expander_get_width_for_height;
+}
+
+static void
+gtk_expander_get_width (GtkSizeRequest *widget,
+ gint *minimum_size,
+ gint *natural_size)
+{
+ GtkExpander *expander;
+ GtkWidget *child;
+ GtkExpanderPrivate *priv;
+ gint border_width;
+ gint expander_size;
+ gint expander_spacing;
+ gboolean interior_focus;
+ gint focus_width;
+ gint focus_pad;
+
+ child = gtk_bin_get_child (GTK_BIN (widget));
+ expander = GTK_EXPANDER (widget);
+ priv = expander->priv;
+
- border_width = GTK_CONTAINER (widget)->border_width;
++ border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
+
+ gtk_widget_style_get (GTK_WIDGET (widget),
+ "interior-focus", &interior_focus,
+ "focus-line-width", &focus_width,
+ "focus-padding", &focus_pad,
+ "expander-size", &expander_size,
+ "expander-spacing", &expander_spacing,
+ NULL);
+
+ *minimum_size = *natural_size =
+ expander_size + 2 * expander_spacing +
+ 2 * focus_width + 2 * focus_pad;
+
+ if (priv->label_widget && gtk_widget_get_visible (priv->label_widget))
+ {
+ gint label_min, label_nat;
+
+ gtk_size_request_get_width (GTK_SIZE_REQUEST (priv->label_widget),
+ &label_min, &label_nat);
+
+ *minimum_size += label_min;
+ *natural_size += label_nat;
+ }
+
+ if (child && GTK_WIDGET_CHILD_VISIBLE (child))
+ {
+ gint child_min, child_nat;
+
+ gtk_size_request_get_width (GTK_SIZE_REQUEST (child),
+ &child_min, &child_nat);
+
+ *minimum_size = MAX (*minimum_size, child_min);
+ *natural_size = MAX (*natural_size, child_nat);
+
+ }
+
+ *minimum_size += 2 * border_width;
+ *natural_size += 2 * border_width;
+}
+
+static void
+gtk_expander_get_height (GtkSizeRequest *widget,
+ gint *minimum_size,
+ gint *natural_size)
+{
+ GtkExpander *expander;
+ GtkWidget *child;
+ GtkExpanderPrivate *priv;
+ gint border_width;
+ gint expander_size;
+ gint expander_spacing;
+ gboolean interior_focus;
+ gint focus_width;
+ gint focus_pad;
+
+ child = gtk_bin_get_child (GTK_BIN (widget));
+ expander = GTK_EXPANDER (widget);
+ priv = expander->priv;
+
- border_width = GTK_CONTAINER (widget)->border_width;
++ border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
+
+ gtk_widget_style_get (GTK_WIDGET (widget),
+ "interior-focus", &interior_focus,
+ "focus-line-width", &focus_width,
+ "focus-padding", &focus_pad,
+ "expander-size", &expander_size,
+ "expander-spacing", &expander_spacing,
+ NULL);
+
+ *minimum_size = *natural_size =
+ interior_focus ? (2 * focus_width + 2 * focus_pad) : 0;
+
+
+ if (priv->label_widget && gtk_widget_get_visible (priv->label_widget))
+ {
+ gint label_min, label_nat;
+
+ gtk_size_request_get_height (GTK_SIZE_REQUEST (priv->label_widget),
+ &label_min, &label_nat);
+
+ *minimum_size += label_min;
+ *natural_size += label_nat;
+ }
+
+ *minimum_size = MAX (*minimum_size, expander_size + 2 * expander_spacing);
+ *natural_size = MAX (*natural_size, *minimum_size);
+
+ if (!interior_focus)
+ {
+ gint extra = 2 * focus_width + 2 * focus_pad;
+ *minimum_size += extra;
+ *natural_size += extra;
+ }
+
+ if (child && GTK_WIDGET_CHILD_VISIBLE (child))
+ {
+ gint child_min, child_nat;
+
+ gtk_size_request_get_height (GTK_SIZE_REQUEST (child),
+ &child_min, &child_nat);
+
+ *minimum_size += child_min + priv->spacing;
+ *natural_size += child_nat + priv->spacing;
+
+ }
+
+ *minimum_size += 2 * border_width;
+ *natural_size += 2 * border_width;
+}
+
+static void
+gtk_expander_get_height_for_width (GtkSizeRequest *widget,
+ gint width,
+ gint *minimum_height,
+ gint *natural_height)
+{
+ GtkExpander *expander;
+ GtkWidget *child;
+ GtkExpanderPrivate *priv;
+ gint border_width;
+ gint expander_size;
+ gint expander_spacing;
+ gboolean interior_focus;
+ gint focus_width;
+ gint focus_pad;
+ gint label_xpad;
+
+ child = gtk_bin_get_child (GTK_BIN (widget));
+ expander = GTK_EXPANDER (widget);
+ priv = expander->priv;
+
- border_width = GTK_CONTAINER (widget)->border_width;
++ border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
+
+ gtk_widget_style_get (GTK_WIDGET (widget),
+ "interior-focus", &interior_focus,
+ "focus-line-width", &focus_width,
+ "focus-padding", &focus_pad,
+ "expander-size", &expander_size,
+ "expander-spacing", &expander_spacing,
+ NULL);
+
+ label_xpad = 2 * border_width + expander_size + 2 * expander_spacing - 2 * focus_width + 2 * focus_pad;
+
+ *minimum_height = *natural_height =
+ interior_focus ? (2 * focus_width + 2 * focus_pad) : 0;
+
+
+ if (priv->label_widget && gtk_widget_get_visible (priv->label_widget))
+ {
+ gint label_min, label_nat;
+
+ gtk_size_request_get_height_for_width (GTK_SIZE_REQUEST (priv->label_widget),
+ MAX (width - label_xpad, 1),
+ &label_min, &label_nat);
+
+ *minimum_height += label_min;
+ *natural_height += label_nat;
+ }
+
+ *minimum_height = MAX (*minimum_height, expander_size + 2 * expander_spacing);
+ *natural_height = MAX (*natural_height, *minimum_height);
+
+ if (!interior_focus)
+ {
+ gint extra = 2 * focus_width + 2 * focus_pad;
+ *minimum_height += extra;
+ *natural_height += extra;
+ }
+
+ if (child && GTK_WIDGET_CHILD_VISIBLE (child))
+ {
+ gint child_min, child_nat;
+
+ gtk_size_request_get_height_for_width (GTK_SIZE_REQUEST (child),
+ MAX (width - 2 * border_width, 1),
+ &child_min, &child_nat);
+
+ *minimum_height += child_min + priv->spacing;
+ *natural_height += child_nat + priv->spacing;
+ }
+
+ *minimum_height += 2 * border_width;
+ *natural_height += 2 * border_width;
+}
+
+static void
+gtk_expander_get_width_for_height (GtkSizeRequest *widget,
+ gint height,
+ gint *minimum_width,
+ gint *natural_width)
+{
+ gtk_size_request_get_width (widget, minimum_width, natural_width);
+ //GTK_SIZE_REQUEST_GET_IFACE (widget)->get_width (widget, minimum_width, natural_width);
+}
+
+
+
/**
* gtk_expander_new:
* @label: the text of the label
diff --cc gtk/gtkscrolledwindow.c
index 8928312,6bbe37b..e769fdf
--- a/gtk/gtkscrolledwindow.c
+++ b/gtk/gtkscrolledwindow.c
@@@ -1728,55 -1745,82 +1747,56 @@@ gtk_scrolled_window_size_request_init (
iface->get_width_for_height = gtk_scrolled_window_get_width_for_height;
}
-static void
-gtk_scrolled_window_get_size (GtkSizeRequest *widget,
- GtkOrientation orientation,
- gint *minimum_size,
- gint *natural_size)
+static void
+gtk_scrolled_window_get_width (GtkSizeRequest *widget,
+ gint *minimum_size,
+ gint *natural_size)
{
+
GtkScrolledWindow *scrolled_window;
- GtkBin *bin;
- gint extra_width;
- gint extra_height;
- gint scrollbar_spacing;
GtkRequisition hscrollbar_requisition;
GtkRequisition vscrollbar_requisition;
- GtkRequisition minimum_req, natural_req;
GtkWidget *child;
+ gint min_width, nat_width;
gint min_child_size, nat_child_size;
- gint extra_width;
- guint border_width;
++ gint extra_width, border_width;
+ gint scrollbar_spacing;
scrolled_window = GTK_SCROLLED_WINDOW (widget);
- bin = GTK_BIN (scrolled_window);
+ child = gtk_bin_get_child (GTK_BIN (scrolled_window));
scrollbar_spacing = _gtk_scrolled_window_get_scrollbar_spacing (scrolled_window);
++ border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
extra_width = 0;
- extra_height = 0;
- minimum_req.width = 0;
- minimum_req.height = 0;
- natural_req.width = 0;
- natural_req.height = 0;
+ min_width = 0;
+ nat_width = 0;
gtk_widget_size_request (scrolled_window->hscrollbar,
&hscrollbar_requisition);
gtk_widget_size_request (scrolled_window->vscrollbar,
&vscrollbar_requisition);
-
+
- child = gtk_bin_get_child (bin);
if (child && gtk_widget_get_visible (child))
{
- if (orientation == GTK_ORIENTATION_HORIZONTAL)
+ gtk_size_request_get_width (GTK_SIZE_REQUEST (child),
+ &min_child_size,
+ &nat_child_size);
+
+ if (scrolled_window->hscrollbar_policy == GTK_POLICY_NEVER)
{
- gtk_size_request_get_width (GTK_SIZE_REQUEST (child),
- &min_child_size,
- &nat_child_size);
-
- if (scrolled_window->hscrollbar_policy == GTK_POLICY_NEVER)
- {
- minimum_req.width += min_child_size;
- natural_req.width += nat_child_size;
- }
- else
- {
- GtkWidgetAuxInfo *aux_info = _gtk_widget_get_aux_info (child, FALSE);
-
- if (aux_info && aux_info->width > 0)
- {
- minimum_req.width += aux_info->width;
- natural_req.width += aux_info->width;
- extra_width = -1;
- }
- else
- {
- minimum_req.width += vscrollbar_requisition.width;
- natural_req.width += vscrollbar_requisition.width;
- }
- }
+ min_width += min_child_size;
+ nat_width += nat_child_size;
}
- else /* GTK_ORIENTATION_VERTICAL */
+ else
{
- gtk_size_request_get_height (GTK_SIZE_REQUEST (child),
- &min_child_size,
- &nat_child_size);
-
- if (scrolled_window->vscrollbar_policy == GTK_POLICY_NEVER)
+ GtkWidgetAuxInfo *aux_info = _gtk_widget_get_aux_info (child, FALSE);
+
+ if (aux_info && aux_info->width > 0)
{
- minimum_req.height += min_child_size;
- natural_req.height += nat_child_size;
+ min_width += aux_info->width;
+ nat_width += aux_info->width;
+ extra_width = -1;
}
else
{
@@@ -1800,8 -1859,11 +1820,8 @@@
extra_width = scrollbar_spacing + vscrollbar_requisition.width;
}
- min_width += GTK_CONTAINER (widget)->border_width * 2 + MAX (0, extra_width);
- nat_width += GTK_CONTAINER (widget)->border_width * 2 + MAX (0, extra_width);
- border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
- minimum_req.width += border_width * 2 + MAX (0, extra_width);
- minimum_req.height += border_width * 2 + MAX (0, extra_height);
- natural_req.width += border_width * 2 + MAX (0, extra_width);
- natural_req.height += border_width * 2 + MAX (0, extra_height);
++ min_width += border_width * 2 + MAX (0, extra_width);
++ nat_width += border_width * 2 + MAX (0, extra_width);
if (scrolled_window->shadow_type != GTK_SHADOW_NONE)
{
@@@ -1820,85 -1902,7 +1840,86 @@@ gtk_scrolled_window_get_height (GtkSize
gint *minimum_size,
gint *natural_size)
{
- gtk_scrolled_window_get_size (widget, GTK_ORIENTATION_VERTICAL, minimum_size, natural_size);
+ GtkScrolledWindow *scrolled_window;
+ GtkRequisition hscrollbar_requisition;
+ GtkRequisition vscrollbar_requisition;
+ GtkWidget *child;
+ gint min_height, nat_height;
+ gint min_child_size, nat_child_size;
- gint extra_height;
++ gint extra_height, border_width;
+ gint scrollbar_spacing;
+
+ scrolled_window = GTK_SCROLLED_WINDOW (widget);
+ child = gtk_bin_get_child (GTK_BIN (scrolled_window));
+
+ scrollbar_spacing = _gtk_scrolled_window_get_scrollbar_spacing (scrolled_window);
++ border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
+
+ extra_height = 0;
+ min_height = 0;
+ nat_height = 0;
+
+ gtk_widget_size_request (scrolled_window->hscrollbar,
+ &hscrollbar_requisition);
+ gtk_widget_size_request (scrolled_window->vscrollbar,
+ &vscrollbar_requisition);
+
+ if (child && gtk_widget_get_visible (child))
+ {
+ gtk_size_request_get_height (GTK_SIZE_REQUEST (child),
+ &min_child_size,
+ &nat_child_size);
+
+ if (scrolled_window->vscrollbar_policy == GTK_POLICY_NEVER)
+ {
+ min_height += min_child_size;
+ nat_height += nat_child_size;
+ }
+ else
+ {
+ GtkWidgetAuxInfo *aux_info = _gtk_widget_get_aux_info (child, FALSE);
+
+ if (aux_info && aux_info->height > 0)
+ {
+ min_height += aux_info->height;
+ nat_height += aux_info->height;
+ extra_height = -1;
+ }
+ else
+ {
+ min_height += hscrollbar_requisition.height;
+ nat_height += hscrollbar_requisition.height;
+ }
+ }
+ }
+
+ if (scrolled_window->hscrollbar_policy == GTK_POLICY_AUTOMATIC ||
+ scrolled_window->hscrollbar_policy == GTK_POLICY_ALWAYS)
+ {
+ if (!extra_height || scrolled_window->hscrollbar_policy == GTK_POLICY_ALWAYS)
+ extra_height = scrollbar_spacing + hscrollbar_requisition.height;
+ }
+
+ if (scrolled_window->vscrollbar_policy == GTK_POLICY_AUTOMATIC ||
+ scrolled_window->vscrollbar_policy == GTK_POLICY_ALWAYS)
+ {
+ min_height = MAX (min_height, vscrollbar_requisition.height);
+ nat_height = MAX (nat_height, vscrollbar_requisition.height);
+ }
+
- min_height += GTK_CONTAINER (widget)->border_width * 2 + MAX (0, extra_height);
- nat_height += GTK_CONTAINER (widget)->border_width * 2 + MAX (0, extra_height);
++ min_height += border_width * 2 + MAX (0, extra_height);
++ nat_height += border_width * 2 + MAX (0, extra_height);
+
+ if (scrolled_window->shadow_type != GTK_SHADOW_NONE)
+ {
+ min_height += 2 * GTK_WIDGET (widget)->style->ythickness;
+ nat_height += 2 * GTK_WIDGET (widget)->style->ythickness;
+ }
+
+ if (minimum_size)
+ *minimum_size = min_height;
+ if (natural_size)
+ *natural_size = nat_height;
}
static void
@@@ -1923,17 -1921,8 +1944,14 @@@ gtk_scrolled_window_get_width_for_heigh
gint height,
gint *minimum_width,
gint *natural_width)
-{
- g_return_if_fail (GTK_IS_WIDGET (widget));
+{
+ GtkScrolledWindow *scrolled_window = GTK_SCROLLED_WINDOW (widget);
- GTK_SIZE_REQUEST_GET_IFACE (widget)->get_width (widget, minimum_width, natural_width);
+ /* In the unlikely case that both scrollbars are disabled; forward the child's
+ * width-for-height request via the GtkBin generic method */
+ if (scrolled_window->hscrollbar_policy == GTK_POLICY_NEVER &&
+ scrolled_window->vscrollbar_policy == GTK_POLICY_NEVER)
+ parent_size_request_iface->get_width_for_height (widget, height, minimum_width, natural_width);
+ else
+ gtk_size_request_get_width (widget, minimum_width, natural_width);
}
-
- #define __GTK_SCROLLED_WINDOW_C__
- #include "gtkaliasdef.c"
diff --cc gtk/gtksizerequest.c
index 2556070,d0adb8b..6dddfb9
--- a/gtk/gtksizerequest.c
+++ b/gtk/gtksizerequest.c
@@@ -538,106 -533,3 +537,103 @@@ gtk_size_request_get_size (GtkSizeReque
}
}
}
+
+
+static gint
+compare_gap (gconstpointer p1,
+ gconstpointer p2,
+ gpointer data)
+{
+ GtkRequestedSize *sizes = data;
+ const guint *c1 = p1;
+ const guint *c2 = p2;
+
+ const gint d1 = MAX (sizes[*c1].natural_size -
+ sizes[*c1].minimum_size,
+ 0);
+ const gint d2 = MAX (sizes[*c2].natural_size -
+ sizes[*c2].minimum_size,
+ 0);
+
+ gint delta = (d2 - d1);
+
+ if (0 == delta)
+ delta = (*c2 - *c1);
+
+ return delta;
+}
+
+/**
+ * gtk_distribute_natural_allocation:
+ * @extra_space: Extra space to redistribute among children after subtracting
+ * minimum sizes and any child padding from the overall allocation
+ * @n_requested_sizes: Number of requests to fit into the allocation
+ * @sizes: An array of structs with a client pointer and a minimum/natural size
+ * in the orientation of the allocation.
+ *
+ * Distributes @extra_space to child @sizes by bringing up smaller
+ * children up to natural size first.
+ *
+ * The remaining space will be added to the @minimum_size member of the
+ * GtkRequestedSize struct. If all sizes reach their natural size then
+ * the remaining space is returned.
+ *
+ * Returns: The remainder of @extra_space after redistributing space
+ * to @sizes.
+ */
+gint
+gtk_distribute_natural_allocation (gint extra_space,
+ guint n_requested_sizes,
+ GtkRequestedSize *sizes)
+{
+ guint *spreading = g_newa (guint, n_requested_sizes);
+ gint i;
+
+ for (i = 0; i < n_requested_sizes; i++)
+ spreading[i] = i;
+
+ /* Distribute the container's extra space c_gap. We want to assign
+ * this space such that the sum of extra space assigned to children
+ * (c^i_gap) is equal to c_cap. The case that there's not enough
+ * space for all children to take their natural size needs some
+ * attention. The goals we want to achieve are:
+ *
+ * a) Maximize number of children taking their natural size.
+ * b) The allocated size of children should be a continuous
+ * function of c_gap. That is, increasing the container size by
+ * one pixel should never make drastic changes in the distribution.
+ * c) If child i takes its natural size and child j doesn't,
+ * child j should have received at least as much gap as child i.
+ *
+ * The following code distributes the additional space by following
+ * these rules.
+ */
+
+ /* Sort descending by gap and position. */
+ g_qsort_with_data (spreading,
+ n_requested_sizes, sizeof (guint),
+ compare_gap, sizes);
+
+ /* Distribute available space.
+ * This master piece of a loop was conceived by Behdad Esfahbod.
+ */
+ for (i = n_requested_sizes - 1; extra_space > 0 && i >= 0; --i)
+ {
+ /* Divide remaining space by number of remaining children.
+ * Sort order and reducing remaining space by assigned space
+ * ensures that space is distributed equally.
+ */
+ gint glue = (extra_space + i) / (i + 1);
+ gint gap = sizes[(spreading[i])].natural_size
+ - sizes[(spreading[i])].minimum_size;
+
+ gint extra = MIN (glue, gap);
+
+ sizes[spreading[i]].minimum_size += extra;
+
+ extra_space -= extra;
+ }
+
+ return extra_space;
+}
+
-
- #define __GTK_SIZE_REQUEST_C__
- #include "gtkaliasdef.c"
diff --cc gtk/gtktreeview.c
index a7846c8,444a81a..80c6680
--- a/gtk/gtktreeview.c
+++ b/gtk/gtktreeview.c
@@@ -44,9 -43,7 +44,8 @@@
#include "gtkframe.h"
#include "gtktreemodelsort.h"
#include "gtktooltip.h"
+#include "gtkscrolledwindow.h"
#include "gtkprivate.h"
- #include "gtkalias.h"
#define GTK_TREE_VIEW_PRIORITY_VALIDATE (GDK_PRIORITY_REDRAW + 5)
#define GTK_TREE_VIEW_PRIORITY_SCROLL_SYNC (GTK_TREE_VIEW_PRIORITY_VALIDATE + 2)
@@@ -4766,44 -4684,78 +4773,61 @@@ gtk_tree_view_bin_expose (GtkWidge
*/
highlight_x = cell_area.x;
expander_cell_width = cell_area.width;
-
- if (is_separator)
- gtk_paint_hline (widget->style,
- event->window,
- state,
- &cell_area,
- widget,
- NULL,
- cell_area.x,
- cell_area.x + cell_area.width,
- cell_area.y + cell_area.height / 2);
- else
- _gtk_tree_view_column_cell_render (column,
- event->window,
- &background_area,
- &cell_area,
- &event->area,
- flags);
- if (TREE_VIEW_DRAW_EXPANDERS(tree_view)
- && (node->flags & GTK_RBNODE_IS_PARENT) == GTK_RBNODE_IS_PARENT)
- {
- if (!got_pointer)
- {
- gdk_window_get_pointer (tree_view->priv->bin_window,
- &pointer_x, &pointer_y, NULL);
- got_pointer = TRUE;
- }
-
- gtk_tree_view_draw_arrow (GTK_TREE_VIEW (widget),
- tree,
- node,
- pointer_x, pointer_y);
- }
}
+
+ /* Do the actual rendering */
+ if (is_separator)
+ gtk_paint_hline (widget->style,
+ event->window,
+ state,
+ &cell_area,
+ widget,
+ NULL,
+ cell_area.x,
+ cell_area.x + cell_area.width,
+ cell_area.y + cell_area.height / 2);
else
+ _gtk_tree_view_column_cell_render (column,
+ event->window,
+ &background_area,
+ &cell_area,
+ &event->area,
+ flags);
+
+ if (gtk_tree_view_is_expander_column (tree_view, column) &&
+ TREE_VIEW_DRAW_EXPANDERS(tree_view) &&
+ (node->flags & GTK_RBNODE_IS_PARENT) == GTK_RBNODE_IS_PARENT)
{
- if (is_separator)
- gtk_paint_hline (widget->style,
- event->window,
- state,
- &cell_area,
- widget,
- NULL,
- cell_area.x,
- cell_area.x + cell_area.width,
- cell_area.y + cell_area.height / 2);
- else
- _gtk_tree_view_column_cell_render (column,
- event->window,
- &background_area,
- &cell_area,
- &event->area,
- flags);
+ if (!got_pointer)
+ {
+ gdk_window_get_pointer (tree_view->priv->bin_window,
+ &pointer_x, &pointer_y, NULL);
+ got_pointer = TRUE;
+ }
+
+ gtk_tree_view_draw_arrow (GTK_TREE_VIEW (widget),
+ tree,
+ node,
+ pointer_x, pointer_y);
}
+ if (draw_hgrid_lines)
+ {
+ if (background_area.y > 0)
+ gtk_tree_view_draw_line (tree_view, event->window,
+ GTK_TREE_VIEW_GRID_LINE,
+ background_area.x, background_area.y,
+ background_area.x + background_area.width,
+ background_area.y);
+
+ if (y_offset + max_height >= event->area.height)
+ gtk_tree_view_draw_line (tree_view, event->window,
+ GTK_TREE_VIEW_GRID_LINE,
+ background_area.x, background_area.y + max_height,
+ background_area.x + background_area.width,
+ background_area.y + max_height);
+ }
+
if (gtk_tree_view_is_expander_column (tree_view, column) &&
tree_view->priv->tree_lines_enabled)
{
@@@ -15797,104 -15699,3 +15826,101 @@@ gtk_tree_view_get_tooltip_column (GtkTr
return tree_view->priv->tooltip_column;
}
+
+
+static void
+gtk_tree_view_get_minimum_size (GtkWidget *widget,
+ GtkRequisition *requisition)
+{
+ GtkTreeView *tree_view = GTK_TREE_VIEW (widget);
+ GList *tmp_list;
+
+ /* we validate some rows initially just to make sure we have some size.
+ * In practice, with a lot of static lists, this should get a good width.
+ */
+ do_validate_rows (tree_view, FALSE);
+ gtk_tree_view_size_request_columns (tree_view);
+ gtk_tree_view_update_size (GTK_TREE_VIEW (widget));
+
+ requisition->width = tree_view->priv->width;
+ requisition->height = tree_view->priv->height + TREE_VIEW_HEADER_HEIGHT (tree_view);
+
+ tmp_list = tree_view->priv->children;
+
+ while (tmp_list)
+ {
+ GtkTreeViewChild *child = tmp_list->data;
+ GtkRequisition child_requisition;
+
+ tmp_list = tmp_list->next;
+
+ if (gtk_widget_get_visible (child->widget))
+ gtk_widget_size_request (child->widget, &child_requisition);
+ }
+}
+
+static void
+gtk_tree_view_size_request_init (GtkSizeRequestIface *iface)
+{
+ iface->get_width = gtk_tree_view_get_width;
+ iface->get_height = gtk_tree_view_get_height;
+}
+
+static void
+gtk_tree_view_get_size (GtkSizeRequest *widget,
+ GtkOrientation orientation,
+ gint *minimum_size,
+ gint *natural_size)
+{
+ GtkTreeView *tree_view;
+ gint natural_width = 0;
+ GList *column_iter;
+ GtkRequisition requisition;
+
+ tree_view = GTK_TREE_VIEW (widget);
+
+ gtk_tree_view_get_minimum_size (GTK_WIDGET (widget), &requisition);
+
+ if (orientation == GTK_ORIENTATION_HORIZONTAL)
+ {
+ for (column_iter = tree_view->priv->columns; column_iter; column_iter = column_iter->next)
+ {
+ GtkTreeViewColumn *column = column_iter->data;
+
+ if (!column->visible)
+ continue;
+
+ natural_width += gtk_tree_view_get_real_natural_width_from_column (tree_view, column);
+ }
+
+ if (minimum_size)
+ *minimum_size = requisition.width;
+
+ if (natural_size)
+ *natural_size = MAX (requisition.width, natural_width);
+ }
+ else
+ {
+ if (minimum_size)
+ *minimum_size = requisition.height;
+
+ if (natural_size)
+ *natural_size = requisition.height;
+ }
+}
+
+static void
+gtk_tree_view_get_width (GtkSizeRequest *widget,
+ gint *minimum_size,
+ gint *natural_size)
+{
+ gtk_tree_view_get_size (widget, GTK_ORIENTATION_HORIZONTAL, minimum_size, natural_size);
+}
+
+static void
+gtk_tree_view_get_height (GtkSizeRequest *widget,
+ gint *minimum_size,
+ gint *natural_size)
+{
+ gtk_tree_view_get_size (widget, GTK_ORIENTATION_VERTICAL, minimum_size, natural_size);
+}
-
- #define __GTK_TREE_VIEW_C__
- #include "gtkaliasdef.c"
diff --cc gtk/gtktreeviewcolumn.c
index 90b170b,7f75f2c..0021331
--- a/gtk/gtktreeviewcolumn.c
+++ b/gtk/gtktreeviewcolumn.c
@@@ -31,10 -29,9 +31,10 @@@
#include "gtkhbox.h"
#include "gtkmarshalers.h"
#include "gtkarrow.h"
+#include "gtkdebug.h"
#include "gtkprivate.h"
#include "gtkintl.h"
- #include "gtkalias.h"
+
enum
{
@@@ -2780,42 -2774,86 +2790,44 @@@ gtk_tree_view_column_cell_process_actio
else if (extra_space > 0 && expand_cell_count > 0)
extra_space /= expand_cell_count;
-
- /* iterate list for GTK_PACK_START cells */
- for (list = tree_column->cell_list; list; list = list->next)
+ for (packing = GTK_PACK_START; packing <= GTK_PACK_END; ++packing)
{
- GtkTreeViewColumnCellInfo *info = (GtkTreeViewColumnCellInfo *) list->data;
-
- if (info->pack == GTK_PACK_END)
- continue;
-
- if (!gtk_cell_renderer_get_visible (info->cell))
- continue;
-
- if ((info->has_focus || special_cells == 1) && cursor_row)
- flags |= GTK_CELL_RENDERER_FOCUSED;
- else
- flags &= ~GTK_CELL_RENDERER_FOCUSED;
-
- info->real_width = info->requested_width + (info->expand?extra_space:0);
- /* We constrain ourselves to only the width available */
- if (real_cell_area.x - focus_line_width + info->real_width > cell_area->x + cell_area->width)
+ for (list = tree_column->cell_list; list; list = list->next)
{
- info->real_width = cell_area->x + cell_area->width - real_cell_area.x;
- }
+ GtkTreeViewColumnCellInfo *info = (GtkTreeViewColumnCellInfo *) list->data;
++ gboolean visible;
+
- if (real_cell_area.x > cell_area->x + cell_area->width)
- break;
++ g_object_get (info->cell, "visible", &visible, NULL);
- real_cell_area.width = info->real_width;
- real_cell_area.width -= 2 * focus_line_width;
+ if (info->pack != packing)
+ continue;
- if (! info->cell->visible)
- if (list->next)
- {
- real_background_area.width = info->real_width + depth;
- }
- else
- {
- /* fill the rest of background for the last cell */
- real_background_area.width = background_area->x + background_area->width - real_background_area.x;
- }
++ if (! visible)
+ continue;
- rtl_cell_area = real_cell_area;
- rtl_background_area = real_background_area;
-
- if (rtl)
- {
- rtl_cell_area.x = cell_area->x + cell_area->width - (real_cell_area.x - cell_area->x) - real_cell_area.width;
- rtl_background_area.x = background_area->x + background_area->width - (real_background_area.x - background_area->x) - real_background_area.width;
- }
+ if ((info->has_focus || special_cells == 1) && cursor_row)
+ flags |= GTK_CELL_RENDERER_FOCUSED;
+ else
+ flags &= ~GTK_CELL_RENDERER_FOCUSED;
- /* RENDER */
- if (action == CELL_ACTION_RENDER)
- {
- gtk_cell_renderer_render (info->cell,
- window,
- tree_column->tree_view,
- &rtl_background_area,
- &rtl_cell_area,
- &real_expose_area,
- flags);
- }
- /* FOCUS */
- else if (action == CELL_ACTION_FOCUS)
- {
- gint x_offset, y_offset, width, height;
+ /* We constrain ourselves to only the width available */
+ if (real_cell_area.x - focus_line_width + info->real_width > cell_area->x + cell_area->width)
+ {
+ info->real_width = cell_area->x + cell_area->width - real_cell_area.x;
+ }
+
+ /* Break out of the inner loop once we itterate out of our allocation
+ * (and possibly start the other packing direction) */
+ if (real_cell_area.x > cell_area->x + cell_area->width)
+ break;
- gtk_cell_renderer_get_size (info->cell,
- tree_column->tree_view,
- &rtl_cell_area,
- &x_offset, &y_offset,
- &width, &height);
+ real_cell_area.width = info->real_width;
+ real_cell_area.width -= 2 * focus_line_width;
- if (special_cells > 1)
+ if (list->next)
{
- if (info->has_focus)
- {
- min_x = rtl_cell_area.x + x_offset;
- max_x = min_x + width;
- min_y = rtl_cell_area.y + y_offset;
- max_y = min_y + height;
- }
+ real_background_area.width = info->real_width + depth;
}
else
{
@@@ -3636,289 -3777,3 +3648,284 @@@ gtk_tree_view_column_get_tree_view (Gtk
return tree_column->tree_view;
}
+
+/**
+ * gtk_tree_view_column_get_natural_width:
+ * @tree_column: A #GtkTreeViewColumn
+ * @minimum_width: location for storing the minimum width, or %NULL
+ * @natural_width: location for storing the natural width, or %NULL
+ *
+ * Retreives @tree_column's minimum and natural width.
+ *
+ * Since: 3.0
+ */
+void
+gtk_tree_view_column_get_natural_width (GtkTreeViewColumn *column,
+ gint *minimum_width,
+ gint *natural_width)
+{
+ GList *list;
+ gboolean first_cell = TRUE;
+ gint focus_line_width;
+ gint min = 0, nat = 0;
+
+ g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (column));
+
+ gtk_widget_style_get (column->tree_view, "focus-line-width", &focus_line_width, NULL);
+
+ for (list = column->cell_list; list; list = list->next)
+ {
+ GtkTreeViewColumnCellInfo *info = (GtkTreeViewColumnCellInfo *) list->data;
+ gint cell_min, cell_nat;
+ gboolean visible;
+
+ g_object_get (info->cell, "visible", &visible, NULL);
+
+ if (visible == FALSE)
+ continue;
+
+ if (first_cell == FALSE)
+ {
+ min += column->spacing;
+ nat += column->spacing;
+ }
+
+ gtk_cell_size_request_get_width (GTK_CELL_SIZE_REQUEST (info->cell),
+ column->tree_view, &cell_min, &cell_nat);
+
+ cell_min += focus_line_width * 2;
+ cell_nat += focus_line_width * 2;
+
+ /* Store 'requested_width' and 'natural_width' to cache all the requests
+ * for every row in the column; natural space distribution is only calculated
+ * once for the whole column for now. */
+ info->requested_width = MAX (info->requested_width, cell_min);
+ info->natural_width = MAX (info->natural_width, cell_nat);
+
+ /* Return the collective minimum/natural width of all
+ * cached sizes */
+ min += info->requested_width;
+ nat += info->natural_width;
+
+ first_cell = FALSE;
+ }
+
+ if (minimum_width)
+ *minimum_width = min;
+
+ if (natural_width)
+ *natural_width = nat;
+}
+
+/**
+ * gtk_tree_view_column_get_height_for_width:
+ * @tree_column: A #GtkTreeViewColumn
+ * @width: the width available for allocation
+ * @minimum_height: location for storing the minimum height, or %NULL
+ * @natural_height: location for storing the natural height, or %NULL
+ *
+ * Retreives @tree_column's minimum and natural height if it were rendered to
+ * @widget with the specified @height.
+ *
+ * Since: 3.0
+ */
+void
+gtk_tree_view_column_get_height_for_width (GtkTreeViewColumn *column,
+ gint width,
+ gint *minimum_height,
+ gint *natural_height)
+{
+ GList *list;
+ GArray *array;
+ gint size = width;
+ gint focus_line_width;
+ gint expand_cell_count = 0, i;
+ gboolean first_cell = TRUE;
+ gint min_height = 0, nat_height = 0;
+ GtkRequestedSize *sizes;
+
+ g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (column));
+
+ gtk_widget_style_get (column->tree_view, "focus-line-width", &focus_line_width, NULL);
+
+ array = g_array_new (0, TRUE, sizeof (GtkRequestedSize));
+
+
+ /* First get the overall expand space and collect the cell requests */
+ for (list = column->cell_list; list; list = list->next)
+ {
+ GtkTreeViewColumnCellInfo *info = (GtkTreeViewColumnCellInfo *) list->data;
+ gboolean visible;
+ GtkRequestedSize requested;
+
+ g_object_get (info->cell, "visible", &visible, NULL);
+
+ if (visible == FALSE)
+ continue;
+
+ if (info->expand == TRUE)
+ expand_cell_count++;
+
+ if (first_cell == FALSE)
+ size -= column->spacing;
+
+ size -= focus_line_width * 2;
+ size -= info->requested_width;
+
+ /* Here the collective minimum/natural width for all rows
+ * has necessarily been cached by gtk_tree_view_column_get_natural_width().
+ *
+ * As the allocated width is based on the collective widths of all rows,
+ * the allocated width for a cell will be the same in each row.
+ *
+ * However the height-for-width must also be calculated for each
+ * row based on the aligned width in order to determine the row height.
+ *
+ * OPTIMIZE ME: It would be better to calculate the allocations of the cells once
+ * and caching an extra info->allocated_width in order to avoid this
+ * calculation for every row.
+ *
+ * Note we would use the real minimums/naturals as reported
+ * by the cells for each row here if we were to display
+ * the cells unaligned (which is more expensive to calculate
+ * but would allow cells to flow more naturally inside columns).
+ */
+ requested.data = info;
+ requested.minimum_size = info->requested_width;
+ requested.natural_size = info->natural_width;
+ g_array_append_val (array, requested);
+
+ first_cell = FALSE;
+ }
+
+
+ /* Distribute as much of remaining 'size' as possible before sharing expand space */
+ sizes = (GtkRequestedSize *)array->data;
+ size = gtk_distribute_natural_allocation (size, array->len, sizes);
+
+ /* The rest gets split up evenly among expanding cells */
+ if (expand_cell_count)
+ size /= expand_cell_count;
+
+ /* Collect the minimum and natural height for the allocations of cells */
+ for (i = 0, list = column->cell_list; list; list = list->next)
+ {
+ GtkTreeViewColumnCellInfo *info = (GtkTreeViewColumnCellInfo *) list->data;
+ gint cell_min, cell_nat;
+ gboolean visible;
+
+ g_object_get (info->cell, "visible", &visible, NULL);
+
+ if (visible == FALSE)
+ continue;
+
+ gtk_cell_size_request_get_height_for_width (GTK_CELL_SIZE_REQUEST (info->cell),
+ column->tree_view,
+ sizes[i].minimum_size + (info->expand ? size : 0),
+ &cell_min, &cell_nat);
+
+ min_height = MAX (min_height, cell_min);
+ nat_height = MAX (nat_height, cell_nat);
+
+ i++;
+ }
+ g_array_free (array, TRUE);
+
+ if (minimum_height)
+ *minimum_height = min_height;
+
+ if (natural_height)
+ *natural_height = nat_height;
+}
+
+/**
+ * gtk_tree_view_column_allocate_width:
+ * @tree_column: A #GtkTreeViewColumn
+ * @width: the overall width of the column
+ *
+ * This allocates a good size for each cell in the column
+ * based on the overall minimum and natural widths of the
+ * cells after having been tested for each column.
+ *
+ * A width must be allocated after the request phase
+ * and before handling events
+ *
+ * Since: 3.0
+ */
+void
+gtk_tree_view_column_allocate_width (GtkTreeViewColumn *column,
+ gint width)
+{
+ GList *list;
+ GArray *array;
+ gint size = width;
+ gint focus_line_width;
+ gint expand_cell_count = 0, i;
+ gboolean first_cell = TRUE;
+ GtkRequestedSize *sizes;
+
+ g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (column));
+
+ column->width = width;
+
+ gtk_widget_style_get (column->tree_view, "focus-line-width", &focus_line_width, NULL);
+
+ array = g_array_new (0, TRUE, sizeof (GtkRequestedSize));
+
+ /* First get the overall expand space and collect the cell requests */
+ for (list = column->cell_list; list; list = list->next)
+ {
+ GtkTreeViewColumnCellInfo *info = (GtkTreeViewColumnCellInfo *) list->data;
+ gboolean visible;
+ GtkRequestedSize requested;
+
+ g_object_get (info->cell, "visible", &visible, NULL);
+
+ if (visible == FALSE)
+ continue;
+
+ if (info->expand == TRUE)
+ expand_cell_count++;
+
+ if (first_cell == FALSE)
+ size -= column->spacing;
+
+ size -= focus_line_width * 2;
+ size -= info->requested_width;
+
+ requested.data = info;
+ requested.minimum_size = info->requested_width;
+ requested.natural_size = info->natural_width;
+ g_array_append_val (array, requested);
+
+ first_cell = FALSE;
+ }
+
+ /* Distribute as much of remaining 'size' as possible before sharing expand space */
+ sizes = (GtkRequestedSize *)array->data;
+ size = gtk_distribute_natural_allocation (size, array->len, sizes);
+
+ /* The rest gets split up evenly among expanding cells */
+ if (expand_cell_count > 0)
+ size /= expand_cell_count;
+
+ /* Allocate/assign info->real_width based in minimum/natural size + expand space */
+ for (i = 0, list = column->cell_list; list; list = list->next)
+ {
+ GtkTreeViewColumnCellInfo *info = (GtkTreeViewColumnCellInfo *) list->data;
+ gboolean visible;
+
+ g_object_get (info->cell, "visible", &visible, NULL);
+
+ if (visible == FALSE)
+ continue;
+
+ info->real_width = sizes[i].minimum_size + (info->expand ? size : 0);
+
+ i++;
+ }
+ g_array_free (array, TRUE);
+
+ g_object_notify (G_OBJECT (column), "width");
+}
+
-
-
-
- #define __GTK_TREE_VIEW_COLUMN_C__
- #include "gtkaliasdef.c"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]