forked from AuroraMiddleware/gtk
iconhelper: Respect -gtk-icon-style
This allows styling of entry icons, treeview pixbufs and images. They can now be forced to be symbolic or regular.
This commit is contained in:
parent
9619b8cff4
commit
f8cccbad0e
@ -19,9 +19,13 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <math.h>
|
||||
#include "gtkiconhelperprivate.h"
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include "gtkiconhelperprivate.h"
|
||||
#include "gtkstylecontextprivate.h"
|
||||
|
||||
struct _GtkIconHelperPrivate {
|
||||
GtkImageType storage_type;
|
||||
|
||||
@ -254,7 +258,7 @@ check_invalidate_pixbuf (GtkIconHelper *self,
|
||||
}
|
||||
|
||||
static GtkIconLookupFlags
|
||||
get_icon_lookup_flags (GtkIconHelper *self)
|
||||
get_icon_lookup_flags (GtkIconHelper *self, GtkStyleContext *context)
|
||||
{
|
||||
GtkIconLookupFlags flags = GTK_ICON_LOOKUP_USE_BUILTIN;
|
||||
|
||||
@ -263,6 +267,8 @@ get_icon_lookup_flags (GtkIconHelper *self)
|
||||
if (self->priv->pixel_size != -1)
|
||||
flags |= GTK_ICON_LOOKUP_FORCE_SIZE;
|
||||
|
||||
flags |= _gtk_style_context_get_icon_lookup_flags (context);
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
@ -279,7 +285,7 @@ ensure_pixbuf_for_gicon (GtkIconHelper *self,
|
||||
return;
|
||||
|
||||
icon_theme = gtk_icon_theme_get_default ();
|
||||
flags = get_icon_lookup_flags (self);
|
||||
flags = get_icon_lookup_flags (self, context);
|
||||
|
||||
ensure_icon_size (self, context, &width, &height);
|
||||
|
||||
@ -685,7 +691,7 @@ ensure_surface_for_gicon (GtkIconHelper *self,
|
||||
return;
|
||||
|
||||
icon_theme = gtk_icon_theme_get_default ();
|
||||
flags = get_icon_lookup_flags (self);
|
||||
flags = get_icon_lookup_flags (self, context);
|
||||
|
||||
ensure_icon_size (self, context, &width, &height);
|
||||
scale = get_scale_factor (self, context);
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "gtkcsscolorvalueprivate.h"
|
||||
#include "gtkcsscornervalueprivate.h"
|
||||
#include "gtkcssenginevalueprivate.h"
|
||||
#include "gtkcssenumvalueprivate.h"
|
||||
#include "gtkcssnumbervalueprivate.h"
|
||||
#include "gtkcssrgbavalueprivate.h"
|
||||
#include "gtkdebug.h"
|
||||
@ -4677,6 +4678,29 @@ _gtk_style_context_get_changes (GtkStyleContext *context)
|
||||
return context->priv->invalidating_context;
|
||||
}
|
||||
|
||||
GtkIconLookupFlags
|
||||
_gtk_style_context_get_icon_lookup_flags (GtkStyleContext *context)
|
||||
{
|
||||
GtkCssIconStyle icon_style;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_STYLE_CONTEXT (context), 0);
|
||||
|
||||
icon_style = _gtk_css_icon_style_value_get (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_ICON_STYLE));
|
||||
|
||||
switch (icon_style)
|
||||
{
|
||||
case GTK_CSS_ICON_STYLE_REGULAR:
|
||||
return GTK_ICON_LOOKUP_FORCE_REGULAR;
|
||||
case GTK_CSS_ICON_STYLE_SYMBOLIC:
|
||||
return GTK_ICON_LOOKUP_FORCE_SYMBOLIC;
|
||||
case GTK_CSS_ICON_STYLE_REQUESTED:
|
||||
return 0;
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
static AtkAttributeSet *
|
||||
add_attribute (AtkAttributeSet *attributes,
|
||||
AtkTextAttribute attr,
|
||||
|
@ -19,6 +19,8 @@
|
||||
#define __GTK_STYLE_CONTEXT_PRIVATE_H__
|
||||
|
||||
#include "gtkstylecontext.h"
|
||||
|
||||
#include "gtkicontheme.h"
|
||||
#include "gtkstyleproviderprivate.h"
|
||||
#include "gtkbitmaskprivate.h"
|
||||
#include "gtkcssvalueprivate.h"
|
||||
@ -54,6 +56,8 @@ void _gtk_style_context_get_cursor_color (GtkStyleContext
|
||||
|
||||
void _gtk_style_context_update_animating (GtkStyleContext *context);
|
||||
|
||||
GtkIconLookupFlags _gtk_style_context_get_icon_lookup_flags (GtkStyleContext *context);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_STYLE_CONTEXT_PRIVATE_H__ */
|
||||
|
Loading…
Reference in New Issue
Block a user