[gtk+/win32-theme2: 12/18] Add pulse style class and use in progress bar and entry



commit ca829b484c48d9ccbf12032a7f45ae910fd5ace8
Author: Alexander Larsson <alexl redhat com>
Date:   Fri Nov 18 10:15:04 2011 +0100

    Add pulse style class and use in progress bar and entry
    
    This is used for indeterminate progress reporting.

 gtk/gtkentry.c        |    4 ++++
 gtk/gtkprogressbar.c  |    1 +
 gtk/gtkstylecontext.h |    9 +++++++++
 3 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c
index 0acf72d..9d92af8 100644
--- a/gtk/gtkentry.c
+++ b/gtk/gtkentry.c
@@ -3522,6 +3522,8 @@ gtk_entry_draw_progress (GtkWidget       *widget,
                          GtkStyleContext *context,
                          cairo_t         *cr)
 {
+  GtkEntry *entry = GTK_ENTRY (widget);
+  GtkEntryPrivate *private = entry->priv;
   gint 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_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,
                        x, y, width, height);
diff --git a/gtk/gtkprogressbar.c b/gtk/gtkprogressbar.c
index 48ead04..319ac1a 100644
--- a/gtk/gtkprogressbar.c
+++ b/gtk/gtkprogressbar.c
@@ -760,6 +760,7 @@ gtk_progress_bar_paint_activity (GtkProgressBar *pbar,
 
   gtk_style_context_save (context);
   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);
 
diff --git a/gtk/gtkstylecontext.h b/gtk/gtkstylecontext.h
index 634c31a..7b5f8e8 100644
--- a/gtk/gtkstylecontext.h
+++ b/gtk/gtkstylecontext.h
@@ -669,6 +669,15 @@ struct _GtkStyleContextClass
  */
 #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;
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]