Commit 63c75a23 authored by Carlos Garnacho's avatar Carlos Garnacho

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).
parent 0eb09ac0
......@@ -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
......
......@@ -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 */
/**
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment