]> Pileus Git - ~andy/gtk/commitdiff
texthandles: Add an extra style class to the cursor-mode handle
authorCarlos Garnacho <carlos@lanedo.com>
Fri, 26 Oct 2012 15:57:03 +0000 (17:57 +0200)
committerCarlos Garnacho <carlos@lanedo.com>
Fri, 26 Oct 2012 16:38:38 +0000 (18:38 +0200)
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
gtk/gtkstylecontext.h
gtk/gtktexthandle.c

index be5315f78d58441b9442ed0cb6b925df528884e7..9e159b160cab602ce189a50663570ca936c6596f 100644 (file)
@@ -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
index 1783d4c6a1bbf8dd374a8e9d51292165d7bf33a4..8731cba327b9d541ee8b9d09270e5a4059c9b700 100644 (file)
@@ -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 */
 
 /**
index 3d06ee4e09415ff8aea064e754733993e8b31ec6..6c7033b28a3f5407b0221374f3a0f1c482dcfecd 100644 (file)
@@ -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);