forked from AuroraMiddleware/gtk
Fixes based on comments from Owen Taylor, #125264.
Tue Nov 18 19:47:59 2003 Kristian Rietveld <kris@gtk.org> Fixes based on comments from Owen Taylor, #125264. * gtk/gtkcellview.[ch] (gtk_cell_view_finalize): remove unused variable, (gtk_cell_view_set_value), (gtk_cell_view_set_displayed_model): queue a resize, (gtk_cell_view_get_size_of_row): new function, (gtk_cell_view_set_value), (gtk_cell_view_set_valuesv), (gtk_cell_view_set_values), (gtk_cell_view_set_model), (gtk_cell_view_set_displayed_row), (gtk_cell_view_get_displayed_row): s/cellview/cell_view/ in the function definitions, so they match with the header file. * gtk/gtkcombobox.c (gtk_combo_box_remeasure): remove the resize flag again (:, and use gtk_cell_view_get_size_of_row instead of the measurer, remove _set_size_request call, (gtk_combo_box_calc_requested_width): use gtk_cell_view_get_size_of_row instead of the measurer, (gtk_combo_box_style_set): queue a resize, (gtk_combo_box_size_request): update of _remeasure call, (gtk_combo_box_init), (gtk_combo_box_cell_layout_pack_start), (gtk_combo_box_cell_layout_pack_end), (gtk_combo_box_cell_layout_clear), (gtk_combo_box_set_model): get rid of the measurer, (gtk_combo_box_cell_layout_add_attribute), (gtk_combo_box_cell_layout_set_cell_data_func), (gtk_combo_box_cell_layout_clear_attributes): ditto and queue a resize instead of calling _remeasure.
This commit is contained in:
parent
7ea41146e9
commit
e9154691d1
31
ChangeLog
31
ChangeLog
@ -1,3 +1,34 @@
|
||||
Tue Nov 18 19:47:59 2003 Kristian Rietveld <kris@gtk.org>
|
||||
|
||||
Fixes based on comments from Owen Taylor, #125264.
|
||||
|
||||
* gtk/gtkcellview.[ch] (gtk_cell_view_finalize): remove unused
|
||||
variable,
|
||||
(gtk_cell_view_set_value), (gtk_cell_view_set_displayed_model): queue
|
||||
a resize,
|
||||
(gtk_cell_view_get_size_of_row): new function,
|
||||
(gtk_cell_view_set_value), (gtk_cell_view_set_valuesv),
|
||||
(gtk_cell_view_set_values), (gtk_cell_view_set_model),
|
||||
(gtk_cell_view_set_displayed_row), (gtk_cell_view_get_displayed_row):
|
||||
s/cellview/cell_view/ in the function definitions, so they match
|
||||
with the header file.
|
||||
|
||||
* gtk/gtkcombobox.c (gtk_combo_box_remeasure): remove the resize
|
||||
flag again (:, and use gtk_cell_view_get_size_of_row instead of
|
||||
the measurer, remove _set_size_request call,
|
||||
(gtk_combo_box_calc_requested_width): use gtk_cell_view_get_size_of_row
|
||||
instead of the measurer,
|
||||
(gtk_combo_box_style_set): queue a resize,
|
||||
(gtk_combo_box_size_request): update of _remeasure call,
|
||||
(gtk_combo_box_init), (gtk_combo_box_cell_layout_pack_start),
|
||||
(gtk_combo_box_cell_layout_pack_end),
|
||||
(gtk_combo_box_cell_layout_clear),
|
||||
(gtk_combo_box_set_model): get rid of the measurer,
|
||||
(gtk_combo_box_cell_layout_add_attribute),
|
||||
(gtk_combo_box_cell_layout_set_cell_data_func),
|
||||
(gtk_combo_box_cell_layout_clear_attributes): ditto and queue a
|
||||
resize instead of calling _remeasure.
|
||||
|
||||
Mon Nov 17 16:25:04 2003 Manish Singh <yosh@gimp.org>
|
||||
|
||||
* gdk-pixbuf/Makefile.am
|
||||
|
@ -1,3 +1,34 @@
|
||||
Tue Nov 18 19:47:59 2003 Kristian Rietveld <kris@gtk.org>
|
||||
|
||||
Fixes based on comments from Owen Taylor, #125264.
|
||||
|
||||
* gtk/gtkcellview.[ch] (gtk_cell_view_finalize): remove unused
|
||||
variable,
|
||||
(gtk_cell_view_set_value), (gtk_cell_view_set_displayed_model): queue
|
||||
a resize,
|
||||
(gtk_cell_view_get_size_of_row): new function,
|
||||
(gtk_cell_view_set_value), (gtk_cell_view_set_valuesv),
|
||||
(gtk_cell_view_set_values), (gtk_cell_view_set_model),
|
||||
(gtk_cell_view_set_displayed_row), (gtk_cell_view_get_displayed_row):
|
||||
s/cellview/cell_view/ in the function definitions, so they match
|
||||
with the header file.
|
||||
|
||||
* gtk/gtkcombobox.c (gtk_combo_box_remeasure): remove the resize
|
||||
flag again (:, and use gtk_cell_view_get_size_of_row instead of
|
||||
the measurer, remove _set_size_request call,
|
||||
(gtk_combo_box_calc_requested_width): use gtk_cell_view_get_size_of_row
|
||||
instead of the measurer,
|
||||
(gtk_combo_box_style_set): queue a resize,
|
||||
(gtk_combo_box_size_request): update of _remeasure call,
|
||||
(gtk_combo_box_init), (gtk_combo_box_cell_layout_pack_start),
|
||||
(gtk_combo_box_cell_layout_pack_end),
|
||||
(gtk_combo_box_cell_layout_clear),
|
||||
(gtk_combo_box_set_model): get rid of the measurer,
|
||||
(gtk_combo_box_cell_layout_add_attribute),
|
||||
(gtk_combo_box_cell_layout_set_cell_data_func),
|
||||
(gtk_combo_box_cell_layout_clear_attributes): ditto and queue a
|
||||
resize instead of calling _remeasure.
|
||||
|
||||
Mon Nov 17 16:25:04 2003 Manish Singh <yosh@gimp.org>
|
||||
|
||||
* gdk-pixbuf/Makefile.am
|
||||
|
@ -1,3 +1,34 @@
|
||||
Tue Nov 18 19:47:59 2003 Kristian Rietveld <kris@gtk.org>
|
||||
|
||||
Fixes based on comments from Owen Taylor, #125264.
|
||||
|
||||
* gtk/gtkcellview.[ch] (gtk_cell_view_finalize): remove unused
|
||||
variable,
|
||||
(gtk_cell_view_set_value), (gtk_cell_view_set_displayed_model): queue
|
||||
a resize,
|
||||
(gtk_cell_view_get_size_of_row): new function,
|
||||
(gtk_cell_view_set_value), (gtk_cell_view_set_valuesv),
|
||||
(gtk_cell_view_set_values), (gtk_cell_view_set_model),
|
||||
(gtk_cell_view_set_displayed_row), (gtk_cell_view_get_displayed_row):
|
||||
s/cellview/cell_view/ in the function definitions, so they match
|
||||
with the header file.
|
||||
|
||||
* gtk/gtkcombobox.c (gtk_combo_box_remeasure): remove the resize
|
||||
flag again (:, and use gtk_cell_view_get_size_of_row instead of
|
||||
the measurer, remove _set_size_request call,
|
||||
(gtk_combo_box_calc_requested_width): use gtk_cell_view_get_size_of_row
|
||||
instead of the measurer,
|
||||
(gtk_combo_box_style_set): queue a resize,
|
||||
(gtk_combo_box_size_request): update of _remeasure call,
|
||||
(gtk_combo_box_init), (gtk_combo_box_cell_layout_pack_start),
|
||||
(gtk_combo_box_cell_layout_pack_end),
|
||||
(gtk_combo_box_cell_layout_clear),
|
||||
(gtk_combo_box_set_model): get rid of the measurer,
|
||||
(gtk_combo_box_cell_layout_add_attribute),
|
||||
(gtk_combo_box_cell_layout_set_cell_data_func),
|
||||
(gtk_combo_box_cell_layout_clear_attributes): ditto and queue a
|
||||
resize instead of calling _remeasure.
|
||||
|
||||
Mon Nov 17 16:25:04 2003 Manish Singh <yosh@gimp.org>
|
||||
|
||||
* gdk-pixbuf/Makefile.am
|
||||
|
@ -1,3 +1,34 @@
|
||||
Tue Nov 18 19:47:59 2003 Kristian Rietveld <kris@gtk.org>
|
||||
|
||||
Fixes based on comments from Owen Taylor, #125264.
|
||||
|
||||
* gtk/gtkcellview.[ch] (gtk_cell_view_finalize): remove unused
|
||||
variable,
|
||||
(gtk_cell_view_set_value), (gtk_cell_view_set_displayed_model): queue
|
||||
a resize,
|
||||
(gtk_cell_view_get_size_of_row): new function,
|
||||
(gtk_cell_view_set_value), (gtk_cell_view_set_valuesv),
|
||||
(gtk_cell_view_set_values), (gtk_cell_view_set_model),
|
||||
(gtk_cell_view_set_displayed_row), (gtk_cell_view_get_displayed_row):
|
||||
s/cellview/cell_view/ in the function definitions, so they match
|
||||
with the header file.
|
||||
|
||||
* gtk/gtkcombobox.c (gtk_combo_box_remeasure): remove the resize
|
||||
flag again (:, and use gtk_cell_view_get_size_of_row instead of
|
||||
the measurer, remove _set_size_request call,
|
||||
(gtk_combo_box_calc_requested_width): use gtk_cell_view_get_size_of_row
|
||||
instead of the measurer,
|
||||
(gtk_combo_box_style_set): queue a resize,
|
||||
(gtk_combo_box_size_request): update of _remeasure call,
|
||||
(gtk_combo_box_init), (gtk_combo_box_cell_layout_pack_start),
|
||||
(gtk_combo_box_cell_layout_pack_end),
|
||||
(gtk_combo_box_cell_layout_clear),
|
||||
(gtk_combo_box_set_model): get rid of the measurer,
|
||||
(gtk_combo_box_cell_layout_add_attribute),
|
||||
(gtk_combo_box_cell_layout_set_cell_data_func),
|
||||
(gtk_combo_box_cell_layout_clear_attributes): ditto and queue a
|
||||
resize instead of calling _remeasure.
|
||||
|
||||
Mon Nov 17 16:25:04 2003 Manish Singh <yosh@gimp.org>
|
||||
|
||||
* gdk-pixbuf/Makefile.am
|
||||
|
@ -1,3 +1,34 @@
|
||||
Tue Nov 18 19:47:59 2003 Kristian Rietveld <kris@gtk.org>
|
||||
|
||||
Fixes based on comments from Owen Taylor, #125264.
|
||||
|
||||
* gtk/gtkcellview.[ch] (gtk_cell_view_finalize): remove unused
|
||||
variable,
|
||||
(gtk_cell_view_set_value), (gtk_cell_view_set_displayed_model): queue
|
||||
a resize,
|
||||
(gtk_cell_view_get_size_of_row): new function,
|
||||
(gtk_cell_view_set_value), (gtk_cell_view_set_valuesv),
|
||||
(gtk_cell_view_set_values), (gtk_cell_view_set_model),
|
||||
(gtk_cell_view_set_displayed_row), (gtk_cell_view_get_displayed_row):
|
||||
s/cellview/cell_view/ in the function definitions, so they match
|
||||
with the header file.
|
||||
|
||||
* gtk/gtkcombobox.c (gtk_combo_box_remeasure): remove the resize
|
||||
flag again (:, and use gtk_cell_view_get_size_of_row instead of
|
||||
the measurer, remove _set_size_request call,
|
||||
(gtk_combo_box_calc_requested_width): use gtk_cell_view_get_size_of_row
|
||||
instead of the measurer,
|
||||
(gtk_combo_box_style_set): queue a resize,
|
||||
(gtk_combo_box_size_request): update of _remeasure call,
|
||||
(gtk_combo_box_init), (gtk_combo_box_cell_layout_pack_start),
|
||||
(gtk_combo_box_cell_layout_pack_end),
|
||||
(gtk_combo_box_cell_layout_clear),
|
||||
(gtk_combo_box_set_model): get rid of the measurer,
|
||||
(gtk_combo_box_cell_layout_add_attribute),
|
||||
(gtk_combo_box_cell_layout_set_cell_data_func),
|
||||
(gtk_combo_box_cell_layout_clear_attributes): ditto and queue a
|
||||
resize instead of calling _remeasure.
|
||||
|
||||
Mon Nov 17 16:25:04 2003 Manish Singh <yosh@gimp.org>
|
||||
|
||||
* gdk-pixbuf/Makefile.am
|
||||
|
@ -287,8 +287,6 @@ gtk_cell_view_style_set (GtkWidget *widget,
|
||||
static void
|
||||
gtk_cell_view_finalize (GObject *object)
|
||||
{
|
||||
GtkCellView *cellview = GTK_CELL_VIEW (object);
|
||||
|
||||
gtk_cell_view_cell_layout_clear (GTK_CELL_LAYOUT (object));
|
||||
|
||||
if (G_OBJECT_CLASS (parent_class)->finalize)
|
||||
@ -765,22 +763,23 @@ gtk_cell_view_new_with_pixbuf (GdkPixbuf *pixbuf)
|
||||
}
|
||||
|
||||
void
|
||||
gtk_cell_view_set_value (GtkCellView *cellview,
|
||||
gtk_cell_view_set_value (GtkCellView *cell_view,
|
||||
GtkCellRenderer *renderer,
|
||||
gchar *property,
|
||||
GValue *value)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_CELL_VIEW (cellview));
|
||||
g_return_if_fail (GTK_IS_CELL_VIEW (cell_view));
|
||||
g_return_if_fail (GTK_IS_CELL_RENDERER (renderer));
|
||||
|
||||
g_object_set_property (G_OBJECT (renderer), property, value);
|
||||
|
||||
/* force redraw */
|
||||
gtk_widget_queue_draw (GTK_WIDGET (cellview));
|
||||
/* force resize and redraw */
|
||||
gtk_widget_queue_resize (GTK_WIDGET (cell_view));
|
||||
gtk_widget_queue_draw (GTK_WIDGET (cell_view));
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_cell_view_set_valuesv (GtkCellView *cellview,
|
||||
gtk_cell_view_set_valuesv (GtkCellView *cell_view,
|
||||
GtkCellRenderer *renderer,
|
||||
va_list args)
|
||||
{
|
||||
@ -792,77 +791,101 @@ gtk_cell_view_set_valuesv (GtkCellView *cellview,
|
||||
while (attribute)
|
||||
{
|
||||
value = va_arg (args, GValue *);
|
||||
gtk_cell_view_set_value (cellview, renderer, attribute, value);
|
||||
gtk_cell_view_set_value (cell_view, renderer, attribute, value);
|
||||
attribute = va_arg (args, gchar *);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gtk_cell_view_set_values (GtkCellView *cellview,
|
||||
gtk_cell_view_set_values (GtkCellView *cell_view,
|
||||
GtkCellRenderer *renderer,
|
||||
...)
|
||||
{
|
||||
va_list args;
|
||||
|
||||
g_return_if_fail (GTK_IS_CELL_VIEW (cellview));
|
||||
g_return_if_fail (GTK_IS_CELL_VIEW (cell_view));
|
||||
g_return_if_fail (GTK_IS_CELL_RENDERER (renderer));
|
||||
g_return_if_fail (gtk_cell_view_get_cell_info (cellview, renderer));
|
||||
g_return_if_fail (gtk_cell_view_get_cell_info (cell_view, renderer));
|
||||
|
||||
va_start (args, renderer);
|
||||
gtk_cell_view_set_valuesv (cellview, renderer, args);
|
||||
gtk_cell_view_set_valuesv (cell_view, renderer, args);
|
||||
va_end (args);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_cell_view_set_model (GtkCellView *cellview,
|
||||
gtk_cell_view_set_model (GtkCellView *cell_view,
|
||||
GtkTreeModel *model)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_CELL_VIEW (cellview));
|
||||
g_return_if_fail (GTK_IS_CELL_VIEW (cell_view));
|
||||
g_return_if_fail (GTK_IS_TREE_MODEL (model));
|
||||
|
||||
if (cellview->priv->model)
|
||||
if (cell_view->priv->model)
|
||||
{
|
||||
if (cellview->priv->displayed_row)
|
||||
gtk_tree_row_reference_free (cellview->priv->displayed_row);
|
||||
cellview->priv->displayed_row = NULL;
|
||||
if (cell_view->priv->displayed_row)
|
||||
gtk_tree_row_reference_free (cell_view->priv->displayed_row);
|
||||
cell_view->priv->displayed_row = NULL;
|
||||
|
||||
g_object_unref (G_OBJECT (cellview->priv->model));
|
||||
cellview->priv->model = NULL;
|
||||
g_object_unref (G_OBJECT (cell_view->priv->model));
|
||||
cell_view->priv->model = NULL;
|
||||
}
|
||||
|
||||
cellview->priv->model = model;
|
||||
cell_view->priv->model = model;
|
||||
|
||||
if (cellview->priv->model)
|
||||
g_object_ref (G_OBJECT (cellview->priv->model));
|
||||
if (cell_view->priv->model)
|
||||
g_object_ref (G_OBJECT (cell_view->priv->model));
|
||||
}
|
||||
|
||||
void
|
||||
gtk_cell_view_set_displayed_row (GtkCellView *cellview,
|
||||
gtk_cell_view_set_displayed_row (GtkCellView *cell_view,
|
||||
GtkTreePath *path)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_CELL_VIEW (cellview));
|
||||
g_return_if_fail (GTK_IS_TREE_MODEL (cellview->priv->model));
|
||||
g_return_if_fail (GTK_IS_CELL_VIEW (cell_view));
|
||||
g_return_if_fail (GTK_IS_TREE_MODEL (cell_view->priv->model));
|
||||
g_return_if_fail (path != NULL);
|
||||
|
||||
if (cellview->priv->displayed_row)
|
||||
gtk_tree_row_reference_free (cellview->priv->displayed_row);
|
||||
if (cell_view->priv->displayed_row)
|
||||
gtk_tree_row_reference_free (cell_view->priv->displayed_row);
|
||||
|
||||
cellview->priv->displayed_row =
|
||||
gtk_tree_row_reference_new (cellview->priv->model, path);
|
||||
cell_view->priv->displayed_row =
|
||||
gtk_tree_row_reference_new (cell_view->priv->model, path);
|
||||
|
||||
/* force redraw */
|
||||
gtk_widget_queue_draw (GTK_WIDGET (cellview));
|
||||
/* force resize and redraw */
|
||||
gtk_widget_queue_resize (GTK_WIDGET (cell_view));
|
||||
gtk_widget_queue_draw (GTK_WIDGET (cell_view));
|
||||
}
|
||||
|
||||
GtkTreePath *
|
||||
gtk_cell_view_get_displayed_row (GtkCellView *cellview)
|
||||
gtk_cell_view_get_displayed_row (GtkCellView *cell_view)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_CELL_VIEW (cellview), NULL);
|
||||
g_return_val_if_fail (GTK_IS_CELL_VIEW (cell_view), NULL);
|
||||
|
||||
if (!cellview->priv->displayed_row)
|
||||
if (!cell_view->priv->displayed_row)
|
||||
return NULL;
|
||||
|
||||
return gtk_tree_row_reference_get_path (cellview->priv->displayed_row);
|
||||
return gtk_tree_row_reference_get_path (cell_view->priv->displayed_row);
|
||||
}
|
||||
|
||||
gboolean
|
||||
gtk_cell_view_get_size_of_row (GtkCellView *cell_view,
|
||||
GtkTreePath *path,
|
||||
GtkRequisition *requisition)
|
||||
{
|
||||
GtkTreeRowReference *tmp;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_CELL_VIEW (cell_view), FALSE);
|
||||
g_return_val_if_fail (path != NULL, FALSE);
|
||||
g_return_val_if_fail (requisition != NULL, FALSE);
|
||||
|
||||
tmp = cell_view->priv->displayed_row;
|
||||
cell_view->priv->displayed_row =
|
||||
gtk_tree_row_reference_new (cell_view->priv->model, path);
|
||||
|
||||
gtk_cell_view_size_request (GTK_WIDGET (cell_view), requisition);
|
||||
|
||||
gtk_tree_row_reference_free (cell_view->priv->displayed_row);
|
||||
cell_view->priv->displayed_row = tmp;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -71,6 +71,9 @@ void gtk_cell_view_set_model (GtkCellView *cell_v
|
||||
void gtk_cell_view_set_displayed_row (GtkCellView *cell_view,
|
||||
GtkTreePath *path);
|
||||
GtkTreePath *gtk_cell_view_get_displayed_row (GtkCellView *cell_view);
|
||||
gboolean gtk_cell_view_get_size_of_row (GtkCellView *cell_view,
|
||||
GtkTreePath *path,
|
||||
GtkRequisition *requisition);
|
||||
|
||||
void gtk_cell_view_set_background_color (GtkCellView *cell_view,
|
||||
GdkColor *color);
|
||||
|
@ -80,7 +80,6 @@ struct _GtkComboBoxPrivate
|
||||
GtkTreeViewColumn *column;
|
||||
|
||||
GtkWidget *cell_view;
|
||||
GtkWidget *measurer;
|
||||
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *cell_view_frame;
|
||||
@ -166,8 +165,7 @@ static void gtk_combo_box_popdown (GtkComboBox *combo_box)
|
||||
|
||||
static gint gtk_combo_box_calc_requested_width (GtkComboBox *combo_box,
|
||||
GtkTreePath *path);
|
||||
static void gtk_combo_box_remeasure (GtkComboBox *combo_box,
|
||||
gboolean resize);
|
||||
static void gtk_combo_box_remeasure (GtkComboBox *combo_box);
|
||||
|
||||
static void gtk_combo_box_unset_model (GtkComboBox *combo_box);
|
||||
static void gtk_combo_box_set_model_internal (GtkComboBox *combo_box);
|
||||
@ -415,8 +413,6 @@ gtk_combo_box_init (GtkComboBox *combo_box)
|
||||
gtk_container_add (GTK_CONTAINER (combo_box), combo_box->priv->cell_view);
|
||||
gtk_widget_show (combo_box->priv->cell_view);
|
||||
|
||||
combo_box->priv->measurer = gtk_cell_view_new ();
|
||||
|
||||
combo_box->priv->width = 0;
|
||||
combo_box->priv->wrap_width = 0;
|
||||
|
||||
@ -504,6 +500,8 @@ gtk_combo_box_style_set (GtkWidget *widget,
|
||||
gboolean appearance;
|
||||
GtkComboBox *combo_box = GTK_COMBO_BOX (widget);
|
||||
|
||||
gtk_widget_queue_resize (widget);
|
||||
|
||||
/* if wrap_width > 0, then we are in grid-mode and forced to use
|
||||
* unix style
|
||||
*/
|
||||
@ -792,25 +790,27 @@ gtk_combo_box_calc_requested_width (GtkComboBox *combo_box,
|
||||
gint padding;
|
||||
GtkRequisition req;
|
||||
|
||||
gtk_widget_style_get (combo_box->priv->measurer,
|
||||
if (combo_box->priv->cell_view)
|
||||
gtk_widget_style_get (combo_box->priv->cell_view,
|
||||
"focus-line-width", &padding,
|
||||
NULL);
|
||||
else
|
||||
padding = 0;
|
||||
|
||||
/* add some pixels for good measure */
|
||||
padding += BONUS_PADDING;
|
||||
|
||||
gtk_cell_view_set_displayed_row (GTK_CELL_VIEW (combo_box->priv->measurer),
|
||||
path);
|
||||
|
||||
/* nasty trick to get around the sizegroup's size request caching */
|
||||
(* GTK_WIDGET_GET_CLASS (combo_box->priv->measurer)->size_request) (combo_box->priv->measurer, &req);
|
||||
if (combo_box->priv->cell_view)
|
||||
gtk_cell_view_get_size_of_row (GTK_CELL_VIEW (combo_box->priv->cell_view),
|
||||
path, &req);
|
||||
else
|
||||
req.width = 0;
|
||||
|
||||
return req.width + padding;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_combo_box_remeasure (GtkComboBox *combo_box,
|
||||
gboolean resize)
|
||||
gtk_combo_box_remeasure (GtkComboBox *combo_box)
|
||||
{
|
||||
GtkTreeIter iter;
|
||||
GtkTreePath *path;
|
||||
@ -819,11 +819,16 @@ gtk_combo_box_remeasure (GtkComboBox *combo_box,
|
||||
if (!gtk_tree_model_get_iter_first (combo_box->priv->model, &iter))
|
||||
return;
|
||||
|
||||
combo_box->priv->width = 0;
|
||||
|
||||
path = gtk_tree_path_new_from_indices (0, -1);
|
||||
|
||||
gtk_widget_style_get (combo_box->priv->measurer,
|
||||
if (combo_box->priv->cell_view)
|
||||
gtk_widget_style_get (combo_box->priv->cell_view,
|
||||
"focus-line-width", &padding,
|
||||
NULL);
|
||||
else
|
||||
padding = 0;
|
||||
|
||||
/* add some pixels for good measure */
|
||||
padding += BONUS_PADDING;
|
||||
@ -832,11 +837,11 @@ gtk_combo_box_remeasure (GtkComboBox *combo_box,
|
||||
{
|
||||
GtkRequisition req;
|
||||
|
||||
gtk_cell_view_set_displayed_row (GTK_CELL_VIEW (combo_box->priv->measurer),
|
||||
path);
|
||||
|
||||
/* nasty trick to get around the sizegroup's size request caching */
|
||||
(* GTK_WIDGET_GET_CLASS (combo_box->priv->measurer)->size_request) (combo_box->priv->measurer, &req);
|
||||
if (combo_box->priv->cell_view)
|
||||
gtk_cell_view_get_size_of_row (GTK_CELL_VIEW (combo_box->priv->cell_view),
|
||||
path, &req);
|
||||
else
|
||||
req.width = 0;
|
||||
|
||||
combo_box->priv->width = MAX (combo_box->priv->width,
|
||||
req.width + padding);
|
||||
@ -846,13 +851,6 @@ gtk_combo_box_remeasure (GtkComboBox *combo_box,
|
||||
while (gtk_tree_model_iter_next (combo_box->priv->model, &iter));
|
||||
|
||||
gtk_tree_path_free (path);
|
||||
|
||||
if (combo_box->priv->cell_view && resize)
|
||||
{
|
||||
gtk_widget_set_size_request (combo_box->priv->cell_view,
|
||||
combo_box->priv->width, -1);
|
||||
gtk_widget_queue_resize (combo_box->priv->cell_view);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
@ -866,7 +864,7 @@ gtk_combo_box_size_request (GtkWidget *widget,
|
||||
|
||||
/* common */
|
||||
gtk_widget_size_request (GTK_BIN (widget)->child, &bin_req);
|
||||
gtk_combo_box_remeasure (combo_box, FALSE);
|
||||
gtk_combo_box_remeasure (combo_box);
|
||||
bin_req.width = MAX (bin_req.width, combo_box->priv->width);
|
||||
|
||||
if (!combo_box->priv->tree_view)
|
||||
@ -1967,9 +1965,6 @@ gtk_combo_box_cell_layout_pack_start (GtkCellLayout *layout,
|
||||
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo_box->priv->cell_view),
|
||||
cell, expand);
|
||||
|
||||
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo_box->priv->measurer),
|
||||
cell, expand);
|
||||
|
||||
if (combo_box->priv->column)
|
||||
gtk_tree_view_column_pack_start (combo_box->priv->column, cell, expand);
|
||||
|
||||
@ -2015,9 +2010,6 @@ gtk_combo_box_cell_layout_pack_end (GtkCellLayout *layout,
|
||||
gtk_cell_layout_pack_end (GTK_CELL_LAYOUT (combo_box->priv->cell_view),
|
||||
cell, expand);
|
||||
|
||||
gtk_cell_layout_pack_end (GTK_CELL_LAYOUT (combo_box->priv->measurer),
|
||||
cell, expand);
|
||||
|
||||
if (combo_box->priv->column)
|
||||
gtk_tree_view_column_pack_end (combo_box->priv->column, cell, expand);
|
||||
|
||||
@ -2053,9 +2045,6 @@ gtk_combo_box_cell_layout_clear (GtkCellLayout *layout)
|
||||
if (combo_box->priv->cell_view)
|
||||
gtk_cell_layout_clear (GTK_CELL_LAYOUT (combo_box->priv->cell_view));
|
||||
|
||||
if (combo_box->priv->measurer)
|
||||
gtk_cell_layout_clear (GTK_CELL_LAYOUT (combo_box->priv->measurer));
|
||||
|
||||
if (combo_box->priv->column)
|
||||
gtk_tree_view_column_clear (combo_box->priv->column);
|
||||
|
||||
@ -2103,9 +2092,6 @@ gtk_combo_box_cell_layout_add_attribute (GtkCellLayout *layout,
|
||||
gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (combo_box->priv->cell_view),
|
||||
cell, attribute, column);
|
||||
|
||||
gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (combo_box->priv->measurer),
|
||||
cell, attribute, column);
|
||||
|
||||
if (combo_box->priv->column)
|
||||
gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (combo_box->priv->column),
|
||||
cell, attribute, column);
|
||||
@ -2131,7 +2117,7 @@ gtk_combo_box_cell_layout_add_attribute (GtkCellLayout *layout,
|
||||
g_list_free (list);
|
||||
}
|
||||
|
||||
gtk_combo_box_remeasure (combo_box, TRUE);
|
||||
gtk_widget_queue_resize (GTK_WIDGET (combo_box));
|
||||
}
|
||||
|
||||
static void
|
||||
@ -2165,8 +2151,6 @@ gtk_combo_box_cell_layout_set_cell_data_func (GtkCellLayout *layout,
|
||||
if (combo_box->priv->cell_view)
|
||||
gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (combo_box->priv->cell_view), cell, func, func_data, NULL);
|
||||
|
||||
gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (combo_box->priv->measurer), cell, func, func_data, NULL);
|
||||
|
||||
if (combo_box->priv->column)
|
||||
gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (combo_box->priv->column), cell, func, func_data, NULL);
|
||||
|
||||
@ -2191,7 +2175,7 @@ gtk_combo_box_cell_layout_set_cell_data_func (GtkCellLayout *layout,
|
||||
g_list_free (list);
|
||||
}
|
||||
|
||||
gtk_combo_box_remeasure (combo_box, TRUE);
|
||||
gtk_widget_queue_resize (GTK_WIDGET (combo_box));
|
||||
}
|
||||
|
||||
static void
|
||||
@ -2222,8 +2206,6 @@ gtk_combo_box_cell_layout_clear_attributes (GtkCellLayout *layout,
|
||||
if (combo_box->priv->cell_view)
|
||||
gtk_cell_layout_clear_attributes (GTK_CELL_LAYOUT (combo_box->priv->cell_view), cell);
|
||||
|
||||
gtk_cell_layout_clear_attributes (GTK_CELL_LAYOUT (combo_box->priv->measurer), cell);
|
||||
|
||||
if (combo_box->priv->column)
|
||||
gtk_cell_layout_clear_attributes (GTK_CELL_LAYOUT (combo_box->priv->column), cell);
|
||||
|
||||
@ -2247,7 +2229,7 @@ gtk_combo_box_cell_layout_clear_attributes (GtkCellLayout *layout,
|
||||
g_list_free (list);
|
||||
}
|
||||
|
||||
gtk_combo_box_remeasure (combo_box, TRUE);
|
||||
gtk_widget_queue_resize (GTK_WIDGET (combo_box));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -2545,8 +2527,6 @@ gtk_combo_box_set_model (GtkComboBox *combo_box,
|
||||
if (combo_box->priv->cell_view)
|
||||
gtk_cell_view_set_model (GTK_CELL_VIEW (combo_box->priv->cell_view),
|
||||
combo_box->priv->model);
|
||||
gtk_cell_view_set_model (GTK_CELL_VIEW (combo_box->priv->measurer),
|
||||
combo_box->priv->model);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user