mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-19 18:00:09 +00:00
Implement GtkExtendedCell on GtkCellRendererText
This commit is contained in:
parent
59dafa77dc
commit
a17e12c87d
@ -21,7 +21,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "gtkcellrenderertext.h"
|
#include "gtkcellrenderertext.h"
|
||||||
#include "gtkeditable.h"
|
#include "gtkeditable.h"
|
||||||
#include "gtkextendedlayout.h"
|
#include "gtkextendedcell.h"
|
||||||
#include "gtkentry.h"
|
#include "gtkentry.h"
|
||||||
#include "gtkmarshalers.h"
|
#include "gtkmarshalers.h"
|
||||||
#include "gtkintl.h"
|
#include "gtkintl.h"
|
||||||
@ -62,7 +62,7 @@ static GtkCellEditable *gtk_cell_renderer_text_start_editing (GtkCellRenderer
|
|||||||
GdkRectangle *cell_area,
|
GdkRectangle *cell_area,
|
||||||
GtkCellRendererState flags);
|
GtkCellRendererState flags);
|
||||||
|
|
||||||
static void gtk_cell_renderer_text_extended_layout_init (GtkExtendedLayoutIface *iface);
|
static void gtk_cell_renderer_text_extended_cell_init (GtkExtendedCellIface *iface);
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
EDITED,
|
EDITED,
|
||||||
@ -151,12 +151,11 @@ struct _GtkCellRendererTextPrivate
|
|||||||
gint wrap_width;
|
gint wrap_width;
|
||||||
|
|
||||||
GtkWidget *entry;
|
GtkWidget *entry;
|
||||||
GtkWidget *owner;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
G_DEFINE_TYPE_WITH_CODE (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_EXTENDED_LAYOUT,
|
G_IMPLEMENT_INTERFACE (GTK_TYPE_EXTENDED_CELL,
|
||||||
gtk_cell_renderer_text_extended_layout_init))
|
gtk_cell_renderer_text_extended_cell_init))
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_cell_renderer_text_init (GtkCellRendererText *celltext)
|
gtk_cell_renderer_text_init (GtkCellRendererText *celltext)
|
||||||
@ -1500,7 +1499,6 @@ get_size (GtkCellRenderer *cell,
|
|||||||
GtkCellRendererTextPrivate *priv;
|
GtkCellRendererTextPrivate *priv;
|
||||||
|
|
||||||
priv = GTK_CELL_RENDERER_TEXT_GET_PRIVATE (cell);
|
priv = GTK_CELL_RENDERER_TEXT_GET_PRIVATE (cell);
|
||||||
priv->owner = widget;
|
|
||||||
|
|
||||||
if (celltext->calc_fixed_height)
|
if (celltext->calc_fixed_height)
|
||||||
{
|
{
|
||||||
@ -1938,21 +1936,19 @@ gtk_cell_renderer_text_set_fixed_height_from_font (GtkCellRendererText *renderer
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_cell_renderer_text_extended_layout_get_desired_size (GtkExtendedLayout *layout,
|
gtk_cell_renderer_text_extended_cell_get_desired_size (GtkExtendedCell *cell,
|
||||||
|
GtkWidget *widget,
|
||||||
GtkRequisition *minimal_size,
|
GtkRequisition *minimal_size,
|
||||||
GtkRequisition *desired_size)
|
GtkRequisition *desired_size)
|
||||||
{
|
{
|
||||||
GtkCellRendererTextPrivate *priv;
|
GtkCellRendererTextPrivate *priv;
|
||||||
|
|
||||||
priv = GTK_CELL_RENDERER_TEXT_GET_PRIVATE (layout);
|
priv = GTK_CELL_RENDERER_TEXT_GET_PRIVATE (cell);
|
||||||
|
|
||||||
if (priv->owner)
|
|
||||||
{
|
|
||||||
|
|
||||||
if (minimal_size)
|
if (minimal_size)
|
||||||
{
|
{
|
||||||
get_size (GTK_CELL_RENDERER (layout),
|
get_size (GTK_CELL_RENDERER (cell),
|
||||||
priv->owner, NULL, NULL, NULL, NULL,
|
widget, NULL, NULL, NULL, NULL,
|
||||||
&minimal_size->width, &minimal_size->height);
|
&minimal_size->width, &minimal_size->height);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1963,33 +1959,18 @@ gtk_cell_renderer_text_extended_layout_get_desired_size (GtkExtendedLayout *layo
|
|||||||
ellipsize = priv->ellipsize;
|
ellipsize = priv->ellipsize;
|
||||||
priv->ellipsize = PANGO_ELLIPSIZE_NONE;
|
priv->ellipsize = PANGO_ELLIPSIZE_NONE;
|
||||||
|
|
||||||
get_size (GTK_CELL_RENDERER (layout),
|
get_size (GTK_CELL_RENDERER (cell),
|
||||||
priv->owner, NULL, NULL, NULL, NULL,
|
widget, NULL, NULL, NULL, NULL,
|
||||||
&desired_size->width, &desired_size->height);
|
&desired_size->width, &desired_size->height);
|
||||||
|
|
||||||
priv->ellipsize = ellipsize;
|
priv->ellipsize = ellipsize;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (minimal_size)
|
|
||||||
{
|
|
||||||
minimal_size->height = 0;
|
|
||||||
minimal_size->width = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (desired_size)
|
|
||||||
{
|
|
||||||
desired_size->height = 0;
|
|
||||||
desired_size->width = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_cell_renderer_text_extended_layout_init (GtkExtendedLayoutIface *iface)
|
gtk_cell_renderer_text_extended_cell_init (GtkExtendedCellIface *iface)
|
||||||
{
|
{
|
||||||
iface->get_desired_size = gtk_cell_renderer_text_extended_layout_get_desired_size;
|
iface->get_desired_size = gtk_cell_renderer_text_extended_cell_get_desired_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define __GTK_CELL_RENDERER_TEXT_C__
|
#define __GTK_CELL_RENDERER_TEXT_C__
|
||||||
|
Loading…
Reference in New Issue
Block a user