forked from AuroraMiddleware/gtk
cellrenderertoggle: size based on -gtk-icon-size
Instead of hardcoding 16px.
This commit is contained in:
parent
18cb15a05a
commit
aff25212df
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
#include "gtkcellrenderertoggle.h"
|
#include "gtkcellrenderertoggle.h"
|
||||||
|
|
||||||
|
#include "gtkcssnumbervalueprivate.h"
|
||||||
#include "gtkintl.h"
|
#include "gtkintl.h"
|
||||||
#include "gtkmarshalers.h"
|
#include "gtkmarshalers.h"
|
||||||
#include "gtkprivate.h"
|
#include "gtkprivate.h"
|
||||||
@ -86,8 +87,6 @@ enum {
|
|||||||
PROP_INCONSISTENT
|
PROP_INCONSISTENT
|
||||||
};
|
};
|
||||||
|
|
||||||
#define TOGGLE_WIDTH 16
|
|
||||||
|
|
||||||
static guint toggle_cell_signals[LAST_SIGNAL] = { 0 };
|
static guint toggle_cell_signals[LAST_SIGNAL] = { 0 };
|
||||||
|
|
||||||
typedef struct _GtkCellRendererTogglePrivate GtkCellRendererTogglePrivate;
|
typedef struct _GtkCellRendererTogglePrivate GtkCellRendererTogglePrivate;
|
||||||
@ -316,20 +315,11 @@ gtk_cell_renderer_toggle_save_context (GtkCellRenderer *cell,
|
|||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static int
|
||||||
calc_indicator_size (GtkStyleContext *context,
|
calc_indicator_size (GtkStyleContext *context)
|
||||||
gint *width,
|
|
||||||
gint *height)
|
|
||||||
{
|
{
|
||||||
gtk_style_context_get (context,
|
GtkCssStyle *style = gtk_style_context_lookup_style (context);
|
||||||
"min-width", width,
|
return _gtk_css_number_value_get (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_ICON_SIZE), 100);
|
||||||
"min-height", height,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
if (*width == 0)
|
|
||||||
*width = TOGGLE_WIDTH;
|
|
||||||
if (*height == 0)
|
|
||||||
*height = TOGGLE_WIDTH;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -353,7 +343,7 @@ gtk_cell_renderer_toggle_get_size (GtkCellRenderer *cell,
|
|||||||
gtk_style_context_get_padding (context, &padding);
|
gtk_style_context_get_padding (context, &padding);
|
||||||
gtk_style_context_get_border (context, &border);
|
gtk_style_context_get_border (context, &border);
|
||||||
|
|
||||||
calc_indicator_size (context, &calc_width, &calc_height);
|
calc_width = calc_height = calc_indicator_size (context);
|
||||||
calc_width += xpad * 2 + padding.left + padding.right + border.left + border.right;
|
calc_width += xpad * 2 + padding.left + padding.right + border.left + border.right;
|
||||||
calc_height += ypad * 2 + padding.top + padding.bottom + border.top + border.bottom;
|
calc_height += ypad * 2 + padding.top + padding.bottom + border.top + border.bottom;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user