This fixes a GTK+ 3.0 regression. In GTK+ 2, the render method
on GtkCellRenderer had a expose_area parameter, typically set to
cell_area. This parameter was used for clipping cell content to be
rendered to the cell area (and thus clipping to within the focus
rectangle). During the rendering clean up this parameter was removed
and no clipping put back into place.
Since expose_area was usually equal to cell_area anyway, it does not make
sense to reintroduce the expose_area parameter. Instead, we do clipping at
two levels:
- in gtk_cell_renderer_render() we clip to background_area. We cannot
clip to cell_area here because we want to allow cell renderers to
render in the background area (e.g. background color/effect).
- cell renderers should clip to clip_area when rendering cell
content individually (as they had to individually clip to expose_region
before).
Since parse() is a method of the Gdk.RGBA class, the GdkRGBA pointer
should be the first argument, and the string the second one, to allow a
more natural binding.
https://bugzilla.gnome.org/show_bug.cgi?id=635879
Since a cell renderer might use more space than the natural
size when recieving expand space it's impossible to know how
much space is actually used to render content.
Adding this virtual method to allow text renderers to implement
it, the base default method uses height-for-width apis and aligns
the cell assuming the renderer uses a fixed size.
This commit removes the similar code from gtkcellarea and
subclasses.
These properties use GdkRGBA to render the cell renderer's content.
Note that Pango attributes are used to render the foreground color,
so the alpha value is currently ignored.
This mostly goes to keep consistency with the changes to GtkSizeRequest
in the last patch, as GtkCellSizeRequest requires GtkCellRenderer and
GtkCellRenderer implements GtkCellSizeRequest there's no use in keeping
them separate.
This patch renames the functions:
gtk_cell_size_request_get_request_mode()
=> gtk_cell_renderer_get_request_mode()
gtk_cell_size_request_get_width()
=> gtk_cell_renderer_get_preferred_width()
gtk_cell_size_request_get_height()
=> gtk_cell_renderer_get_preferred_height()
gtk_cell_size_request_get_size()
=> gtk_cell_renderer_get_preferred_size()
gtk_cell_size_request_get_width_for_height()
=> gtk_cell_renderer_get_preferred_width_for_height()
gtk_cell_size_request_get_height_for_width()
=> gtk_cell_renderer_get_preferred_height_for_width()
... and moves the corresponding vfuncs to GtkCellRenderer.
The patch also renames the implementations of these functions in cell
renderers to include the word "preferrred".
It doesn't make sense to keep them separate as GtkSizeRequest requires a
GtkWidget and GtkWidget implements GtkSizeRequest, so you can never have
one without the other.
It also makes the code a lot easier because no casts are required when
calling functions.
Also, the names would translate to gtk_widget_get_width() and people
agreed that this would be a too generic name, so a "preferred" was added
to the names.
So this patch moves the functions:
gtk_size_request_get_request_mode() => gtk_widget_get_request_mode()
gtk_size_request_get_width() => gtk_widget_get_preferred_width()
gtk_size_request_get_height() => gtk_widget_get_preferred_height()
gtk_size_request_get_size() => gtk_widget_get_preferred_size()
gtk_size_request_get_width_for_height() =>
gtk_widget_get_preferred_width_for_height()
gtk_size_request_get_height_for_width() =>
gtk_widget_get_preferred_height_for_width()
... and moves the corresponding vfuncs to the GtkWidgetClass.
The patch also renames the implementations of the vfuncs in widgets to
include the word "preferrred".
This patch adds height-for-width geometry management
for cell renderers while still responding to the old
gtk_cell_renderer_get_size() apis with virtual return values
(obtained by soliciting the new height-for-width cell renderer
apis).
GtkCellEditable::editing-canceled property was added in 2.19 cycle,
so we should make the code that currently uses entry->editing_canceled
directly go through the property
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=599213
2007-12-27 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkcellrenderertext.c: Fix the default value for the
wrap-mode and font-scale properties.
svn path=/trunk/; revision=19256
2007-02-02 Mariano Suárez-Alvarez <mariano@gnome.org>
* gtk/gtkcellrenderertext.c(gtk_cell_renderer_text_class_init):
be a little more helpful with the docs on GtkCellRendererText:alignment.
Bug #403409.
svn path=/trunk/; revision=17250
2006-12-28 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkiconview.c: Use word wrapping by default, and
center multiline labels. (#318763, Ross Burton)
* gtk/gtkcellrenderertext.c (get_layout): Remove a special
case for single-line layouts.
2006-12-13 Benjamin Berg <benjamin@sipsolutions.net>
* engines/clearlooks/src/clearlooks_rc_style.c:
(clearlooks_rc_style_init), (clearlooks_gtk2_rc_parse_dummy),
(clearlooks_rc_style_parse), (clearlooks_rc_style_merge):
* engines/clearlooks/src/clearlooks_rc_style.h:
* engines/clearlooks/src/clearlooks_style.c:
(clearlooks_style_draw_box), (clearlooks_style_init_from_rc),
(clearlooks_style_copy):
* engines/clearlooks/src/clearlooks_style.h:
* engines/clearlooks/src/clearlooks_types.h:
- Remove unused code/options from the code. Warn about their usage
while parsing.
* themes/Clearlooks/gtk-2.0/gtkrc:
- Remove options that don't have any effect.
2006-12-10 Kristian Rietveld <kris@gtk.org>
* gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_focus_out_event):
cancel editing (ie. don't accept changes) when the entry loses
focus. (Fixes#164494, reported by Chris Rouch).
2006-09-24 Kristian Rietveld <kris@gtk.org>
* gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_class_init),
(gtk_cell_renderer_text_[sg]et_property): actually add align-set
property to the API (left-over patch from #157439).
2006-07-19 Kristian Rietveld <kris@imendio.com>
* gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_init),
(gtk_cell_renderer_text_[gs]et_property), (get_layout): add
align_set field to keep track whether the align property was
set by the user, if not we will use the alignment by looking
at the direction of the widget. (#157439)
2006-07-18 Kristian Rietveld <kris@imendio.com>
Fix for #335012, reported by Matteo Nastasi.
* gtk/gtktreeview.c (gtk_tree_view_real_start_editing): if the
requested space of the editable is smaller than the cell area,
put it up above the middle of the cell area.
* gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_start_editing):
configure the inner border to cover the cell area if the
entry requisition is smaller than the cell_area.