[gtk+/touch-selection-fixes: 3/3] texthandles: Add an extra style class to the cursor-mode handle



commit 63c75a23847f5e46c599ae5417f6b755a886ce48
Author: Carlos Garnacho <carlos lanedo com>
Date:   Fri Oct 26 17:57:03 2012 +0200

    texthandles: Add an extra style class to the cursor-mode handle
    
    Themes may want to render handles differently depending on whether
    the widget is in selection mode (2 handles enclosing a selection) or
    cursor mode (one handle pointing out the insertion cursor).

 docs/reference/gtk/gtk3-sections.txt |    1 +
 gtk/gtkstylecontext.h                |    9 +++++++++
 gtk/gtktexthandle.c                  |   10 ++++++++--
 3 files changed, 18 insertions(+), 2 deletions(-)
---
diff --git a/docs/reference/gtk/gtk3-sections.txt b/docs/reference/gtk/gtk3-sections.txt
index be5315f..9e159b1 100644
--- a/docs/reference/gtk/gtk3-sections.txt
+++ b/docs/reference/gtk/gtk3-sections.txt
@@ -5779,6 +5779,7 @@ GTK_STYLE_CLASS_ARROW
 GTK_STYLE_CLASS_OSD
 GTK_STYLE_CLASS_LEVEL_BAR
 GTK_STYLE_CLASS_CURSOR_HANDLE
+GTK_STYLE_CLASS_INSERTION_CURSOR
 GTK_STYLE_REGION_COLUMN
 GTK_STYLE_REGION_COLUMN_HEADER
 GTK_STYLE_REGION_ROW
diff --git a/gtk/gtkstylecontext.h b/gtk/gtkstylecontext.h
index 1783d4c..8731cba 100644
--- a/gtk/gtkstylecontext.h
+++ b/gtk/gtkstylecontext.h
@@ -709,6 +709,15 @@ struct _GtkStyleContextClass
  */
 #define GTK_STYLE_CLASS_CURSOR_HANDLE "cursor-handle"
 
+/**
+ * GTK_STYLE_CLASS_INSERTION_CURSOR:
+ *
+ * A CSS class used when rendering a drag handle for
+ * the insertion cursor position.
+ */
+#define GTK_STYLE_CLASS_INSERTION_CURSOR "insertion-cursor"
+
+
 /* Predefined set of widget regions */
 
 /**
diff --git a/gtk/gtktexthandle.c b/gtk/gtktexthandle.c
index 3d06ee4..6c7033b 100644
--- a/gtk/gtktexthandle.c
+++ b/gtk/gtktexthandle.c
@@ -108,8 +108,14 @@ _gtk_text_handle_draw (GtkTextHandle         *handle,
                                GTK_STYLE_CLASS_CURSOR_HANDLE);
 
   if (pos == GTK_TEXT_HANDLE_POSITION_SELECTION_END)
-    gtk_style_context_add_class (priv->style_context,
-                                 GTK_STYLE_CLASS_BOTTOM);
+    {
+      gtk_style_context_add_class (priv->style_context,
+                                   GTK_STYLE_CLASS_BOTTOM);
+
+      if (priv->mode == GTK_TEXT_HANDLE_MODE_CURSOR)
+        gtk_style_context_add_class (priv->style_context,
+                                     GTK_STYLE_CLASS_INSERTION_CURSOR);
+    }
   else
     gtk_style_context_add_class (priv->style_context,
                                  GTK_STYLE_CLASS_TOP);



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