Add pulse style class and use in progress bar and entry

This is used for indeterminate progress reporting.
This commit is contained in:
Alexander Larsson 2011-11-18 10:15:04 +01:00
parent 68c74e1427
commit ca829b484c
3 changed files with 14 additions and 0 deletions

View File

@ -3522,6 +3522,8 @@ gtk_entry_draw_progress (GtkWidget *widget,
GtkStyleContext *context, GtkStyleContext *context,
cairo_t *cr) cairo_t *cr)
{ {
GtkEntry *entry = GTK_ENTRY (widget);
GtkEntryPrivate *private = entry->priv;
gint x, y, width, height; gint x, y, width, height;
get_progress_area (widget, &x, &y, &width, &height); get_progress_area (widget, &x, &y, &width, &height);
@ -3531,6 +3533,8 @@ gtk_entry_draw_progress (GtkWidget *widget,
gtk_style_context_save (context); gtk_style_context_save (context);
gtk_style_context_add_class (context, GTK_STYLE_CLASS_PROGRESSBAR); gtk_style_context_add_class (context, GTK_STYLE_CLASS_PROGRESSBAR);
if (private->progress_pulse_mode)
gtk_style_context_add_class (context, GTK_STYLE_CLASS_PULSE);
gtk_render_activity (context, cr, gtk_render_activity (context, cr,
x, y, width, height); x, y, width, height);

View File

@ -760,6 +760,7 @@ gtk_progress_bar_paint_activity (GtkProgressBar *pbar,
gtk_style_context_save (context); gtk_style_context_save (context);
gtk_style_context_add_class (context, GTK_STYLE_CLASS_PROGRESSBAR); gtk_style_context_add_class (context, GTK_STYLE_CLASS_PROGRESSBAR);
gtk_style_context_add_class (context, GTK_STYLE_CLASS_PULSE);
gtk_render_activity (context, cr, area.x, area.y, area.width, area.height); gtk_render_activity (context, cr, area.x, area.y, area.width, area.height);

View File

@ -669,6 +669,15 @@ struct _GtkStyleContextClass
*/ */
#define GTK_STYLE_REGION_TAB "tab" #define GTK_STYLE_REGION_TAB "tab"
/**
* GTK_STYLE_CLASS_PULSE:
*
* A CSS class to use when rendering a pulse in an indeterminate progress bar.
*
* This is used by #GtkProgressBar and #GtkEntry.
*/
#define GTK_STYLE_CLASS_PULSE "pulse"
GType gtk_style_context_get_type (void) G_GNUC_CONST; GType gtk_style_context_get_type (void) G_GNUC_CONST;